Decompiled source of LeviathanSkills v1.0.2

LevSkills.dll

Decompiled 6 months 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 AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Bandit2;
using EntityStates.Croco;
using EntityStates.Merc;
using JetBrains.Annotations;
using On.EntityStates.Croco;
using On.EntityStates.Merc;
using On.RoR2;
using R2API;
using R2API.Utils;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[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("LevSkills")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LevSkills")]
[assembly: AssemblyTitle("LevSkills")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace LevSkills;

internal class Assets
{
	public static AssetBundle MainAssetBundle;

	public static void PopulateAssets()
	{
		if ((Object)(object)MainAssetBundle == (Object)null)
		{
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LevSkills.levassets"))
			{
				MainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
		}
	}
}
internal class MercMdlBehaviour : MonoBehaviour
{
	private ChildLocator childLocator;

	private CharacterBody body;

	public GameObject sword;

	public GameObject backSword;

	public GameObject kunai;

	public GameObject dagger;

	public GameObject shuriken;

	private void Start()
	{
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0315: Unknown result type (might be due to invalid IL or missing references)
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0335: Unknown result type (might be due to invalid IL or missing references)
		//IL_0367: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: Unknown result type (might be due to invalid IL or missing references)
		//IL_043c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0461: Unknown result type (might be due to invalid IL or missing references)
		//IL_0486: Unknown result type (might be due to invalid IL or missing references)
		body = ((Component)this).GetComponent<CharacterBody>();
		if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.skillLocator) && Object.op_Implicit((Object)(object)body.skillLocator.primary) && Object.op_Implicit((Object)(object)body.skillLocator.secondary) && Object.op_Implicit((Object)(object)body.skillLocator.special) && Object.op_Implicit((Object)(object)body.modelLocator) && Object.op_Implicit((Object)(object)body.modelLocator.modelTransform))
		{
			if (Object.op_Implicit((Object)(object)body.skillLocator.primary.skillDef) && body.skillLocator.primary.skillDef.skillNameToken == "MERC_DRG_ALT_M1")
			{
				childLocator = ((Component)body.modelLocator.modelTransform).GetComponent<ChildLocator>();
				sword = ((Component)body.modelLocator.modelTransform.Find("MercSwordMesh")).gameObject;
				sword.SetActive(false);
				backSword = Object.Instantiate<GameObject>(Prefabs.sword);
				backSword.transform.SetParent(childLocator.FindChild("Chest"));
				backSword.transform.localPosition = new Vector3(0.15f, 0.5f, -0.21f);
				backSword.transform.localRotation = Quaternion.Euler(95f, 250f, 180f);
				kunai = Object.Instantiate<GameObject>(Prefabs.kunai);
				kunai.transform.SetParent(childLocator.FindChild("HandL"));
				kunai.transform.localPosition = new Vector3(0.03f, 0.12f, 0f);
				kunai.transform.localRotation = Quaternion.Euler(5f, 85f, 90f);
				kunai.transform.localScale = new Vector3(0.5f, 0.5f, -0.5f);
			}
			if (Object.op_Implicit((Object)(object)body.skillLocator.secondary.skillDef) && body.skillLocator.secondary.skillDef.skillNameToken == "MERC_DRG_ALT_M2")
			{
				shuriken = Object.Instantiate<GameObject>(Prefabs.shuriken);
				shuriken.transform.SetParent(childLocator.FindChild("Chest"));
				shuriken.transform.localPosition = new Vector3(-0.2f, 0.12f, -0.2f);
				shuriken.transform.localRotation = Quaternion.Euler(95f, 35f, 0f);
				shuriken.transform.localScale = Vector3.one * 0.45f;
				Transform child = shuriken.transform.GetChild(0);
				((Component)child).transform.localPosition = new Vector3(-0.1f, 0f, -0.1f);
				((Component)child).transform.localRotation = Quaternion.Euler(5f, 325f, 355f);
			}
			if (Object.op_Implicit((Object)(object)body.skillLocator.special.skillDef) && body.skillLocator.special.skillDef.skillNameToken == "MERC_DRG_ALT_SPEC")
			{
				dagger = Object.Instantiate<GameObject>(Prefabs.dagger);
				Object.Destroy((Object)(object)dagger.GetComponentInChildren<TrailRenderer>());
				dagger.transform.SetParent(childLocator.FindChild("Pelvis"));
				dagger.transform.localPosition = new Vector3(0.1f, 0.04f, 0.12f);
				dagger.transform.localRotation = Quaternion.Euler(0f, 75f, 65f);
				dagger.transform.localScale = new Vector3(0.45f, 0.45f, -0.45f);
			}
		}
		else
		{
			Object.Destroy((Object)(object)this);
		}
	}

	public void Swap()
	{
		if (Object.op_Implicit((Object)(object)kunai))
		{
			if (kunai.activeInHierarchy)
			{
				kunai.SetActive(false);
			}
			else
			{
				kunai.SetActive(true);
			}
		}
		if (Object.op_Implicit((Object)(object)sword))
		{
			if (sword.activeInHierarchy)
			{
				sword.SetActive(false);
			}
			else
			{
				sword.SetActive(true);
			}
		}
		if (Object.op_Implicit((Object)(object)backSword))
		{
			if (backSword.activeInHierarchy)
			{
				backSword.SetActive(false);
			}
			else
			{
				backSword.SetActive(true);
			}
		}
	}
}
internal class MercSkillAimDef : SkillDef
{
	private class InstanceData : BaseSkillInstanceData
	{
		public MercTracker behaviour;
	}

	public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
	{
		return (BaseSkillInstanceData)(object)new InstanceData
		{
			behaviour = ((Component)skillSlot).GetComponent<MercTracker>()
		};
	}

	internal static bool IsExecutable([NotNull] GenericSkill skillSlot)
	{
		MercTracker behaviour = ((InstanceData)(object)skillSlot.skillInstanceData).behaviour;
		return Object.op_Implicit((Object)(object)((HuntressTracker)behaviour).GetTrackingTarget());
	}

	public override bool CanExecute([NotNull] GenericSkill skillSlot)
	{
		return IsExecutable(skillSlot) && ((SkillDef)this).CanExecute(skillSlot);
	}

	public override bool IsReady([NotNull] GenericSkill skillSlot)
	{
		return ((SkillDef)this).IsReady(skillSlot) && IsExecutable(skillSlot);
	}
}
internal class MercTracker : HuntressTracker
{
	public SkillLocator skillLocator;

	public bool target => Object.op_Implicit((Object)(object)base.trackingTarget) ? true : false;

	private void Awake()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		base.indicator = new Indicator(((Component)this).gameObject, Prefabs.mercIndicator);
	}

	private void OnEnable()
	{
		((HuntressTracker)this).OnEnable();
		base.maxTrackingDistance = 35f;
	}

	private void FixedUpdate()
	{
		((HuntressTracker)this).FixedUpdate();
		if (!Object.op_Implicit((Object)(object)skillLocator))
		{
			skillLocator = ((Component)this).GetComponent<SkillLocator>();
		}
		if (Object.op_Implicit((Object)(object)skillLocator) && Object.op_Implicit((Object)(object)skillLocator.secondary) && Object.op_Implicit((Object)(object)skillLocator.secondary.skillDef))
		{
			base.indicator.active = skillLocator.secondary.skillDef.skillNameToken == "MERC_DRG_ALT_M2";
		}
	}
}
internal class Hook
{
	internal static void Hooks()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Expected O, but got Unknown
		CharacterBody.Start += new hook_Start(CharacterBody_Start);
		WhirlwindBase.OnEnter += new hook_OnEnter(WhirlwindBase_OnEnter);
		WhirlwindBase.OnExit += new hook_OnExit(WhirlwindBase_OnExit);
		Uppercut.OnEnter += new hook_OnEnter(Uppercut_OnEnter);
		Uppercut.OnExit += new hook_OnExit(Uppercut_OnExit);
		Slash.AuthorityModifyOverlapAttack += new hook_AuthorityModifyOverlapAttack(Slash_AuthorityModifyOverlapAttack);
		Language.Init += new hook_Init(Language_Init);
	}

	private static void Language_Init(orig_Init orig)
	{
		orig.Invoke();
		string text = "MERC_DESCRIPTION";
		string @string = Language.GetString(text);
		string text2 = @string + "<style=cSub>\r\n\r\n< ! > If you get enough hardlight afterburners, Mercenary can fight god.";
		LanguageAPI.AddOverlay(text, text2);
	}

	private static void Slash_AuthorityModifyOverlapAttack(orig_AuthorityModifyOverlapAttack orig, Slash self, OverlapAttack overlapAttack)
	{
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && Object.op_Implicit((Object)(object)((EntityState)self).characterBody.skillLocator) && Object.op_Implicit((Object)(object)((EntityState)self).characterBody.skillLocator.primary) && Object.op_Implicit((Object)(object)((EntityState)self).characterBody.skillLocator.primary.skillDef) && ((EntityState)self).characterBody.skillLocator.primary.skillDef.skillNameToken == "CROCO_DRG_ALT_M1_2" && self.isComboFinisher && overlapAttack != null)
		{
			overlapAttack.damageType = (DamageType)4096;
		}
		orig.Invoke(self, overlapAttack);
	}

	private static void Uppercut_OnEnter(orig_OnEnter orig, Uppercut self)
	{
		MercMdlBehaviour component = ((EntityState)self).gameObject.GetComponent<MercMdlBehaviour>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.Swap();
		}
		orig.Invoke(self);
	}

	private static void Uppercut_OnExit(orig_OnExit orig, Uppercut self)
	{
		MercMdlBehaviour component = ((EntityState)self).gameObject.GetComponent<MercMdlBehaviour>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.Swap();
		}
		orig.Invoke(self);
	}

	private static void WhirlwindBase_OnEnter(orig_OnEnter orig, WhirlwindBase self)
	{
		MercMdlBehaviour component = ((EntityState)self).gameObject.GetComponent<MercMdlBehaviour>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.Swap();
		}
		orig.Invoke(self);
	}

	private static void WhirlwindBase_OnExit(orig_OnExit orig, WhirlwindBase self)
	{
		MercMdlBehaviour component = ((EntityState)self).gameObject.GetComponent<MercMdlBehaviour>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.Swap();
		}
		orig.Invoke(self);
	}

	private static void CharacterBody_Start(orig_Start orig, CharacterBody self)
	{
		orig.Invoke(self);
	}
}
[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.Dragonyck.LeviathanSkills", "LeviathanSkills", "1.0.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class MainPlugin : BaseUnityPlugin
{
	public const string MODUID = "com.Dragonyck.LeviathanSkills";

	public const string MODNAME = "LeviathanSkills";

	public const string VERSION = "1.0.0";

	public static SkillDef scepterOverrideDef0;

	public static SkillDef scepterOverrideDef1;

	private ConfigEntry<bool> croco;

	private void Awake()
	{
		//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
		croco = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Enable WIP Acrid Skills", "Enable"), false, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		Assets.PopulateAssets();
		Prefabs.CreatePrefabs();
		AcridSetup();
		MercSetup();
		Hook.Hooks();
		if (ModCompat.AncientScepterEnabled)
		{
			ModCompat.AddScepterSupport();
		}
	}

	private void AcridSetup()
	{
		//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_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Expected O, but got Unknown
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: 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_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_0291: Unknown result type (might be due to invalid IL or missing references)
		//IL_029b: Expected O, but got Unknown
		//IL_029c: Unknown result type (might be due to invalid IL or missing references)
		//IL_029e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Croco/CrocoBody.prefab").WaitForCompletion();
		if (Object.op_Implicit((Object)(object)val) && croco.Value)
		{
			SkillLocator component = val.GetComponent<SkillLocator>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.primary) && Object.op_Implicit((Object)(object)component.secondary))
			{
				LanguageAPI.Add("CROCO_DRG_ALT_M1_2", "Envenomed Claws");
				LanguageAPI.Add("CROCO_DRG_ALT_M1_DESCRIPTION_2", "Perform a slower three hit combo for <style=cIsDamage>800% damage</style> that applies <style=cIsHealing>poison</style> on the last hit.");
				SkillDef val2 = Object.Instantiate<SkillDef>(Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Croco/CrocoSlash.asset").WaitForCompletion());
				val2.icon = Assets.MainAssetBundle.LoadAsset<Sprite>("crocoBite");
				val2.skillDescriptionToken = "CROCO_DRG_ALT_M1_DESCRIPTION_2";
				val2.skillName = "CROCO_DRG_ALT_M1_2";
				val2.skillNameToken = "CROCO_DRG_ALT_M1_2";
				val2.cancelSprintingOnActivation = true;
				ContentAddition.AddSkillDef(val2);
				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
				};
				((Variant)(ref val3)).viewableNode = new Node(val2.skillNameToken, false, (Node)null);
				variants[num] = val3;
				SkillFamily skillFamily2 = component.secondary.skillFamily;
				LanguageAPI.Add("CROCO_DRG_ALT_M1", "Toxic Slam");
				LanguageAPI.Add("CROCO_DRG_ALT_M1_DESCRIPTION", "<style=cIsDamage>Charge</style> up a radial slam for <style=cIsDamage>200-650% damage</style> that <style=cIsHealing>poisons</style> everything it hits, and at full charge leaves a poisonous puddle.");
				val2 = ScriptableObject.CreateInstance<SkillDef>();
				val2.activationStateMachineName = "Weapon";
				val2.activationState = new SerializableEntityStateType(typeof(BaseCrocoCharge));
				val2.baseMaxStock = 0;
				val2.baseRechargeInterval = 0f;
				val2.beginSkillCooldownOnSkillEnd = true;
				val2.canceledFromSprinting = false;
				val2.fullRestockOnAssign = true;
				val2.interruptPriority = (InterruptPriority)0;
				val2.isCombatSkill = true;
				val2.mustKeyPress = false;
				val2.cancelSprintingOnActivation = true;
				val2.rechargeStock = 0;
				val2.requiredStock = 0;
				val2.stockToConsume = 0;
				val2.icon = Assets.MainAssetBundle.LoadAsset<Sprite>("crocoSwipe");
				val2.skillDescriptionToken = "CROCO_DRG_ALT_M1_DESCRIPTION";
				val2.skillName = "CROCO_DRG_ALT_M1";
				val2.skillNameToken = "CROCO_DRG_ALT_M1";
				ContentAddition.AddSkillDef(val2);
				Array.Resize(ref skillFamily2.variants, skillFamily2.variants.Length + 1);
				Variant[] variants2 = skillFamily2.variants;
				int num2 = skillFamily2.variants.Length - 1;
				val3 = new Variant
				{
					skillDef = val2
				};
				((Variant)(ref val3)).viewableNode = new Node(val2.skillNameToken, false, (Node)null);
				variants2[num2] = val3;
				bool flag = false;
				ContentAddition.AddEntityState<BaseCrocoCharge>(ref flag);
				ContentAddition.AddEntityState<SlashCrocoCharge>(ref flag);
				ContentAddition.AddEntityState<EndSlashCrocoCharge>(ref flag);
			}
		}
	}

	private void MercSetup()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: 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_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Expected O, but got Unknown
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: 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_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_0264: Unknown result type (might be due to invalid IL or missing references)
		//IL_0329: Unknown result type (might be due to invalid IL or missing references)
		//IL_0343: Unknown result type (might be due to invalid IL or missing references)
		//IL_034d: Expected O, but got Unknown
		//IL_034e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0350: Unknown result type (might be due to invalid IL or missing references)
		//IL_035a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d7: Expected O, but got Unknown
		//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04da: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0568: Unknown result type (might be due to invalid IL or missing references)
		//IL_056d: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_069c: Unknown result type (might be due to invalid IL or missing references)
		//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c6: Expected O, but got Unknown
		//IL_06c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_06fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0741: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0806: Unknown result type (might be due to invalid IL or missing references)
		//IL_080e: Unknown result type (might be due to invalid IL or missing references)
		OrbAPI.AddOrb<MercOrb>();
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Merc/MercBody.prefab").WaitForCompletion();
		if (!Object.op_Implicit((Object)(object)val))
		{
			return;
		}
		val.AddComponent<MercMdlBehaviour>();
		val.AddComponent<MercTracker>();
		SkillLocator component = val.GetComponent<SkillLocator>();
		if (Object.op_Implicit((Object)(object)component))
		{
			Variant val3;
			if (Object.op_Implicit((Object)(object)component.primary))
			{
				LanguageAPI.Add("MERC_DRG_ALT_M1", "T125 Hardlight Blades");
				LanguageAPI.Add("MERC_DRG_ALT_M1_DESCRIPTION", "Hurl three fighting knives for <style=cIsDamage>100% damage</style> each. On critical strikes, throw double.");
				SkillDef val2 = ScriptableObject.CreateInstance<SkillDef>();
				val2.activationStateMachineName = "Weapon";
				val2.activationState = new SerializableEntityStateType(typeof(KunaiThrow));
				val2.baseMaxStock = 0;
				val2.baseRechargeInterval = 0f;
				val2.beginSkillCooldownOnSkillEnd = true;
				val2.canceledFromSprinting = false;
				val2.fullRestockOnAssign = true;
				val2.interruptPriority = (InterruptPriority)0;
				val2.isCombatSkill = true;
				val2.mustKeyPress = false;
				val2.cancelSprintingOnActivation = false;
				val2.rechargeStock = 0;
				val2.requiredStock = 0;
				val2.stockToConsume = 0;
				val2.icon = Assets.MainAssetBundle.LoadAsset<Sprite>("mercPrimary");
				val2.skillDescriptionToken = "MERC_DRG_ALT_M1_DESCRIPTION";
				val2.skillName = "MERC_DRG_ALT_M1";
				val2.skillNameToken = "MERC_DRG_ALT_M1";
				val2.keywordTokens = new string[1] { "KEYWORD_AGILE" };
				ContentAddition.AddSkillDef(val2);
				SkillFamily skillFamily = component.primary.skillFamily;
				Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
				Variant[] variants = skillFamily.variants;
				int num = skillFamily.variants.Length - 1;
				val3 = new Variant
				{
					skillDef = val2
				};
				((Variant)(ref val3)).viewableNode = new Node(val2.skillNameToken, false, (Node)null);
				variants[num] = val3;
				bool flag = false;
				ContentAddition.AddEntityState<KunaiThrow>(ref flag);
			}
			if (Object.op_Implicit((Object)(object)component.secondary))
			{
				LanguageAPI.Add("MERC_DRG_ALT_M2", "Hunter-Killer Fuma");
				LanguageAPI.Add("MERC_DRG_ALT_M2_DESCRIPTION", "Throw a bouncing bladed shuriken that strikes multiple targets for <style=cIsDamage>280% damage</style>.");
				MercSkillAimDef mercSkillAimDef = ScriptableObject.CreateInstance<MercSkillAimDef>();
				((SkillDef)mercSkillAimDef).activationStateMachineName = "Weapon";
				((SkillDef)mercSkillAimDef).activationState = new SerializableEntityStateType(typeof(SecondaryMerc));
				((SkillDef)mercSkillAimDef).baseMaxStock = 1;
				((SkillDef)mercSkillAimDef).baseRechargeInterval = 5f;
				((SkillDef)mercSkillAimDef).beginSkillCooldownOnSkillEnd = true;
				((SkillDef)mercSkillAimDef).canceledFromSprinting = false;
				((SkillDef)mercSkillAimDef).fullRestockOnAssign = true;
				((SkillDef)mercSkillAimDef).interruptPriority = (InterruptPriority)0;
				((SkillDef)mercSkillAimDef).isCombatSkill = true;
				((SkillDef)mercSkillAimDef).mustKeyPress = false;
				((SkillDef)mercSkillAimDef).cancelSprintingOnActivation = false;
				((SkillDef)mercSkillAimDef).rechargeStock = 1;
				((SkillDef)mercSkillAimDef).requiredStock = 1;
				((SkillDef)mercSkillAimDef).stockToConsume = 1;
				((SkillDef)mercSkillAimDef).icon = Assets.MainAssetBundle.LoadAsset<Sprite>("mercSecondary");
				((SkillDef)mercSkillAimDef).skillDescriptionToken = "MERC_DRG_ALT_M2_DESCRIPTION";
				((SkillDef)mercSkillAimDef).skillName = "MERC_DRG_ALT_M2";
				((SkillDef)mercSkillAimDef).skillNameToken = "MERC_DRG_ALT_M2";
				((SkillDef)mercSkillAimDef).keywordTokens = new string[1] { "KEYWORD_AGILE" };
				ContentAddition.AddSkillDef((SkillDef)(object)mercSkillAimDef);
				SkillFamily skillFamily2 = component.secondary.skillFamily;
				Array.Resize(ref skillFamily2.variants, skillFamily2.variants.Length + 1);
				Variant[] variants2 = skillFamily2.variants;
				int num2 = skillFamily2.variants.Length - 1;
				val3 = new Variant
				{
					skillDef = (SkillDef)(object)mercSkillAimDef
				};
				((Variant)(ref val3)).viewableNode = new Node(((SkillDef)mercSkillAimDef).skillNameToken, false, (Node)null);
				variants2[num2] = val3;
				bool flag2 = false;
				ContentAddition.AddEntityState<SecondaryMerc>(ref flag2);
			}
			if (Object.op_Implicit((Object)(object)component.utility))
			{
				LanguageAPI.Add("MERC_DRG_ALT_UTIL", "Nanoshield Bomb");
				LanguageAPI.Add("MERC_DRG_ALT_UTIL_DESCRIPTION", "Hurl a package of high-durability nanites at the ground, which use their brief battery power to render you and nearby allies <style=cIsUtility>invulnerable</style> for a short period.");
				SkillDef val4 = ScriptableObject.CreateInstance<SkillDef>();
				val4.activationStateMachineName = "Weapon";
				val4.activationState = new SerializableEntityStateType(typeof(UtilityMerc));
				val4.baseMaxStock = 1;
				val4.baseRechargeInterval = 3f;
				val4.beginSkillCooldownOnSkillEnd = true;
				val4.canceledFromSprinting = false;
				val4.fullRestockOnAssign = true;
				val4.interruptPriority = (InterruptPriority)0;
				val4.isCombatSkill = true;
				val4.mustKeyPress = false;
				val4.cancelSprintingOnActivation = false;
				val4.rechargeStock = 1;
				val4.requiredStock = 1;
				val4.stockToConsume = 1;
				val4.icon = Assets.MainAssetBundle.LoadAsset<Sprite>("mercUtil");
				val4.skillDescriptionToken = "MERC_DRG_ALT_UTIL_DESCRIPTION";
				val4.skillName = "MERC_DRG_ALT_UTIL";
				val4.skillNameToken = "MERC_DRG_ALT_UTIL";
				val4.keywordTokens = new string[1] { "KEYWORD_AGILE" };
				ContentAddition.AddSkillDef(val4);
				SkillFamily skillFamily3 = component.utility.skillFamily;
				Array.Resize(ref skillFamily3.variants, skillFamily3.variants.Length + 1);
				Variant[] variants3 = skillFamily3.variants;
				int num3 = skillFamily3.variants.Length - 1;
				val3 = new Variant
				{
					skillDef = val4
				};
				((Variant)(ref val3)).viewableNode = new Node(val4.skillNameToken, false, (Node)null);
				variants3[num3] = val3;
				bool flag3 = false;
				ContentAddition.AddEntityState<UtilityMerc>(ref flag3);
			}
			if (Object.op_Implicit((Object)(object)component.special))
			{
				LanguageAPI.Add("MERC_DRG_ALT_SPEC", "Detonator Spikes");
				LanguageAPI.Add("MERC_DRG_ALT_SPEC_DESCRIPTION", "Hurl a Barrage of impact activated explosive knives for <style=cIsDamage>600% damage</style>.");
				LanguageAPI.Add("MERC_DRG_ALT_SPEC_ITEM", "C40 Detonator Spikes");
				LanguageAPI.Add("MERC_DRG_ALT_SPEC_DESCRIPTION_ITEM", "Hurl a smaller Barrage of impact activated explosive knives for <style=cIsDamage>450% damage</style>. Hold up to three <style=cIsDamage>charges</style>.");
				scepterOverrideDef0 = ScriptableObject.CreateInstance<SkillDef>();
				scepterOverrideDef0.activationStateMachineName = "Body";
				scepterOverrideDef0.activationState = new SerializableEntityStateType(typeof(SpecialMerc));
				scepterOverrideDef0.baseMaxStock = 1;
				scepterOverrideDef0.baseRechargeInterval = 5f;
				scepterOverrideDef0.beginSkillCooldownOnSkillEnd = true;
				scepterOverrideDef0.canceledFromSprinting = false;
				scepterOverrideDef0.fullRestockOnAssign = true;
				scepterOverrideDef0.interruptPriority = (InterruptPriority)0;
				scepterOverrideDef0.isCombatSkill = true;
				scepterOverrideDef0.mustKeyPress = false;
				scepterOverrideDef0.cancelSprintingOnActivation = false;
				scepterOverrideDef0.rechargeStock = 1;
				scepterOverrideDef0.requiredStock = 1;
				scepterOverrideDef0.stockToConsume = 1;
				scepterOverrideDef0.icon = Assets.MainAssetBundle.LoadAsset<Sprite>("mercSpecial");
				scepterOverrideDef0.skillDescriptionToken = "MERC_DRG_ALT_SPEC_DESCRIPTION";
				scepterOverrideDef0.skillName = "MERC_DRG_ALT_SPEC";
				scepterOverrideDef0.skillNameToken = "MERC_DRG_ALT_SPEC";
				scepterOverrideDef0.keywordTokens = new string[1] { "KEYWORD_AGILE" };
				ContentAddition.AddSkillDef(scepterOverrideDef0);
				SkillFamily skillFamily4 = component.special.skillFamily;
				Array.Resize(ref skillFamily4.variants, skillFamily4.variants.Length + 1);
				Variant[] variants4 = skillFamily4.variants;
				int num4 = skillFamily4.variants.Length - 1;
				val3 = new Variant
				{
					skillDef = scepterOverrideDef0
				};
				((Variant)(ref val3)).viewableNode = new Node(scepterOverrideDef0.skillNameToken, false, (Node)null);
				variants4[num4] = val3;
				scepterOverrideDef1 = ScriptableObject.CreateInstance<SkillDef>();
				scepterOverrideDef1.activationStateMachineName = "Body";
				scepterOverrideDef1.activationState = new SerializableEntityStateType(typeof(ItemSpecialMerc));
				scepterOverrideDef1.baseMaxStock = 3;
				scepterOverrideDef1.baseRechargeInterval = 5f;
				scepterOverrideDef1.beginSkillCooldownOnSkillEnd = true;
				scepterOverrideDef1.canceledFromSprinting = false;
				scepterOverrideDef1.fullRestockOnAssign = true;
				scepterOverrideDef1.interruptPriority = (InterruptPriority)0;
				scepterOverrideDef1.isCombatSkill = true;
				scepterOverrideDef1.mustKeyPress = false;
				scepterOverrideDef1.cancelSprintingOnActivation = false;
				scepterOverrideDef1.rechargeStock = 1;
				scepterOverrideDef1.requiredStock = 1;
				scepterOverrideDef1.stockToConsume = 1;
				scepterOverrideDef0.icon = Assets.MainAssetBundle.LoadAsset<Sprite>("mercSpecial");
				scepterOverrideDef1.skillDescriptionToken = "MERC_DRG_ALT_SPEC_DESCRIPTION_ITEM";
				scepterOverrideDef1.skillName = "MERC_DRG_ALT_SPEC_ITEM";
				scepterOverrideDef1.skillNameToken = "MERC_DRG_ALT_SPEC_ITEM";
				scepterOverrideDef1.keywordTokens = new string[1] { "KEYWORD_AGILE" };
				ContentAddition.AddSkillDef(scepterOverrideDef1);
				bool flag4 = false;
				ContentAddition.AddEntityState<SpecialMerc>(ref flag4);
				ContentAddition.AddEntityState<SpecialMercFire>(ref flag4);
				ContentAddition.AddEntityState<ItemSpecialMerc>(ref flag4);
				ContentAddition.AddEntityState<ItemSpecialMercFire>(ref flag4);
			}
		}
	}
}
public static class ModCompat
{
	private static bool? ancientEnabled;

