Decompiled source of HIFUArtificerTweaks v1.1.9

HIFUArtificerTweaks.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 ArtificerExtended.Passive;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Mage;
using EntityStates.Mage.Weapon;
using HIFUArtificerTweaks.Projectiles;
using HIFUArtificerTweaks.Skilldefs;
using HIFUArtificerTweaks.Skills;
using HarmonyLib;
using IL.EntityStates.Mage;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Mage;
using On.EntityStates.Mage.Weapon;
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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HIFUArtificerTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HIFUArtificerTweaks")]
[assembly: AssemblyTitle("HIFUArtificerTweaks")]
[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 HIFUArtificerTweaks
{
	public static class AddUtility
	{
		public static void Create()
		{
			//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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_0081: 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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageBody.prefab").WaitForCompletion();
			SkillLocator component = val.GetComponent<SkillLocator>();
			SkillFamily skillFamily = component.utility.skillFamily;
			Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
			Variant[] variants = skillFamily.variants;
			int num = skillFamily.variants.Length - 1;
			Variant val2 = new Variant
			{
				skillDef = FlamewallSD.sd,
				unlockableName = ""
			};
			((Variant)(ref val2)).viewableNode = new Node(FlamewallSD.nameToken, false, (Node)null);
			variants[num] = val2;
		}
	}
	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.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("HIFU.HIFUArtificerTweaks", "HIFUArtificerTweaks", "1.1.9")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "HIFU.HIFUArtificerTweaks";

		public const string PluginAuthor = "HIFU";

		public const string PluginName = "HIFUArtificerTweaks";

		public const string PluginVersion = "1.1.9";

		public static ConfigFile HATConfig;

		public static ConfigFile HATBackupConfig;

		public static bool aeLoaded;

		public static ManualLogSource HATLogger;

		public static ConfigEntry<float> flamewallDamage;

		public static ConfigEntry<float> flamewallSpeed;

		public static ConfigEntry<float> flamewallProcCoeff;

		public static AssetBundle hifuartificertweaks;

		public static bool _preVersioning;

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

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

		public void Awake()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			HATLogger = ((BaseUnityPlugin)this).Logger;
			HATConfig = ((BaseUnityPlugin)this).Config;
			aeLoaded = Chainloader.PluginInfos.ContainsKey("com.Borbo.ArtificerExtended");
			hifuartificertweaks = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("HIFUArtificerTweaks.dll", "hifuartificertweaks"));
			HATBackupConfig = new ConfigFile(Paths.ConfigPath + "\\HIFU.HIFUArtificerTweaks.Backup.cfg", true);
			HATBackupConfig.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 = HATConfig.Bind<bool>("Config", "Enable Auto Config Sync", true, "Disabling this would stop HIFUArtificerTweaks from syncing config whenever a new version is found.");
			_preVersioning = !((Dictionary<ConfigDefinition, string>)AccessTools.DeclaredPropertyGetter(typeof(ConfigFile), "OrphanedEntries").Invoke(HATConfig, null)).Keys.Any((ConfigDefinition x) => x.Key == "Latest Version");
			latestVersion = HATConfig.Bind<string>("Config", "Latest Version", "1.1.9", "DO NOT CHANGE THIS");
			if (enableAutoConfig.Value && (_preVersioning || latestVersion.Value != "1.1.9"))
			{
				latestVersion.Value = "1.1.9";
				ConfigManager.VersionChanged = true;
				HATLogger.LogInfo((object)"Config Autosync Enabled.");
			}
			flamewallDamage = ((BaseUnityPlugin)this).Config.Bind<float>(": Utility :: Flamewall", "Damage", 0.55f, "Decimal. Default is 0.65");
			flamewallSpeed = ((BaseUnityPlugin)this).Config.Bind<float>(": Utility :: Flamewall", "Speed Multiplier", 1.3f, "Default is 1.3");
			flamewallProcCoeff = ((BaseUnityPlugin)this).Config.Bind<float>(": Utility :: Flamewall", "Proc Coefficient", 0.15f, "Default is 0.15");
			WallOfInfernoProjectile.Create();
			FlamewallSD.Create();
			AddUtility.Create();
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(TweakBase))
				select type;
			HATLogger.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;
			HATLogger.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 WITHINDESTRUCTIONMYFUCKINGBELOVED()
		{
		}
	}
	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.HATConfig.Bind<T>(Name, name, value, description);
			ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)val, Main.HATBackupConfig, name);
			return val.Value;
		}

		public abstract void Hooks();

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

		public virtual void Init()
		{
			Hooks();
			Main.HATLogger.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 bool done = false;

		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.HATConfig.Bind<T>(Name, name, value, description);
			ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)val, Main.HATBackupConfig, name);
			if (!done)
			{
				ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)Main.flamewallDamage, Main.HATBackupConfig, ((ConfigEntryBase)Main.flamewallDamage).Definition.Key);
				ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)Main.flamewallSpeed, Main.HATBackupConfig, ((ConfigEntryBase)Main.flamewallSpeed).Definition.Key);
				ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)Main.flamewallProcCoeff, Main.HATBackupConfig, ((ConfigEntryBase)Main.flamewallProcCoeff).Definition.Key);
				done = true;
			}
			return val.Value;
		}

		public abstract void Hooks();

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

		public virtual void Init()
		{
			Hooks();
			string text = "MAGE_" + SkillToken.ToUpper() + "_DESCRIPTION";
			LanguageAPI.Add(text, DescText);
			Main.HATLogger.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 HIFUArtificerTweaks.Skills
{
	public class CastNanoSpear : TweakBase
	{
		public static float minDamage;

		public static float maxDamage;

		public static float castTime;

		public override string Name => ": Secondary :: Cast Nano-Spear";

		public override string SkillToken => "secondary_ice";

		public override string DescText => "<style=cIsUtility>Freezing</style>. Charge up a <style=cIsDamage>piercing</style> nano-spear that deals <style=cIsDamage>" + d(minDamage) + "-" + d(maxDamage) + "</style> damage.";

		public override void Init()
		{
			minDamage = ConfigOption(4f, "Minimum Damage", "Decimal. Vanilla is 4");
			maxDamage = ConfigOption(16f, "Maximum Damage", "Decimal. Vanilla is 12");
			castTime = ConfigOption(1.3f, "Max Charge Time", "Vanilla is 2");
			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
			BaseChargeBombState.OnEnter += new hook_OnEnter(BaseChargeBombState_OnEnter);
			BaseThrowBombState.OnEnter += new hook_OnEnter(BaseThrowBombState_OnEnter);
		}

		private void BaseChargeBombState_OnEnter(orig_OnEnter orig, BaseChargeBombState self)
		{
			if (self is ChargeIcebomb)
			{
				self.baseDuration = castTime;
			}
			orig.Invoke(self);
		}

		private void BaseThrowBombState_OnEnter(orig_OnEnter orig, BaseThrowBombState self)
		{
			if (self is ThrowIcebomb)
			{
				self.minDamageCoefficient = minDamage;
				self.maxDamageCoefficient = maxDamage;
			}
			orig.Invoke(self);
		}
	}
	public class ChargedNanoBomb : TweakBase
	{
		public static float minDamage;

		public static float maxDamage;

		public static float castTime;

		public override string Name => ": Secondary :: Charged Nano-Bomb";

		public override string SkillToken => "secondary_lightning";

		public override string DescText => "<style=cIsDamage>Stunning</style>. Charge up a <style=cIsDamage>exploding</style> nano-bomb that deals <style=cIsDamage>" + d(minDamage) + "-" + d(maxDamage) + "</style> damage.";

		public override void Init()
		{
			minDamage = ConfigOption(4f, "Minimum Damage", "Decimal. Vanilla is 4");
			maxDamage = ConfigOption(20f, "Maximum Damage", "Decimal. Vanilla is 20");
			castTime = ConfigOption(2f, "Max Charge Time", "Vanilla is 2");
			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
			BaseChargeBombState.OnEnter += new hook_OnEnter(BaseChargeBombState_OnEnter);
			BaseThrowBombState.OnEnter += new hook_OnEnter(BaseThrowBombState_OnEnter);
		}

		private void BaseChargeBombState_OnEnter(orig_OnEnter orig, BaseChargeBombState self)
		{
			if (self is ChargeNovabomb)
			{
				self.baseDuration = castTime;
			}
			orig.Invoke(self);
		}

		private void BaseThrowBombState_OnEnter(orig_OnEnter orig, BaseThrowBombState self)
		{
			if (self is ThrowNovabomb)
			{
				self.minDamageCoefficient = minDamage;
				self.maxDamageCoefficient = maxDamage;
			}
			orig.Invoke(self);
		}
	}
	public class Flamethrower : TweakBase
	{
		public static float Damage;

		public static float BurnChance;

		public static float Range;

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

		public override string SkillToken => "special_fire";

		public override string DescText => "<style=cIsDamage>Ignite</style>. Burn all enemies in front of you for <style=cIsDamage>" + d(Damage + Damage / (1f / (BurnChance / 100f))) + " damage</style>.";

		public override void Init()
		{
			Damage = ConfigOption(20f, "Damage", "Decimal. Vanilla is 20");
			BurnChance = ConfigOption(100f, "Ignite Chance", "Decimal. Vanilla is 50");
			Range = ConfigOption(20f, "Range", "Vanilla is 20");
			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
			Flamethrower.OnEnter += new hook_OnEnter(Flamethrower_OnEnter);
		}

		private void Flamethrower_OnEnter(orig_OnEnter orig, Flamethrower self)
		{
			Flamethrower.ignitePercentChance = BurnChance;
			Flamethrower.totalDamageCoefficient = Damage;
			self.maxDistance = Range;
			orig.Invoke(self);
		}
	}
	public class FlamewallState : BaseSkillState
	{
		public float duration = 2f;

		public float timer;

		public float interval = 0.25f;

		public float speedMultiplier = Main.flamewallSpeed.Value;

		private Vector3 idealDirection;

		public GameObject wallPrefab = WallOfInfernoProjectile.prefab;

		public SkillLocator sl;

		public override void OnEnter()
		{
			//IL_003e: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			sl = ((Component)((EntityState)this).characterBody).GetComponent<SkillLocator>();
			if (((EntityState)this).isAuthority)
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank))
				{
					idealDirection = ((EntityState)this).inputBank.aimDirection;
					idealDirection.y = 0f;
				}
				if (Object.op_Implicit((Object)(object)sl) && sl.special.skillNameToken == "MAGE_SPECIAL_FIRE_NAME")
				{
					sl.special.skillDef.canceledFromSprinting = false;
					sl.special.skillDef.cancelSprintingOnActivation = false;
				}
				UpdateDirection();
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = true;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterDirection.forward = idealDirection;
			}
			if (Main.aeLoaded)
			{
				SkillCast();
			}
			((EntityState)this).characterBody.SetAimTimer(duration + 1f);
			((EntityState)this).PlayAnimation("Gesture, Additive", "PrepWall", "PrepWall.playbackRate", duration, 0f);
			Util.PlaySound("Play_item_use_fireballDash_start", ((EntityState)this).gameObject);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public void SkillCast()
		{
			GameObject gameObject = ((Component)((EntityState)this).outer).gameObject;
			if (AltArtiPassive.instanceLookup.TryGetValue(gameObject, out var value))
			{
				value.SkillCast((BatchHandle)null);
			}
		}

		private void UpdateDirection()
		{
			//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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank))
			{
				Vector2 val = Util.Vector3XZToVector2XY(((EntityState)this).inputBank.moveVector);
				if (val != Vector2.zero)
				{
					((Vector2)(ref val)).Normalize();
					Vector3 val2 = new Vector3(val.x, 0f, val.y);
					idealDirection = ((Vector3)(ref val2)).normalized;
				}
			}
		}

		private Vector3 GetIdealVelocity()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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)
			return ((EntityState)this).characterDirection.forward * ((EntityState)this).characterBody.moveSpeed * speedMultiplier;
		}

		public override void FixedUpdate()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			timer += Time.fixedDeltaTime;
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.isSprinting = true;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterDirection.moveVector = idealDirection;
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.disableAirControlUntilCollision)
				{
					CharacterMotor characterMotor = ((EntityState)this).characterMotor;
					characterMotor.rootMotion += GetIdealVelocity() * Time.fixedDeltaTime;
				}
			}
			UpdateDirection();
			if (((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			else if (timer >= interval)
			{
				Vector3 up = Vector3.up;
				FireProjectileInfo val = default(FireProjectileInfo);
				val.projectilePrefab = wallPrefab;
				val.position = ((EntityState)this).characterBody.corePosition;
				val.rotation = Util.QuaternionSafeLookRotation(up);
				val.owner = ((EntityState)this).gameObject;
				val.damage = ((BaseState)this).damageStat;
				val.force = 0f;
				val.damageColorIndex = (DamageColorIndex)0;
				val.crit = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master);
				FireProjectileInfo val2 = val;
				ProjectileManager.instance.FireProjectile(val2);
				Util.PlaySound(Flamethrower.endAttackSoundString, ((EntityState)this).gameObject);
				timer = 0f;
			}
		}

		public override void OnExit()
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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)
			((EntityState)this).OnExit();
			if (!((EntityState)this).outer.destroying && Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).PlayAnimation("Gesture, Additive", "FireWall");
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.disableAirControlUntilCollision)
			{
				CharacterMotor characterMotor = ((EntityState)this).characterMotor;
				characterMotor.velocity += GetIdealVelocity();
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = false;
			}
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)sl) && sl.special.skillNameToken == "MAGE_SPECIAL_FIRE_NAME")
			{
				sl.special.skillDef.canceledFromSprinting = true;
				sl.special.skillDef.cancelSprintingOnActivation = true;
			}
			Util.PlaySound("Play_item_use_fireballDash_explode", ((EntityState)this).gameObject);
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	public class IonSurge : TweakBase
	{
		public static float AoE;

		public static float Cooldown;

		public static float Damage;

		public static float dashSpeed;

		public static float Duration;

		public static bool ScaleWithSpeed;

		public override string Name => ": Special :: Ion Surge";

		public override string SkillToken => "special_lightning";

		public override string DescText => "<style=cIsDamage>Stunning</style>. Soar and dash, dealing <style=cIsDamage>" + d(Damage) + " damage</style> in a large area.";

		public override void Init()
		{
			AoE = ConfigOption(14f, "Area of Effect", "Vanilla is 14");
			Cooldown = ConfigOption(5f, "Cooldown", "Vanilla is 8");
			Damage = ConfigOption(8f, "Damage", "Decimal. Vanilla is 8");
			dashSpeed = ConfigOption(3.5f, "Dash Speed Multiplier", "Default is 3.5");
			Duration = ConfigOption(0.3f, "Duration", "This affects height. Vanilla is 1.66");
			ScaleWithSpeed = ConfigOption(value: false, "Make Height scale with Movement Speed?", "Vanilla is true");
			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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			FlyUpState.OnEnter += new hook_OnEnter(FlyUpState_OnEnter);
			if (!ScaleWithSpeed)
			{
				FlyUpState.HandleMovements += new Manipulator(FlyUpState_HandleMovements);
			}
			Changes();
		}

		private void FlyUpState_HandleMovements(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<BaseState>(x, "moveSpeedStat")
			}))
			{
				int index = val.Index;
				val.Index = index + 1;
				val.EmitDelegate<Func<float, float>>((Func<float, float>)((float orig) => 10.15f));
			}
			else
			{
				Main.HATLogger.LogError((object)"Failed to IL hook Ion Surge Handle Movements");
			}
		}

		private void FlyUpState_OnEnter(orig_OnEnter orig, FlyUpState self)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			FlyUpState.blastAttackRadius = AoE;
			FlyUpState.blastAttackDamageCoefficient = Damage;
			FlyUpState.duration = Duration;
			orig.Invoke(self);
			if (((EntityState)self).isAuthority)
			{
				Vector3 val = ((((EntityState)self).inputBank.moveVector == Vector3.zero) ? Vector3.zero : ((Vector3)(ref ((EntityState)self).inputBank.moveVector)).normalized);
				Vector3 velocity = ((Vector3)(ref val)).normalized * dashSpeed * ((BaseState)self).moveSpeedStat;
				((BaseCharacterController)((EntityState)self).characterMotor).Motor.ForceUnground(0.1f);
				((EntityState)self).characterMotor.velocity = velocity;
			}
		}

		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/Mage/MageBodyFlyUp.asset").WaitForCompletion();
			val.baseRechargeInterval = Cooldown;
		}
	}
	public class PlasmaBolt : TweakBase
	{
		public static float AoE;

		public static float Damage;

		public override string Name => ": Primary :: Plasma Bolt";

		public override string SkillToken => "primary_lightning";

		public override string DescText => "Fire a bolt for <style=cIsDamage>" + d(Damage) + " damage</style> that <style=cIsDamage>explodes</style> in a medium area. Hold up to 4.</style>";

		public override void Init()
		{
			AoE = ConfigOption(6f, "Area of Effect", "Vanilla is 6");
			Damage = ConfigOption(3f, "Damage", "Decimal. Vanilla is 2.8");
			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
			FireFireBolt.OnEnter += new hook_OnEnter(FireFireBolt_OnEnter);
			Changes();
		}

		private void FireFireBolt_OnEnter(orig_OnEnter orig, FireFireBolt self)
		{
			if (self is FireLightningBolt)
			{
				self.damageCoefficient = Damage;
			}
			orig.Invoke(self);
		}

		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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageLightningboltBasic.prefab").WaitForCompletion();
			((ProjectileExplosion)val.GetComponent<ProjectileImpactExplosion>()).blastRadius = AoE;
		}
	}
	public class Snapfreeze : TweakBase
	{
		public static float damage;

		public static float lifetime;

		public override string Name => ": Utility : Snapfreeze";

		public override string SkillToken => "utility_ice";

		public override string DescText => "<style=cIsUtility>Freezing</style>. Create a barrier that hurts enemies for <style=cIsDamage>" + d(damage) + " damage</style>.";

		public override void Init()
		{
			lifetime = ConfigOption(0.35f, "Lifetime", "Vanilla is 0.3. Wall Count = 40 * lifetime");
			damage = ConfigOption(1.2f, "Damage", "Decimal. Vanilla is 1");
			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
			PrepWall.OnEnter += new hook_OnEnter(PrepWall_OnEnter);
			Changes();
		}

		private void PrepWall_OnEnter(orig_OnEnter orig, PrepWall self)
		{
			PrepWall.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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageIcewallWalkerProjectile.prefab").WaitForCompletion();
			ProjectileCharacterController component = val.GetComponent<ProjectileCharacterController>();
			component.lifetime = lifetime;
		}
	}
}
namespace HIFUArtificerTweaks.Skilldefs
{
	public static class FlamewallSD
	{
		public static SkillDef sd;

