Decompiled source of AerosSkills v1.0.0

AerosSkills.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Captain.Weapon;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.Merc;
using R2API;
using R2API.Utils;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.Achievements;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("AerosSkills")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AerosSkills")]
[assembly: AssemblyTitle("AerosSkills")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AerosSkills;

public static class Achievements
{
	[RegisterAchievement("AEROS_MASTERY", "ACHIEVEMENT_AEROS_MASTERY_UNLOCKABLE_ID", null, 10u, null)]
	public class MasteryUnlockable : BasePerSurvivorClearGameMonsoonAchievement
	{
		public override BodyIndex LookUpRequiredBodyIndex()
		{
			//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_000e: Unknown result type (might be due to invalid IL or missing references)
			return BodyCatalog.FindBodyIndex("CaptainBody");
		}
	}

	internal static UnlockableDef masteryUnlock;

	public static void RegisterUnlockables()
	{
	}

	private static UnlockableDef NewUnlockable<T>(string AchievementIdentifier, Sprite Icon, string Title, string Description) where T : BaseAchievement
	{
		string text = "ACHIEVEMENT_AEROS_";
		UnlockableDef val = ScriptableObject.CreateInstance<UnlockableDef>();
		string langName = text + AchievementIdentifier + "_NAME";
		string langDesc = text + AchievementIdentifier + "_DESCRIPTION";
		LanguageAPI.Add(langName, Title);
		LanguageAPI.Add(langDesc, Description);
		Func<string> func = () => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[2]
		{
			Language.GetString(langName),
			Language.GetString(langDesc)
		});
		Type typeFromHandle = typeof(T);
		val.cachedName = text + AchievementIdentifier + "_UNLOCKABLE_ID";
		val.getHowToUnlockString = func;
		val.getUnlockedString = func;
		val.achievementIcon = Icon;
		val.sortScore = 200;
		val.hidden = false;
		ContentAddition.AddUnlockableDef(val);
		return val;
	}
}
internal class Assets
{
	public static AssetBundle MainAssetBundle;

	public static T Load<T>(string name) where T : Object
	{
		return MainAssetBundle.LoadAsset<T>(name);
	}

	public static void PopulateAssets()
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		if ((Object)(object)MainAssetBundle == (Object)null)
		{
			using (Stream stream = executingAssembly.GetManifestResourceStream("AerosSkills.AssetBundle." + "AerosSkills".ToLower() + "assets"))
			{
				MainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
		}
	}
}
internal class CrosshairSwap : MonoBehaviour
{
	private CharacterBody body;

	private void Awake()
	{
		body = ((Component)this).GetComponent<CharacterBody>();
	}

	private void Start()
	{
		if (body.skillLocator.primary.skillNameToken == "AEROS_M1")
		{
			body.spreadBloomCurve = Prefabs.spreadBloomCurve;
			body._defaultCrosshairPrefab = Prefabs.Load<GameObject>("RoR2/Base/UI/StandardCrosshair.prefab");
		}
	}
}
internal class RadialBuff : MonoBehaviour
{
	private TeamFilter teamFilter;