	public static bool AncientScepterEnabled
	{
		get
		{
			if (!ancientEnabled.HasValue)
			{
				ancientEnabled = Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter");
			}
			return ancientEnabled.Value;
		}
	}

	public static void AddScepterSupport()
	{
		ItemBase<AncientScepterItem>.instance.RegisterScepterSkill(MainPlugin.scepterOverrideDef0, "RahkshiBody", (SkillSlot)3, 0);
		ItemBase<AncientScepterItem>.instance.RegisterScepterSkill(MainPlugin.scepterOverrideDef1, "RahkshiBody", (SkillSlot)3, 1);
	}
}
internal class Prefabs
{
	internal static GameObject kunai;

	internal static GameObject dagger;

	internal static GameObject shuriken;

	internal static GameObject sword;

	internal static GameObject daggerProjectile;

	internal static GameObject shurikenOrbEffect;

	internal static GameObject kunaiProjectile;

	internal static GameObject kunaiSlashEffect;

	internal static GameObject shurikenImpactEffect;

	internal static GameObject dashEffect;

	internal static GameObject mercIndicator;

	internal static void CreatePrefabs()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: 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_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Expected O, but got Unknown
		//IL_00d9: 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_0179: 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_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0240: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_0286: Unknown result type (might be due to invalid IL or missing references)
		//IL_036a: Unknown result type (might be due to invalid IL or missing references)
		//IL_036f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0469: Unknown result type (might be due to invalid IL or missing references)
		//IL_046e: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_052d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0532: Unknown result type (might be due to invalid IL or missing references)
		//IL_05df: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0600: Unknown result type (might be due to invalid IL or missing references)
		//IL_0609: Unknown result type (might be due to invalid IL or missing references)
		//IL_060e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0694: Unknown result type (might be due to invalid IL or missing references)
		//IL_0699: Unknown result type (might be due to invalid IL or missing references)
		//IL_070b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0710: Unknown result type (might be due to invalid IL or missing references)
		//IL_0726: Unknown result type (might be due to invalid IL or missing references)
		//IL_0742: Unknown result type (might be due to invalid IL or missing references)
		//IL_077d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0799: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_07de: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Assets.MainAssetBundle.LoadAsset<GameObject>("shuriken");
		Material val2 = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/LunarWisp/matLunarWispBombChargeTrail.mat").WaitForCompletion());
		val2.mainTexture = (Texture)(object)Addressables.LoadAssetAsync<Texture2D>((object)"Calm Water/DistTex.jpg").WaitForCompletion();
		TrailRenderer[] componentsInChildren = val.GetComponentsInChildren<TrailRenderer>();
		foreach (TrailRenderer val3 in componentsInChildren)
		{
			((Renderer)val3).material = val2;
		}
		dashEffect = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/BrotherDashEffect.prefab").WaitForCompletion(), "SpearmanUtilityDashEffect", true);
		dashEffect.AddComponent<NetworkIdentity>();
		foreach (Transform item in dashEffect.transform)
		{
			Transform val4 = item;
			val4.localRotation = new Quaternion(90f, 0f, 0f, 0f);
			val4.localScale = new Vector3(0.4f, 0.4f, 0.4f);
			if (!(((Object)((Component)val4).gameObject).name == "Dash"))
			{
			}
		}
		ContentAddition.AddEffect(dashEffect);
		sword = PrefabAPI.InstantiateClone(Assets.MainAssetBundle.LoadAsset<GameObject>("MercSwordMesh"), "backSword", false);
		((Renderer)sword.GetComponentInChildren<MeshRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Merc/matMercSword.mat").WaitForCompletion();
		kunai = PrefabAPI.InstantiateClone(Assets.MainAssetBundle.LoadAsset<GameObject>("Kunaimdl"), "Kunai", false);
		Assets.MainAssetBundle.LoadAsset<Material>("kunaiMat").shader = Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGStandard.shader").WaitForCompletion();
		dagger = PrefabAPI.InstantiateClone(Assets.MainAssetBundle.LoadAsset<GameObject>("dagger"), "Dagger", false);
		Assets.MainAssetBundle.LoadAsset<Material>("daggerMat").shader = Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGStandard.shader").WaitForCompletion();
		shuriken = PrefabAPI.InstantiateClone(val, "Shuriken", false);
		Assets.MainAssetBundle.LoadAsset<Material>("shurikenMat").shader = Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGStandard.shader").WaitForCompletion();
		GameObject val5 = PrefabAPI.InstantiateClone(Assets.MainAssetBundle.LoadAsset<GameObject>("dagger"), "DaggerGhost", false);
		val5.AddComponent<ProjectileGhostController>();
		((Renderer)val5.GetComponentInChildren<TrailRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/Railgunner/matRailgunBeamFlashCryo.mat").WaitForCompletion();
		RotateAroundAxis val6 = ((Component)val5.transform.GetChild(0)).gameObject.AddComponent<RotateAroundAxis>();
		val6.speed = (Speed)2;
		val6.fastRotationSpeed = 2880f;
		val6.rotateAroundAxis = (RotationAxis)2;
		ObjectScaleCurve val7 = val5.AddComponent<ObjectScaleCurve>();
		val7.useOverallCurveOnly = true;
		val7.overallCurve = AnimationCurve.Linear(0f, 0.5f, 1f, 1.4f);
		val7.timeMax = 0.1f;
		GameObject val8 = PrefabAPI.InstantiateClone(Assets.MainAssetBundle.LoadAsset<GameObject>("Kunaimdl"), "KunaiGhost", false);
		val8.AddComponent<ProjectileGhostController>();
		ObjectScaleCurve val9 = val8.AddComponent<ObjectScaleCurve>();
		val9.useOverallCurveOnly = true;
		val9.overallCurve = AnimationCurve.Linear(0f, 0.5f, 1f, 1.4f);
		val9.timeMax = 0.1f;
		kunaiProjectile = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2ShivProjectile.prefab").WaitForCompletion(), "MercKunaiProjectile", true);
		kunaiProjectile.GetComponent<Rigidbody>().useGravity = false;
		kunaiProjectile.GetComponent<ProjectileDamage>().damageType = (DamageType)0;
		Object.Destroy((Object)(object)((Component)kunaiProjectile.transform.Find("InFlight")).gameObject);
		kunaiProjectile.GetComponent<ProjectileController>().ghostPrefab = val8;
		ContentAddition.AddProjectile(kunaiProjectile);
		kunaiSlashEffect = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Merc/MercSwordFinisherSlash.prefab").WaitForCompletion(), "MercKunaiSlashEffect", false);
		ParticleSystem[] componentsInChildren2 = kunaiSlashEffect.GetComponentsInChildren<ParticleSystem>();
		foreach (ParticleSystem val10 in componentsInChildren2)
		{
			val10.scalingMode = (ParticleSystemScalingMode)0;
		}
		kunaiSlashEffect.GetComponent<ScaleParticleSystemDuration>().initialDuration = 0.6f;
		Utils.RegisterEffect(kunaiSlashEffect, 1f);
		daggerProjectile = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageFireboltBasic.prefab").WaitForCompletion(), "MercDaggerProjectile", true);
		daggerProjectile.GetComponent<ProjectileController>().ghostPrefab = val5;
		ProjectileImpactExplosion component = daggerProjectile.GetComponent<ProjectileImpactExplosion>();
		((ProjectileExplosion)component).blastRadius = 6f;
		((ProjectileExplosion)component).explosionEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarWisp/LunarWispTrackingBombExplosion.prefab").WaitForCompletion();
		component.impactEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarWisp/LunarWispTrackingBombExplosion.prefab").WaitForCompletion();
		ContentAddition.AddProjectile(daggerProjectile);
		shurikenImpactEffect = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/OmniImpactVFXBrotherLunarShardExplosion.prefab").WaitForCompletion(), "MercShurikenImpactEffect", false);
		Utils.RegisterEffect(shurikenImpactEffect, 1f, "Play_bandit2_m2_impact");
		OrbEffect component2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Huntress/HuntressGlaiveOrbEffect.prefab").WaitForCompletion().GetComponent<OrbEffect>();
		shurikenOrbEffect = PrefabAPI.InstantiateClone(val, "MercShurikenOrb", true);
		GameObject gameObject = ((Component)shurikenOrbEffect.transform.GetChild(0)).gameObject;
		RotateAroundAxis val11 = gameObject.AddComponent<RotateAroundAxis>();
		val11.speed = (Speed)2;
		val11.fastRotationSpeed = 720f;
		val11.rotateAroundAxis = (RotationAxis)1;
		ObjectScaleCurve val12 = gameObject.AddComponent<ObjectScaleCurve>();
		val12.useOverallCurveOnly = true;
		val12.overallCurve = AnimationCurve.Linear(0f, 0.25f, 1f, 1.2f);
		val12.timeMax = 0.1f;
		OrbEffect val13 = shurikenOrbEffect.AddComponent<OrbEffect>();
		val13.startVelocity1 = component2.startVelocity1;
		val13.startVelocity2 = component2.startVelocity2;
		val13.endVelocity1 = component2.endVelocity1;
		val13.endVelocity2 = component2.endVelocity2;
		val13.movementCurve = component2.movementCurve;
		val13.faceMovement = true;
		val13.callArrivalIfTargetIsGone = false;
		val13.startEffect = null;
		val13.startEffectScale = 2f;
		val13.startEffectCopiesRotation = false;
		val13.endEffectScale = 1f;
		val13.endEffectCopiesRotation = false;
		val13.endEffect = shurikenImpactEffect;
		shurikenOrbEffect.AddComponent<Rigidbody>();
		Utils.RegisterEffect(shurikenOrbEffect, 99f, "", parentToReferencedTransform: false, positionAtReferencedTransform: false);
		mercIndicator = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/EngiMissileTrackingIndicator.prefab").WaitForCompletion(), "MercIndicator", false);
		Transform[] componentsInChildren3 = mercIndicator.GetComponentsInChildren<Transform>(true);
		foreach (Transform val14 in componentsInChildren3)
		{
			string name = ((Object)val14).name;
			if (name == "Arrow")
			{
				((Component)val14.parent).gameObject.SetActive(true);
				((Component)val14).GetComponent<SpriteRenderer>().sprite = Utils.CreateSprite(Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/MiscIcons/texOptionsArrowLeft.png").WaitForCompletion());
				val14.localPosition = Vector3.zero;
				val14.localRotation = Quaternion.Euler(0f, 0f, 90f);
			}
			if (name == "Base Core")
			{
				Object.Destroy((Object)(object)((Component)val14.parent).GetComponent<RotateAroundAxis>());
				val14.parent.localRotation = Quaternion.identity;
				val14.localRotation = Quaternion.Euler(0f, 0f, 45f);
				SpriteRenderer component3 = ((Component)val14).GetComponent<SpriteRenderer>();
				component3.sprite = Utils.CreateSprite(Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/UI/texUICornerTier2.png").WaitForCompletion());
				component3.color = new Color(0.13725f, 1f, 0.99216f);
			}
		}
	}
}
internal class MercOrb : Orb
{
	public float speed = 66f;

	public float damageValue;

	public GameObject attacker;

	public GameObject inflictor;

	public int bouncesRemaining;

	public List<HealthComponent> bouncedObjects;

	public TeamIndex teamIndex;

	public bool isCrit;

	public ProcChainMask procChainMask;

	public float procCoefficient = 1f;

	public DamageColorIndex damageColorIndex;

	public float range = 35f;

	public float damageCoefficientPerBounce = 1f;

	public int targetsToFindPerBounce = 1;

	public DamageType damageType;

	private bool failedToKill;

	private BullseyeSearch search;

	public override void Begin()
	{
		//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_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		((Orb)this).Begin();
		((Orb)this).duration = 0.25f;
		EffectData val = new EffectData
		{
			origin = base.origin,
			genericFloat = ((Orb)this).duration
		};
		val.SetHurtBoxReference(base.target);
		EffectManager.SpawnEffect(Prefabs.shurikenOrbEffect, val, true);
	}

	public override void OnArrival()
	{
		//IL_0024: 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_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Expected O, but got Unknown
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0243: Unknown result type (might be due to invalid IL or missing references)
		//IL_0248: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_027c: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)base.target))
		{
			return;
		}
		EffectManager.SimpleEffect(Prefabs.shurikenImpactEffect, ((Component)base.target).transform.position, Quaternion.identity, true);
		HealthComponent healthComponent = base.target.healthComponent;
		if (Object.op_Implicit((Object)(object)healthComponent))
		{
			DamageInfo val = new DamageInfo();
			val.damage = damageValue;
			val.attacker = attacker;
			val.inflictor = inflictor;
			val.force = Vector3.zero;
			val.crit = isCrit;
			val.procChainMask = procChainMask;
			val.procCoefficient = procCoefficient;
			val.position = ((Component)base.target).transform.position;
			val.damageColorIndex = damageColorIndex;
			val.damageType = damageType;
			healthComponent.TakeDamage(val);
			GlobalEventManager.instance.OnHitEnemy(val, ((Component)healthComponent).gameObject);
			GlobalEventManager.instance.OnHitAll(val, ((Component)healthComponent).gameObject);
		}
		failedToKill |= !Object.op_Implicit((Object)(object)healthComponent) || healthComponent.alive;
		if (bouncesRemaining <= 0)
		{
			return;
		}
		for (int i = 0; i < targetsToFindPerBounce; i++)
		{
			if (bouncedObjects != null)
			{
				bouncedObjects.Add(base.target.healthComponent);
			}
			HurtBox val2 = PickNextTarget(((Component)base.target).transform.position);
			if (Object.op_Implicit((Object)(object)val2))
			{
				MercOrb mercOrb = new MercOrb();
				mercOrb.search = search;
				((Orb)mercOrb).origin = ((Component)base.target).transform.position;
				((Orb)mercOrb).target = val2;
				mercOrb.attacker = attacker;
				mercOrb.inflictor = inflictor;
				mercOrb.teamIndex = teamIndex;
				mercOrb.damageValue = damageValue * damageCoefficientPerBounce;
				mercOrb.bouncesRemaining = bouncesRemaining - 1;
				mercOrb.isCrit = isCrit;
				mercOrb.bouncedObjects = bouncedObjects;
				mercOrb.procChainMask = procChainMask;
				mercOrb.procCoefficient = procCoefficient;
				mercOrb.damageColorIndex = damageColorIndex;
				mercOrb.damageCoefficientPerBounce = damageCoefficientPerBounce;
				mercOrb.speed = speed;
				mercOrb.range = range;
				mercOrb.damageType = damageType;
				mercOrb.failedToKill = failedToKill;
				OrbManager.instance.AddOrb((Orb)(object)mercOrb);
			}
		}
	}

	public HurtBox PickNextTarget(Vector3 position)
	{
		//IL_0021: 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_002d: 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_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Expected O, but got Unknown
		if (search == null)
		{
			search = new BullseyeSearch();
		}
		search.searchOrigin = position;
		search.searchDirection = Vector3.zero;
		search.teamMaskFilter = TeamMask.allButNeutral;
		((TeamMask)(ref search.teamMaskFilter)).RemoveTeam(teamIndex);
		search.filterByLoS = false;
		search.sortMode = (SortMode)1;
		search.maxDistanceFilter = range;
		search.RefreshCandidates();
		HurtBox val = (from v in search.GetResults()
			where !bouncedObjects.Contains(v.healthComponent)
			select v).FirstOrDefault();
		if (Object.op_Implicit((Object)(object)val))
		{
			bouncedObjects.Add(val.healthComponent);
		}
		return val;
	}
}
internal class BaseCrocoCharge : BaseSkillState
{
	private float duration = 1.5f;

	private SlashCrocoCharge state;

	public override void OnEnter()
	{
		((EntityState)this).characterBody.isSprinting = false;
		((EntityState)this).GetModelAnimator().SetBool("isSprinting", false);
		((EntityState)this).PlayAnimation("Body", "Run");
		((BaseState)this).OnEnter();
		((BaseState)this).StartAimMode(2f, false);
		state = new SlashCrocoCharge();
		((EntityState)this).PlayAnimation("Gesture, Additive", "Slash3", "Slash.playbackRate", 10f);
		((EntityState)this).PlayAnimation("Gesture, Override", "Slash3", "Slash.playbackRate", 10f);
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		((EntityState)this).characterBody.isSprinting = false;
		if (state != null)
		{
			state.charge = Mathf.Clamp(Mathf.Clamp01(((EntityState)this).fixedAge / 1.5f), 0f, 1f);
		}
		if ((((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority) || !((EntityState)this).inputBank.skill2.down)
		{
			((EntityState)this).outer.SetNextState((EntityState)(object)state);
		}
	}

	public override void OnExit()
	{
		((EntityState)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)2;
	}
}
internal class SlashCrocoCharge : Slash
{
	public float charge = 0f;

	private float blastDamageCoefficient;

	public override void OnEnter()
	{
		//IL_002b: 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)
		blastDamageCoefficient = Util.Remap(charge, 0f, 1f, 2f, 6.5f);
		Slash.comboFinisherSwingEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Croco/CrocoComboFinisherSlash.prefab").WaitForCompletion();
		((BasicMeleeAttack)this).baseDuration = 0.25f;
		base.hasGrantedBuff = true;
		base.step = 2;
		((BasicMeleeAttack)this).hitBoxGroupName = "Slash";
		((BasicMeleeAttack)this).mecanimHitboxActiveParameter = "Slash.hitBoxActive";
		((BasicMeleeAttack)this).hitPauseDuration = 0.07f;
		((Slash)this).OnEnter();
		((BaseState)this).StartAimMode(2f, false);
		base.durationBeforeInterruptable = 9f;
		Slash.comboFinisherDamageCoefficient = 0f;
	}

	public override void PlayAnimation()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: 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_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: 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_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Expected O, but got Unknown
		//IL_0062: 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_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: 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_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: 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_0114: 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_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: 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_01a7: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		Vector3 footPosition = ((EntityState)this).characterBody.footPosition;
		((EntityState)this).GetModelAnimator().SetFloat("Slash.playbackRate", 1f);
		EffectManager.SpawnEffect(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Croco/CrocoLeapExplosion.prefab").WaitForCompletion(), new EffectData
		{
			origin = footPosition,
			scale = BaseLeap.blastRadius
		}, false);
		if (((EntityState)this).isAuthority)
		{
			new BlastAttack
			{
				attacker = ((EntityState)this).gameObject,
				teamIndex = ((EntityState)this).teamComponent.teamIndex,
				baseDamage = ((BaseState)this).damageStat * blastDamageCoefficient,
				crit = ((BaseState)this).RollCrit(),
				radius = Util.Remap(charge, 0f, 1f, 4.8f, 7.5f),
				damageType = (DamageType)4096,
				damageColorIndex = (DamageColorIndex)0,
				falloffModel = (FalloffModel)0,
				procChainMask = default(ProcChainMask),
				procCoefficient = 1f,
				position = ((EntityState)this).characterBody.footPosition,
				impactEffect = EffectCatalog.FindEffectIndexFromPrefab(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Croco/CrocoDiseaseImpactEffect.prefab").WaitForCompletion()),
				attackerFiltering = (AttackerFiltering)0
			}.Fire();
			if (Util.Remap(charge, 0f, 1f, 0f, 1f) == 1f)
			{
				FireProjectileInfo val = default(FireProjectileInfo);
				val.projectilePrefab = BaseLeap.projectilePrefab;
				val.crit = ((BasicMeleeAttack)this).isCritAuthority;
				val.force = 0f;
				val.damage = ((BaseState)this).damageStat;
				val.owner = ((EntityState)this).gameObject;
				val.rotation = Quaternion.identity;
				val.position = footPosition;
				FireProjectileInfo val2 = val;
				ProjectileManager.instance.FireProjectile(val2);
			}
		}
	}

	public override void AuthorityOnFinish()
	{
		((EntityState)this).outer.SetNextState((EntityState)(object)new EndSlashCrocoCharge());
	}

	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;
	}
}
internal class EndSlashCrocoCharge : BaseSkillState
{
	private float duration = 0.3f;

	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;
	}
}
internal class KunaiThrow : BaseSkillState
{
	private float duration;

	private float baseDuration = 0.55f;

	private float delay;

	private float baseDelay = 0.1f;

	private float damageCoefficient = 1f;

	private bool crit;

	private bool hasFired;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		duration = baseDuration / ((BaseState)this).attackSpeedStat;
		delay = baseDelay / ((BaseState)this).attackSpeedStat;
		PlayAnimation(duration);
		crit = ((BaseState)this).RollCrit();
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).fixedAge >= delay && !hasFired)
		{
			hasFired = true;
			Util.PlaySound("Play_merc_R_slicingBlades_throw", ((EntityState)this).gameObject);
			FireProjectiles();
		}
		if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	private void PlayAnimation(float duration)
	{
		Animator modelAnimator = ((EntityState)this).GetModelAnimator();
		if (Object.op_Implicit((Object)(object)modelAnimator))
		{
			bool @bool = modelAnimator.GetBool("isMoving");
			bool bool2 = modelAnimator.GetBool("isGrounded");
			if (@bool || !bool2)
			{
				((EntityState)this).PlayAnimation("Gesture, Additive", "GroundLight3", "GroundLight.playbackRate", duration);
				((EntityState)this).PlayAnimation("Gesture, Override", "GroundLight3", "GroundLight.playbackRate", duration);
			}
			else
			{
				((EntityState)this).PlayAnimation("FullBody, Override", "GroundLight3", "GroundLight.playbackRate", duration);
			}
		}
	}

	private void FireProjectiles()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: 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)
		//IL_007e: 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_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: 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)
		//IL_00dc: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: 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_0103: Unknown result type (might be due to invalid IL or missing references)
		EffectData val = new EffectData
		{
			scale = 0.3f,
			rotation = Quaternion.Euler(90f, 115f, 0f),
			origin = ((BaseState)this).FindModelChild("GroundLight3").position
		};
		EffectManager.SpawnEffect(Prefabs.kunaiSlashEffect, val, false);
		if (((EntityState)this).isAuthority)
		{
			int num = 3;
			if (crit)
			{
				num = 6;
			}
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 val2 = Vector3.Cross(Vector3.up, ((Ray)(ref aimRay)).direction);
			Vector3 val3 = Vector3.Cross(((Ray)(ref aimRay)).direction, val2);
			float num2 = 4f;
			float num3 = num2 / (float)(num - 1);
			Vector3 val4 = Quaternion.AngleAxis((0f - num2) * 0.5f, val3) * ((Ray)(ref aimRay)).direction;
			Quaternion val5 = Quaternion.AngleAxis(num3, val3);
			Ray val6 = default(Ray);
			((Ray)(ref val6))..ctor(((Ray)(ref aimRay)).origin, val4);
			for (int i = 0; i < num; i++)
			{
				NewProjectile(((Ray)(ref val6)).direction, aimRay);
				((Ray)(ref val6)).direction = val5 * ((Ray)(ref val6)).direction;
			}
		}
	}

	private void NewProjectile(Vector3 direction, Ray aimRay)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		ProjectileManager.instance.FireProjectile(Prefabs.kunaiProjectile, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(direction), ((EntityState)this).gameObject, ((EntityState)this).characterBody.damage * damageCoefficient, 120f, crit, (DamageColorIndex)0, (GameObject)null, -1f);
	}

	public override void OnExit()
	{
		((EntityState)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)2;
	}
}
internal class SecondaryMerc : BaseSkillState
{
	private float duration;

