Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of AlwaysArtifacts v1.0.3
AlwaysArtifacts.dll
Decompiled 5 months 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 Microsoft.CodeAnalysis; using On.RoR2; using RoR2; [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("AlwaysArtifacts")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+452e910508fd71c5df7a397f71c4086b0156070a")] [assembly: AssemblyProduct("AlwaysArtifacts")] [assembly: AssemblyTitle("AlwaysArtifacts")] [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 AlwaysArtifacts { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("oorzkws.AlwaysArtifacts", "AlwaysArtifacts", "1.0.2")] public class AlwaysArtifacts : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_SetArtifactEnabled <>9__4_0; public static hook_SetArtifactEnabledServer <>9__4_1; internal void <Awake>b__4_0(orig_SetArtifactEnabled orig, RunArtifactManager self, ArtifactDef def, bool newEnabled) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) bool flag = newEnabled || AlwaysArtifactsConfig.ArtifactToggles[def.artifactIndex].Value; Log.LogDebug($"RunArtifactManager.SetArtifactEnabled: {Language.GetString(def.nameToken)}: {newEnabled} (o:{flag})"); if (flag) { orig.Invoke(self, def, false); } orig.Invoke(self, def, flag); } internal void <Awake>b__4_1(orig_SetArtifactEnabledServer orig, RunArtifactManager self, ArtifactDef def, bool newEnabled) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) bool flag = newEnabled || AlwaysArtifactsConfig.ArtifactToggles[def.artifactIndex].Value; Log.LogDebug($"RunArtifactManager.SetArtifactEnabledServer: {Language.GetString(def.nameToken)}: {newEnabled} (o:{flag})"); if (flag) { orig.Invoke(self, def, false); } orig.Invoke(self, def, flag); } } public const string PluginGUID = "oorzkws.AlwaysArtifacts"; public const string PluginAuthor = "oorzkws"; public const string PluginName = "AlwaysArtifacts"; public const string PluginVersion = "1.0.2"; public void Awake() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); AlwaysArtifactsConfig.Init(((BaseUnityPlugin)this).Config); object obj = <>c.<>9__4_0; if (obj == null) { hook_SetArtifactEnabled val = delegate(orig_SetArtifactEnabled orig, RunArtifactManager self, ArtifactDef def, bool newEnabled) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) bool flag2 = newEnabled || AlwaysArtifactsConfig.ArtifactToggles[def.artifactIndex].Value; Log.LogDebug($"RunArtifactManager.SetArtifactEnabled: {Language.GetString(def.nameToken)}: {newEnabled} (o:{flag2})"); if (flag2) { orig.Invoke(self, def, false); } orig.Invoke(self, def, flag2); }; <>c.<>9__4_0 = val; obj = (object)val; } RunArtifactManager.SetArtifactEnabled += (hook_SetArtifactEnabled)obj; object obj2 = <>c.<>9__4_1; if (obj2 == null) { hook_SetArtifactEnabledServer val2 = delegate(orig_SetArtifactEnabledServer orig, RunArtifactManager self, ArtifactDef def, bool newEnabled) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) bool flag = newEnabled || AlwaysArtifactsConfig.ArtifactToggles[def.artifactIndex].Value; Log.LogDebug($"RunArtifactManager.SetArtifactEnabledServer: {Language.GetString(def.nameToken)}: {newEnabled} (o:{flag})"); if (flag) { orig.Invoke(self, def, false); } orig.Invoke(self, def, flag); }; <>c.<>9__4_1 = val2; obj2 = (object)val2; } RunArtifactManager.SetArtifactEnabledServer += (hook_SetArtifactEnabledServer)obj2; Log.LogInfo("Awake done."); } } public static class AlwaysArtifactsConfig { [CompilerGenerated] private static class <>O { public static hook_Init <0>__EnumerateArtifacts; } public static readonly Dictionary<ArtifactIndex, ConfigEntry<bool>> ArtifactToggles = new Dictionary<ArtifactIndex, ConfigEntry<bool>>(); private static ConfigFile _config; private static void EnumerateArtifacts(orig_Init orig) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(); ArtifactDef[] artifactDefs = ArtifactCatalog.artifactDefs; foreach (ArtifactDef val in artifactDefs) { string @string = Language.GetString(val.nameToken); Log.LogInfo("Found artifact: " + @string); ArtifactToggles.Add(val.artifactIndex, _config.Bind<bool>("Artifact Toggles", "Force-enable " + @string, false, (ConfigDescription)null)); } } public static void Init(ConfigFile config) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown _config = config; object obj = <>O.<0>__EnumerateArtifacts; if (obj == null) { hook_Init val = EnumerateArtifacts; <>O.<0>__EnumerateArtifacts = val; obj = (object)val; } ArtifactCatalog.Init += (hook_Init)obj; } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } }