Decompiled source of HIFUEngineerTweaks v1.1.5

HIFUEngineerTweaks.dll

Decompiled 3 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.Engi.EngiBubbleShield;
using EntityStates.Engi.EngiMissilePainter;
using EntityStates.Engi.EngiWeapon;
using EntityStates.Engi.Mine;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using On.EntityStates.Engi.EngiBubbleShield;
using On.EntityStates.Engi.EngiMissilePainter;
using On.EntityStates.Engi.EngiWeapon;
using On.EntityStates.Engi.Mine;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.CharacterAI;
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("HIFUEngineerTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HIFUEngineerTweaks")]
[assembly: AssemblyTitle("HIFUEngineerTweaks")]
[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 HIFUEngineerTweaks
{
	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.*/)]
	[BepInPlugin("HIFU.HIFUEngineerTweaks", "HIFUEngineerTweaks", "1.1.4")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "HIFU.HIFUEngineerTweaks";

		public const string PluginAuthor = "HIFU";

		public const string PluginName = "HIFUEngineerTweaks";

		public const string PluginVersion = "1.1.4";

		public static ConfigFile HETConfig;

		public static ConfigFile HETBackupConfig;

		public static ManualLogSource HETLogger;

		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
			HETLogger = ((BaseUnityPlugin)this).Logger;
			HETConfig = ((BaseUnityPlugin)this).Config;
			HETBackupConfig = new ConfigFile(Paths.ConfigPath + "\\HIFU.HIFUEngineerTweaks.Backup.cfg", true);
			HETBackupConfig.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 = HETConfig.Bind<bool>("Config", "Enable Auto Config Sync", true, "Disabling this would stop HIFUEngineerTweaks from syncing config whenever a new version is found.");
			_preVersioning = !((Dictionary<ConfigDefinition, string>)AccessTools.DeclaredPropertyGetter(typeof(ConfigFile), "OrphanedEntries").Invoke(HETConfig, null)).Keys.Any((ConfigDefinition x) => x.Key == "Latest Version");
			latestVersion = HETConfig.Bind<string>("Config", "Latest Version", "1.1.4", "DO NOT CHANGE THIS");
			if (enableAutoConfig.Value && (_preVersioning || latestVersion.Value != "1.1.4"))
			{
				latestVersion.Value = "1.1.4";
				ConfigManager.VersionChanged = true;
				HETLogger.LogInfo((object)"Config Autosync Enabled.");
			}
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(TweakBase))
				select type;
			HETLogger.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;
			HETLogger.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.HETConfig.Bind<T>(Name, name, value, description);
			ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)val, Main.HETBackupConfig, name);
			return val.Value;
		}

		public abstract void Hooks();

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

		public virtual void Init()
		{
			Hooks();
			Main.HETLogger.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.HETConfig.Bind<T>(Name, name, value, description);
			ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)val, Main.HETBackupConfig, name);
			return val.Value;
		}

		public abstract void Hooks();

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

		public virtual void Init()
		{
			Hooks();
			string text = "ENGI_" + SkillToken.ToUpper() + "_DESCRIPTION";
			LanguageAPI.Add(text, DescText);
			Main.HETLogger.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 HIFUEngineerTweaks.Skills
{
	public class BouncingGrenades : TweakBase
	{
		public static float damage;

		public static int maximumGrenadesCount;

		public static float chargeTime;

		public static float aoe;

		public override string Name => ": Primary : Bouncing Grenades";

		public override string SkillToken => "primary";

		public override string DescText => "Fire <style=cIsDamage>" + maximumGrenadesCount + "</style> grenades that deal <style=cIsDamage>" + d(damage) + " damage</style> each.";

		public override void Init()
		{
			damage = ConfigOption(1.6f, "Damage", "Decimal. Vanilla is 1");
			maximumGrenadesCount = ConfigOption(3, "Grenade Count", "Vanilla is 8");
			aoe = ConfigOption(4.5f, "Area of Effect", "Vanilla is 3.5");
			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
			Changes();
			ChargeGrenades.OnEnter += new hook_OnEnter(ChargeGrenades_OnEnter);
			FireGrenades.OnEnter += new hook_OnEnter(FireGrenades_OnEnter);
		}

		private void FireGrenades_OnEnter(orig_OnEnter orig, FireGrenades self)
		{
			FireGrenades.damageCoefficient = damage;
			FireGrenades.fireDuration = 0.2f;
			FireGrenades.baseDuration = 1f;
			orig.Invoke(self);
		}

		private void ChargeGrenades_OnEnter(orig_OnEnter orig, ChargeGrenades self)
		{
			ChargeGrenades.baseMaxChargeTime = 0f;
			ChargeGrenades.baseTotalDuration = 0f;
			ChargeGrenades.maxCharges = 0;
			ChargeGrenades.maxGrenadeCount = maximumGrenadesCount;
			ChargeGrenades.minGrenadeCount = maximumGrenadesCount;
			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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/EngiGrenadeProjectile.prefab").WaitForCompletion();
			ProjectileImpactExplosion component = val.GetComponent<ProjectileImpactExplosion>();
			((ProjectileExplosion)component).blastRadius = aoe;
		}
	}
	public class BubbleShield : TweakBase
	{
		public static float damage;

		public static float cooldown;

		public static float duration;

		public static float aoe;

		public static float ticks;

		public static float procCoefficient;

		public static bool changeShape;

		public static float size;

		public static int charges;

		public static int chargesToConsume;

		public static int chargesToRecharge;

		public override string Name => ": Utility : Bubble Shield";

		public override string SkillToken => "utility";

		public override string DescText => "Place an <style=cIsUtility>impenetrable shield</style> that blocks all incoming damage" + ((damage > 0f) ? (" and deals <style=cIsDamage>" + d(damage / ticks) + "</style> damage per second to nearby enemies.") : ".");

		public override void Init()
		{
			damage = ConfigOption(0.1f, "Damage per Tick", "Decimal. Vanilla is 0");
			cooldown = ConfigOption(9f, "Cooldown", "Vanilla is 25");
			duration = ConfigOption(8f, "Duration", "Vanilla is 15");
			aoe = ConfigOption(30f, "Damage Area of Effect", "Default is 30");
			ticks = ConfigOption(0.2f, "Time per Tick", "Default is 1");
			procCoefficient = ConfigOption(0f, "Proc Coefficient", "Default is 0");
			size = ConfigOption(35f, "Size", "Vanilla is 20, for 10m Radius\nKnockback area is equal to this as well");
			charges = ConfigOption(2, "Charges", "Vanilla is 1");
			chargesToConsume = ConfigOption(2, "Charges Required", "Vanilla is 1");
			chargesToRecharge = ConfigOption(1, "Charges to Recharge", "Vanilla is 1\nThis is so Bandolier and Hardlight Afterburner aren't as cracked");
			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
			CharacterMaster.GetDeployableSameSlotLimit += new hook_GetDeployableSameSlotLimit(CharacterMaster_GetDeployableSameSlotLimit);
			Deployed.OnEnter += new hook_OnEnter(Deployed_OnEnter);
			Changes();
		}

		private void Deployed_OnEnter(orig_OnEnter orig, Deployed self)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			Deployed.lifetime = duration;
			orig.Invoke(self);
			ChildLocator component = ((EntityState)self).GetComponent<ChildLocator>();
			if (Object.op_Implicit((Object)(object)component))
			{
				((Component)component.FindChild(Deployed.childLocatorString)).gameObject.transform.localScale = new Vector3(size, size, size);
			}
		}

		private int CharacterMaster_GetDeployableSameSlotLimit(orig_GetDeployableSameSlotLimit orig, CharacterMaster self, DeployableSlot slot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if ((int)slot == 3)
			{
				return 2 + self.inventory.GetItemCount(Items.UtilitySkillMagazine);
			}
			return orig.Invoke(self, slot);
		}

		private void Changes()
		{
			//IL_000c: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Engi/EngiBodyPlaceBubbleShield.asset").WaitForCompletion();
			val.baseRechargeInterval = cooldown;
			val.baseMaxStock = charges;
			val.stockToConsume = chargesToConsume;
			val.rechargeStock = chargesToRecharge;
			val.requiredStock = chargesToConsume;
			float timer = 0f;
			Deployed.FixedUpdate += (hook_FixedUpdate)delegate(orig_FixedUpdate orig, Deployed self)
			{
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Unknown result type (might be due to invalid IL or missing references)
				//IL_012f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0131: Unknown result type (might be due to invalid IL or missing references)
				//IL_0136: Unknown result type (might be due to invalid IL or missing references)
				//IL_013d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0142: Unknown result type (might be due to invalid IL or missing references)
				//IL_0147: Unknown result type (might be due to invalid IL or missing references)
				//IL_0149: Unknown result type (might be due to invalid IL or missing references)
				//IL_014e: Unknown result type (might be due to invalid IL or missing references)
				//IL_015a: Unknown result type (might be due to invalid IL or missing references)
				//IL_015f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0164: Unknown result type (might be due to invalid IL or missing references)
				//IL_016a: Unknown result type (might be due to invalid IL or missing references)
				//IL_016f: Unknown result type (might be due to invalid IL or missing references)
				//IL_017b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0186: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: Unknown result type (might be due to invalid IL or missing references)
				//IL_0198: Unknown result type (might be due to invalid IL or missing references)
				//IL_019b: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				timer += Time.fixedDeltaTime;
				if (timer > ticks && self != null && (Object)(object)((EntityState)self).gameObject != (Object)null && (Object)(object)((EntityState)self).gameObject.GetComponent<Deployable>() != (Object)null && (Object)(object)((EntityState)self).gameObject.GetComponent<Deployable>().ownerMaster != (Object)null && (Object)(object)((EntityState)self).gameObject.GetComponent<Deployable>().ownerMaster.GetBodyObject() != (Object)null && (Object)(object)((EntityState)self).gameObject.GetComponent<Deployable>().ownerMaster.GetBody() != (Object)null)
				{
					CharacterMaster ownerMaster = ((EntityState)self).gameObject.GetComponent<Deployable>().ownerMaster;
					if (((EntityState)self).isAuthority)
					{
						new BlastAttack
						{
							attacker = ownerMaster.GetBodyObject(),
							baseDamage = ownerMaster.GetBody().damage * damage,
							baseForce = 0f,
							crit = ownerMaster.GetBody().RollCrit(),
							damageType = (DamageType)8,
							procCoefficient = procCoefficient,
							radius = aoe,
							falloffModel = (FalloffModel)0,
							position = ((EntityState)self).transform.position,
							attackerFiltering = (AttackerFiltering)2,
							teamIndex = ownerMaster.GetBody().teamComponent.teamIndex
						}.Fire();
						new BlastAttack
						{
							attacker = ownerMaster.GetBodyObject(),
							baseDamage = 0f,
							baseForce = 2500f,
							crit = false,
							damageType = (DamageType)32,
							procCoefficient = 0f,
							radius = size / 2f,
							position = ((EntityState)self).transform.position,
							attackerFiltering = (AttackerFiltering)2,
							teamIndex = ownerMaster.GetBody().teamComponent.teamIndex,
							falloffModel = (FalloffModel)0
						}.Fire();
						timer = 0f;
					}
				}
			};
		}
	}
	public class PressureMines : TweakBase
	{
		public static float damageScale;

		public static float aoeScale;

		public static int charges;

		public static float cooldown;

		public override string Name => ": Secondary : Pressure Mines";

		public override string SkillToken => "secondary";

		public override string DescText => "Place a two-stage mine that deals <style=cIsDamage>300% damage</style>, or <style=cIsDamage>" + Mathf.Round(300f * damageScale) + "% damage</style> if fully armed. Can hold up to " + charges + ".";

		public override void Init()
		{
			damageScale = ConfigOption(3.6666667f, "Damage Scale", "Decimal. Vanilla is 3");
			aoeScale = ConfigOption(2f, "Area of Effect Scale", "Vanilla is 2");
			charges = ConfigOption(2, "Charges", "Vanilla is 4");
			cooldown = ConfigOption(4.5f, "Cooldown", "Vanilla is 8");
			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
			Changes();
			CharacterMaster.GetDeployableSameSlotLimit += new hook_GetDeployableSameSlotLimit(CharacterMaster_GetDeployableSameSlotLimit);
			BaseMineArmingState.OnEnter += new hook_OnEnter(BaseMineArmingState_OnEnter);
			MineArmingWeak.FixedUpdate += new hook_FixedUpdate(MineArmingWeak_FixedUpdate);
		}

		private void MineArmingWeak_FixedUpdate(orig_FixedUpdate orig, MineArmingWeak self)
		{
			MineArmingWeak.duration = 1.5f;
			orig.Invoke(self);
		}

		private void BaseMineArmingState_OnEnter(orig_OnEnter orig, BaseMineArmingState self)
		{
			if (self is MineArmingFull)
			{
				self.damageScale = damageScale;
				self.blastRadiusScale = aoeScale;
				self.forceScale = 6f;
			}
			orig.Invoke(self);
		}

		private int CharacterMaster_GetDeployableSameSlotLimit(orig_GetDeployableSameSlotLimit orig, CharacterMaster self, DeployableSlot slot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if ((int)slot == 0)
			{
				return 8 + self.GetBody().inventory.GetItemCount(Items.SecondarySkillMagazine);
			}
			return orig.Invoke(self, slot);
		}

		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)
			SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Engi/EngiBodyPlaceMine.asset").WaitForCompletion();
			val.baseMaxStock = charges;
			val.baseRechargeInterval = cooldown;
		}
	}
	public class SpiderMines : TweakBase
	{
		public static float damage;

		public static int charges;

		public static float cooldown;

		public override string Name => ": Secondary :: Spider Mines";

		public override string SkillToken => "spidermine";

		public override string DescText => "Place a robot mine that deals <style=cIsDamage>" + d(damage) + " damage</style> when an enemy walks nearby. Can hold up to " + charges + ".";

		public override void Init()
		{
			damage = ConfigOption(7f, "Damage", "Decimal. Vanilla is 6");
			charges = ConfigOption(2, "Charges", "Vanilla is 4");
			cooldown = ConfigOption(4f, "Cooldown", "Vanilla is 8");
			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
			Changes();
			CharacterMaster.GetDeployableSameSlotLimit += new hook_GetDeployableSameSlotLimit(CharacterMaster_GetDeployableSameSlotLimit);
			FireMines.OnEnter += new hook_OnEnter(FireMines_OnEnter);
		}

		private void FireMines_OnEnter(orig_OnEnter orig, FireMines self)
		{
			if (self is FireSpiderMine)
			{
				self.damageCoefficient = damage;
			}
			orig.Invoke(self);
		}

		private int CharacterMaster_GetDeployableSameSlotLimit(orig_GetDeployableSameSlotLimit orig, CharacterMaster self, DeployableSlot slot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if ((int)slot == 5)
			{
				return 8 + self.inventory.GetItemCount(Items.SecondarySkillMagazine);
			}
			return orig.Invoke(self, slot);
		}

		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)
			SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Engi/EngiBodyPlaceSpiderMine.asset").WaitForCompletion();
			val.baseMaxStock = charges;
			val.baseRechargeInterval = cooldown;
		}
	}
	public class ThermalHarpoons : TweakBase
	{
		public static float damage;

		public static float cooldown;

		public static int charges;

		public static int chargesToRecharge;

		public static float range;

		public override string Name => ": Utility :: Thermal Harpoons";

		public override string SkillToken => "skill_harpoon";

		public override string DescText => "Enter <style=cIsUtility>target painting mode</style> to launch heat-seeking harpoon missiles that deal <style=cIsDamage>" + d(damage) + " damage</style> each. Can store up to " + charges + ".";

		public override void Init()
		{
			damage = ConfigOption(5f, "Damage", "Decimal. Vanilla is 5");
			cooldown = ConfigOption(2.5f, "Cooldown", "Vanilla is 2.5");
			charges = ConfigOption(4, "Charges", "Vanilla is 4");
			chargesToRecharge = ConfigOption(1, "Charges to Recharge", "Vanilla is 1");
			range = ConfigOption(6969, "Range", "Vanilla is 150");
			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
			Changes();
			Fire.OnEnter += new hook_OnEnter(Fire_OnEnter);
			Paint.OnEnter += new hook_OnEnter(Paint_OnEnter);
		}

		private void Paint_OnEnter(orig_OnEnter orig, Paint self)
		{
			Paint.maxDistance = range;
			orig.Invoke(self);
		}

		private void Fire_OnEnter(orig_OnEnter orig, Fire self)
		{
			Fire.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)
			SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Engi/EngiHarpoons.asset").WaitForCompletion();
			val.rechargeStock = chargesToRecharge;
			val.baseMaxStock = charges;
			val.baseRechargeInterval = cooldown;
		}
	}
	public class TR12GaussAutoTurret : TweakBase
	{
		public override string Name => ": Special : TR12 Gauss Auto Turret";

		public override string SkillToken => "special";

		public override string DescText => "Place a turret that <style=cIsUtility>inherits all your items.</style> Fires a cannon for <style=cIsDamage>100% damage</style>. Can place up to 2.";

		public override void Init()
		{
			base.Init();
		}

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

		public static 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)
			CharacterBody component = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/EngiTurretBody.prefab").WaitForCompletion().GetComponent<CharacterBody>();
			component.baseDamage = 14f;
			component.baseMaxHealth = 150f;
		}
	}
	public class TR58CarbonizerTurret : TweakBase
	{
		public override string Name => ": Special :: TR58 Carbonizer Turret";

		public override string SkillToken => "special_alt1";

		public override string DescText => "Place a <style=cIsUtility>mobile</style> turret that <style=cIsUtility>inherits all your items.</style> Fires a laser for <style=cIsDamage>200% damage per second</style> that <style=cIsUtility>slows enemies</style>. Can place up to 2.";

		public override void Init()
		{
			base.Init();
		}

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

		public static 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_0067: 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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/EngiWalkerTurretMaster.prefab").WaitForCompletion();
			Component[] components = (Component[])(object)val.GetComponents<AISkillDriver>();
			Component[] array = components;
			AISkillDriver val2 = (from x in val.GetComponents<AISkillDriver>()
				where x.customName == "ReturnToLeader"
				select x).First();
			val2.shouldSprint = true;
			val2.minDistance = 35f;
			CharacterBody component = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/EngiWalkerTurretBody.prefab").WaitForCompletion().GetComponent<CharacterBody>();
			component.baseDamage = 14f;
			component.baseMoveSpeed = 11f;
			component.baseMaxHealth = 100f;
		}
	}
}
namespace HIFUEngineerTweaks.Misc
{
	public class BaseStats : MiscBase
	{
		public static float baseDamage;

		public static float baseJumpPower;

		public static float baseMoveSpeed;

		public static SkillDef defectivePropellants;

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

		public override void Init()
		{
			baseDamage = ConfigOption(12f, "Base Damage", "Decimal. Vanilla is 14");
			baseJumpPower = ConfigOption(20f, "Base Jump Power", "Vanilla is 15");
			baseMoveSpeed = ConfigOption(7.5f, "Base Move Speed", "Vanilla is 7");
			base.Init();
		}

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

		public static 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)
			CharacterBody component = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/EngiBody.prefab").WaitForCompletion().GetComponent<CharacterBody>();
			component.baseDamage = baseDamage;
			component.baseJumpPower = baseJumpPower;
			component.baseMoveSpeed = baseMoveSpeed;
		}
	}
}