Decompiled source of ConfigurableStats v1.0.0

ConfigurableStats.dll

Decompiled 9 months ago
using 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 BepInEx.Configuration;
using HG.Reflection;
using R2API.Utils;
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: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ConfigurableStats")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ConfigurableStats")]
[assembly: AssemblyTitle("ConfigurableStats")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ConfigurableStats;

[BepInPlugin("com.Dragonyck.ConfigurableStats", "ConfigurableStats", "1.0.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class MainPlugin : BaseUnityPlugin
{
	public const string MODUID = "com.Dragonyck.ConfigurableStats";

	public const string MODNAME = "ConfigurableStats";

	public const string VERSION = "1.0.0";

	[SystemInitializer(new Type[] { typeof(BodyCatalog) })]
	private static void InitConfigs()
	{
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Expected O, but got Unknown
		foreach (CharacterBody allBodyPrefabBodyBodyComponent in BodyCatalog.allBodyPrefabBodyBodyComponents)
		{
			string text = ((Object)allBodyPrefabBodyBodyComponent).name.Replace("Body", "");
			string section = text + " Stats";
			string text2 = text + ": ";
			ConfigFile config = new ConfigFile(Paths.ConfigPath + "\\ConfigurableStats\\" + text + ".cfg", true);
			allBodyPrefabBodyBodyComponent.mainRootSpeed = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.mainRootSpeed, section, text2 + "Main Root Speed");
			allBodyPrefabBodyBodyComponent.baseAcceleration = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.baseAcceleration, section, text2 + "Base Acceleration");
			allBodyPrefabBodyBodyComponent.baseMaxHealth = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.baseMaxHealth, section, text2 + "Base Max Health");
			allBodyPrefabBodyBodyComponent.levelMaxHealth = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.levelMaxHealth, section, text2 + "Level Max Health");
			allBodyPrefabBodyBodyComponent.baseRegen = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.baseRegen, section, text2 + "Base Regen");
			allBodyPrefabBodyBodyComponent.levelRegen = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.levelRegen, section, text2 + "Level Regen");
			allBodyPrefabBodyBodyComponent.baseMaxShield = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.baseMaxShield, section, text2 + "Base Max Shield");
			allBodyPrefabBodyBodyComponent.levelMaxShield = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.levelMaxShield, section, text2 + "Level Max Shield");
			allBodyPrefabBodyBodyComponent.baseMoveSpeed = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.baseMoveSpeed, section, text2 + "Base Movement Speed");
			allBodyPrefabBodyBodyComponent.levelMoveSpeed = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.levelMoveSpeed, section, text2 + "Level Movement Speed");
			allBodyPrefabBodyBodyComponent.sprintingSpeedMultiplier = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.sprintingSpeedMultiplier, section, text2 + "Sprinting Speed Multiplier");
			allBodyPrefabBodyBodyComponent.baseJumpCount = (int)NewConfigEntry<int>(config, allBodyPrefabBodyBodyComponent.baseJumpCount, section, text2 + "Base Jump Count");
			allBodyPrefabBodyBodyComponent.baseJumpPower = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.baseJumpPower, section, text2 + "Base Jump Power");
			allBodyPrefabBodyBodyComponent.levelJumpPower = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.levelJumpPower, section, text2 + "Level Jump Power");
			allBodyPrefabBodyBodyComponent.baseDamage = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.baseDamage, section, text2 + "Base Damage");
			allBodyPrefabBodyBodyComponent.levelDamage = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.levelDamage, section, text2 + "Level Damage");
			allBodyPrefabBodyBodyComponent.baseAttackSpeed = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.baseAttackSpeed, section, text2 + "Base Attack Speed");
			allBodyPrefabBodyBodyComponent.levelAttackSpeed = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.levelAttackSpeed, section, text2 + "Level Attack Speed");
			allBodyPrefabBodyBodyComponent.baseCrit = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.baseCrit, section, text2 + "Base Critical Chance");
			allBodyPrefabBodyBodyComponent.levelCrit = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.levelCrit, section, text2 + "Level Critical Chance");
			allBodyPrefabBodyBodyComponent.baseArmor = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.baseArmor, section, text2 + "Base Armor");
			allBodyPrefabBodyBodyComponent.levelArmor = (float)NewConfigEntry<float>(config, allBodyPrefabBodyBodyComponent.levelArmor, section, text2 + "Level Armor");
		}
	}

	public static object NewConfigEntry<T>(ConfigFile config, object arg, string section, string key)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_0024: Expected O, but got Unknown
		ConfigEntry<T> val = config.Bind<T>(new ConfigDefinition(section, key), (T)arg, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		return val.Value;
	}
}