	private float baseDuration = 0.55f;

	private float delay;

	private float baseDelay = 0.1f;

	private float damageCoefficient = 2.8f;

	private bool crit;

	private bool hasFired;

	private HurtBox target;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		duration = baseDuration / ((BaseState)this).attackSpeedStat;
		delay = baseDelay / ((BaseState)this).attackSpeedStat;
		PlayAnimation(duration);
		crit = ((BaseState)this).RollCrit();
		MercTracker component = ((EntityState)this).GetComponent<MercTracker>();
		if (Object.op_Implicit((Object)(object)component))
		{
			target = ((HuntressTracker)component).GetTrackingTarget();
		}
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).fixedAge >= delay && !hasFired)
		{
			hasFired = true;
			Util.PlaySound("Play_bandit2_m2_alt_throw", ((EntityState)this).gameObject);
			FireProjectiles();
		}
		if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	private void PlayAnimation(float duration)
	{
		Animator modelAnimator = ((EntityState)this).GetModelAnimator();
		if (Object.op_Implicit((Object)(object)modelAnimator))
		{
			bool @bool = modelAnimator.GetBool("isMoving");
			bool bool2 = modelAnimator.GetBool("isGrounded");
			if (@bool || !bool2)
			{
				((EntityState)this).PlayAnimation("Gesture, Additive", "GroundLight3", "GroundLight.playbackRate", duration);
				((EntityState)this).PlayAnimation("Gesture, Override", "GroundLight3", "GroundLight.playbackRate", duration);
			}
			else
			{
				((EntityState)this).PlayAnimation("FullBody, Override", "GroundLight3", "GroundLight.playbackRate", duration);
			}
		}
	}

	private void FireProjectiles()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		//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_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		EffectData val = new EffectData
		{
			scale = 0.3f,
			rotation = Quaternion.Euler(90f, -15f, 0f),
			origin = ((BaseState)this).FindModelChild("GroundLight3").position
		};
		EffectManager.SpawnEffect(Prefabs.kunaiSlashEffect, val, false);
		if (NetworkServer.active)
		{
			MercOrb mercOrb = new MercOrb();
			mercOrb.damageValue = ((EntityState)this).characterBody.damage * damageCoefficient;
			mercOrb.isCrit = Util.CheckRoll(((EntityState)this).characterBody.crit, ((EntityState)this).characterBody.master);
			mercOrb.teamIndex = TeamComponent.GetObjectTeam(((EntityState)this).gameObject);
			mercOrb.attacker = ((EntityState)this).gameObject;
			mercOrb.procCoefficient = 0.5f;
			mercOrb.bouncesRemaining = 3;
			mercOrb.bouncedObjects = new List<HealthComponent>();
			mercOrb.damageCoefficientPerBounce = 1f;
			mercOrb.procChainMask = default(ProcChainMask);
			if (Object.op_Implicit((Object)(object)target))
			{
				((Orb)mercOrb).origin = ((EntityState)this).transform.position;
				((Orb)mercOrb).target = target;
				OrbManager.instance.AddOrb((Orb)(object)mercOrb);
			}
		}
	}

	public override void OnExit()
	{
		((EntityState)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)2;
	}
}
internal class SpecialMerc : BaseSkillState
{
	private float duration = 0.25f;