		public static string nameToken = "HAT_UTILITY_FIRE_NAME";

		public static void Create()
		{
			//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_0031: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageBody.prefab").WaitForCompletion();
			EntityStateMachine val2 = val.AddComponent<EntityStateMachine>();
			val2.customName = "Wall";
			val2.initialStateType = new SerializableEntityStateType(typeof(Idle));
			val2.mainStateType = new SerializableEntityStateType(typeof(Idle));
			sd = ScriptableObject.CreateInstance<SkillDef>();
			sd.activationState = new SerializableEntityStateType(typeof(FlamewallState));
			sd.activationStateMachineName = "Wall";
			sd.interruptPriority = (InterruptPriority)1;
			sd.baseRechargeInterval = 12f;
			sd.baseMaxStock = 1;
			sd.rechargeStock = 1;
			sd.requiredStock = 1;
			sd.stockToConsume = 1;
			sd.resetCooldownTimerOnUse = false;
			sd.fullRestockOnAssign = true;
			sd.dontAllowPastMaxStocks = false;
			sd.beginSkillCooldownOnSkillEnd = true;
			sd.cancelSprintingOnActivation = false;
			sd.canceledFromSprinting = false;
			sd.isCombatSkill = true;
			sd.mustKeyPress = false;
			sd.icon = Main.hifuartificertweaks.LoadAsset<Sprite>("Assets/Flamewall.png");
			sd.skillNameToken = nameToken;
			sd.skillDescriptionToken = "HAT_UTILITY_FIRE_DESCRIPTION";
			sd.keywordTokens = new string[2] { "KEYWORD_IGNITE", "KEYWORD_AGILE" };
			LanguageAPI.Add("HAT_UTILITY_FIRE_NAME", "Flamewall");
			LanguageAPI.Add("HAT_UTILITY_FIRE_DESCRIPTION", "<style=cIsUtility>Agile</style>. <style=cIsDamage>Ignite</style>. Rush forward, summoning pillars of fire in your wake that deal <style=cIsDamage>" + Main.flamewallDamage.Value * 100f + "% damage per second</style>.");
			ContentAddition.AddSkillDef(sd);
		}
	}
}
namespace HIFUArtificerTweaks.Projectiles
{
	public static class WallOfInfernoProjectile
	{
		public static GameObject prefab;

