Decompiled source of SkillsReturns v0.2.0

SkillsReturns.dll

Decompiled 33 minutes ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
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 IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.Projectile;
using RoR2.Skills;
using ShaderSwapper;
using SkillsReturns.SharedHooks;
using SkillsReturns.SkillSetup;
using SkillsReturns.SkillSetup.Commando;
using SkillsReturns.SkillStates.Bandit2.FlashBang;
using SkillsReturns.SkillStates.Commando;
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("SkillsReturns")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+42857d432cc72383ae10b611c2f59cd55ab4a78d")]
[assembly: AssemblyProduct("SkillsReturns")]
[assembly: AssemblyTitle("SkillsReturns")]
[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 SkillsReturns
{
	internal static class Assets
	{
		public static AssetBundle mainAssetBundle;

		internal static void Init()
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SkillsReturns.skillsreturnsbundle");
			mainAssetBundle = AssetBundle.LoadFromStream(stream);
			ShaderSwapper.UpgradeStubbedShaders(mainAssetBundle);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Forced_Reassembly.SkillsReturns", "Skills Returns", "1.1.0")]
	public class SkillsReturnsPlugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__ModfyFinalDamageHook;
		}

		public static ConfigFile configFile;

		private void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			configFile = ((BaseUnityPlugin)this).Config;
			Assets.Init();
			object obj = <>O.<0>__ModfyFinalDamageHook;
			if (obj == null)
			{
				Manipulator val = ModifyFinalDamage.ModfyFinalDamageHook;
				<>O.<0>__ModfyFinalDamageHook = val;
				obj = (object)val;
			}
			HealthComponent.TakeDamageProcess += (Manipulator)obj;
			AddToAssembly();
		}

		private void AddToAssembly()
		{
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(SkillBase))
				select type;
			foreach (Type item in enumerable)
			{
				SkillBase skillBase = (SkillBase)Activator.CreateInstance(item);
			}
		}
	}
	internal class Utilities
	{
		public static BuffDef CreateBuffDef(string name, bool canStack, bool isCooldown, bool isDebuff, Color color, Sprite iconSprite)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			((Object)val).name = name;
			val.canStack = canStack;
			val.isCooldown = isCooldown;
			val.isDebuff = isDebuff;
			val.buffColor = color;
			val.iconSprite = iconSprite;
			ContentAddition.AddBuffDef(val);
			((Object)val).name = ((Object)val).name;
			return val;
		}
	}
}
namespace SkillsReturns.SkillStates.Commando
{
	public class SlashKnife : BaseSkillState
	{
		public static GameObject biteEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/LemurianBiteTrail.prefab").WaitForCompletion();

		public static float baseDuration = 0.5f;

		private float duration;

		public override void OnEnter()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: 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_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: 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_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: 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_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: 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_0172: Expected O, but got Unknown
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: 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_01a0: 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)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			Ray aimRay = ((BaseState)this).GetAimRay();
			((BaseState)this).StartAimMode(aimRay, 2f, false);
			((EntityState)this).PlayAnimation("Gesture, Additive", "ThrowGrenade", "FireFMJ.playbackRate", duration * 2f, 0f);
			((EntityState)this).PlayAnimation("Gesture, Override", "ThrowGrenade", "FireFMJ.playbackRate", duration * 2f, 0f);
			Util.PlaySound("Play_bandit2_m2_impact", ((EntityState)this).gameObject);
			((BaseState)this).AddRecoil(-0.6f, 0.6f, -0.6f, 0.6f);
			if (Object.op_Implicit((Object)(object)biteEffectPrefab))
			{
				EffectManager.SimpleMuzzleFlash(biteEffectPrefab, ((EntityState)this).gameObject, "MuzzleRight", false);
			}
			if (((EntityState)this).isAuthority)
			{
				BlastAttack val = new BlastAttack
				{
					attacker = ((EntityState)this).gameObject,
					inflictor = ((EntityState)this).gameObject,
					procCoefficient = 1f,
					baseDamage = ((BaseState)this).damageStat * 3.6f,
					position = ((EntityState)this).characterBody.corePosition,
					teamIndex = ((BaseState)this).GetTeam(),
					radius = 10f,
					falloffModel = (FalloffModel)0,
					baseForce = 0f,
					bonusForce = Vector3.zero,
					damageType = DamageTypeCombo.op_Implicit((DamageType)32),
					attackerFiltering = (AttackerFiltering)2
				};
				DamageAPI.AddModdedDamageType(val, CommandoKnife.knifeDamageType);
				Result val2 = val.Fire();
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded && val2.hitCount > 0)
				{
					((EntityState)this).characterMotor.velocity = new Vector3(((EntityState)this).characterMotor.velocity.x, Mathf.Max(((EntityState)this).characterMotor.velocity.y, 6f), ((EntityState)this).characterMotor.velocity.z);
				}
			}
		}

		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)2;
		}
	}
}
namespace SkillsReturns.SkillStates.Bandit2.FlashBang
{
	public class ThrowFlashbang : AimThrowableBase
	{
		public static GameObject smokeProjectilePrefab;