	private void OnCollisionEnter(Collision collision)
	{
		//IL_00ce: 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_001f: Expected O, but got Unknown
		//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_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_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_0270: Expected O, but got Unknown
		float value = MainPlugin.radius.Value;
		if (NetworkServer.active)
		{
			SphereSearch val = new SphereSearch();
			val.origin = ((Component)this).transform.position;
			val.radius = value;
			val.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask;
			HurtBox[] hurtBoxes = val.RefreshCandidates().FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(teamFilter.teamIndex)).FilterCandidatesByDistinctHurtBoxEntities()
				.GetHurtBoxes();
			HurtBox[] array = hurtBoxes;
			foreach (HurtBox val2 in array)
			{
				if (Object.op_Implicit((Object)(object)val2.healthComponent))
				{
					SetStateOnHurt component = ((Component)val2.healthComponent).GetComponent<SetStateOnHurt>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.SetPain();
					}
				}
			}
		}
		foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(teamFilter.teamIndex))
		{
			if (!Object.op_Implicit((Object)(object)teamMember.body) || !(Vector3.Distance(((Component)this).transform.position, ((Component)teamMember).transform.position) <= value))
			{
				continue;
			}
			float value2 = MainPlugin.duration.Value;
			if (Object.op_Implicit((Object)(object)teamMember.body.modelLocator) && Object.op_Implicit((Object)(object)teamMember.body.modelLocator.modelTransform))
			{
				CharacterModel component2 = ((Component)teamMember.body.modelLocator.modelTransform).GetComponent<CharacterModel>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					TemporaryOverlayInstance val3 = TemporaryOverlayManager.AddOverlay(((Component)component2).gameObject);
					val3.duration = value2;
					val3.animateShaderAlpha = true;
					val3.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
					val3.alphaCurve.AddKey(0.85f, 1f);
					val3.destroyComponentOnEnd = true;
					val3.originalMaterial = Prefabs.overlay;
					val3.AddToCharacterModel(component2);
				}
			}
			if (NetworkServer.active)
			{
				teamMember.body.AddTimedBuff(Prefabs.overclock, value2);
			}
		}
		EffectManager.SpawnEffect(Prefabs.buffProjectileExplosion, new EffectData
		{
			origin = ((Component)this).transform.position,
			scale = value
		}, false);
	}

	private void Awake()
	{
		teamFilter = ((Component)this).GetComponent<TeamFilter>();
	}
}
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
		RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
	}

	private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
	{
		if (sender.HasBuff(Prefabs.overclock))
		{
			args.baseRegenAdd += MainPlugin.regen.Value;
			args.baseAttackSpeedAdd += MainPlugin.atkspd.Value;
			args.baseMoveSpeedAdd += MainPlugin.movspd.Value;
			args.cooldownMultAdd += 0f - MainPlugin.cooldown.Value;
		}
	}
}
[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.AerosSkills", "AerosSkills", "1.0.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class MainPlugin : BaseUnityPlugin
{
	public const string MODUID = "com.Dragonyck.AerosSkills";

	public const string MODNAME = "AerosSkills";

	public const string VERSION = "1.0.0";

	public const string MODKEY = "AEROS";

	internal static SkillLocator skillLocator;

	internal static ConfigEntry<float> burstDMG;

	internal static ConfigEntry<float> radius;

	internal static ConfigEntry<float> regen;

	internal static ConfigEntry<float> atkspd;

	internal static ConfigEntry<float> movspd;

	internal static ConfigEntry<float> cooldown;

	internal static ConfigEntry<float> duration;

	internal static ConfigEntry<float> CD;

	private void Awake()
	{
		burstDMG = ((BaseUnityPlugin)this).Config.Bind<float>("VulcanRepeater", "Damage Coefficient", 1.65f, (ConfigDescription)null);
		radius = ((BaseUnityPlugin)this).Config.Bind<float>("Overclock", "Explosion Radius", 12f, (ConfigDescription)null);
		regen = ((BaseUnityPlugin)this).Config.Bind<float>("Overclock", "Base Health Regen Add", 5f, (ConfigDescription)null);
		atkspd = ((BaseUnityPlugin)this).Config.Bind<float>("Overclock", "Base Attack Speed Add", 1f, (ConfigDescription)null);
		movspd = ((BaseUnityPlugin)this).Config.Bind<float>("Overclock", "Base Movement Speed Add", 5f, (ConfigDescription)null);
		cooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Overclock", "Cooldown Reduction Mult", 0.75f, (ConfigDescription)null);
		duration = ((BaseUnityPlugin)this).Config.Bind<float>("Overclock", "Buff Duration", 3f, (ConfigDescription)null);
		CD = ((BaseUnityPlugin)this).Config.Bind<float>("Overclock", "Skill Cooldown", 6f, (ConfigDescription)null);
		Assets.PopulateAssets();
		Prefabs.CreatePrefabs();
		SkillSetup();
		RegisterStates();
		Hook.Hooks();
	}

	internal void SkillSetup()
	{
		GameObject val = Prefabs.Load<GameObject>("RoR2/Base/Captain/CaptainBody.prefab");
		skillLocator = val.GetComponent<SkillLocator>();
		val.AddComponent<CrosshairSwap>();
		Prefabs.spreadBloomCurve = Prefabs.Load<GameObject>("RoR2/Base/Commando/CommandoBody.prefab").GetComponent<CharacterBody>().spreadBloomCurve;
		PrimarySetup();
		SecondarySetup();
	}

	private void RegisterStates()
	{
		//IL_0003: 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_0013: 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_0023: 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_0033: Unknown result type (might be due to invalid IL or missing references)
		bool flag = default(bool);
		ContentAddition.AddEntityState<Primary>(ref flag);
		ContentAddition.AddEntityState<Secondary>(ref flag);
		ContentAddition.AddEntityState<Utility>(ref flag);
		ContentAddition.AddEntityState<Special>(ref flag);
		ContentAddition.AddEntityState<CharacterMain>(ref flag);
		ContentAddition.AddEntityState<MeleeSkillState>(ref flag);
		ContentAddition.AddEntityState<BasicMeleeSkillState>(ref flag);
	}

	private void PassiveSetup()
	{
		SkillLocator val = skillLocator;
		LanguageAPI.Add("AEROS_PASSIVE_NAME", "");
		LanguageAPI.Add("AEROS_PASSIVE_DESCRIPTION", "");
		val.passiveSkill.enabled = false;
		val.passiveSkill.skillNameToken = "AEROS_PASSIVE_NAME";
		val.passiveSkill.skillDescriptionToken = "AEROS_PASSIVE_DESCRIPTION";
		val.passiveSkill.icon = Assets.MainAssetBundle.LoadAsset<Sprite>("passive");
	}

	private void PrimarySetup()
	{
		SkillLocator val = skillLocator;
		LanguageAPI.Add("AEROS_M1", "Vulcan Repeater");
		LanguageAPI.Add("AEROS_M1_DESCRIPTION", "Fire a quick burst of <style=cIsDamage>3</style> pellets that deal <style=cIsDamage>3x" + burstDMG.Value * 100f + "% damage</style>.");
		SkillDef skillDef = Utils.NewSkillDef<SkillDef>(typeof(Primary), "Weapon", 0, 0f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: true, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: false, cancelSprintingOnActivation: true, 0, 0, 0, Assets.MainAssetBundle.LoadAsset<Sprite>("primary"), "AEROS_M1_DESCRIPTION", "AEROS_M1", Array.Empty<string>());
		Utils.AddAlt(skillLocator.primary._skillFamily, skillDef);
	}

	private void SecondarySetup()
	{
		SkillLocator val = skillLocator;
		LanguageAPI.Add("AEROS_M2", "Overclock");
		LanguageAPI.Add("AEROS_M2_DESCRIPTION", "Fire a <style=cIsHealth>non damaging</style> projectile that <style=cIsDamage>buffs</style> nearby allies on impact with <style=cIsHealing>+" + regen.Value + " hp/s health regen</style>, <style=cIsDamage>+" + atkspd.Value + " attack speed</style>, <style=cIsUtility>+" + movspd.Value + " movement speed</style> and <style=cIsUtility>" + cooldown.Value * 100f + "% cooldown reduction</style> for <style=cIsUtility>" + duration.Value + "s</style>.");
		SkillDef skillDef = Utils.NewSkillDef<SkillDef>(typeof(Secondary), "Weapon", 1, CD.Value, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)1, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 1, 1, 1, Assets.MainAssetBundle.LoadAsset<Sprite>("secondary"), "AEROS_M2_DESCRIPTION", "AEROS_M2", Array.Empty<string>());
		Utils.AddAlt(skillLocator.secondary.skillFamily, skillDef);
	}

	private void UtilitySetup()
	{
		SkillLocator val = skillLocator;
		LanguageAPI.Add("AEROS_UTIL", "");
		LanguageAPI.Add("AEROS_UTIL_DESCRIPTION", "");
		SkillDef val2 = Utils.NewSkillDef<SkillDef>(typeof(Utility), "Body", 1, 5f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 1, 1, 1, Assets.MainAssetBundle.LoadAsset<Sprite>("utility"), "AEROS_UTIL_DESCRIPTION", "AEROS_UTIL", Array.Empty<string>());
	}

	private void SpecialSetup()
	{
		SkillLocator val = skillLocator;
		LanguageAPI.Add("AEROS_SPEC", "");
		LanguageAPI.Add("AEROS_SPEC_DESCRIPTION", "");
		SkillDef val2 = Utils.NewSkillDef<SkillDef>(typeof(Special), "Slide", 1, 8f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 1, 1, 1, Assets.MainAssetBundle.LoadAsset<Sprite>("special"), "AEROS_SPEC_DESCRIPTION", "AEROS_SPEC", Array.Empty<string>());
	}
}
internal class Prefabs
{
	internal static GameObject buffProjectileGhost;

