Decompiled source of HIFULoaderTweaks v1.1.5

HIFULoaderTweaks.dll

Decompiled 9 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Loader;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using On.EntityStates;
using On.EntityStates.Loader;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;

[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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("HIFULoaderTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HIFULoaderTweaks")]
[assembly: AssemblyTitle("HIFULoaderTweaks")]
[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 HIFULoaderTweaks
{
	public class ConfigManager
	{
		internal static bool ConfigChanged;

		internal static bool VersionChanged;

		public static T HandleConfig<T>(ConfigEntryBase entry, ConfigFile config, string name)
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			MethodInfo methodInfo = (from x in typeof(ConfigFile).GetMethods()
				where x.Name == "Bind"
				select x).First();
			methodInfo = methodInfo.MakeGenericMethod(typeof(T));
			object[] parameters = new object[3]
			{
				(object)new ConfigDefinition(Regex.Replace(config.ConfigFilePath, "\\W", "") + " : " + entry.Definition.Section, name),
				entry.DefaultValue,
				(object)new ConfigDescription(entry.Description.Description, (AcceptableValueBase)null, Array.Empty<object>())
			};
			ConfigEntryBase val = (ConfigEntryBase)methodInfo.Invoke(config, parameters);
			if (Main._preVersioning)
			{
				entry.BoxedValue = entry.DefaultValue;
			}
			if (!ConfigEqual(val.DefaultValue, val.BoxedValue) && VersionChanged)
			{
				entry.BoxedValue = entry.DefaultValue;
				val.BoxedValue = val.DefaultValue;
			}
			return default(T);
		}

		private static bool ConfigEqual(object a, object b)
		{
			if (a.Equals(b))
			{
				return true;
			}
			if (float.TryParse(a.ToString(), out var result) && float.TryParse(b.ToString(), out var result2) && (double)Mathf.Abs(result - result2) < 0.0001)
			{
				return true;
			}
			return false;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("HIFU.HIFULoaderTweaks", "HIFULoaderTweaks", "1.1.5")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "HIFU.HIFULoaderTweaks";

		public const string PluginAuthor = "HIFU";

		public const string PluginName = "HIFULoaderTweaks";

		public const string PluginVersion = "1.1.5";

		public static ConfigFile HLTConfig;

		public static ConfigFile HLTBackupConfig;

		public static ManualLogSource HLTLogger;

		public static bool _preVersioning;

		public static ConfigEntry<bool> enableAutoConfig { get; set; }

		public static ConfigEntry<string> latestVersion { get; set; }

		public void Awake()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			HLTLogger = ((BaseUnityPlugin)this).Logger;
			HLTConfig = ((BaseUnityPlugin)this).Config;
			HLTBackupConfig = new ConfigFile(Paths.ConfigPath + "\\HIFU.HIFULoaderTweaks.Backup.cfg", true);
			HLTBackupConfig.Bind<string>(": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :");
			enableAutoConfig = HLTConfig.Bind<bool>("Config", "Enable Auto Config Sync", true, "Disabling this would stop HIFULoaderTweaks from syncing config whenever a new version is found.");
			_preVersioning = !((Dictionary<ConfigDefinition, string>)AccessTools.DeclaredPropertyGetter(typeof(ConfigFile), "OrphanedEntries").Invoke(HLTConfig, null)).Keys.Any((ConfigDefinition x) => x.Key == "Latest Version");
			latestVersion = HLTConfig.Bind<string>("Config", "Latest Version", "1.1.5", "DO NOT CHANGE THIS");
			if (enableAutoConfig.Value && (_preVersioning || latestVersion.Value != "1.1.5"))
			{
				latestVersion.Value = "1.1.5";
				ConfigManager.VersionChanged = true;
				HLTLogger.LogInfo((object)"Config Autosync Enabled.");
			}
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(TweakBase))
				select type;
			HLTLogger.LogInfo((object)"==+----------------==TWEAKS==----------------+==");
			foreach (Type item in enumerable)
			{
				TweakBase tweakBase = (TweakBase)Activator.CreateInstance(item);
				if (ValidateTweak(tweakBase))
				{
					tweakBase.Init();
				}
			}
			IEnumerable<Type> enumerable2 = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(MiscBase))
				select type;
			HLTLogger.LogInfo((object)"==+----------------==MISC==----------------+==");
			foreach (Type item2 in enumerable2)
			{
				MiscBase miscBase = (MiscBase)Activator.CreateInstance(item2);
				if (ValidateMisc(miscBase))
				{
					miscBase.Init();
				}
			}
		}

		public bool ValidateTweak(TweakBase tb)
		{
			if (tb.isEnabled && ((BaseUnityPlugin)this).Config.Bind<bool>(tb.Name, "Enable?", true, "Vanilla is false").Value)
			{
				return true;
			}
			return false;
		}

		public bool ValidateMisc(MiscBase mb)
		{
			if (mb.isEnabled && ((BaseUnityPlugin)this).Config.Bind<bool>(mb.Name, "Enable?", true, "Vanilla is false").Value)
			{
				return true;
			}
			return false;
		}

		private void PeripheryMyBeloved()
		{
		}
	}
	public abstract class MiscBase
	{
		public abstract string Name { get; }

		public virtual bool isEnabled { get; } = true;


		public T ConfigOption<T>(T value, string name, string description)
		{
			ConfigEntry<T> val = Main.HLTConfig.Bind<T>(Name, name, value, description);
			ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)val, Main.HLTBackupConfig, name);
			return val.Value;
		}

		public abstract void Hooks();

		public string d(float f)
		{
			return f * 100f + "%";
		}

		public virtual void Init()
		{
			Hooks();
			Main.HLTLogger.LogInfo((object)("Added " + Name));
		}
	}
	public abstract class MiscBase<T> : MiscBase where T : MiscBase<T>
	{
		public static T instance { get; set; }

		public MiscBase()
		{
			if (instance != null)
			{
				throw new InvalidOperationException("Singleton class " + typeof(T).Name + " was instantiated twice");
			}
			instance = this as T;
		}
	}
	public abstract class TweakBase
	{
		public abstract string Name { get; }

		public abstract string SkillToken { get; }

		public abstract string DescText { get; }

		public virtual bool isEnabled { get; } = true;


		public T ConfigOption<T>(T value, string name, string description)
		{
			ConfigEntry<T> val = Main.HLTConfig.Bind<T>(Name, name, value, description);
			ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)val, Main.HLTBackupConfig, name);
			return val.Value;
		}

		public abstract void Hooks();

		public string d(float f)
		{
			return f * 100f + "%";
		}

		public virtual void Init()
		{
			Hooks();
			string text = "LOADER_" + SkillToken.ToUpper() + "_DESCRIPTION";
			LanguageAPI.Add(text, DescText);
			Main.HLTLogger.LogInfo((object)("Added " + Name));
		}
	}
	public abstract class TweakBase<T> : TweakBase where T : TweakBase<T>
	{
		public static T instance { get; set; }

		public TweakBase()
		{
			if (instance != null)
			{
				throw new InvalidOperationException("Singleton class " + typeof(T).Name + " was instantiated twice");
			}
			instance = this as T;
		}
	}
}
namespace HIFULoaderTweaks.Skills
{
	public class ChargedGauntlet : TweakBase
	{
		public static float minDamage;

