Decompiled source of One in the Chamber aka Classicish Bandit Blast v1.0.0

ScrimBanditBlast.dll

Decompiled 4 hours ago
using System;
using System.Collections.Generic;
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.Bandit2.Weapon;
using Microsoft.CodeAnalysis;
using R2API;
using RoR2;
using RoR2.Skills;
using ScrimBanditBlast.CustomSkillsTutorial.MyEntityStates;
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("ScrimBanditBlast")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ScrimBanditBlast")]
[assembly: AssemblyTitle("ScrimBanditBlast")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 ScrimBanditBlast.CustomSkillsTutorial
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Scrimbles.ScrimBanditBlast", "ScrimBanditBlast", "1.0.0")]
	public class ClassicBanditBlast : 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_00a3: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: 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_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: 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("BANDIT2_PASSIVE_SCRIM_QUICKLOADER_NAME", "One in the Chamber");
			LanguageAPI.Add("BANDIT2_PASSIVE_SCRIM_QUICKLOADER_DESCRIPTION", "Fire a forceful plasma slug for <style=cIsDamage>180% damage</style>. Holds 1 bullet, but <style=cIsUtility>reloads extremely quickly</style>.");
			ReloadSkillDef val2 = ScriptableObject.CreateInstance<ReloadSkillDef>();
			SerializableEntityStateType activationState = default(SerializableEntityStateType);
			((SerializableEntityStateType)(ref activationState))..ctor(typeof(SimpleBulletAttack));
			((SkillDef)val2).activationState = activationState;
			val2.reloadState = new SerializableEntityStateType(typeof(ScrimQuickReload));
			((SkillDef)val2).activationStateMachineName = "Weapon";
			((SkillDef)val2).baseMaxStock = 1;
			val2.graceDuration = 0.2f;
			((SkillDef)val2).beginSkillCooldownOnSkillEnd = true;
			((SkillDef)val2).fullRestockOnAssign = false;
			((SkillDef)val2).isCombatSkill = true;
			((SkillDef)val2).mustKeyPress = true;
			val2.reloadInterruptPriority = (InterruptPriority)0;
			((SkillDef)val2).canceledFromSprinting = true;
			((SkillDef)val2).cancelSprintingOnActivation = true;
			((SkillDef)val2).forceSprintDuringState = false;
			((SkillDef)val2).baseRechargeInterval = 0f;
			((SkillDef)val2).rechargeStock = 0;
			((SkillDef)val2).requiredStock = 1;
			((SkillDef)val2).stockToConsume = 1;
			((SkillDef)val2).icon = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Junk/Bandit/texBanditSkill1Icon.png").WaitForCompletion();
			((SkillDef)val2).skillDescriptionToken = "BANDIT2_PASSIVE_SCRIM_QUICKLOADER_DESCRIPTION";
			((SkillDef)val2).skillName = "BANDIT2_PASSIVE_SCRIM_QUICKLOADER_NAME";
			((SkillDef)val2).skillNameToken = "BANDIT2_PASSIVE_SCRIM_QUICKLOADER_NAME";
			ContentAddition.AddSkillDef((SkillDef)(object)val2);
			bool flag = default(bool);
			ContentAddition.AddEntityState<SimpleBulletAttack>(ref flag);
			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 = (SkillDef)(object)val2
			};
			((Variant)(ref val3)).viewableNode = new Node(((SkillDef)val2).skillNameToken, false, (Node)null);
			variants[num] = val3;
		}
	}
}
namespace ScrimBanditBlast.CustomSkillsTutorial.MyEntityStates
{
	public class ScrimQuickReload : BaseState
	{
		public static string enterSoundString;

		public static float baseDuration;

		private float duration => baseDuration / 1.2f / base.attackSpeedStat;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			((EntityState)this).PlayCrossfade("Gesture, Additive", "EnterReload", "Reload.playbackRate", duration, 0.1f);
			Util.PlaySound(enterSoundString, ((EntityState)this).gameObject);
		}

		public override void FixedUpdate()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge > duration)
			{
				((EntityState)this).outer.SetNextState((EntityState)new Reload());
			}
		}

		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;
		}
	}
	internal class SimpleBulletAttack : Bandit2FirePrimaryBase
	{
		private static readonly string soundString = "Play_wCowboyShoot1";

		private static readonly string muzzleString = "MuzzleShotgun";

		private static readonly float baseDamageCoef = 1.8f;

		private float damage;

		private static readonly float procCoef = 1f;

		private GameObject tracerEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/TracerBandit2Rifle.prefab").WaitForCompletion();

		private GameObject hitEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/HitsparkBandit.prefab").WaitForCompletion();

		private GameObject muzzleEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/MuzzleflashBandit2.prefab").WaitForCompletion();

		private List<HurtBox> hitHurtBoxes = new List<HurtBox>();

		public override void OnEnter()
		{
			((GenericBulletBaseState)this).baseDuration = 1f;
			base.minimumBaseDuration = 0.1f;
			((BaseState)this).StartAimMode(2f, false);
			((Bandit2FirePrimaryBase)this).OnEnter();
		}

		public override void FireBullet(Ray aimRay)
		{
			//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)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_0078: 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)
			//IL_008f: 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)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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_0129: Expected O, but got Unknown
			for (int i = 0; i < 13; i++)
			{
				Util.PlaySound(soundString, ((EntityState)this).gameObject);
			}
			if (((EntityState)this).isAuthority)
			{
				damage = baseDamageCoef * ((EntityState)this).characterBody.damage;
				BulletAttack val = new BulletAttack
				{
					origin = ((Ray)(ref aimRay)).origin,
					aimVector = ((Ray)(ref aimRay)).direction,
					tracerEffectPrefab = tracerEffect,
					muzzleName = muzzleString,
					hitEffectPrefab = hitEffect,
					isCrit = ((BaseState)this).RollCrit(),
					damage = damage,
					owner = ((EntityState)this).gameObject,
					force = 4f,
					maxDistance = 300f,
					minSpread = 0f,
					maxSpread = ((EntityState)this).characterBody.spreadBloomAngle / 2f,
					smartCollision = true,
					procCoefficient = procCoef,
					falloffModel = (FalloffModel)0,
					weapon = ((EntityState)this).gameObject,
					radius = 0.75f,
					damageType = DamageTypeCombo.GenericPrimary
				};
				val.Fire();
			}
			EffectManager.SimpleMuzzleFlash(muzzleEffect, ((EntityState)this).gameObject, muzzleString, false);
		}
	}
}