	internal static GameObject buffProjectile;

	internal static GameObject buffProjectileExplosion;

	internal static GameObject tracer;

	internal static Material overlay;

	internal static BuffDef overclock;

	internal static AnimationCurve spreadBloomCurve;

	internal static T Load<T>(string path)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
	}

	internal static GameObject Instantiate(string path, string name, bool registerNetwork = false)
	{
		return PrefabAPI.InstantiateClone(Load<GameObject>(path), name, registerNetwork);
	}

	internal static GameObject Instantiate(GameObject obj, string name, bool registerNetwork = false)
	{
		return PrefabAPI.InstantiateClone(obj, name, registerNetwork);
	}

	internal static void CreatePrefabs()
	{
		//IL_0020: 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_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: Expected O, but got Unknown
		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0273: Unknown result type (might be due to invalid IL or missing references)
		//IL_027d: Expected O, but got Unknown
		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_037b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0380: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Expected O, but got Unknown
		//IL_0115: 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)
		overclock = Utils.NewBuffDef("Overclock", stack: false, hidden: false, Load<Sprite>("RoR2/Base/Croco/texBuffRegenBoostIcon.tif"), Color32.op_Implicit(new Color32((byte)226, (byte)81, (byte)65, byte.MaxValue)));
		overlay = new Material(Load<Material>("RoR2/Base/Common/matEnergyShield.mat"));
		overlay.SetColor("_TintColor", Color.red);
		overlay.SetFloat("_OffsetAmount", 0.025f);
		buffProjectileExplosion = Instantiate("RoR2/Base/FusionCellDestructible/FusionCellExplosion.prefab", "BuffExplosion");
		buffProjectileExplosion.GetComponent<EffectComponent>().soundName = "Play_roboBall_attack1_explode";
		ParticleSystemRenderer[] componentsInChildren = buffProjectileExplosion.GetComponentsInChildren<ParticleSystemRenderer>();
		foreach (ParticleSystemRenderer val in componentsInChildren)
		{
			string name = ((Object)val).name;
			if (name == "Ring")
			{
				((Renderer)val).material = new Material(Load<Material>("RoR2/Base/RoboBallBoss/matRoboBallParticleRing.mat"));
				((Renderer)val).material.SetTexture("_RemapTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/ColorRamps/texRampHuntressSoftCrit.png"));
				Object.Instantiate<GameObject>(((Component)val).gameObject, ((Component)val).transform.position, ((Component)val).transform.rotation, ((Component)val).transform.parent);
			}
			if (name == "")
			{
			}
			if (name == "")
			{
			}
			if (name == "")
			{
			}
			if (name == "")
			{
			}
		}
		ContentAddition.AddEffect(buffProjectileExplosion);
		buffProjectileGhost = Instantiate("RoR2/Base/Captain/CaptainTazerGhost.prefab", "BuffProjectileGhost");
		Transform child = buffProjectileGhost.transform.GetChild(1);
		((Component)child.GetChild(1)).gameObject.SetActive(false);
		Transform child2 = child.GetChild(0);
		((Component)child2).transform.localPosition = Vector3.zero;
		TrailRenderer component = ((Component)child2).GetComponent<TrailRenderer>();
		component.textureMode = (LineTextureMode)0;
		((Renderer)component).material = new Material(Load<Material>("RoR2/Base/Bandit2/matBandit2SplatterOpaqueTrailAlt.mat"));
		((Renderer)component).material.SetColor("_TintColor", Color32.op_Implicit(new Color32(byte.MaxValue, (byte)44, (byte)44, byte.MaxValue)));
		((Renderer)component).material.SetTexture("_RemapTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/ColorRamps/texRampParentEyes.png"));
		ParticleSystemRenderer componentInChildren = ((Component)child2).GetComponentInChildren<ParticleSystemRenderer>();
		((Renderer)componentInChildren).material = new Material(Load<Material>("RoR2/Base/Common/VFX/matArcaneCircleProvi.mat"));
		((Renderer)componentInChildren).material.SetColor("_TintColor", Color.red);
		((Renderer)componentInChildren).material.SetFloat("_Boost", 6f);
		buffProjectile = Instantiate("RoR2/Base/Captain/CaptainTazer.prefab", "BuffProjectile", registerNetwork: true);
		buffProjectile.GetComponent<Rigidbody>().collisionDetectionMode = (CollisionDetectionMode)2;
		buffProjectile.GetComponent<ProjectileController>().ghostPrefab = buffProjectileGhost;
		buffProjectile.GetComponent<ProjectileDamage>().damageType = DamageTypeCombo.op_Implicit((DamageType)0);
		buffProjectile.GetComponent<ProjectileSimple>().desiredForwardSpeed = 110f;
		Object.Destroy((Object)(object)buffProjectile.GetComponent<ProjectileImpactExplosion>());
		ProjectileSingleTargetImpact val2 = buffProjectile.AddComponent<ProjectileSingleTargetImpact>();
		val2.destroyOnWorld = true;
		val2.destroyWhenNotAlive = true;
		buffProjectile.AddComponent<RadialBuff>();
		ContentAddition.AddProjectile(buffProjectile);
		tracer = Instantiate("RoR2/Base/Bandit2/TracerBanditPistol.prefab", "Tracer");
		tracer.GetComponent<LineRenderer>().endColor = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)31, (byte)0, byte.MaxValue));
		ContentAddition.AddEffect(tracer);
	}
}
internal class BasicMeleeSkillState : BaseSkillState
{
	private float duration = 0.2f;

