Decompiled source of LesserWispRework v1.0.0

LesserWispRework.dll

Decompiled 7 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EntityStates;
using EntityStates.Wisp1Monster;
using On.EntityStates.Wisp1Monster;
using R2API;
using RoR2;
using RoR2.Projectile;
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 = "")]
[assembly: AssemblyCompany("LesserWispRework")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LesserWispRework")]
[assembly: AssemblyTitle("LesserWispRework")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace LesserWispRework;

[BepInPlugin("com.rob.LesserWispRework", "LesserWispRework", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string MODUID = "com.rob.LesserWispRework";

	public static GameObject projectilePrefab;

	public static GameObject ghostPrefab;

	private void Awake()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Expected O, but got Unknown
		CreateProjectile();
		ChargeEmbers.FixedUpdate += new hook_FixedUpdate(ChargeEmbers_FixedUpdate);
	}

	private void CreateProjectile()
	{
		//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_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		projectilePrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/Fireball.prefab").WaitForCompletion(), "RobWispFireball", true);
		ghostPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/FireballGhost.prefab").WaitForCompletion(), "RobWispFireballGhost", false);
		((Component)ghostPrefab.transform.GetChild(0)).transform.localScale = Vector3.one * 0.35f;
		((Renderer)((Component)ghostPrefab.transform.GetChild(0)).GetComponent<ParticleSystemRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Wisp/matWispEmber.mat").WaitForCompletion();
		projectilePrefab.GetComponent<ProjectileController>().ghostPrefab = ghostPrefab;
		if (Object.op_Implicit((Object)(object)projectilePrefab.GetComponent<ProjectileSingleTargetImpact>()))
		{
			projectilePrefab.GetComponent<ProjectileSingleTargetImpact>().impactEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/Wisp/ImpactWispEmber.prefab").WaitForCompletion();
		}
		ContentAddition.AddProjectile(projectilePrefab);
		bool flag = false;
		ContentAddition.AddEntityState<FireBlast>(ref flag);
	}

	private void ChargeEmbers_FixedUpdate(orig_FixedUpdate orig, ChargeEmbers self)
	{
		if (self.stopwatch + Time.fixedDeltaTime >= self.duration && ((EntityState)self).isAuthority)
		{
			((EntityState)self).outer.SetNextState((EntityState)(object)new FireBlast());
		}
		else
		{
			orig.Invoke(self);
		}
	}
}
public class FireBlast : BaseSkillState
{
	private float duration;

	public override void OnEnter()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		((BaseState)this).OnEnter();
		duration = FireEmbers.baseDuration;
		Ray aimRay = ((BaseState)this).GetAimRay();
		Util.PlayAttackSpeedSound(FireEmbers.attackString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
		((BaseState)this).StartAimMode(aimRay, 2f, false);
		((EntityState)this).PlayAnimation("Body", "FireAttack1", "FireAttack1.playbackRate", duration);
		Fire();
	}

	private void Fire()
	{
		//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_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: 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_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: 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_00da: 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_010f: 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 (((EntityState)this).isAuthority)
		{
			bool flag = ((BaseState)this).RollCrit();
			Ray aimRay = ((BaseState)this).GetAimRay();
			ProjectileManager.instance.FireProjectile(Plugin.projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, ((BaseState)this).damageStat * FireEmbers.damageCoefficient, FireEmbers.force / 3f, flag, (DamageColorIndex)0, (GameObject)null, 170f);
			Util.ApplySpread(((Ray)(ref aimRay)).direction, FireEmbers.minSpread, FireEmbers.maxSpread, 0f, 0f, 0f, 0f);
			ProjectileManager.instance.FireProjectile(Plugin.projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, ((BaseState)this).damageStat * FireEmbers.damageCoefficient, FireEmbers.force / 3f, flag, (DamageColorIndex)0, (GameObject)null, 170f);
			Util.ApplySpread(((Ray)(ref aimRay)).direction, FireEmbers.minSpread, FireEmbers.maxSpread, 0f, 0f, 0f, 0f);
			ProjectileManager.instance.FireProjectile(Plugin.projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, ((BaseState)this).damageStat * FireEmbers.damageCoefficient, FireEmbers.force / 3f, flag, (DamageColorIndex)0, (GameObject)null, 170f);
		}
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	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)3;
	}
}