		public static GameObject aimEndpointVisualizerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Huntress/HuntressArrowRainIndicator.prefab").WaitForCompletion();

		public static GameObject aimArcVisualizerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/BasicThrowableVisualizer.prefab").WaitForCompletion();

		public override void OnEnter()
		{
			base.maxDistance = 48f;
			base.rayRadius = 2f;
			base.arcVisualizerPrefab = aimArcVisualizerPrefab;
			base.projectilePrefab = smokeProjectilePrefab;
			base.endpointVisualizerPrefab = aimEndpointVisualizerPrefab;
			base.endpointVisualizerRadiusScale = 4f;
			base.setFuse = false;
			base.damageCoefficient = 0f;
			base.baseMinimumDuration = 0f;
			base.projectileBaseSpeed = 80f;
			((AimThrowableBase)this).OnEnter();
		}

		public override void OnExit()
		{
			//IL_00bd: 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)
			((EntityState)this).PlayAnimation("Gesture, Additive", "SlashBlade", "SlashBlade.playbackRate", 0.5f, 0f);
			((EntityState)this).PlayAnimation("Gesture, Override", "SlashBlade", "SlashBlade.playbackRate", 0.5f, 0f);
			Util.PlaySound("Play_commando_M2_grenade_throw", ((EntityState)this).gameObject);
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded)
			{
				((EntityState)this).characterMotor.velocity = new Vector3(((EntityState)this).characterMotor.velocity.x, Mathf.Max(((EntityState)this).characterMotor.velocity.y, 6f), ((EntityState)this).characterMotor.velocity.z);
			}
			((AimThrowableBase)this).OnExit();
		}

		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;
		}
	}
}
namespace SkillsReturns.SkillSetup
{
	public abstract class SkillBase<T> : SkillBase where T : SkillBase<T>
	{
		public static T Instance { get; private set; }

		public SkillBase()
		{
			if (Instance != null)
			{
				throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting SkillBase was instantiated twice");
			}
			Instance = this as T;
			Instance.Init();
		}
	}
	public abstract class SkillBase
	{
		private bool enabled;

		public SkillDef skillDef;

		public abstract string SkillName { get; }

		public abstract string SkillLangTokenName { get; }

		public abstract string SkillLangTokenDesc { get; }

		public abstract SkillFamily SkillFamily { get; }

		protected void Init()
		{
			CreateConfig();
			if (enabled)
			{
				CreateAssets();
				Hooks();
				RegisterStates();
				CreateSkillDef();
				if (Object.op_Implicit((Object)(object)skillDef))
				{
					ContentAddition.AddSkillDef(skillDef);
				}
				AddSkillToSlot();
			}
		}

		protected virtual void CreateSkillDef()
		{
			skillDef = ScriptableObject.CreateInstance<SkillDef>();
			skillDef.skillName = SkillLangTokenName;
			skillDef.skillNameToken = SkillLangTokenName;
			skillDef.skillDescriptionToken = SkillLangTokenDesc;
			skillDef.keywordTokens = new string[0];
			((Object)skillDef).name = SkillLangTokenName;
		}

		protected virtual void CreateAssets()
		{
		}

		protected virtual void Hooks()
		{
		}