		public static float maxDamage;

		public static float chargeRate;

		public static float speedCoeff;

		public static float cooldown;

		public static bool formula;

		public override string Name => ": Utility : Charged Gauntlet";

		public override string SkillToken => "utility";

		public override string DescText => "<style=cIsUtility>Heavy</style>. Charge up a <style=cIsUtility>piercing</style> punch for <style=cIsDamage>" + d(minDamage) + "-" + d(maxDamage) + " damage</style>.";

		public override void Init()
		{
			minDamage = ConfigOption(5f, "Minimum Damage", "Decimal. Vanilla is ???");
			maxDamage = ConfigOption(18f, "Maximum Damage", "Decimal. Vanilla is ???");
			chargeRate = ConfigOption(2f, "Charge Duration", "Vanilla is 2.5");
			speedCoeff = ConfigOption(0.45f, "Speed Coefficient", "Decimal. Vanilla is 0.3");
			cooldown = ConfigOption(5f, "Cooldown", "Vanilla is 5");
			formula = ConfigOption(value: true, "Damage Formula", "Damage based on total charge, MinDamage and MaxDamage + SpeedCoeff * (Current velocity - 20~90, depending on total charge)");
			base.Init();
		}

		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
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			BaseChargeFist.OnEnter += new hook_OnEnter(BaseChargeFist_OnEnter);
			BaseSwingChargedFist.OnEnter += new hook_OnEnter(BaseSwingChargedFist_OnEnter);
			Changes();
		}