	private Vector3 direction;

	public override void OnEnter()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//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_0025: 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_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		((BaseState)this).OnEnter();
		EffectData val = new EffectData();
		val.rotation = Util.QuaternionSafeLookRotation(Vector3.up);
		val.origin = ((EntityState)this).characterBody.corePosition;
		val.SetHurtBoxReference(((EntityState)this).characterBody.mainHurtBox);
		EffectManager.SpawnEffect(Prefabs.dashEffect, val, false);
		direction = -((EntityState)this).characterDirection.forward;
		((EntityState)this).PlayAnimation("FullBody, Override", "EvisPrep", "EvisPrep.playbackRate", duration);
		Util.PlaySound("Play_moonBrother_phaseJump_jumpAway", ((EntityState)this).gameObject);
	}

	protected virtual void SetState()
	{
		((EntityState)this).outer.SetNextState((EntityState)(object)new SpecialMercFire());
	}

	public override void FixedUpdate()
	{
		//IL_001e: 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_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: 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_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).FixedUpdate();
		if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
		{
			((EntityState)this).characterMotor.velocity = Vector3.zero;
			((EntityState)this).characterMotor.rootMotion = Vector3.up * (((EntityState)this).characterBody.jumpPower * 5f * Time.fixedDeltaTime) + direction * (((EntityState)this).characterBody.jumpPower * 10f * Time.fixedDeltaTime);
		}
		if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
		{
			SetState();
		}
	}

	public override void OnExit()
	{
		((EntityState)this).OnExit();
		((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
	}
}
internal class SpecialMercFire : BaseSkillState
{
	private float duration;

	private float baseDuration = 0.3f;

	private float delay;

	private float baseDelay = 0.08f;

	public float damageCoefficient = 1f;

	private bool crit;

	private bool hasFired;

	public int maxProjectilesFired = 6;

	public int firedProjectiles = 0;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		duration = baseDuration / ((BaseState)this).attackSpeedStat;
		delay = baseDelay / ((BaseState)this).attackSpeedStat;
		PlayAnimation(duration);
		crit = ((BaseState)this).RollCrit();
		((BaseState)this).SmallHop(((EntityState)this).characterMotor, 4f);
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (firedProjectiles < maxProjectilesFired)
		{
			if (((EntityState)this).fixedAge >= delay && !hasFired)
			{
				hasFired = true;
				Util.PlaySound("Play_bandit2_m2_alt_throw", ((EntityState)this).gameObject);
				FireProjectiles();
			}
		}
		else if (((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
		if (((EntityState)this).fixedAge >= duration)
		{
			SpecialMercFire specialMercFire = new SpecialMercFire();
			specialMercFire.firedProjectiles = firedProjectiles + 1;
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)specialMercFire);
			}
		}
	}

	private void PlayAnimation(float duration)
	{
		Animator modelAnimator = ((EntityState)this).GetModelAnimator();
		if (Object.op_Implicit((Object)(object)modelAnimator))
		{
			bool @bool = modelAnimator.GetBool("isMoving");
			bool bool2 = modelAnimator.GetBool("isGrounded");
			string text = "";
			switch (RoR2Application.rng.RangeInt(1, 4))
			{
			case 1:
				text = "GroundLight1";
				break;
			case 2:
				text = "GroundLight2";
				break;
			case 3:
				text = "GroundLight3";
				break;
			}
			if (@bool || !bool2)
			{
				((EntityState)this).PlayCrossfade("Gesture, Additive", text, "GroundLight.playbackRate", duration, 0.05f);
				((EntityState)this).PlayCrossfade("Gesture, Override", text, "GroundLight.playbackRate", duration, 0.05f);
			}
			else
			{
				((EntityState)this).PlayCrossfade("FullBody, Override", text, "GroundLight.playbackRate", duration, 0.05f);
			}
		}
	}

	private void FireProjectiles()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		//IL_005c: 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_008a: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: 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)
		EffectData val = new EffectData
		{
			scale = 0.3f,
			rotation = Quaternion.Euler(90f, -15f, 0f),
			origin = ((BaseState)this).FindModelChild("GroundLight3").position
		};
		EffectManager.SpawnEffect(GroundLight.comboSwingEffectPrefab, val, false);
		if (((EntityState)this).isAuthority)
		{
			Ray aimRay = ((BaseState)this).GetAimRay();
			float num = 5f;
			float num2 = Random.Range(0f - num, num) / 2f;
			float num3 = Random.Range(0f - num, num) / 2f;
			Vector3 direction = Util.ApplySpread(((Ray)(ref aimRay)).direction, 0f, 0f, 1f, 1f, num3, num2);
			NewProjectile(direction, aimRay);
		}
	}

	private void NewProjectile(Vector3 direction, Ray aimRay)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		ProjectileManager.instance.FireProjectile(Prefabs.daggerProjectile, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(direction), ((EntityState)this).gameObject, ((EntityState)this).characterBody.damage * damageCoefficient, 440f, crit, (DamageColorIndex)0, (GameObject)null, 220f);
	}

	public override void OnExit()
	{
		((EntityState)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)2;
	}
}
internal class ItemSpecialMerc : SpecialMerc
{
	protected override void SetState()
	{
		((EntityState)this).outer.SetNextState((EntityState)(object)new ItemSpecialMercFire());
	}
}
internal class ItemSpecialMercFire : SpecialMercFire
{
	public override void OnEnter()
	{
		maxProjectilesFired = 3;
		damageCoefficient = 1.5f;
		base.OnEnter();
	}
}
internal class UtilityMerc : BaseSkillState
{
	private SphereSearch sphereSearch = new SphereSearch();