	private Vector3 dir;

	private OverlapAttack attack;

	private float damageCoefficient = 4.2f;

	private GameObject hitEffectPrefab = null;

	private bool parried;

	public Animator animator;

	private uint ID;

	private string hitboxGroupName = "";

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		animator = ((EntityState)this).GetModelAnimator();
		if (!animator.GetBool("slide"))
		{
			((BaseState)this).StartAimMode(1f, true);
		}
		((EntityState)this).PlayAnimation("LeftArm, Override", "MeleeAttack");
		AkSoundEngine.PostEvent(ID, ((EntityState)this).gameObject);
		attack = ((BaseState)this).InitMeleeOverlap(damageCoefficient, hitEffectPrefab, ((EntityState)this).GetModelTransform(), hitboxGroupName);
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).isAuthority)
		{
			attack.Fire((List<HurtBox>)null);
		}
		if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	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)1;
	}
}
internal class CharacterMain : GenericCharacterMain
{
}
internal class MeleeSkillState : BaseSkillState
{
	public float attackDuration;

	private bool hopped;

	private bool hasSwung;

	public bool isInHitPause;

	public float hitPauseDuration;

	public float hopVelocity;

	public float hitPauseTimer;

	public float stopwatch;

	public HitStopCachedState hitStopCachedState;

	public OverlapAttack overlapAttack;

	public bool hasHit;

	private bool hasAnimParameter;

	private float attackSpeedScaling;

	public Animator animator;

	public virtual float baseAttackDuration => 0f;

	public virtual float earlyExitDurationPercentage => 0f;

	public virtual float damageCoefficient => 0f;

	public virtual float forceMagnitude => 440f;

	public virtual float rootMotionSpeed => 25f;

	public virtual float baseHopVelocity => 4f;

	public virtual string layerName => "Gesture, Override";

	public virtual string animationStateName => "";

	public virtual string animParameter => "M1";

	public virtual string hitBoxGroupName => "";

	public virtual string hitBoxActiveParameter => "Curve";

	public virtual string swingMuzzle => "";

	public virtual GameObject swingEffectPrefab => null;

	public virtual bool hopOnHit => true;

	public virtual bool rootMotion => false;

	public virtual bool rootMotionWhileHitting => false;

	public virtual uint swingSound => 0u;

	public virtual DamageType damageType => (DamageType)0;

	public virtual DamageColorIndex damageColor => (DamageColorIndex)0;

	public virtual Vector3 bonusForce => Vector3.zero;

	public virtual GameObject hitEffectPrefab => null;

	public override void OnEnter()
	{
		//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_00be: Unknown result type (might be due to invalid IL or missing references)
		((BaseState)this).OnEnter();
		attackSpeedScaling = Math.Min(((BaseState)this).attackSpeedStat, 6f);
		attackDuration = baseAttackDuration / attackSpeedScaling;
		hitPauseDuration = GroundLight.hitPauseDuration / attackSpeedScaling;
		hopVelocity = baseHopVelocity / attackSpeedScaling;
		animator = ((EntityState)this).GetModelAnimator();
		animator.SetFloat(hitBoxActiveParameter, 0f);
		overlapAttack = ((BaseState)this).InitMeleeOverlap(damageCoefficient, hitEffectPrefab, ((EntityState)this).GetModelTransform(), hitBoxGroupName);
		overlapAttack.pushAwayForce = 1f;
		overlapAttack.damageType = DamageTypeCombo.op_Implicit(damageType);
		hasAnimParameter = !Utility.IsNullOrWhiteSpace(animParameter);
		if (hasAnimParameter && !Utility.IsNullOrWhiteSpace(animationStateName))
		{
			((EntityState)this).PlayAnimation(layerName, animationStateName, animParameter, attackDuration, 0f);
		}
	}

