Decompiled source of BanditPrimaryRevolver v1.0.0

ExamplePlugin.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using CustomSkillsTutorial.MyEntityStates;
using EntityStates;
using EntityStates.Commando.CommandoWeapon;
using Microsoft.CodeAnalysis;
using R2API;
using RoR2;
using RoR2.Skills;
using RoR2.UI;
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("ExamplePlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExamplePlugin")]
[assembly: AssemblyTitle("ExamplePlugin")]
[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 ExamplePlugin
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}
namespace CustomSkillsTutorial
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.MelonGoonsquad.BanditRevolverPrimary", "BanditRevolverPrimary", "1.0.0")]
	public class CustomSkillTutorial : BaseUnityPlugin
	{
		public void Awake()
		{
			//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_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_008b: 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_00be: 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_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2Body.prefab").WaitForCompletion();
			LanguageAPI.Add("COMMANDO_PRIMARY_SIMPLEBULLET_NAME", "Revolver");
			LanguageAPI.Add("COMMANDO_PRIMARY_SIMPLEBULLET_DESCRIPTION", "Fire a revolver round for <style=cIsDamage>500% damage</style>.");
			SkillDef val2 = ScriptableObject.CreateInstance<SkillDef>();
			val2.activationState = new SerializableEntityStateType(typeof(SimpleBulletAttack));
			val2.activationStateMachineName = "Weapon";
			val2.baseMaxStock = 0;
			val2.baseRechargeInterval = 0f;
			val2.beginSkillCooldownOnSkillEnd = true;
			val2.canceledFromSprinting = false;
			val2.cancelSprintingOnActivation = true;
			val2.fullRestockOnAssign = true;
			val2.interruptPriority = (InterruptPriority)0;
			val2.isCombatSkill = true;
			val2.mustKeyPress = false;
			val2.rechargeStock = 0;
			val2.requiredStock = 0;
			val2.stockToConsume = 0;
			val2.icon = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Junk/Bandit/texBanditSkill1Icon.png").WaitForCompletion();
			val2.skillDescriptionToken = "COMMANDO_PRIMARY_SIMPLEBULLET_DESCRIPTION";
			val2.skillName = "COMMANDO_PRIMARY_SIMPLEBULLET_NAME";
			val2.skillNameToken = "COMMANDO_PRIMARY_SIMPLEBULLET_NAME";
			ContentAddition.AddSkillDef(val2);
			SkillLocator component = val.GetComponent<SkillLocator>();
			SkillFamily skillFamily = component.primary.skillFamily;
			Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
			Variant[] variants = skillFamily.variants;
			int num = skillFamily.variants.Length - 1;
			Variant val3 = new Variant
			{
				skillDef = val2,
				unlockableName = ""
			};
			((Variant)(ref val3)).viewableNode = new Node(val2.skillNameToken, false, (Node)null);
			variants[num] = val3;
		}
	}
}
namespace CustomSkillsTutorial.MyEntityStates
{
	public class SimpleBulletAttack : BaseSkillState
	{
		public float baseDuration = 1f;

		private float duration;

		public float revolverDuration;

		public GameObject crosshairOverridePrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2CrosshairPrepRevolverFire.prefab").WaitForCompletion();

		private Animator animator;

		private int bodySideWeaponLayerIndex;

		private OverrideRequest crosshairOverrideRequest;

		public GameObject hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/HitsparkBandit2Pistol.prefab").WaitForCompletion();

		public GameObject tracerEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/TracerBanditPistol.prefab").WaitForCompletion();

		public GameObject baseSidearmState = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/EntityStates.Bandit2.Weapon.BaseSidearmState.asset").WaitForCompletion();

		public override void OnEnter()
		{
			//IL_004f: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: 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_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: 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_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: 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_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			((EntityState)this).skillLocator.primary.finalRechargeInterval = ((EntityState)this).skillLocator.primary.baseRechargeInterval / ((BaseState)this).attackSpeedStat;
			animator = ((EntityState)this).GetModelAnimator();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			Ray aimRay = ((BaseState)this).GetAimRay();
			((BaseState)this).StartAimMode(aimRay, 2f, false);
			bodySideWeaponLayerIndex = animator.GetLayerIndex("Body, SideWeapon");
			animator.SetLayerWeight(bodySideWeaponLayerIndex, 1f);
			((EntityState)this).PlayAnimation("Gesture, Additive", "FireSideWeapon", "FireSideWeapon.playbackRate", duration);
			((EntityState)this).PlayAnimation("Gesture, Additive", "FireSideWeapon", "FireSideWeapon.playbackRate", duration);
			Util.PlaySound(FireBarrage.fireBarrageSoundString, ((EntityState)this).gameObject);
			((BaseState)this).AddRecoil(-2f, -8f, -2f, -3f);
			if (Object.op_Implicit((Object)(object)FireBarrage.effectPrefab))
			{
				EffectManager.SimpleMuzzleFlash(FireBarrage.effectPrefab, ((EntityState)this).gameObject, "MuzzleRight", false);
			}
			if (((EntityState)this).isAuthority)
			{
				new BulletAttack
				{
					owner = ((EntityState)this).gameObject,
					weapon = ((EntityState)this).gameObject,
					origin = ((Ray)(ref aimRay)).origin,
					aimVector = ((Ray)(ref aimRay)).direction,
					minSpread = 0f,
					maxSpread = ((EntityState)this).characterBody.spreadBloomAngle,
					bulletCount = 1u,
					procCoefficient = 1.2f,
					damage = ((EntityState)this).characterBody.damage * 5f,
					force = 4f,
					falloffModel = (FalloffModel)1,
					tracerEffectPrefab = tracerEffectPrefab,
					muzzleName = "MuzzlePistol",
					hitEffectPrefab = hitEffectPrefab,
					isCrit = ((BaseState)this).RollCrit(),
					HitEffectNormal = false,
					stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask,
					smartCollision = true,
					maxDistance = 9000f
				}.Fire();
			}
		}

		public override async void OnExit()
		{
			<>n__0();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((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)1;
		}

		[CompilerGenerated]
		[DebuggerHidden]
		private void <>n__0()
		{
			((EntityState)this).OnExit();
		}
	}
}