using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.LemurianBruiserMonster;
using EntityStates.Mage;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using R2API;
using RoR2;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
[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("MageEruption")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MageEruption")]
[assembly: AssemblyTitle("MageEruption")]
[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 MageEruption
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("gaforb.MageEruption", "MageEruption", "3.1.3")]
public class MageEruption : BaseUnityPlugin
{
public const string PluginGUID = "gaforb.MageEruption";
public const string PluginAuthor = "gaforb";
public const string PluginName = "MageEruption";
public const string PluginVersion = "3.1.3";
public static ConfigEntry<bool> VFXoff { get; set; }
public static ConfigEntry<bool> IsSprint { get; set; }
public static ConfigEntry<bool> IsSpecial { get; set; }
public static ConfigEntry<float> BlastDmg { get; set; }
public static ConfigEntry<float> BlastArea { get; set; }
public static ConfigEntry<float> BlastProc { get; set; }
public static ConfigEntry<float> BlastForce { get; set; }
public static ConfigEntry<float> Cooldown { get; set; }
public static ConfigEntry<int> Stocks { get; set; }
public void Awake()
{
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: 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_0323: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_0337: Unknown result type (might be due to invalid IL or missing references)
//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0409: Unknown result type (might be due to invalid IL or missing references)
//IL_0413: Expected O, but got Unknown
//IL_0418: Unknown result type (might be due to invalid IL or missing references)
//IL_041a: Unknown result type (might be due to invalid IL or missing references)
//IL_037f: Unknown result type (might be due to invalid IL or missing references)
//IL_039f: Unknown result type (might be due to invalid IL or missing references)
//IL_03a9: Expected O, but got Unknown
//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
VFXoff = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Use simple explosion", false, "Disables some graphical effects, improving performance.");
IsSprint = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Force sprinting", false, "Makes Eruption work like other utility skills and force sprint. if True, using Flamethrower during Eruption will waste the Flamethrower stock.");
IsSpecial = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Move to special", false, "Adds Eruption to the Special slot instead of the Utility slot.");
BlastDmg = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "Blast damage", 3.6f, "How much damage the initial blast deals. 1 = 100%. Setting to 0 will still apply burn.");
BlastArea = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "Blast area", 8f, "How much range the intial blast has. Set to 0 to disable blast attack completely");
BlastProc = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "Blast proc coefficient", 1f, "How well Eruption triggers item effects. Also effects burn duration.");
BlastForce = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "Blast force", 12f, "How much Eruption knocks back enemies.");
Cooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "Cooldown", 7f, "How long Eruption takes to recharge.");
Stocks = ((BaseUnityPlugin)this).Config.Bind<int>("Values", "Stocks", 1, "Number of stocks Eruption has.");
LanguageAPI.Add("MAGE_ERUPTION_FIRE", "Eruption");
LanguageAPI.Add("MAGE_ERUPTION_DESCRIPTION", "Blast forward" + ((BlastArea.Value > 0f) ? (", " + ((BlastDmg.Value > 0f) ? $"dealing <style=cIsDamage>{BlastDmg.Value * 100f}%</style> damage and " : "") + "<style=cIsDamage>igniting</style> nearby enemies") : "") + "." + ((Stocks.Value != 1) ? $" Holds up to {Stocks.Value} charges." : ""));
SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
val.activationState = new SerializableEntityStateType(typeof(MageEruptionState));
val.activationStateMachineName = "Body";
val.baseMaxStock = Mathf.Max(Stocks.Value, 1);
val.baseRechargeInterval = Mathf.Max(Cooldown.Value, 0.5f);
val.beginSkillCooldownOnSkillEnd = false;
val.canceledFromSprinting = false;
val.forceSprintDuringState = IsSprint.Value;
val.cancelSprintingOnActivation = !IsSprint.Value;
val.isCombatSkill = BlastArea.Value > 0f;
val.fullRestockOnAssign = true;
val.interruptPriority = (InterruptPriority)2;
val.mustKeyPress = true;
val.rechargeStock = 1;
val.requiredStock = 1;
val.stockToConsume = 1;
val.icon = SpriteFromFile("eruption.png");
val.skillName = "MAGE_ERUPTION_FIRE";
val.skillNameToken = "MAGE_ERUPTION_FIRE";
val.skillDescriptionToken = "MAGE_ERUPTION_DESCRIPTION";
GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)"mage").WaitForCompletion();
bool flag = default(bool);
ContentAddition.AddEntityState(typeof(MageEruptionState), ref flag);
ContentAddition.AddSkillDef(val);
SkillFamily val3 = Addressables.LoadAssetAsync<SkillFamily>((object)"RoR2/Base/Mage/MageBodySpecialFamily.asset").WaitForCompletion();
SkillFamily val4 = Addressables.LoadAssetAsync<SkillFamily>((object)"RoR2/Base/Mage/MageBodyUtilityFamily.asset").WaitForCompletion();
if (IsSpecial.Value)
{
Array.Resize(ref val3.variants, val3.variants.Length + 1);
Variant[] variants = val3.variants;
int num = val3.variants.Length - 1;
Variant val5 = default(Variant);
val5.skillDef = val;
val5.unlockableDef = null;
((Variant)(ref val5)).viewableNode = new Node(val.skillNameToken, false, (Node)null);
variants[num] = val5;
}
else
{
Array.Resize(ref val4.variants, val4.variants.Length + 1);
Variant[] variants2 = val4.variants;
int num2 = val4.variants.Length - 1;
Variant val6 = default(Variant);
val6.skillDef = val;
val6.unlockableDef = null;
((Variant)(ref val6)).viewableNode = new Node(val.skillNameToken, false, (Node)null);
variants2[num2] = val6;
}
}
public static Sprite SpriteFromFile(string name)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(2, 2);
try
{
ImageConversion.LoadImage(val, File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), name)));
}
catch (FileNotFoundException ex)
{
Debug.LogError((object)("Failed to read file at " + ex.FileName));
return null;
}
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).height, (float)((Texture)val).width), new Vector2(0.5f, 0.5f), 100f);
}
}
public class MageEruptionState : GenericCharacterMain
{
private Transform jetOnEffect;
private Vector3 flyVector = Vector3.zero;
private Vector3 blastPosition;
public float baseDuration = 1.2f;
private float aoe = Mathf.Max(MageEruption.BlastArea.Value, 0f);
private float dmg = Mathf.Max(MageEruption.BlastDmg.Value, 0f);
private float proc = Mathf.Max(MageEruption.BlastProc.Value, 0f);
private float force = Mathf.Max(MageEruption.BlastForce.Value, 0f) * 100f;
private bool vfxoff = MageEruption.VFXoff.Value;
public override void OnEnter()
{
//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)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: 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_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_00b4: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: 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_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: 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_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: 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_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Expected O, but got Unknown
//IL_0180: 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_018b: Unknown result type (might be due to invalid IL or missing references)
((GenericCharacterMain)this).OnEnter();
float num = (((BaseState)this).isGrounded ? 1.1f : 3.3f);
flyVector = Vector3.Normalize(((EntityState)this).characterDirection.forward + Vector3.up / num);
Util.PlaySound(FlyUpState.beginSoundString, ((EntityState)this).gameObject);
CreateBlinkEffect(((EntityState)this).characterBody.corePosition);
((EntityState)this).PlayCrossfade("Body", "FlyUp", "FlyUp.playbackRate", baseDuration, 0.1f);
((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
((EntityState)this).characterMotor.velocity = Vector3.zero;
blastPosition = ((EntityState)this).characterBody.corePosition;
if (((EntityState)this).isAuthority && aoe > 0f)
{
BlastAttack val = new BlastAttack
{
radius = aoe,
procCoefficient = proc,
position = blastPosition,
attacker = ((EntityState)this).gameObject,
crit = Util.CheckRoll(((EntityState)this).characterBody.crit, ((EntityState)this).characterBody.master),
baseDamage = ((EntityState)this).characterBody.damage * dmg,
falloffModel = (FalloffModel)0,
baseForce = force,
attackerFiltering = (AttackerFiltering)2,
damageType = DamageTypeCombo.op_Implicit((DamageType)128)
};
val.teamIndex = TeamComponent.GetObjectTeam(val.attacker);
val.Fire();
}
}
public override void FixedUpdate()
{
((GenericCharacterMain)this).FixedUpdate();
if ((double)((EntityState)this).fixedAge >= (double)baseDuration - 0.4 && ((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void OnExit()
{
if (!((EntityState)this).outer.destroying)
{
Util.PlaySound(FlyUpState.endSoundString, ((EntityState)this).gameObject);
}
((GenericCharacterMain)this).OnExit();
}
public override void OnSerialize(NetworkWriter writer)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).OnSerialize(writer);
writer.Write(blastPosition);
}
public override void OnDeserialize(NetworkReader reader)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).OnDeserialize(reader);
blastPosition = reader.ReadVector3();
}
public override void HandleMovements()
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
((GenericCharacterMain)this).HandleMovements();
float num = 2f + ((BaseState)this).moveSpeedStat * (((EntityState)this).characterBody.isSprinting ? (1f / ((EntityState)this).characterBody.sprintingSpeedMultiplier) : 1f) / 2f * FlyUpState.speedCoefficientCurve.Evaluate(((EntityState)this).fixedAge / baseDuration);
CharacterMotor characterMotor = ((EntityState)this).characterMotor;
characterMotor.rootMotion += flyVector * num * Time.fixedDeltaTime;
CharacterMotor characterMotor2 = ((EntityState)this).characterMotor;
characterMotor2.velocity.y = characterMotor2.velocity.y + 0.3f;
}
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;
}
private void CreateBlinkEffect(Vector3 origin)
{
//IL_001e: 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_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)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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_0049: Expected O, but got Unknown
if (!vfxoff && aoe > 0f)
{
EffectData val = new EffectData
{
rotation = Util.QuaternionSafeLookRotation(flyVector),
origin = origin,
scale = aoe
};
EffectManager.SpawnEffect(Resources.Load<GameObject>("Prefabs/Effects/ImpactEffects/ExplosionSolarFlare"), val, false);
EffectManager.SpawnEffect(Resources.Load<GameObject>("Prefabs/Effects/ImpactEffects/MagmaOrbExplosion"), val, false);
}
EffectManager.SimpleMuzzleFlash(FireMegaFireball.muzzleflashEffectPrefab, ((EntityState)this).gameObject, "MuzzleLeft", false);
EffectManager.SimpleMuzzleFlash(FireMegaFireball.muzzleflashEffectPrefab, ((EntityState)this).gameObject, "MuzzleRight", false);
}
}
}