	public virtual Vector3 rootMotionDirection()
	{
		//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_000f: Unknown result type (might be due to invalid IL or missing references)
		return ((EntityState)this).characterDirection.forward;
	}

	public override void FixedUpdate()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: 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_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).isAuthority)
		{
			bool flag = FireMeleeAttack(overlapAttack, animator, hitBoxActiveParameter, forceMagnitude, bonusForce);
			hasHit = flag;
			if (hasHit)
			{
				if (hopOnHit && !((EntityState)this).characterMotor.isGrounded && !hopped)
				{
					((BaseState)this).SmallHop(((EntityState)this).characterMotor, hopVelocity);
					hopped = true;
				}
				if (!rootMotionWhileHitting && !isInHitPause && hasAnimParameter)
				{
					hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, animParameter);
					isInHitPause = true;
				}
			}
			if (animator.GetFloat(hitBoxActiveParameter) > 0.1f && rootMotion && !isInHitPause)
			{
				Vector3 val = rootMotionDirection();
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(val.x, 0f, val.z);
				CharacterMotor characterMotor = ((EntityState)this).characterMotor;
				characterMotor.rootMotion += val2 * rootMotionSpeed * Time.fixedDeltaTime;
			}
			if (hitPauseTimer >= hitPauseDuration && isInHitPause)
			{
				((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator);
				isInHitPause = false;
				animator.speed = 1f;
			}
			if (!isInHitPause)
			{
				stopwatch += Time.fixedDeltaTime;
			}
			else
			{
				hitPauseTimer += Time.fixedDeltaTime;
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				animator.speed = 0f;
			}
			if (stopwatch >= attackDuration * earlyExitDurationPercentage)
			{
				if (((EntityState)this).inputBank.skill1.down)
				{
					SetState();
				}
				if (stopwatch >= attackDuration)
				{
					BaseSkillState val3 = StateOverride();
					if (val3 != null)
					{
						((EntityState)this).outer.SetNextState((EntityState)(object)val3);
					}
					else
					{
						((EntityState)this).outer.SetNextStateToMain();
					}
					return;
				}
			}
		}
		if (animator.GetFloat(hitBoxActiveParameter) >= 0.11f && !hasSwung)
		{
			hasSwung = true;
			AkSoundEngine.PostEvent(swingSound, ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)swingEffectPrefab) && !Utility.IsNullOrWhiteSpace(swingMuzzle))
			{
				EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, swingMuzzle, false);
			}
		}
	}

	public bool FireMeleeAttack(OverlapAttack attack, Animator animator, string mecanimHitboxActiveParameter, float forceMagnitude, Vector3 bonusForce)
	{
		//IL_0050: 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_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: 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)
		bool result = false;
		if (Object.op_Implicit((Object)(object)animator) && animator.GetFloat(mecanimHitboxActiveParameter) > 0.1f)
		{
			attack.forceVector = (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) ? ((EntityState)this).characterDirection.forward : (((EntityState)this).transform.forward * forceMagnitude + bonusForce));
			result = attack.Fire((List<HurtBox>)null);
		}
		return result;
	}

	public virtual void SetState()
	{
	}

	public virtual BaseSkillState StateOverride()
	{
		return null;
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return (InterruptPriority)1;
	}
}
internal class Primary : BaseSkillState
{
	private float duration;

	private float baseDuration = 0.95f;

	private float delay = 0.095f;

	private float stopwatch;

	private int maxShots = 3;