		protected virtual void CreateConfig()
		{
			//IL_0012: 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_002d: Expected O, but got Unknown
			//IL_002d: Expected O, but got Unknown
			enabled = SkillsReturnsPlugin.configFile.Bind<bool>(new ConfigDefinition(SkillName, "Enabled"), true, new ConfigDescription("Enable this skill.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		}

		protected abstract void RegisterStates();

		protected virtual void AddSkillToSlot()
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)skillDef))
			{
				Debug.LogError((object)("SkillsReturns: Could not add " + SkillName + ": SkillDef is null."));
				return;
			}
			if ((Object)(object)SkillFamily == (Object)null)
			{
				Debug.LogError((object)("SkillsReturns: Could not add " + SkillName + ": SkillFamily is null."));
				return;
			}
			SkillFamily skillFamily = SkillFamily;
			Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
			Variant[] variants = skillFamily.variants;
			int num = skillFamily.variants.Length - 1;
			Variant val = new Variant
			{
				skillDef = skillDef,
				unlockableName = ""
			};
			((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null);
			variants[num] = val;
		}
	}
}
namespace SkillsReturns.SkillSetup.Commando
{
	public class CommandoKnife : SkillBase<CommandoKnife>
	{
		public static ModdedDamageType knifeDamageType;

		public static BuffDef knifeDebuff;

		public override string SkillName => "Commando - Combat Knife";

		public override string SkillLangTokenName => "COMMANDO_SECONDARY_SKILLSRETURNS_SLASHKNIFE_NAME";

		public override string SkillLangTokenDesc => "COMMANDO_SECONDARY_SKILLSRETURNS_SLASHKNIFE_DESCRIPTION";

		public override SkillFamily SkillFamily => Addressables.LoadAssetAsync<SkillFamily>((object)"RoR2/Base/Commando/CommandoBodySecondaryFamily.asset").WaitForCompletion();

		protected override void CreateAssets()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)knifeDebuff))
			{
				knifeDamageType = DamageAPI.ReserveDamageType();
				knifeDebuff = Utilities.CreateBuffDef("CommandoKnifeDebuff", canStack: false, isCooldown: false, isDebuff: true, Color32.op_Implicit(new Color32((byte)81, (byte)0, (byte)0, byte.MaxValue)), Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Bandit2/texBuffSuperBleedingIcon.tif").WaitForCompletion());
			}
		}

		protected override void Hooks()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			GlobalEventManager.onServerDamageDealt += ApplyKnifeDebuff;
			HealthComponent.TakeDamage += new hook_TakeDamage(ChangeDamageColor);
			ModifyFinalDamage.ModifyFinalDamageActions = (ModifyFinalDamage.ModifyFinalDamageDelegate)Delegate.Combine(ModifyFinalDamage.ModifyFinalDamageActions, new ModifyFinalDamage.ModifyFinalDamageDelegate(AmplifyDamage));
		}

		private void AmplifyDamage(ModifyFinalDamage.DamageMult damageMult, DamageInfo damageInfo, HealthComponent victim, CharacterBody victimBody)
		{
			if (victimBody.HasBuff(knifeDebuff))
			{
				damageMult.value += 0.5f;
			}
		}

		private void ApplyKnifeDebuff(DamageReport report)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)report.victimBody) && !report.damageInfo.rejected && DamageAPI.HasModdedDamageType(report.damageInfo, knifeDamageType))
			{
				report.victimBody.AddTimedBuff(knifeDebuff, 5f);
			}
		}

		private void ChangeDamageColor(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_003a: 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_002e: Invalid comparison between Unknown and I4
			if (NetworkServer.active && Object.op_Implicit((Object)(object)self.body) && self.body.HasBuff(knifeDebuff) && (int)damageInfo.damageColorIndex == 0)
			{
				damageInfo.damageColorIndex = (DamageColorIndex)8;
			}
			orig.Invoke(self, damageInfo);
		}

		protected override void CreateSkillDef()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			base.CreateSkillDef();
			skillDef.activationState = new SerializableEntityStateType(typeof(SlashKnife));
			skillDef.activationStateMachineName = "Weapon";
			skillDef.baseMaxStock = 1;
			skillDef.baseRechargeInterval = 3f;
			skillDef.beginSkillCooldownOnSkillEnd = false;
			skillDef.canceledFromSprinting = false;
			skillDef.cancelSprintingOnActivation = true;
			skillDef.fullRestockOnAssign = true;
			skillDef.interruptPriority = (InterruptPriority)1;
			skillDef.isCombatSkill = true;
			skillDef.mustKeyPress = false;
			skillDef.rechargeStock = 1;
			skillDef.requiredStock = 1;
			skillDef.stockToConsume = 1;
			skillDef.icon = Assets.mainAssetBundle.LoadAsset<Sprite>("CombatKnifeIcon");
			LanguageAPI.Add("COMMANDO_SECONDARY_SKILLSRETURNS_SLASHKNIFE_NAME", "Combat Knife");
			LanguageAPI.Add("COMMANDO_SECONDARY_SKILLSRETURNS_SLASHKNIFE_DESCRIPTION", "Slash enemies for <style=cIsDamage>360% damage</style>, wounding and <style=cIsDamage>stunning</style> enemies. Wounded enemies take <style=cIsDamage>50% more damage</style>.");
		}

		protected override void RegisterStates()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			ContentAddition.AddEntityState(typeof(SlashKnife), ref flag);
		}
	}
}
namespace SkillsReturns.SkillSetup.Bandit2
{
	public class Smokescreen : SkillBase<Smokescreen>
	{
		public static ModdedDamageType SmokescreenDamageType;

