Decompiled source of Deputy v0.3.0

plugins/Deputy.dll

Decompiled 7 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Deputy;
using Deputy.Components;
using Deputy.Modules;
using Deputy.Modules.Characters;
using Deputy.Modules.Survivors;
using EmotesAPI;
using EntityStates;
using EntityStates.BrotherMonster;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.Engi.EngiWeapon;
using EntityStates.EngiTurret.EngiTurretWeapon;
using EntityStates.Merc;
using HG;
using HG.BlendableTypes;
using KinematicCharacterController;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Achievements;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using Skillstates.Deputy;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Deputy")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Deputy")]
[assembly: AssemblyTitle("Deputy")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace Skillstates.Deputy
{
	internal class BulletHeaven : BaseState
	{
		public static float jumpDuration = 0.6f;

		public static float loopDuration = 3f;

		public static float jumpPower = 30f;

		public static float baseFireInterval = 0.1f;

		public static float damageCoefficient = Config.bulletHeavenDamage.Value;

		public static float minDampingStrength = 0.5f;

		public static float maxDampingStrength = 0.1f;

		public static float procCoefficient = Config.bulletHeavenProcCoefficient.Value;

		private Vector3 shootVector;

		private float previousAirControl;

		private int maxShots;

		private int currentShots;

		private float fireInterval;

		private float fireStopwatch;

		private float stopwatch;

		private bool isCrit;

		private float dampingStrength;

		private float dampingVelocity;

		private AimRequest aimRequest;

		private string muzzleIndex;

		public override void OnEnter()
		{
			//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_00f4: 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)
			((BaseState)this).OnEnter();
			fireInterval = baseFireInterval / base.attackSpeedStat;
			maxShots = Mathf.FloorToInt(loopDuration / fireInterval);
			dampingStrength = minDampingStrength;
			isCrit = ((BaseState)this).RollCrit();
			((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
			((EntityState)this).PlayCrossfade("FullBody, Override", "BulletHeaven Jump", "Flip.playbackRate", jumpDuration, 0.1f);
			if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams))
			{
				aimRequest = ((EntityState)this).cameraTargetParams.RequestAimType((AimType)2);
			}
			previousAirControl = ((EntityState)this).characterMotor.airControl;
			((EntityState)this).characterMotor.airControl = 1f;
			((EntityState)this).characterMotor.velocity.y = 0f;
			((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground();
			CharacterMotor characterMotor = ((EntityState)this).characterMotor;
			characterMotor.velocity += Vector3.up * jumpPower;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			fireStopwatch += Time.fixedDeltaTime;
			if (((EntityState)this).fixedAge >= jumpDuration)
			{
				stopwatch += Time.fixedDeltaTime;
				if (((EntityState)this).characterMotor.velocity.y <= 0f)
				{
					((EntityState)this).characterMotor.velocity.y *= 0.2f;
				}
				dampingStrength = Mathf.SmoothDamp(dampingStrength, maxDampingStrength, ref dampingVelocity, loopDuration);
				if (fireStopwatch >= fireInterval && currentShots < maxShots)
				{
					fireStopwatch = 0f;
					GetShootVector();
					FireAttack();
				}
			}
			if (stopwatch >= loopDuration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new BulletHeavenExit());
			}
		}

		public void GetShootVector()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Sin(Random.Range(0f, MathF.PI * 2f)) * dampingStrength;
			float num2 = Mathf.Cos(Random.Range(0f, MathF.PI * 2f)) * dampingStrength;
			shootVector = new Vector3(num, -1f, num2);
		}

		private void FireAttack()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_009b: 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_00b7: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: 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_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			if (currentShots % 2 == 0)
			{
				muzzleIndex = "MuzzleL";
			}
			else
			{
				muzzleIndex = "MuzzleR";
			}
			Util.PlaySound(FireBarrage.fireBarrageSoundString, ((EntityState)this).gameObject);
			EffectManager.SimpleMuzzleFlash(FireBarrage.effectPrefab, ((EntityState)this).gameObject, muzzleIndex, false);
			BulletAttack val = new BulletAttack
			{
				owner = ((EntityState)this).gameObject,
				weapon = ((EntityState)this).gameObject,
				origin = ((EntityState)this).characterBody.corePosition,
				aimVector = shootVector,
				minSpread = 0f,
				procCoefficient = procCoefficient,
				maxSpread = ((EntityState)this).characterBody.spreadBloomAngle,
				damage = damageCoefficient * base.damageStat,
				force = FirePistol2.force,
				tracerEffectPrefab = FireBarrage.tracerEffectPrefab,
				muzzleName = muzzleIndex,
				hitEffectPrefab = FireBarrage.hitEffectPrefab,
				isCrit = isCrit,
				radius = 8f,
				smartCollision = true,
				damageType = (DamageType)0,
				maxDistance = 120f,
				falloffModel = (FalloffModel)0
			};
			DamageAPI.AddModdedDamageType(val, DeputyPlugin.grantDeputyBuff);
			currentShots++;
			if (((EntityState)this).isAuthority)
			{
				val.Fire();
			}
		}

		public override void OnExit()
		{
			if (aimRequest != null)
			{
				aimRequest.Dispose();
			}
			((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
			((EntityState)this).characterMotor.airControl = previousAirControl;
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)1;
		}
	}
	internal class BulletHeavenExit : BaseState
	{
		public static float baseDuration = 1f;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			((EntityState)this).PlayCrossfade("FullBody, Override", "BulletHeaven Exit", "Flip.playbackRate", baseDuration, 0.1f);
		}

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

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)1;
		}
	}
	internal class BulletHeavenLoop : BaseState
	{
		public static float baseDuration = 2f;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterMotor.velocity.y *= 0.1f;
			}
			if (((EntityState)this).fixedAge >= baseDuration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new BulletHeavenExit());
			}
		}

		public override void OnExit()
		{
			((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	internal class CometBounce : BaseState
	{
		public static float baseDuration = 1f;

		internal Vector3 faceDirection;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			((EntityState)this).PlayAnimation("FullBody, Override", "Kick1", "Flip.playbackRate", baseDuration);
		}

		public override void FixedUpdate()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterDirection.forward = faceDirection;
				((EntityState)this).characterBody.isSprinting = true;
				if (((EntityState)this).fixedAge >= baseDuration)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)1;
		}
	}
	internal class CometBounceShoot : BaseState
	{
		public static float baseDuration = 1f;

		public static float preptime = 0.5f;

		public static float fireInterval = 0.15f;

		internal Vector3 faceDirection;

		private float fireTimer;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			((EntityState)this).PlayAnimation("FullBody, Override", "Kick1", "Flip.playbackRate", baseDuration);
		}

		public override void FixedUpdate()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterDirection.forward = faceDirection;
				((EntityState)this).characterBody.isSprinting = true;
				if (((EntityState)this).fixedAge >= baseDuration)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)1;
		}
	}
	internal class CometDash : BaseState
	{
		public static float baseDuration = 0.3f;

		public static float dashPower = 11f;

		public static float damageCoefficient = Config.cometDamageCoefficient.Value;

		public static float pushAwayForce = 30f;

		public static float pushAwayYFactor = 0.5f;

		private Ray aimRay;

		private Vector3 dashVector;

		private OverlapAttack attack;

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

		private bool hasHit;

		public override void OnEnter()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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_0154: 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_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Expected O, but got Unknown
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			aimRay = ((BaseState)this).GetAimRay();
			dashVector = ((Ray)(ref aimRay)).direction;
			((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			HitBoxGroup hitBoxGroup = null;
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == "Dash");
				TemporaryOverlay val = ((Component)modelTransform).gameObject.AddComponent<TemporaryOverlay>();
				val.duration = baseDuration * 3f;
				val.animateShaderAlpha = true;
				val.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
				val.destroyComponentOnEnd = true;
				val.originalMaterial = LegacyResourcesAPI.Load<Material>("Materials/matHuntressFlashBright");
				val.AddToCharacerModel(((Component)modelTransform).GetComponent<CharacterModel>());
			}
			attack = new OverlapAttack();
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.damageType = (DamageType)32;
			attack.procCoefficient = 1f;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.forceVector = Vector3.zero;
			attack.pushAwayForce = 1f;
			attack.damage = damageCoefficient * base.damageStat * GetDamageBoostFromSpeed();
			attack.hitBoxGroup = hitBoxGroup;
			attack.hitEffectPrefab = Assets.skullCrackerImpact;
			DamageAPI.AddModdedDamageType(attack, DeputyPlugin.grantDeputyBuff);
			DamageAPI.AddModdedDamageType(attack, DeputyPlugin.resetUtilityOnKill);
			EffectData val2 = new EffectData
			{
				origin = ((EntityState)this).characterBody.corePosition,
				rotation = Util.QuaternionSafeLookRotation(dashVector),
				scale = 3f
			};
			EffectManager.SpawnEffect(EvisDash.blinkPrefab, val2, false);
			EffectManager.SpawnEffect(BaseSlideState.slideEffectPrefab, val2, false);
			Util.PlaySound(EvisDash.endSoundString, ((EntityState)this).gameObject);
			((EntityState)this).PlayAnimation("FullBody, Override", "Dash");
			((EntityState)this).characterMotor.velocity.y = 0f;
			CharacterMotor characterMotor = ((EntityState)this).characterMotor;
			characterMotor.velocity += dashVector * (dashPower * base.moveSpeedStat);
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.HiddenInvincibility);
			}
		}

		public override void FixedUpdate()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterDirection.forward = dashVector;
				((EntityState)this).characterBody.isSprinting = true;
				if (attack.Fire(victimsStruck))
				{
					hasHit = true;
					((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground();
					Vector3 val = -((EntityState)this).characterDirection.forward;
					val.y = pushAwayYFactor;
					((EntityState)this).characterMotor.velocity = val * pushAwayForce;
					CometBounce nextState = new CometBounce
					{
						faceDirection = -val
					};
					((EntityState)this).outer.SetNextState((EntityState)(object)nextState);
				}
				if (((EntityState)this).fixedAge >= baseDuration)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		private float GetDamageBoostFromSpeed()
		{
			return Mathf.Max(1f, ((EntityState)this).characterBody.moveSpeed / ((EntityState)this).characterBody.baseMoveSpeed);
		}

		public override void OnExit()
		{
			//IL_0015: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			if (!hasHit)
			{
				CharacterMotor characterMotor = ((EntityState)this).characterMotor;
				characterMotor.velocity *= 0.2f;
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.HiddenInvincibility);
				((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, 0.3f);
			}
			((EntityState)this).PlayCrossfade("FullBody, Override", "BufferEmpty", 0.1f);
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)3;
		}
	}
	internal class DeputyMainState : GenericCharacterMain
	{
		private DeputyAnimatorController DAC;

		public override void OnEnter()
		{
			((GenericCharacterMain)this).OnEnter();
			DAC = ((EntityState)this).GetComponent<DeputyAnimatorController>();
		}

		public override void FixedUpdate()
		{
			((GenericCharacterMain)this).FixedUpdate();
		}

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

		public override void UpdateAnimationParameters()
		{
			((BaseCharacterMain)this).UpdateAnimationParameters();
			DAC.UpdateAnimationParams();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	internal class GunSling : BaseState
	{
		public static float baseDuration = 1f;

		public static float basePrepTime = 0.46f;

		public static float rotationAngle = 10f;

		private GameObject gunsMesh;

		private GameObject RevolverL;

		private GameObject RevolverR;

		private DeputyAnimatorController DAC;

		private Animator modelAnimator;

		private Ray aimRay;

		private float duration;

		private float prepTime;

		private bool hasFired;

		public override void OnEnter()
		{
			//IL_00d9: 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_00e5: 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_0102: Expected O, but got Unknown
			((BaseState)this).OnEnter();
			DAC = ((EntityState)this).GetComponent<DeputyAnimatorController>();
			duration = baseDuration / base.attackSpeedStat;
			prepTime = duration * basePrepTime;
			gunsMesh = ((Component)((BaseState)this).FindModelChild("GunsMesh")).gameObject;
			RevolverL = ((Component)((BaseState)this).FindModelChild("RevolverL")).gameObject;
			RevolverR = ((Component)((BaseState)this).FindModelChild("RevolverR")).gameObject;
			modelAnimator = ((EntityState)this).GetModelAnimator();
			modelAnimator.SetLayerWeight(modelAnimator.GetLayerIndex("AimYaw"), 0f);
			DAC.SetCombatState(DeputyAnimatorController.combatState.LeavingCombat);
			if (!((EntityState)this).characterMotor.isGrounded)
			{
				((BaseState)this).SmallHop(((EntityState)this).characterMotor, 10f);
				EffectData val = new EffectData
				{
					origin = ((EntityState)this).characterBody.footPosition,
					scale = ((EntityState)this).characterBody.radius
				};
				EffectManager.SpawnEffect(Assets.landImpactEffect, val, false);
			}
			Util.PlaySound("Play_bandit2_R_load", ((EntityState)this).gameObject);
			((EntityState)this).PlayCrossfade("FullBody, Override", "Gun Sling", "Hand.playbackRate", duration, 0.1f * duration);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			((BaseState)this).StartAimMode(Time.fixedDeltaTime, false);
			if (((EntityState)this).fixedAge >= prepTime && !hasFired)
			{
				ThrowGuns();
			}
			if (((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public void ThrowGuns()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_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)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00af: 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_00fb: 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_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_0134: 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_013a: 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_0150: Unknown result type (might be due to invalid IL or missing references)
			hasFired = true;
			gunsMesh.SetActive(false);
			RevolverL.SetActive(false);
			RevolverR.SetActive(false);
			aimRay = ((BaseState)this).GetAimRay();
			Vector3 val = Vector3.Cross(Vector3.up, ((Ray)(ref aimRay)).direction);
			Vector3 val2 = Vector3.Cross(val, ((Ray)(ref aimRay)).direction);
			Vector3 val3 = Quaternion.AngleAxis(0f - rotationAngle, val2) * ((Ray)(ref aimRay)).direction;
			Vector3 val4 = Quaternion.AngleAxis(rotationAngle, val2) * ((Ray)(ref aimRay)).direction;
			Util.PlaySound(FireMines.throwMineSoundString, ((EntityState)this).gameObject);
			FireProjectileInfo val5 = default(FireProjectileInfo);
			val5.crit = ((BaseState)this).RollCrit();
			val5.damage = RevolverProjectileBehavior.blastDamage * base.damageStat;
			val5.force = 100f;
			val5.owner = ((EntityState)this).gameObject;
			val5.position = ((Ray)(ref aimRay)).origin;
			val5.rotation = Util.QuaternionSafeLookRotation(val3);
			val5.projectilePrefab = Projectiles.revolverProjectile;
			if (((EntityState)this).isAuthority)
			{
				ProjectileManager.instance.FireProjectile(val5);
			}
			val5.rotation = Util.QuaternionSafeLookRotation(val4);
			if (((EntityState)this).isAuthority)
			{
				ProjectileManager.instance.FireProjectile(val5);
			}
		}

		public override void OnExit()
		{
			gunsMesh.SetActive(true);
			RevolverL.SetActive(true);
			RevolverR.SetActive(true);
			modelAnimator.SetLayerWeight(modelAnimator.GetLayerIndex("AimYaw"), 1f);
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	internal class ShootingStar : BaseState
	{
		public static float maxDuration = 2f;

		public static float minDuration = 1f;

		public static float damageCoefficient = Config.shootingStarDamage.Value;

		public static int maxShots = 4;

		public static float baseFireInterval = 0.18f;

		public static float prepTime = 0.2f;

		public static float jumpPower = 40f;

		public static float minYPower = 0.7f;

		private Animator modelAnimator;

		private BullseyeSearch search = new BullseyeSearch();

		private HurtBox bestCandidate;

		private bool isCrit;

		private float currentShots;

		private float fireIndex;

		private float fireTimer;

		private float yPower;

		private Vector3 jumpVector;

		private Vector3 jumpAngle;

		private Vector3 shootVector = Vector3.down;

		private string shootLayer;

		private string shootAnimName;

		private string muzzleIndex;

		public override void OnEnter()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			isCrit = ((BaseState)this).RollCrit();
			modelAnimator = ((EntityState)this).GetModelAnimator();
			modelAnimator.SetLayerWeight(modelAnimator.GetLayerIndex("AimYaw"), 0f);
			((EntityState)this).PlayAnimation("FullBody, Override", "Shooting Star", "Flip.playbackRate", maxDuration);
			jumpVector = ((((EntityState)this).inputBank.moveVector == Vector3.zero) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).inputBank.moveVector);
			((EntityState)this).characterDirection.forward = jumpVector;
			EffectData val = new EffectData();
			val.rotation = Util.QuaternionSafeLookRotation(jumpVector);
			val.origin = ((EntityState)this).characterBody.footPosition;
			EffectManager.SpawnEffect(Assets.shootingStarEffect, val, false);
			Ray aimRay = ((BaseState)this).GetAimRay();
			yPower = Mathf.Max(minYPower, ((Ray)(ref aimRay)).direction.y);
			jumpAngle = new Vector3(0f, yPower, 0f);
			jumpVector += jumpAngle;
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterDirection.forward = jumpVector;
				((EntityState)this).characterBody.isSprinting = true;
			}
			((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground();
			((EntityState)this).characterMotor.velocity.y = 0f;
			CharacterMotor characterMotor = ((EntityState)this).characterMotor;
			characterMotor.velocity += jumpVector * jumpPower;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			fireTimer += Time.fixedDeltaTime;
			if (((EntityState)this).fixedAge >= prepTime && fireTimer >= baseFireInterval && currentShots < (float)maxShots)
			{
				fireTimer = 0f;
				SearchForTarget();
				FireAttack();
			}
			if (((EntityState)this).isAuthority && (((EntityState)this).fixedAge >= maxDuration || (((EntityState)this).fixedAge >= minDuration && ((BaseCharacterController)((EntityState)this).characterMotor).Motor.GroundingStatus.IsStableOnGround)))
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void SearchForTarget()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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)
			search.teamMaskFilter = TeamMask.GetEnemyTeams(((EntityState)this).teamComponent.teamIndex);
			search.filterByLoS = true;
			search.searchOrigin = ((EntityState)this).characterBody.corePosition;
			search.searchDirection = Vector3.down;
			search.sortMode = (SortMode)1;
			search.maxDistanceFilter = 50f;
			search.maxAngleFilter = 80f;
			search.RefreshCandidates();
			search.FilterOutGameObject(((EntityState)this).gameObject);
			bestCandidate = search.GetResults().FirstOrDefault();
		}

		private void FireAttack()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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_012a: 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_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_013d: 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_0153: 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_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: 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_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_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: 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_01d5: 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_01dd: Expected O, but got Unknown
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			currentShots += 1f;
			if (Object.op_Implicit((Object)(object)bestCandidate) && bestCandidate.healthComponent.alive)
			{
				Vector3 val = ((Component)bestCandidate).transform.position - ((EntityState)this).characterBody.corePosition;
				shootVector = ((Vector3)(ref val)).normalized;
			}
			if (fireIndex % 2f == 0f)
			{
				shootLayer = "Left Arm, Additive";
				shootAnimName = "ShootL";
				muzzleIndex = "MuzzleL";
			}
			else
			{
				shootLayer = "Right Arm, Additive";
				shootAnimName = "ShootR";
				muzzleIndex = "MuzzleR";
			}
			Util.PlaySound(FireBarrage.fireBarrageSoundString, ((EntityState)this).gameObject);
			((EntityState)this).PlayAnimation(shootLayer, shootAnimName, "Hand.playbackRate", baseFireInterval);
			EffectManager.SimpleMuzzleFlash(FireBarrage.effectPrefab, ((EntityState)this).gameObject, muzzleIndex, false);
			BulletAttack val2 = new BulletAttack
			{
				owner = ((EntityState)this).gameObject,
				weapon = ((EntityState)this).gameObject,
				origin = ((EntityState)this).characterBody.corePosition,
				aimVector = shootVector,
				minSpread = 0f,
				maxSpread = ((EntityState)this).characterBody.spreadBloomAngle,
				damage = damageCoefficient * base.damageStat,
				force = FirePistol2.force,
				tracerEffectPrefab = FireBarrage.tracerEffectPrefab,
				muzzleName = muzzleIndex,
				hitEffectPrefab = FireBarrage.hitEffectPrefab,
				isCrit = isCrit,
				radius = 2f,
				smartCollision = true,
				damageType = (DamageType)32,
				maxDistance = 80f,
				falloffModel = (FalloffModel)0
			};
			DamageAPI.AddModdedDamageType(val2, DeputyPlugin.grantDeputyBuff);
			if (((EntityState)this).isAuthority)
			{
				val2.Fire();
			}
			fireIndex += 1f;
		}

		public override void OnExit()
		{
			((EntityState)this).PlayAnimation("Fullbody, Override", "BufferEmpty");
			modelAnimator.SetLayerWeight(modelAnimator.GetLayerIndex("AimYaw"), 1f);
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)1;
		}
	}
	internal class SkillTemplate : BaseState
	{
		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
		}

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

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	internal class TriggerTap : BaseSkillState, IStepSetter
	{
		public static float damageCoefficient = Config.primaryDamage.Value;

		public static float baseDuration = 0.3f;

		private DeputyAnimatorController DAC;

		private BulletAttack bulletAttack;

		private string layerName;

		private string muzzleIndex;

		private string animationName = "Shoot";

		private int fireIndex;

		private float duration;

		private Ray aimRay;

		public override void OnEnter()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: 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_0170: 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_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_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_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: 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_0230: Expected O, but got Unknown
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			DAC = ((EntityState)this).GetComponent<DeputyAnimatorController>();
			DAC.SetCombatState(DeputyAnimatorController.combatState.EnteringCombat);
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			aimRay = ((BaseState)this).GetAimRay();
			if (((EntityState)this).characterBody.isSprinting)
			{
				animationName = "Sprint" + animationName;
			}
			else
			{
				((BaseState)this).StartAimMode(1f, false);
			}
			if (fireIndex % 2 == 0)
			{
				layerName = "Left Arm, Additive";
				animationName += "L";
				muzzleIndex = "MuzzleL";
			}
			else
			{
				layerName = "Right Arm, Additive";
				animationName += "R";
				muzzleIndex = "MuzzleR";
			}
			((EntityState)this).PlayAnimation(layerName, animationName, "Hand.playbackRate", duration);
			Util.PlaySound("Play_bandit_M1_shot", ((EntityState)this).gameObject);
			EffectManager.SimpleMuzzleFlash(FirePistol2.muzzleEffectPrefab, ((EntityState)this).gameObject, muzzleIndex, false);
			((BaseState)this).AddRecoil(-0.4f * FirePistol2.recoilAmplitude, -0.8f * FirePistol2.recoilAmplitude, -0.3f * FirePistol2.recoilAmplitude, 0.3f * FirePistol2.recoilAmplitude);
			bulletAttack = new BulletAttack
			{
				owner = ((EntityState)this).gameObject,
				weapon = ((EntityState)this).gameObject,
				origin = ((Ray)(ref aimRay)).origin,
				aimVector = ((Ray)(ref aimRay)).direction,
				minSpread = 0f,
				maxSpread = ((EntityState)this).characterBody.spreadBloomAngle,
				damage = damageCoefficient * ((BaseState)this).damageStat,
				force = FirePistol2.force,
				tracerEffectPrefab = Assets.deputyTracerEffect,
				muzzleName = muzzleIndex,
				hitEffectPrefab = FirePistol2.hitEffectPrefab,
				isCrit = ((BaseState)this).RollCrit(),
				radius = FireBarrage.bulletRadius,
				smartCollision = true,
				maxDistance = 60f,
				falloffModel = (FalloffModel)0
			};
			DamageAPI.AddModdedDamageType(bulletAttack, DeputyPlugin.grantDeputyBuff);
			if (((EntityState)this).isAuthority)
			{
				bulletAttack.Fire();
			}
		}

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

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)1;
		}

		public void SetStep(int i)
		{
			fireIndex = i;
		}
	}
}
namespace Deputy
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Bog.Deputy", "Deputy", "0.3.0")]
	[R2APISubmoduleDependency(new string[] { "PrefabAPI", "LanguageAPI", "SoundAPI", "UnlockableAPI", "DamageAPI" })]
	public class DeputyPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.Bog.Deputy";

		public const string MODNAME = "Deputy";

		public const string MODVERSION = "0.3.0";

		public const string DEVELOPER_PREFIX = "BOG";

		public static DeputyPlugin instance;

		public static PluginInfo PInfo;

		public static GameObject deputyBodyPrefab;

		public static BodyIndex deputyBodyIndex;

		public static ModdedDamageType grantDeputyBuff;

		public static ModdedDamageType resetUtilityOnKill;

		private void Awake()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			PInfo = ((BaseUnityPlugin)this).Info;
			Config.ReadConfig(this);
			Assets.Initialize();
			States.RegisterStates();
			Buffs.RegisterBuffs();
			Projectiles.RegisterProjectiles();
			Tokens.AddTokens();
			ItemDisplays.PopulateDisplays();
			grantDeputyBuff = DamageAPI.ReserveDamageType();
			resetUtilityOnKill = DamageAPI.ReserveDamageType();
			new Deputy.Modules.Survivors.Deputy().Initialize();
			new ContentPacks().Initialize();
			Subscriptions();
			Hook();
		}

		private void Start()
		{
			Assets.LoadSoundbank();
		}

		private void Subscriptions()
		{
		}

		private void Hook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			BodyCatalog.SetBodyPrefabs += new hook_SetBodyPrefabs(BodyCatalog_SetBodyPrefabs);
			if (Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.CustomEmotesAPI"))
			{
				SurvivorCatalog.Init += new hook_Init(SurvivorCatalog_Init);
			}
			GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(GlobalEventManager_OnHitEnemy);
			CharacterBody.AddTimedBuff_BuffDef_float += new hook_AddTimedBuff_BuffDef_float(CharacterBody_AddTimedBuff_BuffDef_float);
			CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
		}

		private void SurvivorCatalog_Init(orig_Init orig)
		{
			orig.Invoke();
			SurvivorDef[] survivorDefs = SurvivorCatalog.survivorDefs;
			foreach (SurvivorDef val in survivorDefs)
			{
				if (((Object)val.bodyPrefab).name == "DeputyBody")
				{
					GameObject val2 = Assets.mainAssetBundle.LoadAsset<GameObject>("DeputyHumanoidSkeleton");
					CustomEmotesAPI.ImportArmature(val.bodyPrefab, val2, 0, true);
					val2.GetComponentInChildren<BoneMapper>().scale = 1.5f;
				}
			}
		}

		private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			self.moveSpeed *= 1f + (float)self.GetBuffCount(Buffs.deputyBuff) * Config.msPerStack.Value;
		}

		private void CharacterBody_AddTimedBuff_BuffDef_float(orig_AddTimedBuff_BuffDef_float orig, CharacterBody self, BuffDef buffDef, float duration)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if (buffDef.buffIndex == Buffs.deputyBuff.buffIndex)
			{
				if (self.GetBuffCount(buffDef) > 0)
				{
					foreach (TimedBuff timedBuff in self.timedBuffs)
					{
						if (timedBuff.buffIndex == buffDef.buffIndex)
						{
							timedBuff.timer = duration;
						}
					}
				}
				if (self.GetBuffCount(buffDef) >= Config.maxStacks.Value)
				{
					return;
				}
			}
			orig.Invoke(self, buffDef, duration);
		}

		private void BodyCatalog_SetBodyPrefabs(orig_SetBodyPrefabs orig, GameObject[] newBodyPrefabs)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(newBodyPrefabs);
			deputyBodyIndex = BodyCatalog.FindBodyIndex(deputyBodyPrefab);
			Log.Warning("Deputy's body index is: " + ((object)(BodyIndex)(ref deputyBodyIndex)).ToString());
		}

		private void GlobalEventManager_OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_000d: 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)
			orig.Invoke(self, damageInfo, victim);
			if (DamageAPI.HasModdedDamageType(damageInfo, grantDeputyBuff) && Object.op_Implicit((Object)(object)damageInfo.attacker) && !damageInfo.rejected)
			{
				CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && component.bodyIndex == deputyBodyIndex && NetworkServer.active)
				{
					component.AddTimedBuff(Buffs.deputyBuff, Config.msBuffDuration.Value);
				}
			}
		}
	}
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}
namespace Deputy.Modules
{
	internal static class Assets
	{
		internal static AssetBundle mainAssetBundle;