		private void BaseSwingChargedFist_OnEnter(orig_OnEnter orig, BaseSwingChargedFist self)
		{
			if (self is SwingChargedFist)
			{
				BaseSwingChargedFist.velocityDamageCoefficient = speedCoeff;
				orig.Invoke(self);
				self.bonusDamage -= BaseSwingChargedFist.velocityDamageCoefficient * ((BaseState)self).damageStat * Mathf.Lerp(self.minLungeSpeed, self.maxLungeSpeed, self.charge);
				((BasicMeleeAttack)self).damageCoefficient = Mathf.Lerp(minDamage, maxDamage, self.charge);
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private void BaseChargeFist_OnEnter(orig_OnEnter orig, BaseChargeFist self)
		{
			if (self is ChargeFist)
			{
				self.baseChargeDuration = chargeRate;
			}
			orig.Invoke(self);
		}

		private void Changes()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			SteppedSkillDef val = Addressables.LoadAssetAsync<SteppedSkillDef>((object)"RoR2/Base/Loader/ChargeFist.asset").WaitForCompletion();
			((SkillDef)val).baseRechargeInterval = cooldown;
		}
	}
	public class GrappleFist : TweakBase
	{
		public static float cooldown;

		public static float range;

		public override string Name => ": Secondary : Grapple Fist";

		public override string SkillToken => "secondary";

		public override string DescText => "Fire your gauntlet forward, <style=cIsUtility>pulling</style> you to the target.";

		public override void Init()
		{
			cooldown = ConfigOption(5f, "Cooldown", "Vanilla is 5");
			range = ConfigOption(80f, "Max Range", "Vanilla is 80");
			base.Init();
		}

		public override void Hooks()
		{
			Changes();
		}