	public override void OnEnter()
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: 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_006c: 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_00f2: Invalid comparison between Unknown and I4
		((BaseState)this).OnEnter();
		((BaseState)this).SmallHop(((EntityState)this).characterMotor, 18f);
		EffectManager.SimpleEffect(StealthMode.smokeBombEffectPrefab, ((EntityState)this).characterBody.footPosition, Quaternion.identity, false);
		sphereSearch.origin = ((EntityState)this).characterBody.corePosition;
		sphereSearch.radius = 12f;
		sphereSearch.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask;
		HurtBox[] hurtBoxes = sphereSearch.RefreshCandidates().OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities()
			.GetHurtBoxes();
		foreach (HurtBox val in hurtBoxes)
		{
			if (Object.op_Implicit((Object)(object)val.healthComponent) && Object.op_Implicit((Object)(object)val.healthComponent.body) && Object.op_Implicit((Object)(object)val.healthComponent.body.teamComponent) && NetworkServer.active && (int)val.healthComponent.body.teamComponent.teamIndex == 1 && val.healthComponent.body.isPlayerControlled)
			{
				val.healthComponent.body.AddTimedBuff(Buffs.Cloak, 1f);
				val.healthComponent.body.AddTimedBuff(Buffs.HiddenInvincibility, 1f);
			}
		}
		Util.PlaySound(StealthMode.enterStealthSound, ((EntityState)this).gameObject);
		if (((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	public override void OnExit()
	{
		((EntityState)this).OnExit();
		Util.PlaySound(StealthMode.exitStealthSound, ((EntityState)this).gameObject);
	}
}
internal class Utils
{
	internal static RendererInfo NewRendererInfo(Renderer renderer)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: 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_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		RendererInfo result = default(RendererInfo);
		result.renderer = renderer;
		result.defaultMaterial = renderer.material;
		result.defaultShadowCastingMode = (ShadowCastingMode)1;
		result.ignoreOverlays = false;
		return result;
	}

	internal static NameTransformPair NewTransformPair(string name, Transform transform)
	{
		//IL_0003: 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_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: 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_001f: Unknown result type (might be due to invalid IL or missing references)
		NameTransformPair result = default(NameTransformPair);
		result.name = name;
		result.transform = transform;
		return result;
	}

	internal static Sprite CreateSprite(Texture2D tex)
	{
		//IL_001a: 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)
		return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f), 128f);
	}