		public static BuffDef BlindingDebuff;

		public override string SkillName => "Bandit - Flashbang";

		public override string SkillLangTokenName => "BANDIT2_UTILITY_SKILLSRETURNS_FLASHBANG_NAME";

		public override string SkillLangTokenDesc => "BANDIT2_UTILITY_SKILLSRETURNS_FLASHBANG_DESCRIPTION";

		public override SkillFamily SkillFamily => Addressables.LoadAssetAsync<SkillFamily>((object)"RoR2/Base/Bandit2/Bandit2BodyUtilityFamily.asset").WaitForCompletion();

		protected override void RegisterStates()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			ContentAddition.AddEntityState(typeof(ThrowFlashbang), ref flag);
		}

		protected override void CreateAssets()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)BlindingDebuff))
			{
				SmokescreenDamageType = DamageAPI.ReserveDamageType();
				BlindingDebuff = Utilities.CreateBuffDef("SmokescreenDebuff", canStack: false, isCooldown: false, isDebuff: true, new Color(41f / 51f, 41f / 85f, 43f / 51f), Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffCloakIcon.tif").WaitForCompletion());
				BuildProjectile();
			}
		}

		protected override void Hooks()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			GlobalEventManager.onServerDamageDealt += ApplySmokescreenDebuff;
			HealthComponent.TakeDamage += new hook_TakeDamage(ChangeDamageColor);
			ModifyFinalDamage.ModifyFinalDamageActions = (ModifyFinalDamage.ModifyFinalDamageDelegate)Delegate.Combine(ModifyFinalDamage.ModifyFinalDamageActions, new ModifyFinalDamage.ModifyFinalDamageDelegate(AmplifyDamage));
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(Bandit2SmokebombDebuffModifier);
		}

		private void AmplifyDamage(ModifyFinalDamage.DamageMult damageMult, DamageInfo damageInfo, HealthComponent victim, CharacterBody victimBody)
		{
			if (victimBody.HasBuff(BlindingDebuff))
			{
				damageMult.value += 0.25f;
			}
		}

		private void ApplySmokescreenDebuff(DamageReport report)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)report.victimBody) && !report.damageInfo.rejected && DamageAPI.HasModdedDamageType(report.damageInfo, SmokescreenDamageType))
			{
				report.victimBody.AddTimedBuff(BlindingDebuff, 3f);
			}
		}

		private void ChangeDamageColor(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_003a: 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_002e: Invalid comparison between Unknown and I4
			if (NetworkServer.active && Object.op_Implicit((Object)(object)self.body) && self.body.HasBuff(BlindingDebuff) && (int)damageInfo.damageColorIndex == 0)
			{
				damageInfo.damageColorIndex = (DamageColorIndex)4;
			}
			orig.Invoke(self, damageInfo);
		}

		private void Bandit2SmokebombDebuffModifier(CharacterBody sender, StatHookEventArgs args)
		{
			if (sender.HasBuff(BlindingDebuff))
			{
				args.moveSpeedReductionMultAdd += 0.8f;
				args.attackSpeedReductionMultAdd += 0.3f;
			}
		}

		private void BuildProjectile()
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_0124: 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_015e: 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_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: 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)
			float duration = 7f;
			float num = 15f;
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/CommandoGrenadeProjectile"), "SkillsReturns_SmokeGrenade", true);
			ProjectileController component = val.GetComponent<ProjectileController>();
			ProjectileDamage component2 = val.GetComponent<ProjectileDamage>();
			ProjectileSimple component3 = val.GetComponent<ProjectileSimple>();
			ProjectileImpactExplosion component4 = val.GetComponent<ProjectileImpactExplosion>();
			GameObject val2 = PrefabAPI.InstantiateClone(Assets.mainAssetBundle.LoadAsset<GameObject>("SmokeGrenade"), "SniperClassic_SmokeGhost", true);
			val2.AddComponent<NetworkIdentity>();
			val2.AddComponent<ProjectileGhostController>();
			component.ghostPrefab = val2;
			component.startSound = "";
			component.procCoefficient = 1f;
			component2.crit = false;
			component2.damage = 0f;
			component2.damageColorIndex = (DamageColorIndex)0;
			component2.damageType = DamageTypeCombo.op_Implicit((DamageType)33);
			component2.force = 0f;
			GameObject val3 = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/SporeGrenadeProjectileDotZone"), "SkillsReturns_SmokeDotZone", true);
			ProjectileController component5 = val3.GetComponent<ProjectileController>();
			ProjectileDamage component6 = val3.GetComponent<ProjectileDamage>();
			Object.Destroy((Object)(object)val3.GetComponent<ProjectileDotZone>());
			component5.procCoefficient = 0f;
			component6.crit = false;
			component6.damage = 0f;
			component6.damageColorIndex = (DamageColorIndex)5;
			component6.damageType = DamageTypeCombo.op_Implicit((DamageType)33);
			component6.force = 0f;
			BuffWard val4 = val3.AddComponent<BuffWard>();
			val4.radius = num;
			val4.interval = 0.25f;
			val4.buffDef = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Common/bdCloak.asset").WaitForCompletion();
			val4.buffDuration = 1f;
			val4.floorWard = false;
			val4.expires = false;
			val4.invertTeamFilter = false;
			val4.expireDuration = 0f;
			val4.animateRadius = false;
			val4.rangeIndicator = null;
			BuffWard val5 = val3.AddComponent<BuffWard>();
			val5.radius = num;
			val5.interval = 0.5f;
			val5.buffDef = BlindingDebuff;
			val5.buffDuration = 1f;
			val5.floorWard = false;
			val5.expires = false;
			val5.invertTeamFilter = true;
			val5.expireDuration = 0f;
			val5.animateRadius = false;
			val5.rangeIndicator = null;
			Object.Destroy((Object)(object)((Component)val3.transform.GetChild(0)).gameObject);
			GameObject val6 = PrefabAPI.InstantiateClone(Assets.mainAssetBundle.LoadAsset<GameObject>("SmokeEffect"), "FX", false);
			val6.AddComponent<DestroyOnTimer>().duration = duration;
			val6.transform.parent = val3.transform;
			val6.transform.localPosition = Vector3.zero;
			val3.AddComponent<DestroyOnTimer>().duration = duration;
			HackyTeamAreaIndicator hackyTeamAreaIndicator = val3.AddComponent<HackyTeamAreaIndicator>();
			hackyTeamAreaIndicator.radius = num;
			component4.offsetForLifetimeExpiredSound = 1f;
			component4.destroyOnEnemy = true;
			component4.destroyOnWorld = true;
			component4.timerAfterImpact = false;
			((ProjectileExplosion)component4).falloffModel = (FalloffModel)0;
			component4.lifetime = 12f;
			component4.lifetimeRandomOffset = 0f;
			((ProjectileExplosion)component4).blastRadius = num;
			((ProjectileExplosion)component4).blastDamageCoefficient = 1f;
			((ProjectileExplosion)component4).blastProcCoefficient = 1f;
			((ProjectileExplosion)component4).fireChildren = true;
			((ProjectileExplosion)component4).childrenCount = 1;
			((ProjectileExplosion)component4).childrenProjectilePrefab = val3;
			((ProjectileExplosion)component4).childrenDamageCoefficient = 0f;
			GameObject val7 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2SmokeBomb.prefab").WaitForCompletion(), "SkillsReturns_SmokescreenImpactEffect", false);
			val7.GetComponent<EffectComponent>().soundName = "Play_bandit2_shift_exit";
			ContentAddition.AddEffect(val7);
			component4.impactEffect = val7;
			ContentAddition.AddProjectile(val);
			ContentAddition.AddProjectile(val3);
			ThrowFlashbang.smokeProjectilePrefab = val;
		}

		protected override void CreateSkillDef()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			base.CreateSkillDef();
			skillDef.activationState = new SerializableEntityStateType(typeof(ThrowFlashbang));
			skillDef.activationStateMachineName = "Weapon";
			skillDef.baseMaxStock = 1;
			skillDef.baseRechargeInterval = 15f;
			skillDef.beginSkillCooldownOnSkillEnd = false;
			skillDef.canceledFromSprinting = false;
			skillDef.cancelSprintingOnActivation = true;
			skillDef.fullRestockOnAssign = true;
			skillDef.interruptPriority = (InterruptPriority)2;
			skillDef.isCombatSkill = false;
			skillDef.mustKeyPress = true;
			skillDef.rechargeStock = 1;
			skillDef.requiredStock = 1;
			skillDef.stockToConsume = 1;
			skillDef.icon = Assets.mainAssetBundle.LoadAsset<Sprite>("FlashbangIcon");
			LanguageAPI.Add("BANDIT2_UTILITY_SKILLSRETURNS_FLASHBANG_NAME", "Flashbang");
			LanguageAPI.Add("BANDIT2_UTILITY_SKILLSRETURNS_FLASHBANG_DESCRIPTION", "Toss a flash grenade, <style=cIsDamage>stunning and blinding</style> enemies. Blinded enemies have <style=cIsDamage>reduced mobility</style> and take <style=cIsDamage>25% more damage</style>.");
		}
	}
	public class HackyTeamAreaIndicator : MonoBehaviour
	{
		public GameObject indicatorPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/TeamAreaIndicator, FullSphere.prefab").WaitForCompletion();

		public float radius = 12f;

		private GameObject indicatorInstance;

		public void Awake()
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			TeamFilter component = ((Component)this).GetComponent<TeamFilter>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			indicatorInstance = Object.Instantiate<GameObject>(indicatorPrefab, ((Component)this).transform);
			if (Object.op_Implicit((Object)(object)indicatorInstance))
			{
				TeamAreaIndicator component2 = indicatorInstance.GetComponent<TeamAreaIndicator>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					component2.teamFilter = component;
					((Component)component2).transform.localScale = radius * Vector3.one;
				}
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)indicatorInstance))
			{
				Object.Destroy((Object)(object)indicatorInstance);
			}
		}
	}
}
namespace SkillsReturns.SharedHooks
{
	internal static class ModifyFinalDamage
	{
		public delegate void ModifyFinalDamageDelegate(DamageMult damageMult, DamageInfo damageInfo, HealthComponent victim, CharacterBody victimBody);

		internal class DamageMult
		{
			public float value = 1f;
		}

		public static ModifyFinalDamageDelegate ModifyFinalDamageActions;

		internal static void ModfyFinalDamageHook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_008f: 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_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)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "damage"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 7)
			}))
			{
				val.Index += 3;
				val.Emit(OpCodes.Ldloc, 7);
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Func<float, HealthComponent, DamageInfo, float>>((Func<float, HealthComponent, DamageInfo, float>)delegate(float origDamage, HealthComponent victimHealth, DamageInfo damageInfo)
				{
					float num = origDamage;
					CharacterBody body = victimHealth.body;
					if (Object.op_Implicit((Object)(object)body))
					{
						DamageMult damageMult = new DamageMult();
						ModifyFinalDamageActions?.Invoke(damageMult, damageInfo, victimHealth, body);
						num *= damageMult.value;
					}
					return num;
				});
				val.Emit(OpCodes.Stloc, 7);
			}
			else
			{
				Debug.LogError((object)"SkillsReturns: ModifyFinalDamage IL Hook failed. This will break a lot of things.");
			}
		}
	}
}