		internal static NetworkSoundEventDef swordHitSoundEvent;

		internal static Shader hotpoo = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/HGStandard");

		internal static Material commandoMat;

		private static string[] assetNames = new string[0];

		private const string assetFolder = "DeputyAssetBundle";

		private const string assetbundleName = "deputyassets";

		private const string soundbankFolder = "DeputySoundbanks";

		private const string soundbankName = "DeputyBank.bnk";

		private const string csProjName = "Deputy";

		internal static GameObject landImpactEffect;

		internal static GameObject deputyTracerEffect;

		internal static GameObject shootingStarEffect;

		internal static GameObject deputyBulletImpact;

		internal static GameObject skullCrackerImpact;

		public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(DeputyPlugin.PInfo.Location), "DeputyAssetBundle", "deputyassets");

		public static string SoundBankPath => Path.Combine(Path.GetDirectoryName(DeputyPlugin.PInfo.Location), "DeputySoundbanks");

		internal static void Initialize()
		{
			bool flag = false;
			LoadAssetBundle();
			PopulateAssets();
		}

		internal static void LoadAssetBundle()
		{
			try
			{
				if ((Object)(object)mainAssetBundle == (Object)null)
				{
					mainAssetBundle = AssetBundle.LoadFromFile(AssetBundlePath);
				}
				if (Object.op_Implicit((Object)(object)mainAssetBundle))
				{
					Log.Warning("Deputy asset bundle loaded succesfully");
				}
			}
			catch (Exception ex)
			{
				Log.Error("Failed to load assetbundle. Make sure your assetbundle name is setup correctly\n" + ex);
				return;
			}
			assetNames = mainAssetBundle.GetAllAssetNames();
		}

