Decompiled source of RealerConfigAspectDropChance v1.0.0

RealerConfigAspectDropChance.dll

Decompiled 8 hours ago
using 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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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("RealerConfigAspectDropChance")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RealerConfigAspectDropChance")]
[assembly: AssemblyTitle("RealerConfigAspectDropChance")]
[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 RealerConfigAspectDropChance
{
	[BepInPlugin("prodzpod.RealerConfigAspectDropChance", "RealerConfigAspectDropChance", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "prodzpod.RealerConfigAspectDropChance";

		public const string PluginAuthor = "prodzpod";

		public const string PluginName = "RealerConfigAspectDropChance";

		public const string PluginVersion = "1.0.0";

		public static ManualLogSource Log;

		public static PluginInfo pluginInfo;

		public static Harmony Harmony;

		public static ConfigFile Config;

		public static ConfigEntry<bool> WorksThroughCommand;

		public void Awake()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony = new Harmony("prodzpod.RealerConfigAspectDropChance");
			Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "prodzpod.RealerConfigAspectDropChance.cfg"), true);
			WorksThroughCommand = Config.Bind<bool>(": General", "Works through Artifact of Command", true, "default: aspect still drops in command. true per commissioner request.");
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				EliteDef[] eliteDefs = EliteCatalog.eliteDefs;
				foreach (EliteDef val in eliteDefs)
				{
					EquipmentDef eliteEquipmentDef = val.eliteEquipmentDef;
					if (Object.op_Implicit((Object)(object)eliteEquipmentDef))
					{
						eliteEquipmentDef.dropOnDeathChance = Config.Bind<float>(":: Drop Chance", Language.GetString(eliteEquipmentDef.nameToken).Replace("\n", " ").Replace("\t", " ")
							.Replace("\\", "/")
							.Replace("\"", "``")
							.Replace("'", "`")
							.Replace("[", "(")
							.Replace("]", ")"), eliteEquipmentDef.dropOnDeathChance * 100f, "Drop chance for " + Language.GetString(val.modifierToken).Replace("{0}", "Elite") + " Aspect, in %.").Value / 100f;
					}
				}
			});
		}
	}
}