	internal static SkinDefInfo CreateNewSkinDefInfo(List<GameObject> childList, GameObject rootObject, string skinName, string objectToEnable, RendererInfo[] rendererInfos)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		SkinDefInfo result = default(SkinDefInfo);
		result.BaseSkins = Array.Empty<SkinDef>();
		result.MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0];
		result.ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0];
		List<GameObjectActivation> list = new List<GameObjectActivation>();
		foreach (GameObject child in childList)
		{
			GameObjectActivation val = default(GameObjectActivation);
			val.gameObject = child;
			val.shouldActivate = ((Object)child).name == objectToEnable;
			GameObjectActivation item = val;
			list.Add(item);
		}
		result.GameObjectActivations = list.ToArray();
		result.Icon = Assets.MainAssetBundle.LoadAsset<Sprite>(objectToEnable);
		result.MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0];
		result.Name = skinName;
		result.NameToken = skinName;
		result.RendererInfos = rendererInfos;
		result.RootObject = rootObject;
		result.UnlockableDef = null;
		return result;
	}

	internal static T CopyComponent<T>(T original, GameObject destination) where T : Component
	{
		Type type = ((object)original).GetType();
		Component val = destination.AddComponent(type);
		FieldInfo[] fields = type.GetFields();
		FieldInfo[] array = fields;
		foreach (FieldInfo fieldInfo in array)
		{
			fieldInfo.SetValue(val, fieldInfo.GetValue(original));
		}
		return (T)(object)((val is T) ? val : null);
	}

	public static Sprite CreateSpriteFromTexture(Texture2D texture)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)texture))
		{
			return Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f));
		}
		return null;
	}

	public static GameObject FindInActiveObjectByName(string name)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Invalid comparison between Unknown and I4
		Transform[] array = Resources.FindObjectsOfTypeAll<Transform>();
		for (int i = 0; i < array.Length; i++)
		{
			if ((int)((Object)array[i]).hideFlags == 0 && ((Object)array[i]).name == name)
			{
				return ((Component)array[i]).gameObject;
			}
		}
		return null;
	}

	public static GameObject CreateHitbox(string name, Transform parent, Vector3 scale)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		//IL_001b: 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_003d: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject(name);
		val.transform.SetParent(parent);
		val.transform.localPosition = Vector3.zero;
		val.transform.localRotation = Quaternion.identity;
		val.transform.localScale = scale;
		HitBoxGroup val2 = ((Component)parent).gameObject.AddComponent<HitBoxGroup>();
		HitBox val3 = val.AddComponent<HitBox>();
		val.layer = LayerIndex.projectile.intVal;
		val2.hitBoxes = (HitBox[])(object)new HitBox[1] { val3 };
		val2.groupName = name;
		return val;
	}

	internal static void RegisterEffect(GameObject effect, float duration, string soundName = "", bool parentToReferencedTransform = true, bool positionAtReferencedTransform = true)
	{
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		EffectComponent val = effect.GetComponent<EffectComponent>();
		if (!Object.op_Implicit((Object)(object)val))
		{
			val = effect.AddComponent<EffectComponent>();
		}
		if (!Object.op_Implicit((Object)(object)effect.GetComponent<DestroyOnTimer>()))
		{
			effect.AddComponent<DestroyOnTimer>().duration = duration;
		}
		if (!Object.op_Implicit((Object)(object)effect.GetComponent<NetworkIdentity>()))
		{
			effect.AddComponent<NetworkIdentity>();
		}
		if (!Object.op_Implicit((Object)(object)effect.GetComponent<VFXAttributes>()))
		{
			effect.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
		}
		val.applyScale = true;
		val.effectIndex = (EffectIndex)(-1);
		val.parentToReferencedTransform = parentToReferencedTransform;
		val.positionAtReferencedTransform = positionAtReferencedTransform;
		val.soundName = soundName;
		ContentAddition.AddEffect(effect);
	}

	public static Material InstantiateMaterial(Texture tex)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		Material val = Object.Instantiate<Material>(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<CharacterModel>().baseRendererInfos[0].defaultMaterial);
		if (Object.op_Implicit((Object)(object)val))
		{
			val.SetColor("_Color", Color.white);
			val.SetTexture("_MainTex", tex);
			val.SetColor("_EmColor", Color.black);
			val.SetFloat("_EmPower", 0f);
			val.SetTexture("_EmTex", (Texture)null);
			val.SetFloat("_NormalStrength", 1f);
			val.SetTexture("_NormalTex", (Texture)null);
			return val;
		}
		return val;
	}

	public static Material InstantiateMaterial(Color color, Texture tex, Color emColor, float emPower, Texture emTex, float normStr, Texture normTex)
	{
		//IL_0037: 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)
		Material val = Object.Instantiate<Material>(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<CharacterModel>().baseRendererInfos[0].defaultMaterial);
		if (Object.op_Implicit((Object)(object)val))
		{
			val.SetColor("_Color", color);
			val.SetTexture("_MainTex", tex);
			val.SetColor("_EmColor", emColor);
			val.SetFloat("_EmPower", emPower);
			val.SetTexture("_EmTex", emTex);
			val.SetFloat("_NormalStrength", 1f);
			val.SetTexture("_NormalTex", normTex);
			return val;
		}
		return val;
	}

	public static Material FindMaterial(string name)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Invalid comparison between Unknown and I4
		Material[] array = Resources.FindObjectsOfTypeAll<Material>();
		for (int i = 0; i < array.Length; i++)
		{
			if ((int)((Object)array[i]).hideFlags == 0 && ((Object)array[i]).name == name)
			{
				return array[i];
			}
		}
		return null;
	}
}