	private int shotCount;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		((BaseState)this).StartAimMode(2f, false);
		duration = baseDuration / Math.Min(((BaseState)this).attackSpeedStat, 5.85f);
		delay /= Math.Min(((BaseState)this).attackSpeedStat, 5.85f);
	}

	public override void FixedUpdate()
	{
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: 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_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: 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_01eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).FixedUpdate();
		stopwatch += Time.fixedDeltaTime;
		if (stopwatch >= delay && shotCount < maxShots)
		{
			stopwatch = 0f;
			shotCount++;
			((EntityState)this).PlayAnimation("Gesture, Additive", FireCaptainShotgun.FireCaptainShotgunStateHash);
			((EntityState)this).PlayAnimation("Gesture, Override", FireCaptainShotgun.FireCaptainShotgunStateHash);
			AkSoundEngine.PostEvent(FireBarrage.fireBarrageSoundString, ((EntityState)this).gameObject);
			EffectManager.SimpleMuzzleFlash(Prefabs.Load<GameObject>("RoR2/Base/Common/VFX/Muzzleflash1.prefab"), ((EntityState)this).gameObject, ChargeCaptainShotgun.muzzleName, false);
			if (((EntityState)this).isAuthority)
			{
				float num = 0.8f;
				((EntityState)this).characterBody.AddSpreadBloom(num);
				((BaseState)this).AddRecoil(-1f * num, -1.5f * num, -0.25f * num, 0.25f * num);
				Ray aimRay = ((BaseState)this).GetAimRay();
				float num2 = 0.0425f;
				new BulletAttack
				{
					bulletCount = 1u,
					aimVector = ((Ray)(ref aimRay)).direction,
					origin = ((Ray)(ref aimRay)).origin,
					damage = ((BaseState)this).damageStat * MainPlugin.burstDMG.Value,
					damageColorIndex = (DamageColorIndex)0,
					damageType = DamageTypeCombo.op_Implicit((DamageType)0),
					falloffModel = (FalloffModel)0,
					maxDistance = 250f,
					force = 20f,
					hitMask = CommonMasks.bullet,
					minSpread = 0f - num2,
					maxSpread = num2,
					isCrit = ((BaseState)this).RollCrit(),
					owner = ((EntityState)this).gameObject,
					muzzleName = ChargeCaptainShotgun.muzzleName,
					smartCollision = false,
					procChainMask = default(ProcChainMask),
					procCoefficient = 0.6f,
					radius = 0.08f,
					sniper = false,
					stopperMask = CommonMasks.bullet,
					weapon = null,
					tracerEffectPrefab = Prefabs.Load<GameObject>("RoR2/Base/Captain/TracerCaptainShotgun.prefab"),
					spreadPitchScale = 1f,
					spreadYawScale = 1f,
					hitEffectPrefab = Prefabs.Load<GameObject>("RoR2/Base/Captain/HitsparkCaptainShotgun.prefab")
				}.Fire();
			}
		}
		if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

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

	private float baseDuration = 0.35f;

	public override void OnEnter()
	{
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
		((BaseState)this).OnEnter();
		duration = baseDuration / ((BaseState)this).attackSpeedStat;
		((EntityState)this).PlayAnimation("Gesture, Additive", FireTazer.FireTazerStateHash, FireTazer.FireTazerParamHash, duration);
		((EntityState)this).PlayAnimation("Gesture, Override", FireTazer.FireTazerStateHash, FireTazer.FireTazerParamHash, duration);
		EffectManager.SimpleMuzzleFlash(Prefabs.Load<GameObject>("RoR2/Base/Common/VFX/Muzzleflash1.prefab"), ((EntityState)this).gameObject, ChargeCaptainShotgun.muzzleName, false);
		if (((EntityState)this).isAuthority)
		{
			float num = 0.8f;
			((EntityState)this).characterBody.AddSpreadBloom(num);
			((BaseState)this).AddRecoil(-1f * num, -1.5f * num, -0.25f * num, 0.25f * num);
			Ray aimRay = ((BaseState)this).GetAimRay();
			ProjectileManager.instance.FireProjectile(Prefabs.buffProjectile, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, 0f, 1220f, false, (DamageColorIndex)0, (GameObject)null, -1f);
		}
		AkSoundEngine.PostEvent(FireCaptainShotgun.tightSoundString, ((EntityState)this).gameObject);
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	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 Special : BaseSkillState
{
	private float duration;

	private float baseDuration = 0.35f;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		duration = baseDuration / ((BaseState)this).attackSpeedStat;
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

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

	private float baseDuration = 0.35f;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		duration = baseDuration / ((BaseState)this).attackSpeedStat;
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	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)1;
	}
}
internal class Sounds
{
	public static readonly uint Sound1;

	public static readonly uint Sound2;

	public static readonly uint Sound3;

	public static readonly uint Sound4;
}
internal static class Extensions
{
	public static GameObject NewSyringe(this GameObject g, params Material[] m)
	{
		((Renderer)g.GetComponentsInChildren<MeshRenderer>(false)[0]).material = m[0];
		((Renderer)g.GetComponent<TrailRenderer>()).material = m[1];
		((Renderer)g.GetComponent<ParticleSystemRenderer>()).material = m[2];
		return g;
	}

	public static Material SwapTexture(this Material m, Texture2D t)
	{
		m.mainTexture = (Texture)(object)t;
		return m;
	}

