Decompiled source of Twitch v2.4.0

plugins/Twitch.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
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.ClayBruiser.Weapon;
using EntityStates.Commando;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.GolemMonster;
using EntityStates.LemurianBruiserMonster;
using EntityStates.TwitchStates;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Achievements;
using RoR2.Projectile;
using RoR2.Skills;
using Twitch;
using Twitch.Unlockables;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Twitch")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Twitch")]
[assembly: AssemblyTitle("Twitch")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace EntityStates.TwitchStates
{
	public class TwitchAmbush : BaseState
	{
		public static float duration;

		public static float minimumStateDuration;

		public static string startCloakSoundString;

		public static string stopCloakSoundString;

		public static GameObject smokescreenEffectPrefab;

		public static Material destealthMaterial;

		private float stopwatch;

		private bool hasCastSmoke;

		private Animator animator;

		private Transform modelTransform;

		private TwitchController twitchController;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			animator = ((EntityState)this).GetModelAnimator();
			modelTransform = ((EntityState)this).GetModelTransform();
			twitchController = ((EntityState)this).GetComponent<TwitchController>();
			CastSmoke();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.Cloak);
				((EntityState)this).characterBody.AddBuff(Buffs.CloakSpeed);
			}
			if (Object.op_Implicit((Object)(object)twitchController))
			{
				twitchController.EnterStealth();
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator))
			{
				((EntityState)this).skillLocator.utility.SetSkillOverride((object)((EntityState)this).skillLocator.utility, global::Twitch.Twitch.ambushActiveDef, (SkillOverridePriority)3);
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && NetworkServer.active)
			{
				if (((EntityState)this).characterBody.HasBuff(Buffs.Cloak))
				{
					((EntityState)this).characterBody.RemoveBuff(Buffs.Cloak);
				}
				if (((EntityState)this).characterBody.HasBuff(Buffs.CloakSpeed))
				{
					((EntityState)this).characterBody.RemoveBuff(Buffs.CloakSpeed);
				}
				((EntityState)this).characterBody.AddTimedBuff(global::Twitch.Twitch.ambushBuff, 5f);
				((EntityState)this).characterBody.RecalculateStats();
				if (Object.op_Implicit((Object)(object)modelTransform))
				{
					TemporaryOverlay obj = ((Component)modelTransform).gameObject.AddComponent<TemporaryOverlay>();
					obj.duration = 5f;
					obj.animateShaderAlpha = true;
					obj.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 7.5f, 0f);
					obj.destroyComponentOnEnd = true;
					obj.originalMaterial = Resources.Load<Material>("Materials/matPoisoned");
					obj.AddToCharacerModel(((Component)modelTransform).GetComponent<CharacterModel>());
				}
			}
			if (Object.op_Implicit((Object)(object)twitchController))
			{
				twitchController.GetAmbushBuff(5f);
			}
			if (!((EntityState)this).outer.destroying)
			{
				CastSmoke();
			}
			if (Object.op_Implicit((Object)(object)destealthMaterial))
			{
				TemporaryOverlay obj2 = ((Component)animator).gameObject.AddComponent<TemporaryOverlay>();
				obj2.duration = 1f;
				obj2.destroyComponentOnEnd = true;
				obj2.originalMaterial = destealthMaterial;
				obj2.inspectorCharacterModel = ((Component)animator).gameObject.GetComponent<CharacterModel>();
				obj2.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
				obj2.animateShaderAlpha = true;
			}
			if (Object.op_Implicit((Object)(object)twitchController))
			{
				twitchController.ExitStealth();
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator))
			{
				((EntityState)this).skillLocator.utility.UnsetSkillOverride((object)((EntityState)this).skillLocator.utility, global::Twitch.Twitch.ambushActiveDef, (SkillOverridePriority)3);
			}
			((EntityState)this).OnExit();
		}

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

		private void CastSmoke()
		{
			//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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			if (!hasCastSmoke)
			{
				Util.PlaySound(Sounds.TwitchEnterStealth, ((EntityState)this).gameObject);
				hasCastSmoke = true;
				if (Object.op_Implicit((Object)(object)animator))
				{
					animator.SetBool("isSneaking", true);
				}
			}
			else
			{
				Util.PlaySound(Sounds.TwitchExitStealth, ((EntityState)this).gameObject);
				if (Object.op_Implicit((Object)(object)animator))
				{
					animator.SetBool("isSneaking", false);
				}
			}
			EffectManager.SpawnEffect(CastSmokescreenNoDelay.smokescreenEffectPrefab, new EffectData
			{
				origin = ((EntityState)this).transform.position
			}, false);
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0017: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			if (stopwatch <= minimumStateDuration)
			{
				return (InterruptPriority)2;
			}
			return (InterruptPriority)0;
		}

		static TwitchAmbush()
		{
			duration = 6f;
			minimumStateDuration = 0.25f;
		}
	}
	public class TwitchChargeBazooka : BaseSkillState
	{
		public float maximumDuration = 2.25f;

		public float minimumDuration = 0.5f;

		public float maxDamageCoefficient = 22.5f;

		public float minDamageCoefficient = 1.5f;

		public float maxProcCoefficient = 0.8f;

		public float minProcCoefficient = 0.1f;

		public float maxSpeed = 200f;

		public float minSpeed = 10f;

		public float maxRecoil = 15f;

		public float minRecoil = 0.5f;

		public float force = 500f;

		private float releaseDuration;

		private float duration;

		private bool hasFired;

		private Animator animator;

		private string muzzleString;

		private TwitchController twitchController;

		private GameObject chargeInstance;

		public override void OnEnter()
		{
			//IL_00c6: 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_00f8: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = minimumDuration / ((BaseState)this).attackSpeedStat;
			releaseDuration = maximumDuration / ((BaseState)this).attackSpeedStat;
			animator = ((EntityState)this).GetModelAnimator();
			muzzleString = "Muzzle";
			twitchController = ((EntityState)this).GetComponent<TwitchController>();
			hasFired = false;
			if (Object.op_Implicit((Object)(object)twitchController))
			{
				muzzleString = twitchController.GetMuzzleName();
			}
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Transform val = component.FindChild(muzzleString);
					if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)ChargeMegaFireball.chargeEffectPrefab))
					{
						chargeInstance = Object.Instantiate<GameObject>(ChargeMegaFireball.chargeEffectPrefab, val.position, val.rotation);
						chargeInstance.transform.parent = val;
						Transform transform = chargeInstance.transform;
						transform.localScale *= 0.25f;
						chargeInstance.transform.localPosition = Vector3.zero;
						ScaleParticleSystemDuration component2 = chargeInstance.GetComponent<ScaleParticleSystemDuration>();
						if (Object.op_Implicit((Object)(object)component2))
						{
							component2.newDuration = releaseDuration;
						}
					}
				}
			}
			Util.PlayAttackSpeedSound(Sounds.TwitchCharge, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			if (Object.op_Implicit((Object)(object)chargeInstance))
			{
				EntityState.Destroy((Object)(object)chargeInstance);
			}
		}

		private void FireBazooka()
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			if (!hasFired)
			{
				float num = (((EntityState)this).fixedAge - duration) / releaseDuration;
				Util.PlaySound(Sounds.TwitchAttackBazooka, ((EntityState)this).gameObject);
				EffectManager.SimpleMuzzleFlash(FireMegaFireball.muzzleflashEffectPrefab, ((EntityState)this).gameObject, muzzleString, true);
				if (num >= 0.75f)
				{
					((EntityState)this).PlayAnimation("Gesture, Override", "FireEmpoweredBolt", "FireBolt.playbackRate", duration * 2f);
				}
				else
				{
					((EntityState)this).PlayAnimation("Gesture, Override", "FireExplosive", "FireExplosive.playbackRate", duration * 2f);
				}
				Ray aimRay = ((BaseState)this).GetAimRay();
				if (((EntityState)this).isAuthority)
				{
					float num2 = Mathf.Lerp(minDamageCoefficient, maxDamageCoefficient, num);
					Mathf.Lerp(minProcCoefficient, maxProcCoefficient, num);
					float num3 = Mathf.Lerp(minSpeed, maxSpeed, num);
					float num4 = Mathf.Lerp(minRecoil, maxRecoil, num);
					((BaseState)this).AddRecoil(-2f * num4, -3f * num4, -1f * num4, 1f * num4);
					((EntityState)this).characterBody.AddSpreadBloom(0.33f * num4);
					ProjectileManager.instance.FireProjectile(global::Twitch.Twitch.bazookaProjectile, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, num2 * ((BaseState)this).damageStat, force, Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master), (DamageColorIndex)0, (GameObject)null, num3);
				}
				TwitchFireBazooka nextState = new TwitchFireBazooka();
				((EntityState)this).outer.SetNextState((EntityState)(object)nextState);
			}
			hasFired = true;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			((EntityState)this).characterBody.SetAimTimer(0.5f);
			if (((EntityState)this).fixedAge >= releaseDuration)
			{
				FireBazooka();
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && ((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority && !((EntityState)this).inputBank.skill1.down)
			{
				FireBazooka();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class TwitchCheese : BaseSkillState
	{
		public float baseDuration = 4f;

		private float duration;

		private float fireDuration;

		private bool hasFired;

		private Animator animator;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration;
			fireDuration = duration;
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).PlayAnimation("FullBody, Override", "Cheese");
			Util.PlaySound(Sounds.TwitchCheese, ((EntityState)this).gameObject);
		}

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

		private void EatCheese()
		{
			//IL_0047: 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)
			if (!hasFired)
			{
				hasFired = true;
				Util.PlaySound(Sounds.TwitchHeal, ((EntityState)this).gameObject);
				if (NetworkServer.active)
				{
					((EntityState)this).characterBody.healthComponent.Heal(((EntityState)this).characterBody.healthComponent.fullHealth, default(ProcChainMask), true);
				}
			}
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public class TwitchExplode : BaseSkillState
	{
		public float baseDuration = 2f;

		private float duration;

		private Animator animator;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).PlayAnimation("Grenade", "ThrowGrenade", "ThrowGrenade.playbackRate", duration);
			Explode();
		}

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

		private void Explode()
		{
			//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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d0: 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_00e1: 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_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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: 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_0153: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_0045: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			Util.PlaySound(Sounds.TwitchCaskHit, ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)((EntityState)this).healthComponent))
			{
				DamageInfo val = new DamageInfo();
				val.damage = ((EntityState)this).healthComponent.fullCombinedHealth * 0.5f;
				val.position = ((EntityState)this).characterBody.corePosition;
				val.force = Vector3.zero;
				val.damageColorIndex = (DamageColorIndex)5;
				val.crit = false;
				val.attacker = null;
				val.inflictor = null;
				val.damageType = (DamageType)32;
				val.procCoefficient = 0f;
				val.procChainMask = default(ProcChainMask);
				((EntityState)this).healthComponent.TakeDamage(val);
			}
			new BlastAttack
			{
				attacker = ((EntityState)this).gameObject,
				inflictor = ((EntityState)this).gameObject,
				teamIndex = (TeamIndex)1,
				baseForce = 50f,
				position = ((EntityState)this).characterBody.corePosition,
				radius = 12f,
				falloffModel = (FalloffModel)1,
				crit = ((BaseState)this).RollCrit(),
				baseDamage = 5f * ((BaseState)this).damageStat,
				procCoefficient = 1f
			}.Fire();
			EffectManager.SpawnEffect(Resources.Load<GameObject>("Prefabs/Effects/ImpactEffects/MagmaOrbExplosion"), new EffectData
			{
				origin = ((EntityState)this).characterBody.corePosition,
				scale = 12f
			}, true);
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)0;
		}
	}
	public class TwitchExpunge : BaseSkillState
	{
		public static float damageCoefficient;

		public static float damageBonus;

		public float baseDuration = 0.75f;

		private float duration;

		private float fireDuration;

		private bool hasFired;

		private Animator animator;

		private string muzzleString;

		private TwitchController twitchController;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			fireDuration = 0.2f * duration;
			((EntityState)this).characterBody.SetAimTimer(2f);
			animator = ((EntityState)this).GetModelAnimator();
			muzzleString = "HandL";
			twitchController = ((EntityState)this).GetComponent<TwitchController>();
			((EntityState)this).PlayAnimation("Gesture, Override", "Expunge", "Expunge.playbackRate", duration);
			Util.PlaySound(Sounds.TwitchExpunge, ((EntityState)this).gameObject);
		}

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

		private void FireBolt()
		{
			//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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if (!hasFired)
			{
				hasFired = true;
				((EntityState)this).characterBody.AddSpreadBloom(1f);
				Ray aimRay = ((BaseState)this).GetAimRay();
				EffectManager.SimpleMuzzleFlash(FireMegaFireball.muzzleflashEffectPrefab, ((EntityState)this).gameObject, muzzleString, false);
				if (((EntityState)this).isAuthority)
				{
					ProjectileManager.instance.FireProjectile(global::Twitch.Twitch.expungeProjectile, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, damageCoefficient * ((BaseState)this).damageStat, 0f, Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master), (DamageColorIndex)0, (GameObject)null, -1f);
				}
			}
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}

		static TwitchExpunge()
		{
			damageCoefficient = 4f;
			damageBonus = 0.7f;
		}
	}
	public class TwitchFireBazooka : BaseSkillState
	{
		public static float baseDuration;

		private float duration;

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

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

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}

		static TwitchFireBazooka()
		{
			baseDuration = 0.4f;
		}
	}
	public class TwitchFireBolt : BaseSkillState
	{
		public static float damageCoefficient;

		public float baseDuration = 0.75f;

		public float recoil = 1f;

		public static float projectileSpeed;

		private float duration;

		private float fireDuration;

		private bool hasFired;

		private Animator animator;

		private string muzzleString;

		private TwitchController twitchController;

		public override void OnEnter()
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			fireDuration = 0.15f * duration;
			((EntityState)this).characterBody.SetAimTimer(2f);
			animator = ((EntityState)this).GetModelAnimator();
			muzzleString = "Muzzle";
			twitchController = ((EntityState)this).GetComponent<TwitchController>();
			if (Object.op_Implicit((Object)(object)twitchController))
			{
				muzzleString = twitchController.GetMuzzleName();
			}
			global::Twitch.Twitch.LaserTracerMaterial.SetColor(152, global::Twitch.Twitch.laserTracerColor);
			if (((EntityState)this).characterBody.HasBuff(global::Twitch.Twitch.ambushBuff))
			{
				((EntityState)this).PlayAnimation("Gesture, Override", "FireEmpoweredBolt", "FireBolt.playbackRate", 1.5f * duration);
			}
			else
			{
				((EntityState)this).PlayAnimation("Gesture, Override", "FireBolt", "FireBolt.playbackRate", 2f * duration);
			}
			if (((EntityState)this).characterBody.HasBuff(global::Twitch.Twitch.ambushBuff) && Object.op_Implicit((Object)(object)twitchController))
			{
				twitchController.AmbushAttack();
			}
			else
			{
				Util.PlaySound(Sounds.TwitchAttackStart, ((EntityState)this).gameObject);
			}
		}

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

		private void FireBolt()
		{
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: 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_0253: 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_00bb: 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_00c7: 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_00d4: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: 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)
			//IL_0108: 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_0113: 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_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: 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_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: 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_01ba: 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_01d0: 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_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			if (hasFired)
			{
				return;
			}
			hasFired = true;
			if (((EntityState)this).characterBody.HasBuff(global::Twitch.Twitch.ambushBuff))
			{
				Util.PlaySound(Sounds.TwitchAttackLaser, ((EntityState)this).gameObject);
				EffectManager.SimpleMuzzleFlash(FireLaser.effectPrefab, ((EntityState)this).gameObject, muzzleString, false);
				((BaseState)this).AddRecoil(-2f * recoil, -3f * recoil, -1f * recoil, 1f * recoil);
				if (((EntityState)this).isAuthority)
				{
					float damage = damageCoefficient * ((BaseState)this).damageStat;
					float force = 50f;
					float procCoefficient = 1f;
					bool isCrit = ((BaseState)this).RollCrit();
					Ray aimRay = ((BaseState)this).GetAimRay();
					new BulletAttack
					{
						bulletCount = 1u,
						aimVector = ((Ray)(ref aimRay)).direction,
						origin = ((Ray)(ref aimRay)).origin + new Vector3(0f, 0.25f, 0f),
						damage = damage,
						damageColorIndex = (DamageColorIndex)0,
						damageType = (DamageType)1048576,
						falloffModel = (FalloffModel)0,
						maxDistance = 512f,
						force = force,
						hitMask = CommonMasks.bullet,
						minSpread = 0f,
						maxSpread = 3f,
						isCrit = isCrit,
						owner = ((EntityState)this).gameObject,
						muzzleName = muzzleString,
						smartCollision = false,
						procChainMask = default(ProcChainMask),
						procCoefficient = procCoefficient,
						radius = 1f,
						sniper = false,
						stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask,
						weapon = null,
						tracerEffectPrefab = global::Twitch.Twitch.laserTracer,
						spreadPitchScale = 0.25f,
						spreadYawScale = 0.25f,
						queryTriggerInteraction = (QueryTriggerInteraction)0,
						hitEffectPrefab = MinigunFire.bulletHitEffectPrefab,
						HitEffectNormal = MinigunFire.bulletHitEffectNormal
					}.Fire();
				}
			}
			else
			{
				Util.PlaySound(Sounds.TwitchAttack, ((EntityState)this).gameObject);
				((EntityState)this).characterBody.AddSpreadBloom(0.75f);
				Ray aimRay2 = ((BaseState)this).GetAimRay();
				EffectManager.SimpleMuzzleFlash(FirePistol2.muzzleEffectPrefab, ((EntityState)this).gameObject, muzzleString, false);
				if (((EntityState)this).isAuthority)
				{
					ProjectileManager.instance.FireProjectile(global::Twitch.Twitch.boltProjectile, ((Ray)(ref aimRay2)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay2)).direction), ((EntityState)this).gameObject, damageCoefficient * ((BaseState)this).damageStat, 0f, Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master), (DamageColorIndex)0, (GameObject)null, projectileSpeed);
				}
			}
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}

		static TwitchFireBolt()
		{
			damageCoefficient = 2.25f;
			projectileSpeed = 120f;
		}
	}
	public class TwitchFireShotgun : BaseSkillState
	{
		public static float damageCoefficient;

		public float baseDuration = 0.9f;

		public int projectileCount = 4;

		public float bulletRecoil = 3f;

		public float beamRecoil = 2.5f;

		public static GameObject bulletTracerEffectPrefab;

		private float duration;

		private float fireDuration;

		private bool hasFired;

		private Animator animator;

		private string muzzleString;

		private TwitchController twitchController;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			fireDuration = 0.1f * duration;
			((EntityState)this).characterBody.SetAimTimer(2f);
			animator = ((EntityState)this).GetModelAnimator();
			muzzleString = "Muzzle";
			hasFired = false;
			twitchController = ((EntityState)this).GetComponent<TwitchController>();
			if (Object.op_Implicit((Object)(object)twitchController))
			{
				muzzleString = twitchController.GetMuzzleName();
			}
			if (((EntityState)this).characterBody.HasBuff(global::Twitch.Twitch.ambushBuff))
			{
				((EntityState)this).PlayAnimation("Gesture, Override", "FireEmpoweredBolt", "FireBolt.playbackRate", 1.5f * duration);
			}
			else
			{
				((EntityState)this).PlayAnimation("Gesture, Override", "FireExplosive", "FireExplosive.playbackRate", duration);
			}
			Util.PlaySound(Sounds.TwitchAttackStart, ((EntityState)this).gameObject);
		}

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

		private void FireBullet()
		{
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: 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_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: 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_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: 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_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: 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)
			//IL_010a: 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_0117: 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_011e: 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_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: 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_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: 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_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: 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_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: 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_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: 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)
			if (hasFired)
			{
				return;
			}
			hasFired = true;
			if (((EntityState)this).characterBody.HasBuff(global::Twitch.Twitch.ambushBuff))
			{
				Util.PlayAttackSpeedSound(Sounds.TwitchFireShotgun, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
				((BaseState)this).AddRecoil(-2f * beamRecoil, -3f * beamRecoil, -1f * beamRecoil, 1f * beamRecoil);
				((EntityState)this).characterBody.AddSpreadBloom(0.33f * bulletRecoil);
				EffectManager.SimpleMuzzleFlash(FireShotgun.effectPrefab, ((EntityState)this).gameObject, muzzleString, false);
				if (((EntityState)this).isAuthority)
				{
					float damage = damageCoefficient * ((BaseState)this).damageStat;
					float force = 10f;
					float procCoefficient = 0.4f;
					bool isCrit = ((BaseState)this).RollCrit();
					Ray aimRay = ((BaseState)this).GetAimRay();
					new BulletAttack
					{
						bulletCount = (uint)projectileCount,
						aimVector = ((Ray)(ref aimRay)).direction,
						origin = ((Ray)(ref aimRay)).origin,
						damage = damage,
						damageColorIndex = (DamageColorIndex)0,
						damageType = (DamageType)1048576,
						falloffModel = (FalloffModel)0,
						maxDistance = 40f,
						force = force,
						hitMask = CommonMasks.bullet,
						minSpread = 0f,
						maxSpread = 5f,
						isCrit = isCrit,
						owner = ((EntityState)this).gameObject,
						muzzleName = muzzleString,
						smartCollision = true,
						procChainMask = default(ProcChainMask),
						procCoefficient = procCoefficient,
						radius = 1.5f,
						sniper = false,
						stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask,
						weapon = null,
						tracerEffectPrefab = bulletTracerEffectPrefab,
						spreadPitchScale = 0.5f,
						spreadYawScale = 0.5f,
						queryTriggerInteraction = (QueryTriggerInteraction)0,
						hitEffectPrefab = MinigunFire.bulletHitEffectPrefab,
						HitEffectNormal = MinigunFire.bulletHitEffectNormal
					}.Fire();
				}
			}
			else
			{
				Util.PlaySound(Sounds.TwitchFireShotgun, ((EntityState)this).gameObject);
				((BaseState)this).AddRecoil(-2f * bulletRecoil, -3f * bulletRecoil, -1f * bulletRecoil, 1f * bulletRecoil);
				((EntityState)this).characterBody.AddSpreadBloom(0.33f * bulletRecoil);
				EffectManager.SimpleMuzzleFlash(FireShotgun.effectPrefab, ((EntityState)this).gameObject, muzzleString, false);
				if (((EntityState)this).isAuthority)
				{
					float damage2 = damageCoefficient * ((BaseState)this).damageStat;
					float force2 = 10f;
					float procCoefficient2 = 0.4f;
					bool isCrit2 = ((BaseState)this).RollCrit();
					Ray aimRay2 = ((BaseState)this).GetAimRay();
					new BulletAttack
					{
						bulletCount = (uint)projectileCount,
						aimVector = ((Ray)(ref aimRay2)).direction,
						origin = ((Ray)(ref aimRay2)).origin,
						damage = damage2,
						damageColorIndex = (DamageColorIndex)0,
						damageType = (DamageType)1048576,
						falloffModel = (FalloffModel)0,
						maxDistance = 40f,
						force = force2,
						hitMask = CommonMasks.bullet,
						minSpread = 0f,
						maxSpread = 30f,
						isCrit = isCrit2,
						owner = ((EntityState)this).gameObject,
						muzzleName = muzzleString,
						smartCollision = false,
						procChainMask = default(ProcChainMask),
						procCoefficient = procCoefficient2,
						radius = 1.5f,
						sniper = false,
						stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask,
						weapon = null,
						tracerEffectPrefab = bulletTracerEffectPrefab,
						spreadPitchScale = 0.5f,
						spreadYawScale = 0.5f,
						queryTriggerInteraction = (QueryTriggerInteraction)0,
						hitEffectPrefab = MinigunFire.bulletHitEffectPrefab,
						HitEffectNormal = MinigunFire.bulletHitEffectNormal
					}.Fire();
				}
			}
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}

		static TwitchFireShotgun()
		{
			damageCoefficient = 0.9f;
			bulletTracerEffectPrefab = Resources.Load<GameObject>("Prefabs/Effects/Tracers/TracerCommandoShotgun");
		}
	}
	public class TwitchFireSMG : BaseSkillState
	{
		public float damageCoefficient = 0.85f;

		public static float baseDuration;

		public float fireInterval = 0.1f;

		public static int projectileCount;

		public float bulletRecoil = 0.75f;

		public float beamRecoil = 1f;

		public static GameObject bulletTracerEffectPrefab;

		private float duration;

		private float fireDuration;

		private int hasFired;

		private float lastFired;

		private Animator animator;

		private string muzzleString;

		private TwitchController twitchController;

		public override void OnEnter()
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			fireDuration = 0.2f * duration;
			((EntityState)this).characterBody.SetAimTimer(2f);
			animator = ((EntityState)this).GetModelAnimator();
			muzzleString = "Muzzle";
			hasFired = 0;
			twitchController = ((EntityState)this).GetComponent<TwitchController>();
			if (Object.op_Implicit((Object)(object)twitchController))
			{
				muzzleString = twitchController.GetMuzzleName();
			}
			global::Twitch.Twitch.LaserTracerMaterial.SetColor(152, global::Twitch.Twitch.laserTracerColor);
			if (((EntityState)this).characterBody.HasBuff(global::Twitch.Twitch.ambushBuff))
			{
				((EntityState)this).PlayAnimation("Gesture, Override", "FireEmpoweredBolt", "FireBolt.playbackRate", 1.5f * duration);
			}
			else
			{
				((EntityState)this).PlayAnimation("Gesture, Override", "FireBolt", "FireBolt.playbackRate", 2f * duration);
			}
			if (((EntityState)this).characterBody.HasBuff(global::Twitch.Twitch.ambushBuff) && Object.op_Implicit((Object)(object)twitchController))
			{
				twitchController.AmbushAttack();
			}
			else
			{
				Util.PlaySound(Sounds.TwitchAttackStart, ((EntityState)this).gameObject);
			}
		}

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

		private void FireBullet()
		{
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: 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_010f: 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_0116: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: 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_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: 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_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: 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_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: 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)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			if (hasFired >= projectileCount)
			{
				return;
			}
			if (hasFired == 0 && !((EntityState)this).characterBody.HasBuff(global::Twitch.Twitch.ambushBuff))
			{
				Util.PlaySound(Sounds.TwitchAttackGun, ((EntityState)this).gameObject);
			}
			hasFired++;
			lastFired = Time.time + fireInterval / ((BaseState)this).attackSpeedStat;
			if (((EntityState)this).characterBody.HasBuff(global::Twitch.Twitch.ambushBuff))
			{
				Util.PlaySound(Sounds.TwitchAttackGunLaser, ((EntityState)this).gameObject);
				EffectManager.SimpleMuzzleFlash(FireLaser.effectPrefab, ((EntityState)this).gameObject, muzzleString, false);
				((BaseState)this).AddRecoil(-1f * beamRecoil, -2f * beamRecoil, -1f * beamRecoil, 1f * beamRecoil);
				if (((EntityState)this).isAuthority)
				{
					float damage = damageCoefficient * ((BaseState)this).damageStat;
					float force = 10f;
					float procCoefficient = 0.75f;
					bool isCrit = ((BaseState)this).RollCrit();
					Ray aimRay = ((BaseState)this).GetAimRay();
					new BulletAttack
					{
						bulletCount = 1u,
						aimVector = ((Ray)(ref aimRay)).direction,
						origin = ((Ray)(ref aimRay)).origin + new Vector3(0f, 0.25f, 0f),
						damage = damage,
						damageColorIndex = (DamageColorIndex)0,
						damageType = (DamageType)1048576,
						falloffModel = (FalloffModel)0,
						maxDistance = 512f,
						force = force,
						hitMask = CommonMasks.bullet,
						minSpread = 0f,
						maxSpread = 5f,
						isCrit = isCrit,
						owner = ((EntityState)this).gameObject,
						muzzleName = muzzleString,
						smartCollision = false,
						procChainMask = default(ProcChainMask),
						procCoefficient = procCoefficient,
						radius = 1f,
						sniper = false,
						stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask,
						weapon = null,
						tracerEffectPrefab = global::Twitch.Twitch.laserTracer,
						spreadPitchScale = 0.1f,
						spreadYawScale = 0.1f,
						queryTriggerInteraction = (QueryTriggerInteraction)0,
						hitEffectPrefab = MinigunFire.bulletHitEffectPrefab,
						HitEffectNormal = MinigunFire.bulletHitEffectNormal
					}.Fire();
				}
			}
			else
			{
				Util.PlaySound(Sounds.TwitchAttack, ((EntityState)this).gameObject);
				((EntityState)this).characterBody.AddSpreadBloom(0.75f);
				Ray aimRay2 = ((BaseState)this).GetAimRay();
				EffectManager.SimpleMuzzleFlash(FirePistol2.muzzleEffectPrefab, ((EntityState)this).gameObject, muzzleString, false);
				if (((EntityState)this).isAuthority)
				{
					ProjectileManager.instance.FireProjectile(global::Twitch.Twitch.boltProjectile, ((Ray)(ref aimRay2)).origin + new Vector3(0f, 0.25f, 0f), Util.QuaternionSafeLookRotation(((Ray)(ref aimRay2)).direction), ((EntityState)this).gameObject, TwitchFireBolt.damageCoefficient * ((BaseState)this).damageStat, 0f, Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master), (DamageColorIndex)0, (GameObject)null, TwitchFireBolt.projectileSpeed);
				}
			}
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}

		static TwitchFireSMG()
		{
			baseDuration = 1f;
			projectileCount = 3;
			bulletTracerEffectPrefab = Resources.Load<GameObject>("Prefabs/Effects/Tracers/TracerEngiTurret");
		}
	}
	public class TwitchScurry : BaseState
	{
		public float duration = 0.4f;

		public static GameObject dodgeEffect;

		public static float initialSpeedCoefficient;

		public static float finalSpeedCoefficient;

		private float rollSpeed;

		private bool hasCastSmoke;

		private Vector3 forwardDirection;

		private Animator animator;

		private Vector3 previousPosition;

		private Transform modelTransform;

		private CharacterModel characterModel;

		private TwitchController twitchController;

		public override void OnEnter()
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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_00a4: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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_01e4: 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_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: 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_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			modelTransform = ((EntityState)this).GetModelTransform();
			twitchController = ((EntityState)this).GetComponent<TwitchController>();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				characterModel = ((Component)modelTransform).GetComponent<CharacterModel>();
			}
			animator = ((EntityState)this).GetModelAnimator();
			((Component)animator).GetComponent<ChildLocator>();
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				Vector3 val = ((((EntityState)this).inputBank.moveVector == Vector3.zero) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).inputBank.moveVector);
				forwardDirection = ((Vector3)(ref val)).normalized;
			}
			Vector3 val2 = (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) ? ((EntityState)this).characterDirection.forward : forwardDirection);
			Vector3 val3 = Vector3.Cross(Vector3.up, val2);
			float num = Vector3.Dot(forwardDirection, val2);
			float num2 = Vector3.Dot(forwardDirection, val3);
			animator.SetFloat("forwardSpeed", num, 0.1f, Time.fixedDeltaTime);
			animator.SetFloat("rightSpeed", num2, 0.1f, Time.fixedDeltaTime);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.Cloak);
				((EntityState)this).characterBody.AddBuff(Buffs.CloakSpeed);
			}
			if (Object.op_Implicit((Object)(object)twitchController))
			{
				twitchController.EnterStealth();
			}
			CastSmoke();
			RecalculateSpeed();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				CharacterMotor characterMotor = ((EntityState)this).characterMotor;
				characterMotor.velocity.y = characterMotor.velocity.y * 0.2f;
				((EntityState)this).characterMotor.velocity = forwardDirection * rollSpeed;
			}
			((EntityState)this).PlayAnimation("FullBody, Override", "Scurry");
			Vector3 val4 = (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) ? ((EntityState)this).characterMotor.velocity : Vector3.zero);
			previousPosition = ((EntityState)this).transform.position - val4;
		}

		private void RecalculateSpeed()
		{
			rollSpeed = (2f + 0.5f * base.moveSpeedStat) * Mathf.Lerp(initialSpeedCoefficient, finalSpeedCoefficient, ((EntityState)this).fixedAge / duration);
		}

		private void CastSmoke()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			if (!hasCastSmoke)
			{
				Util.PlaySound(Sounds.TwitchEnterStealth, ((EntityState)this).gameObject);
				hasCastSmoke = true;
			}
			else
			{
				Util.PlaySound(Sounds.TwitchExitStealth, ((EntityState)this).gameObject);
			}
			EffectManager.SpawnEffect(CastSmokescreenNoDelay.smokescreenEffectPrefab, new EffectData
			{
				origin = ((EntityState)this).transform.position
			}, false);
		}

		public override void FixedUpdate()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_00eb: 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)
			((EntityState)this).FixedUpdate();
			RecalculateSpeed();
			if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams))
			{
				((EntityState)this).cameraTargetParams.fovOverride = Mathf.Lerp(DodgeState.dodgeFOV, 60f, ((EntityState)this).fixedAge / duration);
			}
			Vector3 val = ((EntityState)this).transform.position - previousPosition;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) && normalized != Vector3.zero)
			{
				Vector3 val2 = normalized * rollSpeed;
				float y = val2.y;
				val2.y = 0f;
				float num = Mathf.Max(Vector3.Dot(val2, forwardDirection), 0f);
				val2 = forwardDirection * num;
				val2.y += Mathf.Max(y, 0f);
				((EntityState)this).characterMotor.velocity = val2;
			}
			previousPosition = ((EntityState)this).transform.position;
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams))
			{
				((EntityState)this).cameraTargetParams.fovOverride = -1f;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && NetworkServer.active)
			{
				if (((EntityState)this).characterBody.HasBuff(Buffs.Cloak))
				{
					((EntityState)this).characterBody.RemoveBuff(Buffs.Cloak);
				}
				if (((EntityState)this).characterBody.HasBuff(Buffs.CloakSpeed))
				{
					((EntityState)this).characterBody.RemoveBuff(Buffs.CloakSpeed);
				}
				((EntityState)this).characterBody.AddTimedBuff(global::Twitch.Twitch.ambushBuff, 4f);
				((EntityState)this).characterBody.RecalculateStats();
				if (Object.op_Implicit((Object)(object)modelTransform))
				{
					TemporaryOverlay obj = ((Component)modelTransform).gameObject.AddComponent<TemporaryOverlay>();
					obj.duration = 4f;
					obj.animateShaderAlpha = true;
					obj.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 2.5f, 0f);
					obj.destroyComponentOnEnd = true;
					obj.originalMaterial = Resources.Load<Material>("Materials/matPoisoned");
					obj.AddToCharacerModel(((Component)modelTransform).GetComponent<CharacterModel>());
				}
			}
			if (Object.op_Implicit((Object)(object)twitchController))
			{
				twitchController.GetAmbushBuff(5f);
			}
			if (!((EntityState)this).outer.destroying)
			{
				CastSmoke();
			}
			if (Object.op_Implicit((Object)(object)TwitchAmbush.destealthMaterial))
			{
				TemporaryOverlay obj2 = ((Component)animator).gameObject.AddComponent<TemporaryOverlay>();
				obj2.duration = 1f;
				obj2.destroyComponentOnEnd = true;
				obj2.originalMaterial = TwitchAmbush.destealthMaterial;
				obj2.inspectorCharacterModel = ((Component)animator).gameObject.GetComponent<CharacterModel>();
				obj2.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
				obj2.animateShaderAlpha = true;
			}
			if (Object.op_Implicit((Object)(object)twitchController))
			{
				twitchController.ExitStealth();
			}
			((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
			((EntityState)this).OnExit();
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnSerialize(writer);
			writer.Write(forwardDirection);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0009: 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)
			((EntityState)this).OnDeserialize(reader);
			forwardDirection = reader.ReadVector3();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}

		static TwitchScurry()
		{
			initialSpeedCoefficient = 5f;
			finalSpeedCoefficient = 4f;
		}
	}
	public class TwitchThrowBomb : BaseSkillState
	{
		public static float damageCoefficient;

		public static float baseDuration;

		private float duration;

		private float fireDuration;

		private bool hasFired;

		private Animator animator;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			fireDuration = 0.35f * duration;
			((EntityState)this).characterBody.SetAimTimer(2f);
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).PlayAnimation("FullBody, Override", "ThrowBomb", "ThrowBomb.playbackRate", duration);
			Util.PlayAttackSpeedSound(Sounds.TwitchCaskStart, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
		}

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

		private void ThrowBomb()
		{
			//IL_0037: 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_0051: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			if (!hasFired)
			{
				hasFired = true;
				Util.PlaySound(Sounds.TwitchThrowCask, ((EntityState)this).gameObject);
				((EntityState)this).characterBody.AddSpreadBloom(1f);
				Ray aimRay = ((BaseState)this).GetAimRay();
				if (((EntityState)this).isAuthority)
				{
					ProjectileManager.instance.FireProjectile(global::Twitch.Twitch.caskProjectile, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, damageCoefficient * ((BaseState)this).damageStat, 0f, Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master), (DamageColorIndex)0, (GameObject)null, -1f);
				}
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && ((EntityState)this).characterMotor.velocity.y < 0f && !hasFired)
			{
				((EntityState)this).characterMotor.velocity.y = 0f;
			}
			if (((EntityState)this).fixedAge >= fireDuration)
			{
				ThrowBomb();
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}

		static TwitchThrowBomb()
		{
			damageCoefficient = 3f;
			baseDuration = 1.1f;
		}
	}
	public class TwitchThrowGrenade : BaseSkillState
	{
		public float damageCoefficient = 7.5f;

		public float baseDuration = 3f;

		public float throwDuration = 0.25f;

		public float throwOffset = 0.1f;

		private float duration;

		private bool hasFired;

		private bool hasThrown;

		private Animator animator;

		private TwitchController twitchController;

		private float grenadeLifetime;

		private float throwTime;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration + throwDuration;
			animator = ((EntityState)this).GetModelAnimator();
			twitchController = ((EntityState)this).gameObject.GetComponent<TwitchController>();
			((EntityState)this).PlayAnimation("Grenade", "ReadyGrenade", "ReadyGrenade.playbackRate", baseDuration - 0.2f);
			Util.PlaySound(Sounds.TwitchGrenadeStart, ((EntityState)this).gameObject);
		}

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

		private void ThrowGrenade()
		{
			//IL_0037: 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_006f: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			if (hasFired)
			{
				return;
			}
			hasFired = true;
			Util.PlaySound(Sounds.TwitchThrowGrenade, ((EntityState)this).gameObject);
			((EntityState)this).characterBody.AddSpreadBloom(1f);
			Ray aimRay = ((BaseState)this).GetAimRay();
			if (((EntityState)this).isAuthority)
			{
				if (Object.op_Implicit((Object)(object)twitchController))
				{
					twitchController.UpdateGrenadeLifetime(grenadeLifetime);
				}
				ProjectileManager.instance.FireProjectile(global::Twitch.Twitch.grenadeProjectile, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, damageCoefficient * ((BaseState)this).damageStat, 0f, Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master), (DamageColorIndex)0, (GameObject)null, -1f);
			}
		}

		private void ReleaseGrenade()
		{
			if (!hasThrown)
			{
				hasThrown = true;
				((EntityState)this).PlayAnimation("Grenade", "ThrowGrenade", "ThrowGrenade.playbackRate", throwDuration);
				float num = baseDuration;
				num -= ((EntityState)this).fixedAge;
				if (num <= 0f)
				{
					num = 0.1f;
				}
				grenadeLifetime = num;
				throwTime = ((EntityState)this).fixedAge + throwOffset;
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			((EntityState)this).characterBody.SetAimTimer(0.5f);
			if (((EntityState)this).fixedAge >= baseDuration)
			{
				TwitchExplode nextState = new TwitchExplode();
				((EntityState)this).outer.SetNextState((EntityState)(object)nextState);
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && !((EntityState)this).inputBank.skill2.down)
			{
				ReleaseGrenade();
			}
			if (((EntityState)this).fixedAge >= throwTime && hasThrown)
			{
				ThrowGrenade();
			}
			if (hasFired && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
}
namespace Twitch
{
	public class ApplyHorns : MonoBehaviour
	{
		private CharacterModel model;

		private ChildLocator childLocator;

		private void Start()
		{
			model = ((Component)this).GetComponentInChildren<CharacterModel>();
			childLocator = ((Component)this).GetComponentInChildren<ChildLocator>();
			AddHorns();
		}

		private void AddHorns()
		{
			//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_002a: 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_0041: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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)
			//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_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)model))
			{
				DisplayRuleGroup equipmentDisplayRuleGroup = model.itemDisplayRuleSet.GetEquipmentDisplayRuleGroup(Equipment.AffixRed.equipmentIndex);
				if (equipmentDisplayRuleGroup.rules.Length > 1)
				{
					Transform val = childLocator.FindChild(equipmentDisplayRuleGroup.rules[0].childName);
					if (Object.op_Implicit((Object)(object)val))
					{
						Apply(model, equipmentDisplayRuleGroup.rules[0].followerPrefab, val, equipmentDisplayRuleGroup.rules[0].localPos, Quaternion.Euler(equipmentDisplayRuleGroup.rules[0].localAngles), equipmentDisplayRuleGroup.rules[0].localScale);
					}
					if (Object.op_Implicit((Object)(object)childLocator.FindChild(equipmentDisplayRuleGroup.rules[1].childName)))
					{
						Apply(model, equipmentDisplayRuleGroup.rules[1].followerPrefab, val, equipmentDisplayRuleGroup.rules[1].localPos, Quaternion.Euler(equipmentDisplayRuleGroup.rules[1].localAngles), equipmentDisplayRuleGroup.rules[1].localScale);
					}
				}
			}
			else
			{
				Debug.LogError((object)"[LoLTwitchMod] AddHorns - no charactermodel");
			}
		}

		private void Apply(CharacterModel characterModel, GameObject prefab, Transform parent, Vector3 localPosition, Quaternion localRotation, Vector3 localScale)
		{
			//IL_0012: 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)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(prefab.gameObject, parent);
			obj.transform.localPosition = localPosition;
			obj.transform.localRotation = localRotation;
			obj.transform.localScale = localScale;
			LimbMatcher component = obj.GetComponent<LimbMatcher>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)childLocator))
			{
				component.SetChildLocator(childLocator);
			}
		}
	}
	public static class Assets
	{
		public static AssetBundle MainAssetBundle;

		public static Texture charPortrait;

		public static Sprite iconP;

		public static Sprite icon1;

		public static Sprite icon1b;

		public static Sprite icon1c;

		public static Sprite icon1d;

		public static Sprite icon2;

		public static Sprite icon2b;

		public static Sprite icon3;

		public static Sprite icon3b;

		public static Sprite icon3c;

		public static Sprite icon3d;

		public static Sprite icon4;

		public static GameObject arrowModel;

		public static GameObject caskModel;

		public static GameObject bazookaRocketModel;

		public static GameObject grenadeModel;

		public static GameObject knifeModel;

		public static Material mainSkinMat;

		public static Material simpleSkinMat;

		public static Material tarSkinMat;

		public static Material tundraSkinMat;

		public static void PopulateAssets()
		{
			string? directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Twitch.Instance).Info.Location);
			MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "twitch"));
			SoundBanks.Add(Path.Combine(directoryName, "Twitch.bnk"));
			charPortrait = (Texture)(object)MainAssetBundle.LoadAsset<Sprite>("TwitchBody").texture;
			iconP = MainAssetBundle.LoadAsset<Sprite>("VenomIcon");
			icon1 = MainAssetBundle.LoadAsset<Sprite>("SprayAndPrayIcon");
			icon1b = MainAssetBundle.LoadAsset<Sprite>("TommyGunIcon");
			icon1c = MainAssetBundle.LoadAsset<Sprite>("ShotgunIcon");
			icon1d = MainAssetBundle.LoadAsset<Sprite>("BazookaIcon");
			icon2 = MainAssetBundle.LoadAsset<Sprite>("CaskIcon");
			icon2b = MainAssetBundle.LoadAsset<Sprite>("GrenadeIcon");
			icon3 = MainAssetBundle.LoadAsset<Sprite>("AmbushIcon");
			icon3b = MainAssetBundle.LoadAsset<Sprite>("AmbushActiveIcon");
			icon3c = MainAssetBundle.LoadAsset<Sprite>("AmbushRecastIcon");
			icon3d = MainAssetBundle.LoadAsset<Sprite>("CheeseIcon");
			icon4 = MainAssetBundle.LoadAsset<Sprite>("ExpungeIcon");
			arrowModel = MainAssetBundle.LoadAsset<GameObject>("ArrowModel");
			caskModel = MainAssetBundle.LoadAsset<GameObject>("CaskModel");
			bazookaRocketModel = MainAssetBundle.LoadAsset<GameObject>("BazookaRocketModel");
			grenadeModel = MainAssetBundle.LoadAsset<GameObject>("GrenadeModel");
			knifeModel = MainAssetBundle.LoadAsset<GameObject>("KnifeModel");
			mainSkinMat = MainAssetBundle.LoadAsset<Material>("matTwitch");
			simpleSkinMat = MainAssetBundle.LoadAsset<Material>("matTwitchSimple");
			tarSkinMat = MainAssetBundle.LoadAsset<Material>("matTwitchTar");
			tundraSkinMat = MainAssetBundle.LoadAsset<Material>("matTwitchTundra");
		}
	}
	public class MenuAnim : MonoBehaviour
	{
		internal void OnEnable()
		{
			if (((Object)((Component)((Component)this).gameObject.transform.parent).gameObject).name == "CharacterPad")
			{
				((MonoBehaviour)this).StartCoroutine(SpawnAnim());
			}
		}

		private IEnumerator SpawnAnim()
		{
			Animator componentInChildren = ((Component)this).GetComponentInChildren<Animator>();
			EffectManager.SpawnEffect(CastSmokescreenNoDelay.smokescreenEffectPrefab, new EffectData
			{
				origin = ((Component)this).gameObject.transform.position
			}, false);
			Util.PlaySound(Sounds.TwitchExitStealth, ((Component)this).gameObject);
			Util.PlaySound(Sounds.TwitchMenu, ((Component)this).gameObject);
			PlayAnimation("Fullbody, Override", "Menu", "", 1f, componentInChildren);
			yield break;
		}

		private void PlayAnimation(string layerName, string animationStateName, string playbackRateParam, float duration, Animator animator)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			int layerIndex = animator.GetLayerIndex(layerName);
			animator.SetFloat(playbackRateParam, 1f);
			animator.PlayInFixedTime(animationStateName, layerIndex, 0f);
			animator.Update(0f);
			AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(layerIndex);
			float length = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).length;
			animator.SetFloat(playbackRateParam, length / duration);
		}
	}
	public class SeparateFromParent : MonoBehaviour
	{
		private void Awake()
		{
			((Component)this).transform.SetParent((Transform)null);
		}
	}
	public static class Sounds
	{
		public static readonly string TwitchAmbush = "TwitchAmbush";

		public static readonly string TwitchAmbushGun = "TwitchAmbushGun";

		public static readonly string TwitchAttack = "TwitchAttack";

		public static readonly string TwitchAttackBazooka = "TwitchAttackBazooka";

		public static readonly string TwitchAttackGun = "TwitchAttackGun";

		public static readonly string TwitchAttackLaser = "TwitchAttackLaser";

		public static readonly string TwitchAttackGunLaser = "TwitchAttackGunLaser";

		public static readonly string TwitchAttackStart = "TwitchAttackStart";

		public static readonly string TwitchCaskHit = "TwitchCaskHit";

		public static readonly string TwitchCaskStart = "TwitchCaskStart";

		public static readonly string TwitchCharge = "TwitchCharge";

		public static readonly string TwitchCheese = "TwitchCheese";

		public static readonly string TwitchEnterStealth = "TwitchEnterStealth";

		public static readonly string TwitchExitStealth = "TwitchExitStealth";

		public static readonly string TwitchExpunge = "TwitchExpunge";

		public static readonly string TwitchExpungeHit = "TwitchExpungeHit";

		public static readonly string TwitchFireShotgun = "TwitchFireShotgun";

		public static readonly string TwitchGrenadeStart = "TwitchGrenadeStart";

		public static readonly string TwitchGrenadeTick = "TwitchGrenadeTick";

		public static readonly string TwitchHeal = "TwitchHeal";

		public static readonly string TwitchMenu = "TwitchMenu";

		public static readonly string TwitchThrowCask = "TwitchThrowCask";

		public static readonly string TwitchThrowGrenade = "TwitchThrowGrenade";
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.rob.Twitch", "Twitch", "2.4.0")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class Twitch : BaseUnityPlugin
	{
		public const string MODUID = "com.rob.Twitch";

		public static GameObject characterPrefab;

		public GameObject characterDisplay;

		public GameObject doppelganger;

		public static SkillDef ambushDef;

		public static SkillDef ambushActiveDef;

		public static SkillDef ambushRecastDef;

		public static GameObject boltProjectile;

		public static GameObject bulletProjectile;

		public static GameObject expungeProjectile;

		public static GameObject caskProjectile;

		public static GameObject venomPool;

		public static GameObject bazookaProjectile;

		public static GameObject grenadeProjectile;

		public static GameObject laserTracer;

		public static readonly Color characterColor = new Color(0.16f, 0.34f, 0.04f);

		public static readonly Color laserTracerColor = new Color(1.6f, 3.4f, 0.4f);

		private static readonly Color poisonColor = new Color(0.36f, 0.54f, 0.24f);

		private static Dictionary<string, GameObject> itemDisplayPrefabs = new Dictionary<string, GameObject>();

		public static ConfigEntry<bool> how;

		private static ConfigEntry<bool> boom;

		internal static BuffDef venomDebuff;

		internal static BuffDef ambushBuff;

		internal static BuffDef expungedDebuff;

		public static Twitch Instance { get; private set; }

		internal ItemDisplayRuleSet itemDisplayRuleSet { get; set; }

		internal List<KeyAssetRuleGroup> itemDisplayRules { get; set; }

		public UnlockableDef MasteryUnlockableDef { get; private set; }

		public UnlockableDef TarUnlockableDef { get; private set; }

		public UnlockableDef SimpleUnlockableDef { get; private set; }

		public static Material LaserTracerMaterial { get; private set; }

		private void Awake()
		{
			Instance = this;
			ReadConfig();
			Assets.PopulateAssets();
			RegisterStates();
			CreatePrefab();
			RegisterBuff();
			RegisterUnlockables();
			RegisterCharacter();
			RegisterHooks();
		}

		private void ReadConfig()
		{
			//IL_0010: 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_002b: Expected O, but got Unknown
			//IL_002b: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_005b: Expected O, but got Unknown
			how = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("01 - General Settings", "HOW"), false, new ConfigDescription("HOW IS THIS RAT", (AcceptableValueBase)null, Array.Empty<object>()));
			boom = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("01 - General Settings", "Boom"), false, new ConfigDescription("Enables Bazooka", (AcceptableValueBase)null, Array.Empty<object>()));
		}

		private void RegisterUnlockables()
		{
			LanguageAPI.Add("ROB_TWITCH_MASTERYUNLOCKABLE_ACHIEVEMENT_NAME", "Twitch: Mastery");
			LanguageAPI.Add("ROB_TWITCH_MASTERYUNLOCKABLE_ACHIEVEMENT_DESC", "As Twitch, beat the game or obliterate on Monsoon.");
			LanguageAPI.Add("ROB_TWITCH_MASTERYUNLOCKABLE_UNLOCKABLE_NAME", "Twitch: Mastery");
			LanguageAPI.Add("ROB_TWITCH_TARUNLOCKABLE_ACHIEVEMENT_NAME", "Twitch: Pest of Aphelia");
			LanguageAPI.Add("ROB_TWITCH_TARUNLOCKABLE_ACHIEVEMENT_DESC", "As Twitch, get killed by a Clay Dunestrider.");
			LanguageAPI.Add("ROB_TWITCH_TARUNLOCKABLE_UNLOCKABLE_NAME", "Twitch: Pest of Aphelia");
			LanguageAPI.Add("ROB_TWITCH_SIMPLEUNLOCKABLE_ACHIEVEMENT_NAME", "Twitch: Pestilence");
			LanguageAPI.Add("ROB_TWITCH_SIMPLEUNLOCKABLE_ACHIEVEMENT_DESC", "As Twitch, expunge 40 stacks of venom on a single target.");
			LanguageAPI.Add("ROB_TWITCH_SIMPLEUNLOCKABLE_UNLOCKABLE_NAME", "Twitch: Pestilence");
			MasteryUnlockableDef = UnlockableAPI.AddUnlockable<MasteryUnlockable>((Type)null, (UnlockableDef)null);
			TarUnlockableDef = UnlockableAPI.AddUnlockable<TarUnlockable>((Type)null, (UnlockableDef)null);
			SimpleUnlockableDef = UnlockableAPI.AddUnlockable<SimpleUnlockable>((Type)null, (UnlockableDef)null);
		}

		private void RegisterDot()
		{
		}

		private void RegisterHooks()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
			HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
		}

		private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self) && self.HasBuff(venomDebuff))
			{
				float num = 1f - 0.035f * (float)self.GetBuffCount(venomDebuff);
				if (num < 0.1f)
				{
					num = 0.1f;
				}
				Reflection.SetPropertyValue<float>((object)self, "attackSpeed", self.attackSpeed * num);
				Reflection.SetPropertyValue<float>((object)self, "armor", self.armor - 1.5f * (float)self.GetBuffCount(venomDebuff));
			}
			if (Object.op_Implicit((Object)(object)self) && self.HasBuff(ambushBuff))
			{
				Reflection.SetPropertyValue<float>((object)self, "attackSpeed", self.attackSpeed + 1f);
			}
			if (Object.op_Implicit((Object)(object)self) && self.HasBuff(ambushBuff))
			{
				int buffCount = self.GetBuffCount(expungedDebuff);
				float num2 = 1f - 0.045f * (float)buffCount;
				if (num2 < 0.1f)
				{
					num2 = 0.1f;
				}
				Reflection.SetPropertyValue<float>((object)self, "attackSpeed", self.attackSpeed * num2);
				Reflection.SetPropertyValue<float>((object)self, "armor", self.armor - (float)(5 * buffCount));
			}
		}

		private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo di)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Expected O, but got Unknown
			if ((Object)(object)di.attacker != (Object)null && (Object)(object)self != (Object)null && (Object)(object)((Component)self).GetComponent<CharacterBody>() != (Object)null)
			{
				if (((Enum)di.damageType).HasFlag((Enum)(object)(DamageType)1048576))
				{
					if (Object.op_Implicit((Object)(object)di.attacker.GetComponent<CharacterBody>()) && di.attacker.GetComponent<CharacterBody>().baseNameToken == "TWITCH_NAME")
					{
						di.damageType = (DamageType)0;
						if (!((Component)self).GetComponent<CharacterBody>().HasBuff(expungedDebuff))
						{
							((Component)self).GetComponent<CharacterBody>().AddTimedBuff(venomDebuff, 5f * di.procCoefficient);
						}
						if (Object.op_Implicit((Object)(object)di.attacker.GetComponent<TwitchController>()))
						{
							di.attacker.GetComponent<TwitchController>().RefundCooldown(di.procCoefficient);
						}
					}
				}
				else if (((Enum)di.damageType).HasFlag((Enum)(object)(DamageType)4096) && Object.op_Implicit((Object)(object)di.attacker.GetComponent<CharacterBody>()) && di.attacker.GetComponent<CharacterBody>().baseNameToken == "TWITCH_NAME")
				{
					di.damageType = (DamageType)0;
					Util.PlaySound(Sounds.TwitchExpungeHit, ((Component)self).gameObject);
					if (!((Component)self).GetComponent<CharacterBody>().HasBuff(expungedDebuff))
					{
						CharacterBody component = ((Component)self).GetComponent<CharacterBody>();
						if (component.HasBuff(venomDebuff))
						{
							int buffCount = component.GetBuffCount(venomDebuff);
							for (int i = 0; i < buffCount; i++)
							{
								component.AddBuff(expungedDebuff);
								component.RemoveBuff(venomDebuff);
								di.damage += di.attacker.GetComponent<CharacterBody>().damage * TwitchExpunge.damageBonus;
							}
							EffectManager.SpawnEffect(Resources.Load<GameObject>("Prefabs/Effects/ImpactEffects/BeetleSpitExplosion"), new EffectData
							{
								origin = ((Component)self).transform.position,
								scale = buffCount
							}, true);
						}
					}
				}
			}
			orig.Invoke(self, di);
		}

		private void RegisterBuff()
		{
			//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_001d: 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_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_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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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)
			BuffDef obj = ScriptableObject.CreateInstance<BuffDef>();
			obj.buffColor = poisonColor;
			obj.canStack = true;
			obj.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffBleedingIcon.tif").WaitForCompletion();
			obj.isDebuff = true;
			((Object)obj).name = "TwitchVenomDebuff";
			venomDebuff = obj;
			ContentAddition.AddBuffDef(obj);
			BuffDef obj2 = ScriptableObject.CreateInstance<BuffDef>();
			obj2.buffColor = characterColor;
			obj2.canStack = false;
			obj2.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texAttackIcon.png").WaitForCompletion();
			obj2.isDebuff = false;
			((Object)obj2).name = "TwitchAmbushBuff";
			ambushBuff = obj2;
			ContentAddition.AddBuffDef(obj2);
			BuffDef obj3 = ScriptableObject.CreateInstance<BuffDef>();
			obj3.buffColor = characterColor;
			obj3.canStack = true;
			obj3.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/DeathMark/texBuffDeathMarkIcon.tif").WaitForCompletion();
			obj3.isDebuff = true;
			((Object)obj3).name = "TwitchExpungedDebuff";
			expungedDebuff = obj3;
			ContentAddition.AddBuffDef(obj3);
		}

		private static GameObject CreateModel(GameObject main)
		{
			Object.Destroy((Object)(object)((Component)main.transform.Find("ModelBase")).gameObject);
			Object.Destroy((Object)(object)((Component)main.transform.Find("CameraPivot")).gameObject);
			Object.Destroy((Object)(object)((Component)main.transform.Find("AimOrigin")).gameObject);
			return Assets.MainAssetBundle.LoadAsset<GameObject>("mdlTwitch");
		}

		internal static void CreatePrefab()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_006e: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			//IL_0131: 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_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: 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_01b7: 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_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0513: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_055e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_060a: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0615: Unknown result type (might be due to invalid IL or missing references)
			//IL_0653: Unknown result type (might be due to invalid IL or missing references)
			//IL_0660: Unknown result type (might be due to invalid IL or missing references)
			//IL_0662: Unknown result type (might be due to invalid IL or missing references)
			//IL_078c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0791: Unknown result type (might be due to invalid IL or missing references)
			//IL_0871: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_094a: Unknown result type (might be due to invalid IL or missing references)
			//IL_095e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0963: Unknown result type (might be due to invalid IL or missing references)
			//IL_096a: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c7: Unknown result type (might be due to invalid IL or missing references)
			characterPrefab = PrefabAPI.InstantiateClone(Resources.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody"), "TwitchBody", true, "C:\\Users\\rseid\\Documents\\ror2mods\\Twitch\\Twitch\\Twitch.cs", "CreatePrefab", 305);
			characterPrefab.GetComponent<NetworkIdentity>().localPlayerAuthority = true;
			GameObject val = new GameObject("ModelBase");
			val.transform.parent = characterPrefab.transform;
			val.transform.localPosition = new Vector3(0f, -0.81f, 0f);
			val.transform.localRotation = Quaternion.identity;
			val.transform.localScale = new Vector3(1f, 1f, 1f);
			GameObject val2 = new GameObject("CameraPivot");
			val2.transform.parent = val.transform;
			val2.transform.localPosition = new Vector3(0f, 1.6f, 0f);
			val2.transform.localRotation = Quaternion.identity;
			val2.transform.localScale = Vector3.one;
			GameObject val3 = new GameObject("AimOrigin");
			val3.transform.parent = val.transform;
			val3.transform.localPosition = new Vector3(0f, 1.4f, 0f);
			val3.transform.localRotation = Quaternion.identity;
			val3.transform.localScale = Vector3.one;
			GameObject val4 = CreateModel(characterPrefab);
			Transform transform = val4.transform;
			transform.parent = val.transform;
			transform.localPosition = Vector3.zero;
			transform.localScale = new Vector3(0.01f, 0.01f, 0.01f);
			transform.localRotation = Quaternion.identity;
			CharacterDirection component = characterPrefab.GetComponent<CharacterDirection>();
			component.moveVector = Vector3.zero;
			component.targetTransform = val.transform;
			component.overrideAnimatorForwardTransform = null;
			component.rootMotionAccumulator = null;
			component.modelAnimator = val4.GetComponentInChildren<Animator>();
			component.driveFromRootRotation = false;
			component.turnSpeed = 720f;
			CharacterBody component2 = characterPrefab.GetComponent<CharacterBody>();
			((Object)component2).name = "TwitchBody";
			component2.baseNameToken = "TWITCH_NAME";
			component2.subtitleNameToken = "TWITCH_SUBTITLE";
			component2.bodyFlags = (BodyFlags)16;
			component2.rootMotionInMainState = false;
			component2.mainRootSpeed = 0f;
			component2.baseMaxHealth = 90f;
			component2.levelMaxHealth = 24f;
			component2.baseRegen = 0.5f;
			component2.levelRegen = 0.25f;
			component2.baseMaxShield = 0f;
			component2.levelMaxShield = 0f;
			component2.baseMoveSpeed = 7f;
			component2.levelMoveSpeed = 0f;
			component2.baseAcceleration =