		internal static void LoadSoundbank()
		{
			//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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Invalid comparison between Unknown and I4
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Invalid comparison between Unknown and I4
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			AKRESULT val = AkSoundEngine.AddBasePath(SoundBankPath);
			if ((int)val == 1)
			{
				Log.Warning("Added bank base path : " + SoundBankPath);
			}
			else
			{
				Log.Error("Error adding base path : " + SoundBankPath + " " + $"Error code : {val}");
			}
			uint num = default(uint);
			val = AkSoundEngine.LoadBank("DeputyBank.bnk", ref num);
			if ((int)val == 1)
			{
				Log.Warning("Added bank : DeputyBank.bnk");
			}
			else
			{
				Log.Error("Error loading bank : DeputyBank.bnk " + $"Error code : {val}");
			}
		}

		internal static void PopulateAssets()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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)
			if (!Object.op_Implicit((Object)(object)mainAssetBundle))
			{
				Log.Error("There is no AssetBundle to load assets from.");
				return;
			}
			landImpactEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/CharacterLandImpact.prefab").WaitForCompletion();
			deputyTracerEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/GoldGat/TracerGoldGat.prefab").WaitForCompletion();
			shootingStarEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/JumpBoost/BoostJumpEffect.prefab").WaitForCompletion();
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Commando/HitsparkCommando.prefab").WaitForCompletion();
			deputyBulletImpact = PrefabAPI.InstantiateClone(val, "HitsparkDeputy");
			if (Config.bulletRicochet.Value)
			{
				Log.Warning("Adding deputy bullet effect: " + (object)deputyBulletImpact);
				AddNewEffectDef(deputyBulletImpact, "DeputyRicochet");
			}
			skullCrackerImpact = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Loader/OmniImpactVFXLoader.prefab").WaitForCompletion(), "SkullCrackerImpact");
			AddNewEffectDef(skullCrackerImpact, "DeputyKick");
		}

		private static GameObject CreateTracer(string originalTracerName, string newTracerName)
		{
			if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null)
			{
				return null;
			}
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true);
			if (!Object.op_Implicit((Object)(object)val.GetComponent<EffectComponent>()))
			{
				val.AddComponent<EffectComponent>();
			}
			if (!Object.op_Implicit((Object)(object)val.GetComponent<VFXAttributes>()))
			{
				val.AddComponent<VFXAttributes>();
			}
			if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>()))
			{
				val.AddComponent<NetworkIdentity>();
			}
			val.GetComponent<Tracer>().speed = 250f;
			val.GetComponent<Tracer>().length = 50f;
			AddNewEffectDef(val);
			return val;
		}

		internal static NetworkSoundEventDef CreateNetworkSoundEventDef(string eventName)
		{
			NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>();
			val.akId = AkSoundEngine.GetIDFromString(eventName);
			val.eventName = eventName;
			Content.AddNetworkSoundEventDef(val);
			return val;
		}

		internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert)
		{
			if (!Object.op_Implicit((Object)(object)objectToConvert))
			{
				return;
			}
			Renderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				if (val != null)
				{
					val.material?.SetHopooMaterial();
				}
			}
		}

		internal static RendererInfo[] SetupRendererInfos(GameObject obj)
		{
			//IL_001a: 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_0049: 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)
			MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>();
			RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length];
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				array[i] = new RendererInfo
				{
					defaultMaterial = ((Renderer)componentsInChildren[i]).material,
					renderer = (Renderer)(object)componentsInChildren[i],
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false
				};
			}
			return array;
		}

		public static GameObject LoadSurvivorModel(string modelName)
		{
			GameObject val = mainAssetBundle.LoadAsset<GameObject>(modelName);
			if ((Object)(object)val == (Object)null)
			{
				Log.Error("Trying to load a null model- check to see if the name in your code matches the name of the object in Unity");
				return null;
			}
			return PrefabAPI.InstantiateClone(val, ((Object)val).name, false);
		}

		internal static Texture LoadCharacterIconGeneric(string characterName)
		{
			return mainAssetBundle.LoadAsset<Texture>("tex" + characterName + "Icon");
		}

		internal static GameObject LoadCrosshair(string crosshairName)
		{
			if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair") == (Object)null)
			{
				return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair");
			}
			return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair");
		}

		private static GameObject LoadEffect(string resourceName)
		{
			return LoadEffect(resourceName, "", parentToTransform: false);
		}

		private static GameObject LoadEffect(string resourceName, string soundName)
		{
			return LoadEffect(resourceName, soundName, parentToTransform: false);
		}

		private static GameObject LoadEffect(string resourceName, bool parentToTransform)
		{
			return LoadEffect(resourceName, "", parentToTransform);
		}

		private static GameObject LoadEffect(string resourceName, string soundName, bool parentToTransform)
		{
			//IL_0091: 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)
			bool flag = false;
			for (int i = 0; i < assetNames.Length; i++)
			{
				if (assetNames[i].Contains(resourceName.ToLowerInvariant()))
				{
					flag = true;
					i = assetNames.Length;
				}
			}
			if (!flag)
			{
				Log.Error("Failed to load effect: " + resourceName + " because it does not exist in the AssetBundle");
				return null;
			}
			GameObject val = mainAssetBundle.LoadAsset<GameObject>(resourceName);
			val.AddComponent<DestroyOnTimer>().duration = 12f;
			val.AddComponent<NetworkIdentity>();
			val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
			EffectComponent val2 = val.AddComponent<EffectComponent>();
			val2.applyScale = false;
			val2.effectIndex = (EffectIndex)(-1);
			val2.parentToReferencedTransform = parentToTransform;
			val2.positionAtReferencedTransform = true;
			val2.soundName = soundName;
			AddNewEffectDef(val, soundName);
			return val;
		}

		private static void AddNewEffectDef(GameObject effectPrefab)
		{
			AddNewEffectDef(effectPrefab, "");
		}

		private static void AddNewEffectDef(GameObject effectPrefab, string soundName)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			EffectDef val = new EffectDef();
			val.prefab = effectPrefab;
			val.prefabEffectComponent = effectPrefab.GetComponent<EffectComponent>();
			val.prefabName = ((Object)effectPrefab).name;
			val.prefabVfxAttributes = effectPrefab.GetComponent<VFXAttributes>();
			val.spawnSoundEventName = soundName;
			Content.AddEffectDef(val);
		}
	}
	public static class Buffs
	{
		internal static BuffDef deputyBuff;

		internal static void RegisterBuffs()
		{
			//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_001f: Unknown result type (might be due to invalid IL or missing references)
			BuffDef val = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/SprintOutOfCombat/bdWhipBoost.asset").WaitForCompletion();
			deputyBuff = AddNewBuff("DeputyMS", val.iconSprite, Color.yellow, canStack: true, isDebuff: false);
		}

		internal static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			((Object)val).name = buffName;
			val.buffColor = buffColor;
			val.canStack = canStack;
			val.isDebuff = isDebuff;
			val.eliteDef = null;
			val.iconSprite = buffIcon;
			Content.AddBuffDef(val);
			return val;
		}
	}
	public static class Config
	{
		public static ConfigEntry<bool> bulletRicochet;

		public static string passiveTitle = "Passive";

		public static ConfigEntry<int> maxStacks;

		public static ConfigEntry<float> msPerStack;

		public static ConfigEntry<float> msBuffDuration;

		public static string primaryTitle = "Primary";

		public static ConfigEntry<float> primaryDamage;

		public static string secondaryTitle = "Secondary";

		public static ConfigEntry<float> gunSlingBulletDamage;

		public static ConfigEntry<float> gunSlingProcCoefficient;

		public static ConfigEntry<float> gunSlingBlastDamage;

		public static string utilityTitle = "Utility";

		public static ConfigEntry<float> shootingStarDamage;

		public static string specialTitle = "Special";

		public static ConfigEntry<float> cometDamageCoefficient;

		public static ConfigEntry<float> bulletHeavenDamage;

		public static ConfigEntry<float> bulletHeavenProcCoefficient;

		public static void ReadConfig(DeputyPlugin plugin)
		{
			bulletRicochet = ((BaseUnityPlugin)plugin).Config.Bind<bool>("General", "Enable Bullet Ricochet SFX", false, "Enable this for wacky cartoony bullet ricochet SFX");
			maxStacks = ((BaseUnityPlugin)plugin).Config.Bind<int>(passiveTitle, "Hot Pursuit Max Stacks", 50, "Maximum stacks of Hot Pursuit");
			msPerStack = ((BaseUnityPlugin)plugin).Config.Bind<float>(passiveTitle, "Hot Pursuit MS per stack", 0.01f, "Bonus movement speed multiplier per stack of Hot Pursuit");
			msBuffDuration = ((BaseUnityPlugin)plugin).Config.Bind<float>(passiveTitle, "Hot Pursuit Stack Duration", 5f, "Duration of Hot Pursuit buff in seconds");
			primaryDamage = ((BaseUnityPlugin)plugin).Config.Bind<float>(primaryTitle, "Trigger Tap Damage Coefficient", 1.5f, "Damage coefficient of Trigger Tap");
			gunSlingBulletDamage = ((BaseUnityPlugin)plugin).Config.Bind<float>(secondaryTitle, "Gun Sling Gunshot Damage Coefficient", 1f, "Damage coefficient of Gun Sling's gunshots");
			gunSlingProcCoefficient = ((BaseUnityPlugin)plugin).Config.Bind<float>(secondaryTitle, "Gun Sling Gunshot Proc Coefficient", 0.7f, "Proc coefficient of Gun Sling's gunshots");
			gunSlingBlastDamage = ((BaseUnityPlugin)plugin).Config.Bind<float>(secondaryTitle, "Gun Sling Explosion Damage Coefficient", 3f, "Damage coefficient of Gun Sling's explosion");
			shootingStarDamage = ((BaseUnityPlugin)plugin).Config.Bind<float>(utilityTitle, "Shooting Star Damage Coefficient", 1.5f, "Damage coefficient of Shooting Star");
			cometDamageCoefficient = ((BaseUnityPlugin)plugin).Config.Bind<float>(specialTitle, "Crashing Comet Damage Coefficient", 8f, "Damage coefficient of Crashing Comet");
			bulletHeavenDamage = ((BaseUnityPlugin)plugin).Config.Bind<float>(specialTitle, "Bullet Heaven Damage Coefficient", 1.5f, "Damage coefficient of Bullet Heaven");
			bulletHeavenProcCoefficient = ((BaseUnityPlugin)plugin).Config.Bind<float>(specialTitle, "Bullet Heaven Proc Coefficient", 0.7f, "Damage coefficient of Bullet Heaven");
		}

		public static ConfigEntry<bool> CharacterEnableConfig(string characterName, string description = "Set to false to disable this character", bool enabledDefault = true)
		{
			return ((BaseUnityPlugin)DeputyPlugin.instance).Config.Bind<bool>("General", "Enable " + characterName, enabledDefault, description);
		}
	}
	internal class ContentPacks : IContentPackProvider
	{
		internal ContentPack contentPack = new ContentPack();

		public static List<GameObject> bodyPrefabs = new List<GameObject>();

		public static List<GameObject> masterPrefabs = new List<GameObject>();

		public static List<GameObject> projectilePrefabs = new List<GameObject>();

		public static List<SurvivorDef> survivorDefs = new List<SurvivorDef>();

		public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>();

		public static List<SkillFamily> skillFamilies = new List<SkillFamily>();

		public static List<SkillDef> skillDefs = new List<SkillDef>();

		public static List<Type> entityStates = new List<Type>();

		public static List<BuffDef> buffDefs = new List<BuffDef>();

		public static List<EffectDef> effectDefs = new List<EffectDef>();

		public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>();

		public string identifier => "com.Bog.Deputy";

		public void Initialize()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
		}

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)this);
		}

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			contentPack.identifier = identifier;
			contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray());
			contentPack.masterPrefabs.Add(masterPrefabs.ToArray());
			contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray());
			contentPack.survivorDefs.Add(survivorDefs.ToArray());
			contentPack.unlockableDefs.Add(unlockableDefs.ToArray());
			contentPack.skillDefs.Add(skillDefs.ToArray());
			contentPack.skillFamilies.Add(skillFamilies.ToArray());
			contentPack.entityStateTypes.Add(entityStates.ToArray());
			contentPack.buffDefs.Add(buffDefs.ToArray());
			contentPack.effectDefs.Add(effectDefs.ToArray());
			contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray());
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
	internal class Content
	{
		public static void AddCharacterBodyPrefab(GameObject bprefab)
		{
			ContentPacks.bodyPrefabs.Add(bprefab);
		}

		public static void AddMasterPrefab(GameObject prefab)
		{
			ContentPacks.masterPrefabs.Add(prefab);
		}

		public static void AddProjectilePrefab(GameObject prefab)
		{
			ContentPacks.projectilePrefabs.Add(prefab);
		}

		public static void AddSurvivorDef(SurvivorDef survivorDef)
		{
			ContentPacks.survivorDefs.Add(survivorDef);
		}

		public static void AddUnlockableDef(UnlockableDef unlockableDef)
		{
			ContentPacks.unlockableDefs.Add(unlockableDef);
		}

		public static void AddSkillDef(SkillDef skillDef)
		{
			ContentPacks.skillDefs.Add(skillDef);
		}

		public static void AddSkillFamily(SkillFamily skillFamily)
		{
			ContentPacks.skillFamilies.Add(skillFamily);
		}

		public static void AddEntityState(Type entityState)
		{
			ContentPacks.entityStates.Add(entityState);
		}

		public static void AddBuffDef(BuffDef buffDef)
		{
			ContentPacks.buffDefs.Add(buffDef);
		}

		public static void AddEffectDef(EffectDef effectDef)
		{
			ContentPacks.effectDefs.Add(effectDef);
		}

		public static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef)
		{
			ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef);
		}
	}
	internal static class Helpers
	{
		internal const string agilePrefix = "<style=cIsUtility>Agile.</style> ";

		internal static string ScepterDescription(string desc)
		{
			return "\n<color=#d299ff>SCEPTER: " + desc + "</color>";
		}

		public static T[] Append<T>(ref T[] array, List<T> list)
		{
			int num = array.Length;
			int count = list.Count;
			Array.Resize(ref array, num + count);
			list.CopyTo(array, num);
			return array;
		}

		public static Func<T[], T[]> AppendDel<T>(List<T> list)
		{
			return (T[] r) => Append(ref r, list);
		}
	}
	internal static class ItemDisplays
	{
		private static Dictionary<string, GameObject> itemDisplayPrefabs = new Dictionary<string, GameObject>();

		internal static void PopulateDisplays()
		{
			PopulateFromBody("MageBody");
			PopulateFromBody("LunarExploderBody");
			PopulateCustomLightningArm();
		}

		private static void PopulateFromBody(string bodyName)
		{
			ItemDisplayRuleSet itemDisplayRuleSet = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyName).GetComponent<ModelLocator>().modelTransform).GetComponent<CharacterModel>().itemDisplayRuleSet;
			KeyAssetRuleGroup[] keyAssetRuleGroups = itemDisplayRuleSet.keyAssetRuleGroups;
			for (int i = 0; i < keyAssetRuleGroups.Length; i++)
			{
				ItemDisplayRule[] rules = keyAssetRuleGroups[i].displayRuleGroup.rules;
				for (int j = 0; j < rules.Length; j++)
				{
					GameObject followerPrefab = rules[j].followerPrefab;
					if (Object.op_Implicit((Object)(object)followerPrefab))
					{
						string key = ((Object)followerPrefab).name?.ToLowerInvariant();
						if (!itemDisplayPrefabs.ContainsKey(key))
						{
							itemDisplayPrefabs[key] = followerPrefab;
						}
					}
				}
			}
		}

		private static void PopulateCustomLightningArm()
		{
			GameObject val = PrefabAPI.InstantiateClone(itemDisplayPrefabs["displaylightningarmright"], "DisplayLightningCustom", false);
			LimbMatcher component = val.GetComponent<LimbMatcher>();
			component.limbPairs[0].targetChildLimb = "LightningArm1";
			component.limbPairs[1].targetChildLimb = "LightningArm2";
			component.limbPairs[2].targetChildLimb = "LightningArmEnd";
			itemDisplayPrefabs["displaylightningarmcustom"] = val;
		}

		public static GameObject LoadDisplay(string name)
		{
			if (itemDisplayPrefabs.ContainsKey(name.ToLowerInvariant()) && Object.op_Implicit((Object)(object)itemDisplayPrefabs[name.ToLowerInvariant()]))
			{
				return itemDisplayPrefabs[name.ToLowerInvariant()];
			}
			Log.Error("item display " + name + " returned null");
			return null;
		}
	}
	internal static class Materials
	{
		private static List<Material> cachedMaterials = new List<Material>();

		public static Material CreateHopooMaterial(string materialName)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			Material val = cachedMaterials.Find(delegate(Material mat)
			{
				materialName.Replace(" (Instance)", "");
				return ((Object)mat).name.Contains(materialName);
			});
			if (Object.op_Implicit((Object)(object)val))
			{
				return val;
			}
			val = Assets.mainAssetBundle.LoadAsset<Material>(materialName);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Error("Failed to load material: " + materialName + " - Check to see that the material in your Unity project matches this name");
				return new Material(Assets.hotpoo);
			}
			return val.SetHopooMaterial();
		}

		public static Material SetHopooMaterial(this Material tempMat)
		{
			//IL_006f: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			if (cachedMaterials.Contains(tempMat))
			{
				return tempMat;
			}
			float? num = null;
			float? num2 = null;
			Color? val = null;
			if (tempMat.IsKeywordEnabled("_NORMALMAP"))
			{
				num = tempMat.GetFloat("_BumpScale");
			}
			if (tempMat.IsKeywordEnabled("_EMISSION"))
			{
				val = tempMat.GetColor("_EmissionColor");
			}
			if (tempMat.IsKeywordEnabled("CUTOUT"))
			{
				num2 = tempMat.GetFloat("_Cutoff");
			}
			tempMat.shader = Assets.hotpoo;
			tempMat.SetColor("_Color", tempMat.GetColor("_Color"));
			tempMat.SetTexture("_MainTex", tempMat.GetTexture("_MainTex"));
			tempMat.SetTexture("_EmTex", tempMat.GetTexture("_EmissionMap"));
			tempMat.EnableKeyword("DITHER");
			if (num.HasValue)
			{
				tempMat.SetFloat("_NormalStrength", num.Value);
			}
			if (val.HasValue)
			{
				tempMat.SetColor("_EmColor", val.Value);
				tempMat.SetFloat("_EmPower", 1f);
			}
			if (num2.HasValue)
			{
				tempMat.EnableKeyword("CUTOUT");
				tempMat.SetFloat("_Cutoff", num2.Value);
			}
			if (tempMat.IsKeywordEnabled("NOCULL"))
			{
				tempMat.SetInt("_Cull", 0);
			}
			if (tempMat.IsKeywordEnabled("LIMBREMOVAL"))
			{
				tempMat.SetInt("_LimbRemovalOn", 1);
			}
			cachedMaterials.Add(tempMat);
			return tempMat;
		}

		public static Material MakeUnique(this Material material)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (cachedMaterials.Contains(material))
			{
				return new Material(material);
			}
			return material;
		}

		public static Material SetColor(this Material material, Color color)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			material.SetColor("_Color", color);
			return material;
		}

		public static Material SetNormal(this Material material, float normalStrength = 1f)
		{
			material.SetFloat("_NormalStrength", normalStrength);
			return material;
		}

		public static Material SetEmission(this Material material)
		{
			return material.SetEmission(1f);
		}

		public static Material SetEmission(this Material material, float emission)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return material.SetEmission(emission, Color.white);
		}

		public static Material SetEmission(this Material material, float emission, Color emissionColor)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			material.SetFloat("_EmPower", emission);
			material.SetColor("_EmColor", emissionColor);
			return material;
		}

		public static Material SetCull(this Material material, bool cull = false)
		{
			material.SetInt("_Cull", cull ? 1 : 0);
			return material;
		}
	}
	internal static class Prefabs
	{
		private static PhysicMaterial ragdollMaterial;

		public static GameObject CreateDisplayPrefab(string displayModelName, GameObject prefab, BodyInfo bodyInfo)
		{
			GameObject val = Assets.LoadSurvivorModel(displayModelName);
			CharacterModel val2 = val.GetComponent<CharacterModel>();
			if (!Object.op_Implicit((Object)(object)val2))
			{
				val2 = val.AddComponent<CharacterModel>();
			}
			val2.baseRendererInfos = prefab.GetComponentInChildren<CharacterModel>().baseRendererInfos;
			Assets.ConvertAllRenderersToHopooShader(val);
			return val.gameObject;
		}

		public static GameObject CreateBodyPrefab(string bodyName, string modelName, BodyInfo bodyInfo)
		{
			//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_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyInfo.bodyNameToClone + "Body");
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Error(bodyInfo.bodyNameToClone + "Body is not a valid body, character creation failed");
				return null;
			}
			GameObject val2 = PrefabAPI.InstantiateClone(val, bodyName);
			Transform val3 = null;
			GameObject val4 = null;
			if (modelName != "mdl")
			{
				val4 = Assets.LoadSurvivorModel(modelName);
				if ((Object)(object)val4 == (Object)null)
				{
					val4 = ((Component)val2.GetComponentInChildren<CharacterModel>()).gameObject;
				}
				val3 = AddCharacterModelToSurvivorBody(val2, val4.transform, bodyInfo);
			}
			CharacterBody component = val2.GetComponent<CharacterBody>();
			((Object)component).name = bodyInfo.bodyName;
			component.baseNameToken = bodyInfo.bodyNameToken;
			component.subtitleNameToken = bodyInfo.subtitleNameToken;
			component.portraitIcon = bodyInfo.characterPortrait;
			component.bodyColor = bodyInfo.bodyColor;
			component._defaultCrosshairPrefab = bodyInfo.crosshair;
			component.hideCrosshair = false;
			component.preferredPodPrefab = bodyInfo.podPrefab;
			component.baseMaxHealth = bodyInfo.maxHealth;
			component.baseRegen = bodyInfo.healthRegen;
			component.levelArmor = bodyInfo.armorGrowth;
			component.baseMaxShield = bodyInfo.shield;
			component.baseDamage = bodyInfo.damage;
			component.baseAttackSpeed = bodyInfo.attackSpeed;
			component.baseCrit = bodyInfo.crit;
			component.baseMoveSpeed = bodyInfo.moveSpeed;
			component.baseJumpPower = bodyInfo.jumpPower;
			component.autoCalculateLevelStats = bodyInfo.autoCalculateLevelStats;
			component.levelDamage = bodyInfo.damageGrowth;
			component.levelAttackSpeed = bodyInfo.attackSpeedGrowth;
			component.levelCrit = bodyInfo.critGrowth;
			component.levelMaxHealth = bodyInfo.healthGrowth;
			component.levelRegen = bodyInfo.regenGrowth;
			component.baseArmor = bodyInfo.armor;
			component.levelMaxShield = bodyInfo.shieldGrowth;
			component.levelMoveSpeed = bodyInfo.moveSpeedGrowth;
			component.levelJumpPower = bodyInfo.jumpPowerGrowth;
			component.baseAcceleration = bodyInfo.acceleration;
			component.baseJumpCount = bodyInfo.jumpCount;
			component.sprintingSpeedMultiplier = 1.45f;
			component.bodyFlags = (BodyFlags)16;
			component.rootMotionInMainState = false;
			component.hullClassification = (HullClassification)0;
			component.isChampion = false;
			SetupCameraTargetParams(val2, bodyInfo);
			SetupModelLocator(val2, val3, val4.transform);
			SetupCapsuleCollider(val2);
			SetupMainHurtbox(val2, val4);
			SetupAimAnimator(val2, val4);
			if ((Object)(object)val3 != (Object)null)
			{
				SetupCharacterDirection(val2, val3, val4.transform);
			}
			SetupFootstepController(val4);
			SetupRagdoll(val4);
			Content.AddCharacterBodyPrefab(val2);
			return val2;
		}

		public static void CreateGenericDoppelganger(GameObject bodyPrefab, string masterName, string masterToCopy)
		{
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/" + masterToCopy + "MonsterMaster"), masterName, true);
			val.GetComponent<CharacterMaster>().bodyPrefab = bodyPrefab;
			Content.AddMasterPrefab(val);
		}

		private static Transform AddCharacterModelToSurvivorBody(GameObject bodyPrefab, Transform modelTransform, BodyInfo bodyInfo)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_00a1: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			for (int num = bodyPrefab.transform.childCount - 1; num >= 0; num--)
			{
				Object.DestroyImmediate((Object)(object)((Component)bodyPrefab.transform.GetChild(num)).gameObject);
			}
			Transform transform = new GameObject("ModelBase").transform;
			transform.parent = bodyPrefab.transform;
			transform.localPosition = bodyInfo.modelBasePosition;
			transform.localRotation = Quaternion.identity;
			modelTransform.parent = ((Component)transform).transform;
			modelTransform.localPosition = Vector3.zero;
			modelTransform.localRotation = Quaternion.identity;
			GameObject val = new GameObject("CameraPivot");
			val.transform.parent = bodyPrefab.transform;
			val.transform.localPosition = bodyInfo.cameraPivotPosition;
			val.transform.localRotation = Quaternion.identity;
			GameObject val2 = new GameObject("AimOrigin");
			val2.transform.parent = bodyPrefab.transform;
			val2.transform.localPosition = bodyInfo.aimOriginPosition;
			val2.transform.localRotation = Quaternion.identity;
			bodyPrefab.GetComponent<CharacterBody>().aimOriginTransform = val2.transform;
			return ((Component)transform).transform;
		}

		public static CharacterModel SetupCharacterModel(GameObject prefab)
		{
			return SetupCharacterModel(prefab, null);
		}

		public static CharacterModel SetupCharacterModel(GameObject prefab, CustomRendererInfo[] customInfos)
		{
			CharacterModel val = ((Component)prefab.GetComponent<ModelLocator>().modelTransform).gameObject.GetComponent<CharacterModel>();
			bool flag = (Object)(object)val != (Object)null;
			if (!flag)
			{
				val = ((Component)prefab.GetComponent<ModelLocator>().modelTransform).gameObject.AddComponent<CharacterModel>();
			}
			val.body = prefab.GetComponent<CharacterBody>();
			val.autoPopulateLightInfos = true;
			val.invisibilityCount = 0;
			val.temporaryOverlays = new List<TemporaryOverlay>();
			if (!flag)
			{
				SetupCustomRendererInfos(val, customInfos);
			}
			else
			{
				SetupPreAttachedRendererInfos(val);
			}
			return val;
		}

		public static void SetupPreAttachedRendererInfos(CharacterModel characterModel)
		{
			for (int i = 0; i < characterModel.baseRendererInfos.Length; i++)
			{
				if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null)
				{
					characterModel.baseRendererInfos[i].defaultMaterial = characterModel.baseRendererInfos[i].renderer.sharedMaterial;
				}
				characterModel.baseRendererInfos[i].defaultMaterial.SetHopooMaterial();
			}
		}

		public static void SetupCustomRendererInfos(CharacterModel characterModel, CustomRendererInfo[] customInfos)
		{
			//IL_00de: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			ChildLocator component = ((Component)characterModel).GetComponent<ChildLocator>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				Log.Error("Failed CharacterModel setup: ChildLocator component does not exist on the model");
				return;
			}
			List<RendererInfo> list = new List<RendererInfo>();
			for (int i = 0; i < customInfos.Length; i++)
			{
				if (!Object.op_Implicit((Object)(object)component.FindChild(customInfos[i].childName)))
				{
					Log.Error("Trying to add a RendererInfo for a renderer that does not exist: " + customInfos[i].childName);
					continue;
				}
				Renderer component2 = ((Component)component.FindChild(customInfos[i].childName)).GetComponent<Renderer>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					Material val = customInfos[i].material;
					if ((Object)(object)val == (Object)null)
					{
						val = ((!customInfos[i].dontHotpoo) ? component2.material.SetHopooMaterial() : component2.material);
					}
					list.Add(new RendererInfo
					{
						renderer = component2,
						defaultMaterial = val,
						ignoreOverlays = customInfos[i].ignoreOverlays,
						defaultShadowCastingMode = (ShadowCastingMode)1
					});
				}
			}
			characterModel.baseRendererInfos = list.ToArray();
		}

		private static void SetupCharacterDirection(GameObject prefab, Transform modelBaseTransform, Transform modelTransform)
		{
			if (Object.op_Implicit((Object)(object)prefab.GetComponent<CharacterDirection>()))
			{
				CharacterDirection component = prefab.GetComponent<CharacterDirection>();
				component.targetTransform = modelBaseTransform;
				component.overrideAnimatorForwardTransform = null;
				component.rootMotionAccumulator = null;
				component.modelAnimator = ((Component)modelTransform).GetComponent<Animator>();
				component.driveFromRootRotation = false;
				component.turnSpeed = 720f;
			}
		}

		private static void SetupCameraTargetParams(GameObject prefab, BodyInfo bodyInfo)
		{
			CameraTargetParams component = prefab.GetComponent<CameraTargetParams>();
			component.cameraParams = bodyInfo.cameraParams;
			component.cameraPivotTransform = prefab.transform.Find("CameraPivot");
		}

		private static void SetupModelLocator(GameObject prefab, Transform modelBaseTransform, Transform modelTransform)
		{
			ModelLocator component = prefab.GetComponent<ModelLocator>();
			component.modelTransform = modelTransform;
			component.modelBaseTransform = modelBaseTransform;
		}

		private static void SetupCapsuleCollider(GameObject prefab)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			CapsuleCollider component = prefab.GetComponent<CapsuleCollider>();
			component.center = new Vector3(0f, 0f, 0f);
			component.radius = 0.5f;
			component.height = 1.82f;
			component.direction = 1;
		}

		private static void SetupMainHurtbox(GameObject prefab, GameObject model)
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			ChildLocator component = model.GetComponent<ChildLocator>();
			if (!Object.op_Implicit((Object)(object)component.FindChild("MainHurtbox")))
			{
				Debug.LogWarning((object)"Could not set up main hurtbox: make sure you have a transform pair in your prefab's ChildLocator component called 'MainHurtbox'");
				return;
			}
			HurtBoxGroup val = model.AddComponent<HurtBoxGroup>();
			HurtBox val2 = ((Component)component.FindChild("MainHurtbox")).gameObject.AddComponent<HurtBox>();
			((Component)val2).gameObject.layer = LayerIndex.entityPrecise.intVal;
			val2.healthComponent = prefab.GetComponent<HealthComponent>();
			val2.isBullseye = true;
			val2.damageModifier = (DamageModifier)0;
			val2.hurtBoxGroup = val;
			val2.indexInGroup = 0;
			val.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val2 };
			val.mainHurtBox = val2;
			val.bullseyeCount = 1;
		}

		public static void SetupHurtBoxes(GameObject bodyPrefab)
		{
			HealthComponent component = bodyPrefab.GetComponent<HealthComponent>();
			HurtBoxGroup[] componentsInChildren = bodyPrefab.GetComponentsInChildren<HurtBoxGroup>();
			foreach (HurtBoxGroup val in componentsInChildren)
			{
				val.mainHurtBox.healthComponent = component;
				for (int j = 0; j < val.hurtBoxes.Length; j++)
				{
					val.hurtBoxes[j].healthComponent = component;
				}
			}
		}

		private static void SetupFootstepController(GameObject model)
		{
			FootstepHandler val = model.AddComponent<FootstepHandler>();
			val.baseFootstepString = "Play_player_footstep";
			val.sprintFootstepOverrideString = "";
			val.enableFootstepDust = true;
			val.footstepDustPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/GenericFootstepDust");
		}

		private static void SetupRagdoll(GameObject model)
		{
			RagdollController component = model.GetComponent<RagdollController>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			if ((Object)(object)ragdollMaterial == (Object)null)
			{
				ragdollMaterial = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<RagdollController>().bones[1]).GetComponent<Collider>().material;
			}
			Transform[] bones = component.bones;
			foreach (Transform val in bones)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					((Component)val).gameObject.layer = LayerIndex.ragdoll.intVal;
					Collider component2 = ((Component)val).GetComponent<Collider>();
					if (Object.op_Implicit((Object)(object)component2))
					{
						component2.material = ragdollMaterial;
						component2.sharedMaterial = ragdollMaterial;
					}
				}
			}
		}

		private static void SetupAimAnimator(GameObject prefab, GameObject model)
		{
			AimAnimator val = model.AddComponent<AimAnimator>();
			val.directionComponent = prefab.GetComponent<CharacterDirection>();
			val.pitchRangeMax = 60f;
			val.pitchRangeMin = -60f;
			val.yawRangeMin = -80f;
			val.yawRangeMax = 80f;
			val.pitchGiveupRange = 30f;
			val.yawGiveupRange = 10f;
			val.giveupDuration = 3f;
			val.raisedApproachSpeed = 1080f;
			val.inputBank = prefab.GetComponent<InputBankTest>();
		}

		public static void SetupHitbox(GameObject prefab, Transform hitboxTransform, string hitboxName)
		{
			HitBoxGroup val = prefab.AddComponent<HitBoxGroup>();
			HitBox val2 = ((Component)hitboxTransform).gameObject.AddComponent<HitBox>();
			((Component)hitboxTransform).gameObject.layer = LayerIndex.projectile.intVal;
			val.hitBoxes = (HitBox[])(object)new HitBox[1] { val2 };
			val.groupName = hitboxName;
		}

		public static void SetupHitbox(GameObject prefab, string hitboxName, params Transform[] hitboxTransforms)
		{
			HitBoxGroup val = prefab.AddComponent<HitBoxGroup>();
			List<HitBox> list = new List<HitBox>();
			foreach (Transform val2 in hitboxTransforms)
			{
				HitBox item = ((Component)val2).gameObject.AddComponent<HitBox>();
				((Component)val2).gameObject.layer = LayerIndex.projectile.intVal;
				list.Add(item);
			}
			val.hitBoxes = list.ToArray();
			val.groupName = hitboxName;
		}
	}
	public class CustomRendererInfo
	{
		public string childName;

		public Material material = null;

		public bool dontHotpoo = false;

		public bool ignoreOverlays = false;
	}
	internal static class Projectiles
	{
		internal static GameObject revolverProjectile;

		internal static void RegisterProjectiles()
		{
			CreateRevolverProjectile();
			AddProjectile(revolverProjectile);
		}

		private static void CreateRevolverProjectile()
		{
			//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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAsset<GameObject>((object)"RoR2/Base/Toolbot/ToolbotGrenadeLauncherProjectile.prefab").WaitForCompletion();
			revolverProjectile = PrefabAPI.InstantiateClone(val, "RevolverProjectile");
			revolverProjectile.AddComponent<RevolverProjectileBehavior>();
			revolverProjectile.AddComponent<ModdedDamageTypeHolderComponent>().Add(DeputyPlugin.grantDeputyBuff);
			RotateObject val2 = revolverProjectile.AddComponent<RotateObject>();
			val2.rotationSpeed = new Vector3(0f, -1440f, 0f);
			ProjectileController component = revolverProjectile.GetComponent<ProjectileController>();
			GameObject ghostPrefab = CreateGhostPrefab("RevolverGhost");
			component.ghostPrefab = ghostPrefab;
			ProjectileSimple component2 = revolverProjectile.GetComponent<ProjectileSimple>();
			component2.lifetime = 10f;
			component2.desiredForwardSpeed = 150f;
			Object.Destroy((Object)(object)revolverProjectile.GetComponent<ProjectileImpactExplosion>());
			Rigidbody component3 = revolverProjectile.GetComponent<Rigidbody>();
			component3.drag = 4.5f;
			ProjectileExplosion val3 = revolverProjectile.AddComponent<ProjectileExplosion>();
			val3.blastDamageCoefficient = 1f;
			val3.blastRadius = 10f;
			val3.falloffModel = (FalloffModel)0;
			val3.explosionEffect = val.GetComponent<ProjectileImpactExplosion>().impactEffect;
		}

		internal static void AddProjectile(GameObject projectileToAdd)
		{
			Content.AddProjectilePrefab(projectileToAdd);
		}

		private static GameObject CreateGhostPrefab(string ghostName)
		{
			GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>(ghostName);
			if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>()))
			{
				val.AddComponent<NetworkIdentity>();
			}
			if (!Object.op_Implicit((Object)(object)val.GetComponent<ProjectileGhostController>()))
			{
				val.AddComponent<ProjectileGhostController>();
			}
			return val;
		}

		private static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName)
		{
			return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/" + prefabName), newPrefabName);
		}
	}
	internal static class Skills
	{
		public static void CreateSkillFamilies(GameObject targetPrefab, bool destroyExisting = true)
		{
			if (destroyExisting)
			{
				GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren<GenericSkill>();
				foreach (GenericSkill val in componentsInChildren)
				{
					Object.DestroyImmediate((Object)(object)val);
				}
			}
			SkillLocator component = targetPrefab.GetComponent<SkillLocator>();
			component.passiveSkill.enabled = true;
			component.passiveSkill.skillNameToken = "BOG_DEPUTY_BODY_PASSIVE_NAME";
			component.passiveSkill.skillDescriptionToken = "BOG_DEPUTY_BODY_PASSIVE_DESCRIPTION";
			component.passiveSkill.icon = Assets.mainAssetBundle.LoadAsset<Sprite>("HotPursuitIcon");
			component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary");
			component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary");
			component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility");
			component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special");
		}

		public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string familyName, bool hidden = false)
		{
			GenericSkill val = targetPrefab.AddComponent<GenericSkill>();
			val.skillName = familyName;
			val.hideInCharacterSelect = hidden;
			SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val2).name = ((Object)targetPrefab).name + familyName + "Family";
			val2.variants = (Variant[])(object)new Variant[0];
			val._skillFamily = val2;
			Content.AddSkillFamily(val2);
			return val;
		}

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

		public static void AddSkillsToFamily(SkillFamily skillFamily, params SkillDef[] skillDefs)
		{
			foreach (SkillDef skillDef in skillDefs)
			{
				AddSkillToFamily(skillFamily, skillDef);
			}
		}

		public static void AddPrimarySkills(GameObject targetPrefab, params SkillDef[] skillDefs)
		{
			AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().primary.skillFamily, skillDefs);
		}

		public static void AddSecondarySkills(GameObject targetPrefab, params SkillDef[] skillDefs)
		{
			AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().secondary.skillFamily, skillDefs);
		}

		public static void AddUtilitySkills(GameObject targetPrefab, params SkillDef[] skillDefs)
		{
			AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().utility.skillFamily, skillDefs);
		}

		public static void AddSpecialSkills(GameObject targetPrefab, params SkillDef[] skillDefs)
		{
			AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().special.skillFamily, skillDefs);
		}

		public static void AddUnlockablesToFamily(SkillFamily skillFamily, params UnlockableDef[] unlockableDefs)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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)
			for (int i = 0; i < unlockableDefs.Length; i++)
			{
				Variant val = skillFamily.variants[i];
				val.unlockableDef = unlockableDefs[i];
				skillFamily.variants[i] = val;
			}
		}

		public static SkillDef CreateSkillDef(SkillDefInfo skillDefInfo)
		{
			return Skills.CreateSkillDef<SkillDef>(skillDefInfo);
		}

		public static T CreateSkillDef<T>(SkillDefInfo skillDefInfo) where T : SkillDef
		{
			//IL_0064: Unknown result type (might b