	public static GameObject SwapMaterials(this GameObject g, Material[] m)
	{
		Renderer[] componentsInChildren = g.GetComponentsInChildren<Renderer>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			if (Object.op_Implicit((Object)(object)m[i]))
			{
				componentsInChildren[i].material = m[i];
			}
		}
		return g;
	}

	public static float Mult(this float f, float mult = 100f)
	{
		return f * mult;
	}

	public static Color ToRGB255(this Color c, string title, string body)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: 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_002a: 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)
		return new Color(c.r / 255f, c.g / 255f, c.b / 255f);
	}

	public static void SetStrings(this TooltipProvider t, string title, string body)
	{
		t.overrideTitleText = title;
		t.overrideBodyText = body;
	}
}
internal class Utils
{
	public static Vector3 GetForwardDirection(Vector3 dir)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: 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_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = Util.Vector3XZToVector2XY(dir);
		if (val != Vector2.zero)
		{
			((Vector2)(ref val)).Normalize();
			Vector3 val2 = new Vector3(val.x, 0f, val.y);
			return ((Vector3)(ref val2)).normalized;
		}
		return dir;
	}

	public static void PlayAnimation(GameObject g, string layerName, string animationStateName)
	{
		Animator component = g.GetComponent<Animator>();
		if (Object.op_Implicit((Object)(object)component))
		{
			int layerIndex = component.GetLayerIndex(layerName);
			component.speed = 1f;
			component.Update(0f);
			component.PlayInFixedTime(animationStateName, layerIndex, 0f);
		}
	}

	public static void PlayAnimation(GameObject g, string layerName, string animationStateName, string playbackRateParam, float duration)
	{
		//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)
		Animator component = g.GetComponent<Animator>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.speed = 1f;
			component.Update(0f);
			int layerIndex = component.GetLayerIndex(layerName);
			component.SetFloat(playbackRateParam, 1f);
			component.PlayInFixedTime(animationStateName, layerIndex, 0f);
			component.Update(0f);
			AnimatorStateInfo currentAnimatorStateInfo = component.GetCurrentAnimatorStateInfo(layerIndex);
			float length = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).length;
			component.SetFloat(playbackRateParam, length / duration);
		}
	}

	public static void AnimatorPlayAnimation(Animator modelAnimator, string layerName, string animationStateName)
	{
		int layerIndex = modelAnimator.GetLayerIndex(layerName);
		modelAnimator.speed = 1f;
		modelAnimator.Update(0f);
		modelAnimator.PlayInFixedTime(animationStateName, layerIndex, 0f);
	}

	public static void AnimatorPlayAnimation(Animator modelAnimator, string layerName, string animationStateName, string playbackRateParam, float duration)
	{
		//IL_004a: 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)
		modelAnimator.speed = 1f;
		modelAnimator.Update(0f);
		int layerIndex = modelAnimator.GetLayerIndex(layerName);
		modelAnimator.SetFloat(playbackRateParam, 1f);
		modelAnimator.PlayInFixedTime(animationStateName, layerIndex, 0f);
		modelAnimator.Update(0f);
		AnimatorStateInfo currentAnimatorStateInfo = modelAnimator.GetCurrentAnimatorStateInfo(layerIndex);
		float length = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).length;
		modelAnimator.SetFloat(playbackRateParam, length / duration);
	}

	public static SkillDef NewSkillDef<T>(Type activationState, string activationStateMachineName, int baseMaxStock, float baseRechargeInterval, bool beginSkillCooldownOnSkillEnd, bool canceledFromSprinting, bool fullRestockOnAssign, InterruptPriority interruptPriority, bool isCombatSkill, bool mustKeyPress, bool cancelSprintingOnActivation, int rechargeStock, int requiredStock, int stockToConsume, Sprite icon, string skillDescriptionToken, string skillName, params string[] keywordTokens) where T : SkillDef
	{
		//IL_000e: 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)
		//IL_0069: 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)
		T val = ScriptableObject.CreateInstance<T>();
		((SkillDef)val).activationState = new SerializableEntityStateType(activationState);
		((SkillDef)val).activationStateMachineName = activationStateMachineName;
		((SkillDef)val).baseMaxStock = baseMaxStock;
		((SkillDef)val).baseRechargeInterval = baseRechargeInterval;
		((SkillDef)val).beginSkillCooldownOnSkillEnd = beginSkillCooldownOnSkillEnd;
		((SkillDef)val).canceledFromSprinting = canceledFromSprinting;
		((SkillDef)val).fullRestockOnAssign = fullRestockOnAssign;
		((SkillDef)val).interruptPriority = interruptPriority;
		((SkillDef)val).isCombatSkill = isCombatSkill;
		((SkillDef)val).mustKeyPress = mustKeyPress;
		((SkillDef)val).cancelSprintingOnActivation = cancelSprintingOnActivation;
		((SkillDef)val).rechargeStock = rechargeStock;
		((SkillDef)val).requiredStock = requiredStock;
		((SkillDef)val).stockToConsume = stockToConsume;
		((SkillDef)val).icon = icon;
		((SkillDef)val).skillDescriptionToken = skillDescriptionToken;
		((SkillDef)val).skillName = skillName;
		((SkillDef)val).skillNameToken = ((SkillDef)val).skillName;
		((SkillDef)val).keywordTokens = keywordTokens;
		ContentAddition.AddSkillDef((SkillDef)(object)val);
		return (SkillDef)(object)val;
	}

	public static Color HexTo10(string hexColor)
	{
		//IL_0025: 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_0034: 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_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		char[] array = hexColor.ToCharArray();
		return new Color((float)(array[0] + array[1]), (float)(array[2] + array[3]), (float)(array[4] + array[5]), 255f) / 255f;
	}

	public static EntityStateMachine NewStateMachine<T>(GameObject obj, string customName) where T : EntityState
	{
		//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_0028: 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)
		SerializableEntityStateType val = default(SerializableEntityStateType);
		((SerializableEntityStateType)(ref val))..ctor(typeof(T));
		EntityStateMachine val2 = obj.AddComponent<EntityStateMachine>();
		val2.customName = customName;
		val2.initialStateType = val;
		val2.mainStateType = val;
		return val2;
	}

	public static GenericSkill NewGenericSkill(GameObject obj, SkillDef skill)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Expected O, but got Unknown
		//IL_0054: 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)
		GenericSkill val = obj.AddComponent<GenericSkill>();
		SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
		val2.variants = (Variant[])(object)new Variant[1];
		val._skillFamily = val2;
		SkillFamily skillFamily = val.skillFamily;
		Variant[] variants = skillFamily.variants;
		Variant val3 = new Variant
		{
			skillDef = skill
		};
		((Variant)(ref val3)).viewableNode = new Node(skill.skillNameToken, false, (Node)null);
		variants[0] = val3;
		ContentAddition.AddSkillFamily(skillFamily);
		return val;
	}

	public static void AddAlt(SkillFamily skillFamily, SkillDef SkillDef)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected O, but got Unknown
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
		Variant[] variants = skillFamily.variants;
		int num = skillFamily.variants.Length - 1;
		Variant val = new Variant
		{
			skillDef = SkillDef
		};
		((Variant)(ref val)).viewableNode = new Node(SkillDef.skillNameToken, false, (Node)null);
		variants[num] = val;
	}

	public static BuffDef NewBuffDef(string name, bool stack, bool hidden, Sprite sprite, Color color)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
		((Object)val).name = name;
		val.canStack = stack;
		val.isHidden = hidden;
		val.iconSprite = sprite;
		val.buffColor = color;
		ContentAddition.AddBuffDef(val);
		return val;
	}

	public static ObjectScaleCurve AddScaleComponent(GameObject target, float timeMax)
	{
		ObjectScaleCurve val = target.AddComponent<ObjectScaleCurve>();
		val.useOverallCurveOnly = true;
		val.timeMax = timeMax;
		val.overallCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
		return val;
	}

	public static RotateAroundAxis AddRotationComponent(GameObject target, float speed, RotationAxis axis)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		RotateAroundAxis val = target.AddComponent<RotateAroundAxis>();
		val.speed = (Speed)2;
		val.fastRotationSpeed = speed;
		val.rotateAroundAxis = axis;
		return val;
	}

	public static GameObject NewDisplayModel(GameObject model, string name)
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		GameObject val = PrefabAPI.InstantiateClone(model, name, false);
		val.GetComponentInChildren<Animator>().runtimeAnimatorController = Assets.Load<RuntimeAnimatorController>("displayAnimator");
		((Behaviour)val.GetComponentInChildren<CharacterModel>()).enabled = false;
		SkinnedMeshRenderer[] componentsInChildren = val.GetComponentsInChildren<SkinnedMeshRenderer>(true);
		foreach (SkinnedMeshRenderer val2 in componentsInChildren)
		{
			((Renderer)val2).material = new Material(((Renderer)val2).material);
			((Renderer)val2).material.DisableKeyword("DITHER");
		}
		return val;
	}

	public static AnimateShaderAlpha AddShaderAlphaComponent(GameObject target, float timeMax, AnimationCurve curve, bool destroyOnEnd = true, bool disableOnEnd = false)
	{
		AnimateShaderAlpha val = target.AddComponent<AnimateShaderAlpha>();
		val.timeMax = timeMax;
		val.alphaCurve = curve;
		val.destroyOnEnd = destroyOnEnd;
		val.disableOnEnd = disableOnEnd;
		return val;
	}

	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(SkinnedMeshRenderer[] childList, GameObject rootObject, string skinName, string objectToEnable, RendererInfo[] rendererInfos, UnlockableDef unlockableDef = null)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: 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_006e: 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_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: 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 (SkinnedMeshRenderer val in childList)
		{
			GameObjectActivation val2 = default(GameObjectActivation);
			val2.gameObject = ((Component)val).gameObject;
			val2.shouldActivate = ((Object)val).name == objectToEnable;
			GameObjectActivation item = val2;
			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 = unlockableDef;
		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 void CreateHitboxes(string name, Transform parent, Vector3[] sizes, Vector3[] positions)
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		//IL_004f: 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)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		HitBoxGroup val = ((Component)parent).gameObject.AddComponent<HitBoxGroup>();
		val.groupName = name;
		List<HitBox> list = new List<HitBox>();
		for (int i = 0; i < sizes.Length; i++)
		{
			GameObject val2 = new GameObject(name + (i + 1));
			val2.transform.SetParent(parent);
			val2.transform.localPosition = positions[i];
			val2.transform.localRotation = Quaternion.Euler(Vector3.forward * 45f);
			val2.transform.localScale = sizes[i];
			HitBox item = val2.AddComponent<HitBox>();
			val2.layer = LayerIndex.projectile.intVal;
			list.Add(item);
		}
		val.hitBoxes = list.ToArray();
	}

	public static GameObject CreateHitbox(string name, Transform parent, Vector3 scale, Vector3 localPosition)
	{
		//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_0028: 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_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject(name);
		val.transform.SetParent(parent);
		val.transform.localPosition = localPosition;
		val.transform.localRotation = Quaternion.Euler(Vector3.forward * 45f);
		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 EffectComponent RegisterEffect(GameObject effect, float duration, string soundName = "", bool applyScale = false, bool parentToReferencedTransform = true, bool positionAtReferencedTransform = true)
	{
		//IL_00a6: 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)
		EffectComponent val = effect.GetComponent<EffectComponent>();
		if (!Object.op_Implicit((Object)(object)val))
		{
			val = effect.AddComponent<EffectComponent>();
		}
		if (duration != -1f)
		{
			DestroyOnTimer component = effect.GetComponent<DestroyOnTimer>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				effect.AddComponent<DestroyOnTimer>().duration = duration;
			}
			else
			{
				component.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 = applyScale;
		val.effectIndex = (EffectIndex)(-1);
		val.parentToReferencedTransform = parentToReferencedTransform;
		val.positionAtReferencedTransform = positionAtReferencedTransform;
		val.soundName = soundName;
		ContentAddition.AddEffect(effect);
		return val;
	}

	public static Material InstantiateMaterial(Texture tex)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		Material val = Object.Instantiate<Material>(Prefabs.Load<Material>("RoR2/Base/Commando/matCommandoDualies.mat"));
		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;
	}
}