		public static float damage = Main.flamewallDamage.Value;

		public static float procCoeff = Main.flamewallProcCoeff.Value;

		public static void Create()
		{
			//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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: 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_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Expected O, but got Unknown
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Expected O, but got Unknown
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			prefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElementalRings/FireTornado.prefab").WaitForCompletion(), "WallOfInfernoPillar");
			prefab.transform.eulerAngles = new Vector3(0f, 0f, 90f);
			Object.Destroy((Object)(object)prefab.GetComponent<SphereCollider>());
			CapsuleCollider val = prefab.AddComponent<CapsuleCollider>();
			((Collider)val).isTrigger = false;
			val.center = new Vector3(0f, 0f, 0f);
			val.radius = 1f;
			val.height = 1f;
			Transform child = prefab.transform.GetChild(0);
			((Component)child).transform.localScale = new Vector3(8.5f, 8.5f, 20f);
			((Component)child).transform.localPosition = new Vector3(0f, 0f, 8f);
			Rigidbody component = prefab.GetComponent<Rigidbody>();
			component.collisionDetectionMode = (CollisionDetectionMode)1;
			component.useGravity = true;
			component.freezeRotation = true;
			ConstantForce val2 = prefab.AddComponent<ConstantForce>();
			val2.force = new Vector3(0f, -2500f, 0f);
			ProjectileStickOnImpact val3 = prefab.AddComponent<ProjectileStickOnImpact>();
			val3.ignoreCharacters = true;
			val3.ignoreWorld = false;
			val3.alignNormals = false;
			ProjectileSimple component2 = prefab.GetComponent<ProjectileSimple>();
			component2.lifetime = 7f;
			ProjectileDamage component3 = prefab.GetComponent<ProjectileDamage>();
			component3.damageType = DamageTypeCombo.op_Implicit((DamageType)128);
			ProjectileOverlapAttack component4 = prefab.GetComponent<ProjectileOverlapAttack>();
			component4.damageCoefficient = damage;
			component4.resetInterval = 1f;
			component4.overlapProcCoefficient = procCoeff;
			ProjectileController component5 = prefab.GetComponent<ProjectileController>();
			GameObject val4 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/Mage/MageFirePillarGhost.prefab").WaitForCompletion(), "WallOfInfernoPillarGhost", false);
			Transform child2 = val4.transform.GetChild(0);
			child2.localScale = new Vector3(2.5f, 4f, 2.5f);
			ParticleSystem component6 = ((Component)child2).GetComponent<ParticleSystem>();
			ParticleSystemRenderer component7 = ((Component)child2).GetComponent<ParticleSystemRenderer>();
			Material val5 = new Material(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matFirePillarParticle.mat").WaitForCompletion());
			val5.SetInt("_FadeCloseOn", 1);
			val5.SetFloat("_FadeCloseDistance", 0.09f);
			val5.shaderKeywords = new string[4] { "CLOUDOFFSET", "FADECLOSE", "USE_CLOUDS", "_EMISSION" };
			((Renderer)component7).material = val5;
			VelocityOverLifetimeModule velocityOverLifetime = component6.velocityOverLifetime;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).speedModifier = MinMaxCurve.op_Implicit(0.5f);
			Gradient val6 = new Gradient();
			val6.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[4]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(1f, 0.7f),
				new GradientAlphaKey(1f, 0.9f),
				new GradientAlphaKey(0f, 1f)
			});
			ColorOverLifetimeModule colorOverLifetime = component6.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val6);
			val4.transform.eulerAngles = new Vector3(0f, 0f, 90f);
			DestroyOnTimer val7 = val4.AddComponent<DestroyOnTimer>();
			val7.duration = 7f;
			component5.ghostPrefab = val4;
			ContentAddition.AddProjectile(prefab);
		}
	}
}