		private void Changes()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Loader/FireHook.asset").WaitForCompletion();
			val.baseRechargeInterval = cooldown;
			GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Loader/LoaderHook.prefab").WaitForCompletion();
			ProjectileGrappleController component = val2.GetComponent<ProjectileGrappleController>();
			component.maxTravelDistance = range;
		}
	}
	public class Knuckleboom : TweakBase
	{
		public static float damage;

		public static float fireRate;

		public static float burstDamage;

		public static float burstAoE;

		public static float barrierGain;

		public override string Name => ": Primary : Knuckleboom";

		public override string SkillToken => "primary";

		public override string DescText => "Swing at nearby enemies for <style=cIsDamage>" + d(damage) + " damage</style>. Every third hit knocks up for an additional <style=cIsDamage>" + d(burstDamage) + " damage</style> in a large radius.";

		public override void Init()
		{
			damage = ConfigOption(1.7f, "Damage", "Decimal. Vanilla is 3.2");
			burstDamage = ConfigOption(2.3f, "Third Hit Damage", "Decimal. Vanilla is 0");
			burstAoE = ConfigOption(13f, "Third Hit AoE", "Vanilla is 0");
			fireRate = ConfigOption(2.5f, "Fire Rate", "Vanilla is 1.66666667");
			barrierGain = ConfigOption(0.033f, "Barrier Gain per Hit", "Decimal. Vanilla is 0.05");
			base.Init();
		}

		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
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			BasicMeleeAttack.OnEnter += new hook_OnEnter(BasicMeleeAttack_OnEnter);
			BasicMeleeAttack.OnMeleeHitAuthority += new hook_OnMeleeHitAuthority(BasicMeleeAttack_OnMeleeHitAuthority);
			LoaderMeleeAttack.OnMeleeHitAuthority += new hook_OnMeleeHitAuthority(LoaderMeleeAttack_OnMeleeHitAuthority);
		}

		private void LoaderMeleeAttack_OnMeleeHitAuthority(orig_OnMeleeHitAuthority orig, LoaderMeleeAttack self)
		{
			LoaderMeleeAttack.barrierPercentagePerHit = barrierGain;
			orig.Invoke(self);
		}

		private void BasicMeleeAttack_OnMeleeHitAuthority(orig_OnMeleeHitAuthority orig, BasicMeleeAttack self)
		{
			if (self is LoaderMeleeAttack)
			{
				((Component)((EntityState)self).characterBody).gameObject.GetComponent<KnuckleboomButBased>().HitCount++;
			}
			orig.Invoke(self);
		}

		private void BasicMeleeAttack_OnEnter(orig_OnEnter orig, BasicMeleeAttack self)
		{
			if (self is LoaderMeleeAttack)
			{
				self.baseDuration = 1f / fireRate;
				self.damageCoefficient = damage;
				self.pushAwayForce = 50f;
				if ((Object)(object)((Component)((EntityState)self).characterBody).gameObject.GetComponent<KnuckleboomButBased>() == (Object)null)
				{
					((Component)((EntityState)self).characterBody).gameObject.AddComponent<KnuckleboomButBased>();
				}
			}
			orig.Invoke(self);
		}
	}
	public class KnuckleboomButBased : MonoBehaviour
	{
		public int HitCount;

		public CharacterBody body;

		public void Start()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
		}

		public void FixedUpdate()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			if (HitCount >= 3)
			{
				EffectManager.SpawnEffect(GroundSlam.blastEffectPrefab, new EffectData
				{
					origin = body.footPosition,
					scale = Knuckleboom.burstAoE
				}, true);
				if (Util.HasEffectiveAuthority(((Component)this).gameObject))
				{
					new BlastAttack
					{
						attacker = ((Component)body).gameObject,
						baseDamage = body.damage * Knuckleboom.burstDamage,
						baseForce = 50f,
						bonusForce = new Vector3(0f, 1500f, 0f),
						crit = body.RollCrit(),
						damageType = (DamageType)0,
						procCoefficient = 1f,
						radius = Knuckleboom.burstAoE,
						position = body.footPosition,
						attackerFiltering = (AttackerFiltering)2,
						teamIndex = body.teamComponent.teamIndex,
						falloffModel = (FalloffModel)0,
						impactEffect = EffectCatalog.FindEffectIndexFromPrefab(GroundSlam.blastImpactEffectPrefab)
					}.Fire();
				}
				HitCount = 0;
			}
		}
	}
	public class M551Pylon : TweakBase
	{
		public static float damage;

		public static float cooldown;

		public static float aoe;

		public static float fireRate;

		public static float procCoefficient;

		public static int bounces;

		public static float lifetime;

		public override string Name => ": Special : M551 Pylon";

		public override string SkillToken => "special";

		public override string DescText => "Throw a floating pylon that repeatedly <style=cIsDamage>zaps</style> up to <style=cIsDamage>3</style> nearby enemies for <style=cIsDamage>" + d(damage) + " damage</style>. Can be <style=cIsUtility>grappled</style>.";

		public override void Init()
		{
			damage = ConfigOption(0.5f, "Damage", "Decimal. Vanilla is 1");
			aoe = ConfigOption(35f, "Area of Effect", "Vanilla is 25");
			cooldown = ConfigOption(20f, "Cooldown", "Vanilla is 20");
			fireRate = ConfigOption(3f, "Fire Rate", "Vanilla is 1");
			procCoefficient = ConfigOption(0.4f, "Proc Coefficient", "Vanilla is 0.5");
			bounces = ConfigOption(1, "Bounce Count", "Vanilla is 0");
			lifetime = ConfigOption(6f, "Lifetime", "Vanilla is 15");
			base.Init();
		}

		public override void Hooks()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			Changes();
			ThrowPylon.OnEnter += new hook_OnEnter(ThrowPylon_OnEnter);
		}

		private void ThrowPylon_OnEnter(orig_OnEnter orig, ThrowPylon self)
		{
			ThrowPylon.damageCoefficient = damage;
			orig.Invoke(self);
		}

		private void Changes()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Loader/ThrowPylon.asset").WaitForCompletion();
			val.baseRechargeInterval = cooldown;
			GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Loader/LoaderPylon.prefab").WaitForCompletion();
			ProjectileProximityBeamController component = val2.GetComponent<ProjectileProximityBeamController>();
			component.attackInterval = 1f / fireRate;
			component.attackRange = aoe;
			component.procCoefficient = procCoefficient;
			component.bounces = bounces;
			ProjectileSimple component2 = val2.GetComponent<ProjectileSimple>();
			component2.lifetime = lifetime;
		}
	}
	public class SpikedFist : TweakBase
	{
		public static float massLimit;

		public static float cooldown;

		public static float range;

		public override string Name => ": Secondary :: Spiked Fist";

		public override string SkillToken => "yankhook";

		public override string DescText => "<style=cIsDamage>Stunning</style>. Fire your gauntlet forward, dealing <style=cIsDamage>320% damage</style>. <style=cIsUtility>Pulls</style> you to heavy targets. Light targets are <style=cIsUtility>pulled to YOU</style> instead.";

		public override void Init()
		{
			massLimit = ConfigOption(500f, "Mass Limit", "Vanilla is 250");
			cooldown = ConfigOption(5f, "Cooldown", "Vanilla is 5");
			range = ConfigOption(80f, "Max Range", "Vanilla is 80");
			base.Init();
		}

		public override void Hooks()
		{
			Changes();
		}

		private void Changes()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Loader/LoaderYankHook.prefab").WaitForCompletion();
			ProjectileGrappleController component = val.GetComponent<ProjectileGrappleController>();
			component.yankMassLimit = massLimit;
			component.maxTravelDistance = range;
			SkillDef val2 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Loader/FireYankHook.asset").WaitForCompletion();
			val2.baseRechargeInterval = cooldown;
		}
	}
	public class ThunderGauntlet : TweakBase
	{
		public static float damage;

		public static float chargeRate;

		public static float speedCoeff;

		public static float cooldown;

		public static bool formula;

		public override string Name => ": Utility :: Thunder Gauntlet";

		public override string SkillToken => "utility_alt1";

		public override string DescText => "<style=cIsUtility>Heavy</style>. Charge up a <style=cIsUtility>single-target</style> punch for <style=cIsDamage>" + d(damage) + " damage</style> that <style=cIsDamage>shocks</style> enemies in a cone for <style=cIsDamage>900% damage</style>.";

		public override void Init()
		{
			damage = ConfigOption(14f, "Damage", "Decimal. Vanilla is ???");
			chargeRate = ConfigOption(0.4f, "Charge Duration", "Vanilla is 0.4");
			speedCoeff = ConfigOption(0.17f, "Speed Coefficient", "Decimal. Vanilla is 0.3");
			cooldown = ConfigOption(5f, "Cooldown", "Vanilla is 5");
			formula = ConfigOption(value: true, "Damage Formula", "Damage + SpeedCoeff * (Current velocity - 90)");
			base.Init();
		}

		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
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			BaseChargeFist.OnEnter += new hook_OnEnter(BaseChargeFist_OnEnter);
			BaseSwingChargedFist.OnEnter += new hook_OnEnter(BaseSwingChargedFist_OnEnter);
			Changes();
		}

		private void BaseSwingChargedFist_OnEnter(orig_OnEnter orig, BaseSwingChargedFist self)
		{
			if (self is SwingZapFist)
			{
				BaseSwingChargedFist.velocityDamageCoefficient = speedCoeff;
				((BasicMeleeAttack)self).damageCoefficient = damage;
				orig.Invoke(self);
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private void BaseChargeFist_OnEnter(orig_OnEnter orig, BaseChargeFist self)
		{
			if (self is ChargeZapFist)
			{
				self.baseChargeDuration = chargeRate;
			}
			orig.Invoke(self);
		}

		private void Changes()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			SteppedSkillDef val = Addressables.LoadAssetAsync<SteppedSkillDef>((object)"RoR2/Base/Loader/ChargeZapFist.asset").WaitForCompletion();
			((SkillDef)val).baseRechargeInterval = cooldown;
		}
	}
	public class Thunderslam : TweakBase
	{
		public static float damage;

		public static float cooldown;

		public static float aoe;

		public static float yVelocityCoeff;

		public static bool formula;

		public static BuffDef fallDamageReduction;

		public override string Name => ": Special :: Thunderslam";

		public override string SkillToken => "special_alt";

		public override string DescText => "<style=cIsUtility>Very Heavy</style>. <style=cIsDamage>Stunning</style>. Slam your fists down, dealing <style=cIsDamage>" + d(damage) + "</style> damage on impact.";

		public override void Init()
		{
			damage = ConfigOption(4f, "Damage", "Decimal. Vanilla is 20");
			aoe = ConfigOption(13f, "Area of Effect", "Vanilla is 11");
			cooldown = ConfigOption(9f, "Cooldown", "Vanilla is 8");
			yVelocityCoeff = ConfigOption(0.23f, "Y Axis Speed Coefficient", "Vanilla is 0");
			formula = ConfigOption(value: true, "Damage Formula", "if Damage + Y Velocity * -1 * YVelocityCoeff >=\nDamage + YVelocityCoeff * 25,\nset the Damage to that");
			fallDamageReduction = ScriptableObject.CreateInstance<BuffDef>();
			fallDamageReduction.isHidden = true;
			fallDamageReduction.isDebuff = false;
			fallDamageReduction.canStack = false;
			fallDamageReduction.isCooldown = false;
			ContentAddition.AddBuffDef(fallDamageReduction);
			base.Init();
		}

		public override void Hooks()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			Changes();
			GroundSlam.OnEnter += new hook_OnEnter(GroundSlam_OnEnter);
			GroundSlam.FixedUpdate += new hook_FixedUpdate(GroundSlam_FixedUpdate);
			GroundSlam.OnExit += new hook_OnExit(GroundSlam_OnExit);
			GlobalEventManager.OnCharacterHitGroundServer += new hook_OnCharacterHitGroundServer(GlobalEventManager_OnCharacterHitGroundServer);
		}

		private void GlobalEventManager_OnCharacterHitGroundServer(orig_OnCharacterHitGroundServer orig, GlobalEventManager self, CharacterBody characterBody, Vector3 impactVelocity)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_001d: Unknown result type (might be due to invalid IL or missing references)
			if (characterBody.HasBuff(fallDamageReduction))
			{
				impactVelocity *= 0.75f;
			}
			orig.Invoke(self, characterBody, impactVelocity);
		}

		private void GroundSlam_OnExit(orig_OnExit orig, GroundSlam self)
		{
			GroundSlam.blastDamageCoefficient = damage;
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
			{
				((EntityState)self).characterBody.RemoveBuff(fallDamageReduction);
			}
		}

		private void GroundSlam_FixedUpdate(orig_FixedUpdate orig, GroundSlam self)
		{
			if (((EntityState)self).isAuthority && Object.op_Implicit((Object)(object)((EntityState)self).characterMotor))
			{
				float num = damage + ((EntityState)self).characterMotor.velocity.y * -1f * yVelocityCoeff;
				if (num >= damage + yVelocityCoeff * 25f)
				{
					GroundSlam.blastDamageCoefficient = num;
				}
				orig.Invoke(self);
			}
		}

		private void GroundSlam_OnEnter(orig_OnEnter orig, GroundSlam self)
		{
			GroundSlam.blastRadius = aoe;
			if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
			{
				((EntityState)self).characterBody.AddBuff(fallDamageReduction);
			}
			orig.Invoke(self);
		}

		private void Changes()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			SteppedSkillDef val = Addressables.LoadAssetAsync<SteppedSkillDef>((object)"RoR2/Base/Loader/GroundSlam.asset").WaitForCompletion();
			((SkillDef)val).baseRechargeInterval = cooldown;
			LanguageAPI.Add("KEYWORD_VERY_HEAVY", "<style=cKeywordName>Very Heavy</style><style=cSub>The skill deals much more damage the faster you are falling. <color=#FF7F7F>Watch out for backblast</color>.</style>");
			string[] keywordTokens = new string[1] { "KEYWORD_VERY_HEAVY" };
			SkillFamily val2 = Addressables.LoadAssetAsync<SkillFamily>((object)"RoR2/Base/Loader/LoaderBodySpecialFamily.asset").WaitForCompletion();
			val2.variants[1].skillDef.keywordTokens = keywordTokens;
		}
	}
}
namespace HIFULoaderTweaks.Misc
{
	public class FallDamageReduction : MiscBase
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_TakeDamage <>9__5_0;

