Decompiled source of Jakaka Skills v1.0.1

Revolver.dll

Decompiled 19 hours ago
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.Logging;
using CustomRevolver.MyEntityStates;
using EntityStates;
using EntityStates.Commando.CommandoWeapon;
using Microsoft.CodeAnalysis;
using R2API;
using RoR2;
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("Revolver")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Revolver")]
[assembly: AssemblyTitle("Revolver")]
[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 Skill
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.MyName.BanditRevolver", "BanditRevolver", "1.0.0")]
	public class Revolver : BaseUnityPlugin
	{
		public static AssetBundle slayer;

		public const string bundleName = "slayer";

		public void Awake()
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Expected O, but got Unknown
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "slayer");
			if (File.Exists(text))
			{
				slayer = AssetBundle.LoadFromFile(text);
				if ((Object)(object)slayer == (Object)null)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load asset bundle!");
					return;
				}
				GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2Body.prefab").WaitForCompletion();
				LanguageAPI.Add("COMMANDO_PRIMARY_SIMPLEBULLET_NAME", "Slayer");
				LanguageAPI.Add("COMMANDO_PRIMARY_SIMPLEBULLET_DESCRIPTION", "Fire a revolver round for <style=cIsDamage>600% damage</style>.");
				SkillDef val2 = ScriptableObject.CreateInstance<SkillDef>();
				val2.activationState = new SerializableEntityStateType(typeof(RevolverShot));
				val2.activationStateMachineName = "Weapon";
				val2.baseMaxStock = 6;
				val2.rechargeStock = 6;
				val2.baseRechargeInterval = 2.2f;
				val2.beginSkillCooldownOnSkillEnd = true;
				val2.canceledFromSprinting = false;
				val2.cancelSprintingOnActivation = true;
				val2.fullRestockOnAssign = true;
				val2.interruptPriority = (InterruptPriority)0;
				val2.isCombatSkill = true;
				val2.mustKeyPress = true;
				val2.requiredStock = 1;
				val2.stockToConsume = 1;
				val2.icon = slayer.LoadAsset<Sprite>("Slayer.png");
				val2.skillDescriptionToken = "Fire a revolver round for <style=cIsDamage>600% damage</style>.";
				val2.skillName = "Slayer";
				val2.skillNameToken = "Slayer";
				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, true, (Node)null);
				variants[num] = val3;
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Asset bundle not found at path: " + text));
			}
		}
	}
}
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 CustomRevolver.MyEntityStates
{
	public class RevolverShot : BaseSkillState
	{
		public float baseDuration = 1f;

		private float duration;

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

		private Animator animator;

		private int bodySideWeaponLayerIndex;

		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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: 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_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: 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_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			animator = ((EntityState)this).GetModelAnimator();
			bodySideWeaponLayerIndex = animator.GetLayerIndex("Body, SideWeapon");
			animator.SetLayerWeight(bodySideWeaponLayerIndex, 1f);
			((EntityState)this).PlayAnimation("Gesture, Additive", "FireSideWeapon", "FireSideWeapon.playbackRate", duration, 0f);
			Ray aimRay = ((BaseState)this).GetAimRay();
			Util.PlaySound(FireBarrage.fireBarrageSoundString, ((EntityState)this).gameObject);
			((BaseState)this).StartAimMode(aimRay, 2f, false);
			((BaseState)this).AddRecoil(-2f, -6f, -2f, 2f);
			if (Object.op_Implicit((Object)(object)FireBarrage.effectPrefab))
			{
				EffectManager.SimpleMuzzleFlash(FireBarrage.effectPrefab, ((EntityState)this).gameObject, "MuzzleRight", false);
			}
			if (((EntityState)this).isAuthority)
			{
				BulletAttack val = 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 = 1f,
					damage = ((EntityState)this).characterBody.damage * 6f,
					force = 4f,
					falloffModel = (FalloffModel)1,
					tracerEffectPrefab = tracerEffectPrefab,
					muzzleName = "MuzzlePistol",
					hitEffectPrefab = hitEffectPrefab,
					isCrit = ((BaseState)this).RollCrit(),
					HitEffectNormal = false
				};
				LayerIndex world = LayerIndex.world;
				val.stopperMask = ((LayerIndex)(ref world)).mask;
				val.smartCollision = true;
				val.maxDistance = 9000f;
				val.Fire();
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}

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