			internal void <Changes>b__5_0(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				if (damageInfo != null && ((Enum)damageInfo.damageType).HasFlag((Enum)(object)(DamageType)2097152) && Object.op_Implicit((Object)(object)self.body) && ((Object)self.body).name == "LoaderBody(Clone)")
				{
					damageInfo.damage *= 1f - fallDamageReduction;
				}
				orig.Invoke(self, damageInfo);
			}
		}

		public static float fallDamageReduction;

		public override string Name => ":: Misc : Scrap Barrier";

		public override void Init()
		{
			fallDamageReduction = ConfigOption(0.6f, "Fall Damage Reduction", "Decimal. Vanilla is 1");
			base.Init();
		}

		public override void Hooks()
		{
			Changes();
		}

		public static void Changes()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//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_0015: 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_0020: Expected O, but got Unknown
			object obj = <>c.<>9__5_0;
			if (obj == null)
			{
				hook_TakeDamage val = delegate(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
				{
					//IL_0005: Unknown result type (might be due to invalid IL or missing references)
					if (damageInfo != null && ((Enum)damageInfo.damageType).HasFlag((Enum)(object)(DamageType)2097152) && Object.op_Implicit((Object)(object)self.body) && ((Object)self.body).name == "LoaderBody(Clone)")
					{
						damageInfo.damage *= 1f - fallDamageReduction;
					}
					orig.Invoke(self, damageInfo);
				};
				<>c.<>9__5_0 = val;
				obj = (object)val;
			}
			HealthComponent.TakeDamage += (hook_TakeDamage)obj;
			LanguageAPI.Add("LOADER_PASSIVE_DESCRIPTION", "The Loader has her fall damage <style=cIsUtility>reduced by " + fallDamageReduction * 100f + "%</style>. Striking enemies with the Loader's gauntlets grants a <style=cIsHealing>temporary barrier</style>.");
			GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Loader/LoaderBody.prefab").WaitForCompletion();
			CharacterBody component = val2.GetComponent<CharacterBody>();
			component.bodyFlags = (BodyFlags)(component.bodyFlags & -2);
		}
	}
	public class StatChanges : MiscBase
	{
		public static float baseMaxHealth;

		public static float armor;

		public override string Name => ":: Misc :: Base Stats";

		public override void Init()
		{
			baseMaxHealth = ConfigOption(110f, "Base Max Health", "Vanilla is 160");
			armor = ConfigOption(0f, "Base Armor", "Vanilla is 20");
			base.Init();
		}

		public override void Hooks()
		{
			Changes();
		}

		private void Changes()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Loader/LoaderBody.prefab").WaitForCompletion();
			CharacterBody component = val.GetComponent<CharacterBody>();
			component.baseMaxHealth = baseMaxHealth;
			component.levelMaxHealth = baseMaxHealth * 0.3f;
			component.baseArmor = armor;
		}
	}
}