Decompiled source of Summoner v0.4.4

BepInEx/plugins/Redzergling-Summoner/Summoner.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Commando.CommandoWeapon;
using ExtraSkillSlots;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ExpansionManagement;
using RoR2.Networking;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Redzergling.Summoner
{
	internal static class Combat
	{
		internal static float HealingDamage(CharacterBody body)
		{
			PuppetDamageScale component = ((Component)body).GetComponent<PuppetDamageScale>();
			if (!Object.op_Implicit((Object)(object)component) || !((Behaviour)component).enabled)
			{
				return body.damage;
			}
			return body.damage / component.Multiplier;
		}

		public static bool Enemy(CharacterBody source, CharacterBody target)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Invalid comparison between Unknown and I4
			if (Object.op_Implicit((Object)(object)source) && Object.op_Implicit((Object)(object)target) && Object.op_Implicit((Object)(object)target.healthComponent) && target.healthComponent.alive && Object.op_Implicit((Object)(object)target.teamComponent) && Object.op_Implicit((Object)(object)source.teamComponent) && target.teamComponent.teamIndex != source.teamComponent.teamIndex)
			{
				return (int)target.teamComponent.teamIndex > 0;
			}
			return false;
		}

		public static SummonRoster Roster(CharacterBody puppet)
		{
			CharacterMaster val = ((Object.op_Implicit((Object)(object)puppet) && Object.op_Implicit((Object)(object)puppet.master) && Object.op_Implicit((Object)(object)puppet.master.minionOwnership)) ? puppet.master.minionOwnership.ownerMaster : null);
			CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetBody() : null);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				return null;
			}
			return ((Component)val2).GetComponent<SummonRoster>();
		}

		public static CharacterBody AimTarget(CharacterBody source, Ray aim, float distance, bool includeAllies = true)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_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)
			foreach (RaycastHit item in from h in Physics.SphereCastAll(aim, 0.25f, distance, LayerMask.op_Implicit(CommonMasks.bullet), (QueryTriggerInteraction)2)
				orderby ((RaycastHit)(ref h)).distance
				select h)
			{
				RaycastHit current = item;
				HurtBox component = ((Component)((RaycastHit)(ref current)).collider).GetComponent<HurtBox>();
				CharacterBody val = ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.healthComponent)) ? component.healthComponent.body : null);
				if (!((Object)(object)val == (Object)(object)source) && (!Object.op_Implicit((Object)(object)val) || includeAllies || val.teamComponent.teamIndex != source.teamComponent.teamIndex))
				{
					if (Object.op_Implicit((Object)(object)val) && val.healthComponent.alive)
					{
						return val;
					}
					if (((Component)((RaycastHit)(ref current)).collider).gameObject.layer == LayerIndex.world.intVal)
					{
						return null;
					}
				}
			}
			return null;
		}

		public static CharacterBody Target(CharacterBody source, float range)
		{
			//IL_0040: 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_0090: 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_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			SummonRoster summonRoster = Roster(source);
			CharacterBody val = (Object.op_Implicit((Object)(object)summonRoster) ? summonRoster.PingTarget : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				if (!(Vector3.Distance(source.corePosition, val.corePosition) <= range) || !RailTargeting.HasLineOfSight(source, val))
				{
					return null;
				}
				return val;
			}
			CharacterBody val2 = (Object.op_Implicit((Object)(object)summonRoster) ? summonRoster.MarkedTarget : null);
			if (Enemy(source, val2) && Vector3.Distance(source.corePosition, val2.corePosition) <= range && RailTargeting.HasLineOfSight(source, val2))
			{
				return val2;
			}
			BaseAI val3 = (Object.op_Implicit((Object)(object)source.master) ? ((Component)source.master).GetComponent<BaseAI>() : null);
			CharacterBody val4 = ((Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val3.currentEnemy.gameObject)) ? val3.currentEnemy.gameObject.GetComponent<CharacterBody>() : null);
			if (Enemy(source, val4) && Vector3.Distance(source.corePosition, val4.corePosition) <= range && RailTargeting.HasLineOfSight(source, val4))
			{
				return val4;
			}
			return CharacterBody.readOnlyInstancesList.Where((CharacterBody b) => Enemy(source, b) && Vector3.Distance(source.corePosition, b.corePosition) <= range && RailTargeting.HasLineOfSight(source, b)).OrderBy(delegate(CharacterBody b)
			{
				//IL_0001: 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_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val5 = b.corePosition - source.corePosition;
				return ((Vector3)(ref val5)).sqrMagnitude;
			}).FirstOrDefault();
		}

		public static void Damage(CharacterBody source, CharacterBody target, float coefficient, float proc, DamageType type = (DamageType)0u)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			if (NetworkServer.active && Enemy(source, target))
			{
				DamageInfo val = new DamageInfo
				{
					attacker = ((Component)source).gameObject,
					inflictor = ((Component)source).gameObject,
					damage = source.damage * coefficient,
					crit = source.RollCrit(),
					procCoefficient = proc,
					position = target.corePosition,
					damageType = DamageTypeCombo.op_Implicit(type)
				};
				target.healthComponent.TakeDamage(val);
				GlobalEventManager.instance.OnHitEnemy(val, ((Component)target).gameObject);
				GlobalEventManager.instance.OnHitAll(val, ((Component)target).gameObject);
			}
		}

		public static void Beam(Vector3 start, Vector3 end)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			if (NetworkServer.active)
			{
				EffectManager.SpawnEffect(Content.RailTracer, new EffectData
				{
					start = start,
					origin = end
				}, true);
			}
		}

		public static bool SafeGround(CharacterBody body, Vector3 from, out Vector3 foot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			foot = from;
			Vector3 down = Vector3.down;
			LayerIndex world = LayerIndex.world;
			RaycastHit val = default(RaycastHit);
			if (!Physics.Raycast(from, down, ref val, 12f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1) || ((RaycastHit)(ref val)).normal.y < 0.55f)
			{
				return false;
			}
			foot = ((RaycastHit)(ref val)).point + Vector3.up * 0.15f;
			float num = Mathf.Clamp(body.radius * 0.6f, 0.3f, 0.8f);
			Vector3 val2 = foot + Vector3.up * (num + 0.1f);
			Vector3 val3 = foot + Vector3.up * (num + 1.2f);
			world = LayerIndex.world;
			return !Physics.CheckCapsule(val2, val3, num, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1);
		}

		public static bool Phase(CharacterBody body, Vector3 direction, float distance)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.ProjectOnPlane(direction, Vector3.up);
			direction = ((Vector3)(ref val)).normalized;
			if (((Vector3)(ref direction)).sqrMagnitude < 0.1f)
			{
				direction = ((Component)body).transform.forward;
			}
			Vector3 corePosition = body.corePosition;
			Vector3 val2 = direction;
			float num = distance;
			LayerIndex world = LayerIndex.world;
			RaycastHit val3 = default(RaycastHit);
			if (Physics.SphereCast(corePosition, 0.6f, val2, ref val3, num, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
			{
				distance = Mathf.Max(0f, ((RaycastHit)(ref val3)).distance - 0.8f);
			}
			if (distance < 0.5f || !SafeGround(body, body.footPosition + direction * distance + Vector3.up * 3f, out var foot))
			{
				return false;
			}
			Beam(body.corePosition, foot + Vector3.up);
			TeleportHelper.TeleportBody(body, foot);
			return true;
		}

		public static void Melee(CharacterBody body, float range, float coefficient, DamageType type, string hitbox)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_0070: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			HitBoxGroup val = ((IEnumerable<HitBoxGroup>)((Component)body.modelLocator.modelTransform).GetComponents<HitBoxGroup>()).FirstOrDefault((Func<HitBoxGroup, bool>)((HitBoxGroup g) => g.groupName == hitbox));
			if (Object.op_Implicit((Object)(object)val))
			{
				new OverlapAttack
				{
					attacker = ((Component)body).gameObject,
					inflictor = ((Component)body).gameObject,
					teamIndex = body.teamComponent.teamIndex,
					hitBoxGroup = val,
					damage = body.damage * coefficient,
					isCrit = body.RollCrit(),
					procCoefficient = 0.5f,
					damageType = DamageTypeCombo.op_Implicit(type),
					hitEffectPrefab = Content.HitEffect,
					pushAwayForce = 100f
				}.Fire((List<HurtBox>)null);
			}
		}
	}
	public abstract class TimedPuppetState : BaseSkillState
	{
		protected float duration = 0.5f;

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

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

		protected void RiflePose(float length)
		{
			((BaseState)this).StartAimMode(length, false);
			((EntityState)this).PlayAnimation("Gesture, Override", "FirePistol", "FirePistol.playbackRate", length, 0f);
		}
	}
	public sealed class DesignatorBurst : TimedPuppetState
	{
		private int shots;

		private int hits;

		private CharacterBody victim;

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

		public override void FixedUpdate()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Expected O, but got Unknown
			if (NetworkServer.active && shots < 3 && ((EntityState)this).fixedAge >= (float)shots * 0.12f / ((BaseState)this).attackSpeedStat)
			{
				shots++;
				Ray aimRay = ((BaseState)this).GetAimRay();
				CharacterBody hitBody = null;
				new BulletAttack
				{
					owner = ((EntityState)this).gameObject,
					weapon = ((EntityState)this).gameObject,
					origin = ((Ray)(ref aimRay)).origin,
					aimVector = ((Ray)(ref aimRay)).direction,
					muzzleName = OriginalModel.MuzzleName(((EntityState)this).characterBody),
					damage = ((BaseState)this).damageStat * 0.7f,
					isCrit = ((BaseState)this).RollCrit(),
					bulletCount = 1u,
					maxDistance = 180f,
					radius = 0.15f,
					procCoefficient = 0.2f,
					falloffModel = (FalloffModel)0,
					hitMask = CommonMasks.bullet,
					stopperMask = CommonMasks.bullet,
					tracerEffectPrefab = Content.RifleTracer,
					hitEffectPrefab = Content.HitEffect,
					smartCollision = true,
					filterCallback = BulletAttack.ignoreAlliesFilterCallback,
					hitCallback = (HitCallback)delegate(BulletAttack attack, ref BulletHit hit)
					{
						if (Object.op_Implicit((Object)(object)hit.hitHurtBox) && Object.op_Implicit((Object)(object)hit.hitHurtBox.healthComponent))
						{
							hitBody = hit.hitHurtBox.healthComponent.body;
						}
						return BulletAttack.defaultHitCallback.Invoke(attack, ref hit);
					}
				}.Fire();
				if (Combat.Enemy(((EntityState)this).characterBody, hitBody))
				{
					hits = ((!((Object)(object)hitBody == (Object)(object)victim)) ? 1 : (hits + 1));
					victim = hitBody;
				}
				else
				{
					hits = 0;
					victim = null;
				}
				if (hits == 3)
				{
					((EntityState)this).GetComponent<SummonRoster>().Mark(victim);
				}
				Util.PlaySound("Play_commando_M1", ((EntityState)this).gameObject);
			}
			base.FixedUpdate();
		}
	}
	public sealed class Scrapshot : TimedPuppetState
	{
		public override void OnEnter()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_0104: 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)
			((BaseState)this).OnEnter();
			duration = 0.8f / ((BaseState)this).attackSpeedStat;
			RiflePose(duration);
			if (NetworkServer.active)
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				new BulletAttack
				{
					owner = ((EntityState)this).gameObject,
					weapon = ((EntityState)this).gameObject,
					origin = ((Ray)(ref aimRay)).origin,
					aimVector = ((Ray)(ref aimRay)).direction,
					damage = ((BaseState)this).damageStat * 0.45f,
					isCrit = ((BaseState)this).RollCrit(),
					bulletCount = 6u,
					maxDistance = 45f,
					radius = 0.2f,
					procCoefficient = 0.2f,
					force = 350f,
					minSpread = 0f,
					maxSpread = 6f,
					falloffModel = (FalloffModel)1,
					hitMask = CommonMasks.bullet,
					stopperMask = CommonMasks.bullet,
					tracerEffectPrefab = Content.RifleTracer,
					hitEffectPrefab = Content.HitEffect,
					smartCollision = true,
					filterCallback = BulletAttack.ignoreAlliesFilterCallback
				}.Fire();
				Util.PlaySound("Play_commando_M1", ((EntityState)this).gameObject);
			}
		}
	}
	public sealed class ArcWelder : TimedPuppetState
	{
		public override void OnEnter()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = 0.2f / ((BaseState)this).attackSpeedStat;
			((BaseState)this).StartAimMode(0.4f, false);
			if (NetworkServer.active)
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				CharacterBody val = Combat.AimTarget(((EntityState)this).characterBody, aimRay, 28f);
				Combat.Beam(((Ray)(ref aimRay)).origin, Object.op_Implicit((Object)(object)val) ? val.corePosition : ((Ray)(ref aimRay)).GetPoint(28f));
				SummonRoster component = ((EntityState)this).GetComponent<SummonRoster>();
				if (Object.op_Implicit((Object)(object)component) && component.Owns(val))
				{
					val.healthComponent.Heal(Mathf.Min(Combat.HealingDamage(((EntityState)this).characterBody) * 0.25f, val.maxHealth * 0.03f), default(ProcChainMask), true);
				}
				else if (Combat.Enemy(((EntityState)this).characterBody, val))
				{
					Combat.Damage(((EntityState)this).characterBody, val, 0.5f, 0.2f, (DamageType)0);
				}
			}
		}
	}
	public sealed class VolleyState : CommandState
	{
		protected override void Execute(SummonRoster roster, Ray aim)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			roster.Volley(aim);
		}
	}
	public sealed class EntrenchState : CommandState
	{
		protected override void Execute(SummonRoster roster, Ray aim)
		{
			roster.Entrench();
		}
	}
	public sealed class RefitState : CommandState
	{
		protected override void Execute(SummonRoster roster, Ray aim)
		{
			roster.Refit();
		}
	}
	public sealed class CallGuards : CommandState
	{
		protected override void Execute(SummonRoster roster, Ray aim)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			roster.Deploy(SummonKind.Guard, aim);
		}
	}
	public sealed class CallRepair : CommandState
	{
		protected override void Execute(SummonRoster roster, Ray aim)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			roster.Deploy(SummonKind.Healer, aim);
		}
	}
	public sealed class CallRangers : CommandState
	{
		protected override void Execute(SummonRoster roster, Ray aim)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			roster.Deploy(SummonKind.Ranger, aim);
		}
	}
	public sealed class CallSiege : CommandState
	{
		protected override void Execute(SummonRoster roster, Ray aim)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			roster.Deploy(SummonKind.Siege, aim);
		}
	}
	public sealed class CallInterceptors : CommandState
	{
		protected override void Execute(SummonRoster roster, Ray aim)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			roster.Deploy(SummonKind.Interceptor, aim);
		}
	}
	public sealed class CallMortar : CommandState
	{
		protected override void Execute(SummonRoster roster, Ray aim)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			roster.Deploy(SummonKind.Mortar, aim);
		}
	}
	public sealed class CallPylon : CommandState
	{
		protected override void Execute(SummonRoster roster, Ray aim)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			roster.Deploy(SummonKind.Pylon, aim);
		}
	}
	public sealed class CallAegis : CommandState
	{
		protected override void Execute(SummonRoster roster, Ray aim)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			roster.Deploy(SummonKind.Aegis, aim);
		}
	}
	public sealed class PhaseMuster : TimedPuppetState
	{
		public override void OnEnter()
		{
			//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)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = 0.25f;
			if (NetworkServer.active)
			{
				CharacterBody characterBody = ((EntityState)this).characterBody;
				Ray aimRay = ((BaseState)this).GetAimRay();
				if (Combat.Phase(characterBody, ((Ray)(ref aimRay)).direction, 12f))
				{
					((EntityState)this).GetComponent<SummonRoster>().Recall();
				}
			}
		}
	}
	public sealed class GuardPunch : TimedPuppetState
	{
		private bool hit;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = 0.7f / ((BaseState)this).attackSpeedStat;
			((BaseState)this).StartAimMode(duration, false);
			((EntityState)this).PlayAnimation("Gesture, Additive", "SwingFistLeft", "SwingFist.playbackRate", duration, 0f);
			((EntityState)this).PlayAnimation("Gesture, Override", "SwingFistLeft", "SwingFist.playbackRate", duration, 0f);
		}

		public override void FixedUpdate()
		{
			if (NetworkServer.active && !hit && ((EntityState)this).fixedAge >= duration * 0.4f)
			{
				hit = true;
				Combat.Melee(((EntityState)this).characterBody, 4.5f, 1.8f, (DamageType)32, "Punch");
			}
			base.FixedUpdate();
		}
	}
	public sealed class RangerArrow : TimedPuppetState
	{
		public override void OnEnter()
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_011e: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = 0.5f / ((BaseState)this).attackSpeedStat;
			((BaseState)this).StartAimMode(1f, false);
			((EntityState)this).PlayAnimation("Gesture, Override", "FireSeekingShot", "FireSeekingShot.playbackRate", duration, 0f);
			((EntityState)this).PlayAnimation("Gesture, Additive", "FireSeekingShot", "FireSeekingShot.playbackRate", duration, 0f);
			if (NetworkServer.active)
			{
				CharacterBody val = Combat.Target(((EntityState)this).characterBody, 80f);
				if (Object.op_Implicit((Object)(object)val))
				{
					ProjectileManager.instance.FireProjectile(new FireProjectileInfo
					{
						projectilePrefab = Content.ArrowProjectile,
						owner = ((EntityState)this).gameObject,
						position = ((EntityState)this).characterBody.aimOrigin,
						rotation = Util.QuaternionSafeLookRotation(val.corePosition - ((EntityState)this).characterBody.aimOrigin),
						target = ((Component)val.mainHurtBox).gameObject,
						damage = ((BaseState)this).damageStat * 1.4f,
						crit = ((BaseState)this).RollCrit(),
						force = 30f
					});
				}
			}
		}
	}
	public sealed class SiegeNails : TimedPuppetState
	{
		private int nails;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = 1.8f / ((BaseState)this).attackSpeedStat;
			((BaseState)this).StartAimMode(duration, false);
			((EntityState)this).PlayAnimation("Gesture, Additive", "FireNailgun");
			if (Object.op_Implicit((Object)(object)((EntityState)this).GetModelAnimator()))
			{
				((EntityState)this).GetModelAnimator().SetBool("isFiringNailgun", true);
			}
		}

		public override void FixedUpdate()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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)
			if (NetworkServer.active && nails < 12 && ((EntityState)this).fixedAge >= (float)nails * 0.13f / ((BaseState)this).attackSpeedStat)
			{
				nails++;
				CharacterBody val = Combat.Target(((EntityState)this).characterBody, 65f);
				if (Object.op_Implicit((Object)(object)val))
				{
					CharacterBody characterBody = ((EntityState)this).characterBody;
					Vector3 aimOrigin = ((EntityState)this).characterBody.aimOrigin;
					Vector3 val2 = val.corePosition - ((EntityState)this).characterBody.aimOrigin;
					Rifle.FireBullet(characterBody, new Ray(aimOrigin, ((Vector3)(ref val2)).normalized), ((BaseState)this).damageStat * 0.35f, 65f, rail: false);
				}
				Util.PlaySound("Play_MULT_m1_nailgun_fire", ((EntityState)this).gameObject);
			}
			base.FixedUpdate();
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)((EntityState)this).GetModelAnimator()))
			{
				((EntityState)this).GetModelAnimator().SetBool("isFiringNailgun", false);
			}
			((EntityState)this).OnExit();
		}
	}
	public sealed class InterceptorCombo : TimedPuppetState
	{
		private int strikes;

		public override void OnEnter()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = 1.2f / ((BaseState)this).attackSpeedStat;
			((BaseState)this).StartAimMode(duration, false);
			if (NetworkServer.active)
			{
				CharacterBody val = Combat.Target(((EntityState)this).characterBody, 13f);
				if (Object.op_Implicit((Object)(object)val))
				{
					Combat.Phase(((EntityState)this).characterBody, val.corePosition - ((EntityState)this).characterBody.corePosition, Mathf.Min(8f, Mathf.Max(0f, Vector3.Distance(val.corePosition, ((EntityState)this).characterBody.corePosition) - 1.5f)));
				}
			}
		}

		public override void FixedUpdate()
		{
			if (strikes < 3 && ((EntityState)this).fixedAge >= ((float)strikes * 0.33f + 0.13f) / ((BaseState)this).attackSpeedStat)
			{
				strikes++;
				((EntityState)this).PlayAnimation("Gesture, Additive", "GroundLight" + strikes, "GroundLight.playbackRate", 0.33f / ((BaseState)this).attackSpeedStat, 0f);
				((EntityState)this).PlayAnimation("Gesture, Override", "GroundLight" + strikes, "GroundLight.playbackRate", 0.33f / ((BaseState)this).attackSpeedStat, 0f);
				if (NetworkServer.active)
				{
					Combat.Melee(((EntityState)this).characterBody, 4f, 1f, (DamageType)0, (strikes == 3) ? "SwordLarge" : "Sword");
				}
			}
			base.FixedUpdate();
		}
	}
	public sealed class SummonRoster : MonoBehaviour
	{
		private CharacterBody markedTarget;

		private float markExpires;

		private CharacterBody owner;

		private readonly List<CharacterMaster> summons = new List<CharacterMaster>();

		public CharacterBody MarkedTarget
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)markedTarget) || !markedTarget.healthComponent.alive || !(Time.fixedTime < markExpires))
				{
					return null;
				}
				return markedTarget;
			}
		}

		public CharacterBody PingTarget
		{
			get
			{
				if (!NetworkServer.active || !Object.op_Implicit((Object)(object)owner) || !Object.op_Implicit((Object)(object)owner.master))
				{
					return null;
				}
				PingerController component = ((Component)owner.master).GetComponent<PingerController>();
				if (!Object.op_Implicit((Object)(object)component) || !component.currentPing.active || !Object.op_Implicit((Object)(object)((PingInfo)(ref component.currentPing)).targetGameObject))
				{
					return null;
				}
				CharacterBody component2 = ((PingInfo)(ref component.currentPing)).targetGameObject.GetComponent<CharacterBody>();
				if (!Combat.Enemy(owner, component2))
				{
					return null;
				}
				return component2;
			}
		}

		public CharacterBody CommandTarget
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)PingTarget))
				{
					return MarkedTarget;
				}
				return PingTarget;
			}
		}

		public CharacterBody Owner => owner;

		public int LastVolleyActivations { get; private set; }

		public IEnumerable<CharacterMaster> Living => summons.Where((CharacterMaster s) => Object.op_Implicit((Object)(object)s) && Object.op_Implicit((Object)(object)s.GetBody()) && s.GetBody().healthComponent.alive);

		public bool Owns(CharacterBody body)
		{
			if (Object.op_Implicit((Object)(object)body))
			{
				return Living.Any((CharacterMaster m) => (Object)(object)m.GetBody() == (Object)(object)body);
			}
			return false;
		}

		public static int Role(SummonKind kind)
		{
			switch (kind)
			{
			default:
				return 2;
			case SummonKind.Escort:
			case SummonKind.Ranger:
			case SummonKind.Siege:
			case SummonKind.Interceptor:
				return 1;
			case SummonKind.Mini:
			case SummonKind.Guard:
			case SummonKind.Healer:
				return 0;
			}
		}

		private void ClearRole(int role)
		{
			foreach (SummonKind item in from SummonKind k in Enum.GetValues(typeof(SummonKind))
				where Role(k) == role
				select k)
			{
				Clear(item);
			}
		}

		private void ClearOtherKinds(int role, SummonKind except)
		{
			foreach (SummonKind item in from SummonKind k in Enum.GetValues(typeof(SummonKind))
				where Role(k) == role && k != except
				select k)
			{
				Clear(item);
			}
		}

		public void Deploy(SummonKind kind, Ray aim)
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_010e: 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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)owner.master))
			{
				return;
			}
			ClearRole(Role(kind));
			GameObject val = null;
			int num = 1;
			switch (kind)
			{
			case SummonKind.Guard:
				val = Content.GuardMaster;
				num = 2;
				break;
			case SummonKind.Healer:
				val = Content.RepairMaster;
				num = 2;
				break;
			case SummonKind.Ranger:
				val = Content.RangerMaster;
				num = 2;
				break;
			case SummonKind.Siege:
				val = Content.SiegeMaster;
				break;
			case SummonKind.Interceptor:
				val = Content.InterceptorMaster;
				num = 2;
				break;
			case SummonKind.Mortar:
				val = Content.MortarMaster;
				break;
			case SummonKind.Pylon:
				val = Content.PylonMaster;
				break;
			case SummonKind.Aegis:
				val = Content.AegisMaster;
				break;
			}
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			Vector3 val2 = Vector3.ProjectOnPlane(((Ray)(ref aim)).direction, Vector3.up);
			Vector3 val3 = ((Vector3)(ref val2)).normalized;
			if (((Vector3)(ref val3)).sqrMagnitude < 0.1f)
			{
				val3 = ((Component)owner).transform.forward;
			}
			for (int i = 0; i < num; i++)
			{
				Vector3 val4 = ((Role(kind) == 2) ? DeploymentPoint(aim) : GroundPoint(owner.footPosition + val3 * 5f + Vector3.Cross(Vector3.up, val3) * ((i == 0) ? (-2.5f) : 2.5f)));
				if (kind == SummonKind.Healer)
				{
					val4 += Vector3.up * 3f;
				}
				Spawn(val, val4);
			}
		}

		public void Mark(CharacterBody target, float duration = 6f)
		{
			if (NetworkServer.active && Combat.Enemy(owner, target))
			{
				markedTarget = target;
				markExpires = Time.fixedTime + duration;
				target.AddTimedBuff(Content.Marked, duration);
			}
		}

		public int Entrench()
		{
			if (!NetworkServer.active)
			{
				return 0;
			}
			int num = 0;
			CharacterMaster[] array = Living.ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				CharacterBody body = array[i].GetBody();
				body.AddTimedBuff(Content.Entrenched, 6f);
				float num2 = body.healthComponent.fullCombinedHealth * 0.15f;
				body.healthComponent.AddBarrier(Mathf.Max(0f, num2 - body.healthComponent.barrier));
				num++;
			}
			return num;
		}

		public float Refit()
		{
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: 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)
			if (!NetworkServer.active)
			{
				return 0f;
			}
			float num = owner.maxHealth * 1.2f;
			float num2 = 0f;
			foreach (CharacterBody item in from m in Living
				select m.GetBody() into b
				orderby b.healthComponent.combinedHealthFraction
				select b)
			{
				float num3 = Mathf.Min(new float[3]
				{
					num,
					item.maxHealth * 0.25f,
					item.healthComponent.missingHealth
				});
				if (!(num3 <= 0f))
				{
					num2 += item.healthComponent.Heal(num3, default(ProcChainMask), true);
					num -= num3;
					Combat.Beam(owner.aimOrigin, item.corePosition);
				}
			}
			ExtraSkillLocator component = ((Component)owner).GetComponent<ExtraSkillLocator>();
			GenericSkill[] array = (GenericSkill[])(object)new GenericSkill[3]
			{
				owner.skillLocator.utility,
				owner.skillLocator.special,
				Object.op_Implicit((Object)(object)component) ? component.extraFirst : null
			};
			foreach (GenericSkill val in array)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					val.RunRecharge(4f);
				}
			}
			return num2;
		}

		public void Volley(Ray aim)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				LastVolleyActivations = 0;
				CharacterBody target = Combat.AimTarget(owner, aim, 180f, includeAllies: false);
				if (Combat.Enemy(owner, target))
				{
					Mark(target, 4f);
				}
				else
				{
					target = MarkedTarget;
				}
				CharacterMaster[] array = Living.ToArray();
				foreach (CharacterMaster master in array)
				{
					((MonoBehaviour)this).StartCoroutine(VolleyOne(master, target));
				}
			}
		}

		private IEnumerator VolleyOne(CharacterMaster master, CharacterBody target)
		{
			yield return (object)new WaitForSeconds(0.15f);
			if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master.GetBody()))
			{
				yield break;
			}
			CharacterBody body = master.GetBody();
			RepairFollower component = ((Component)body).GetComponent<RepairFollower>();
			if (Object.op_Implicit((Object)(object)component))
			{
				if (component.Pulse())
				{
					LastVolleyActivations++;
				}
				yield break;
			}
			EmplacementController component2 = ((Component)master).GetComponent<EmplacementController>();
			if (Object.op_Implicit((Object)(object)component2) && component2.Kind == SummonKind.Aegis)
			{
				if (component2.SupportPulse() > 0)
				{
					LastVolleyActivations++;
				}
			}
			else
			{
				if (!Object.op_Implicit((Object)(object)target) || !Combat.Enemy(body, target) || !RailTargeting.HasLineOfSight(body, target))
				{
					yield break;
				}
				SummonKind kind = ((Component)master).GetComponent<ConstructIdentity>().Kind;
				if (Vector3.Distance(body.corePosition, target.corePosition) > kind switch
				{
					SummonKind.Rail => float.PositiveInfinity, 
					SummonKind.Mortar => 180f, 
					SummonKind.Pylon => 35f, 
					SummonKind.Interceptor => 13f, 
					SummonKind.Guard => 5f, 
					_ => 80f, 
				})
				{
					yield break;
				}
				BaseAI component3 = ((Component)master).GetComponent<BaseAI>();
				if (Object.op_Implicit((Object)(object)component3))
				{
					component3.currentEnemy.gameObject = ((Component)target).gameObject;
					component3.currentEnemy.Update();
				}
				RailTargeting component4 = ((Component)master).GetComponent<RailTargeting>();
				if (Object.op_Implicit((Object)(object)component4))
				{
					component4.Target = target;
				}
				if (Object.op_Implicit((Object)(object)component2))
				{
					component2.Target = target;
				}
				GenericSkill skill = body.skillLocator.primary;
				if (!Object.op_Implicit((Object)(object)skill))
				{
					yield break;
				}
				float until = Time.fixedTime + 1.2f;
				while (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)target))
				{
					InputBankTest inputBank = body.inputBank;
					Vector3 val = target.corePosition - body.aimOrigin;
					inputBank.aimDirection = ((Vector3)(ref val)).normalized;
					skill.ResetStock();
					if (skill.ExecuteIfReady())
					{
						LastVolleyActivations++;
						break;
					}
					yield return (object)new WaitForFixedUpdate();
					if (!(Time.fixedTime < until))
					{
						break;
					}
				}
			}
		}

		public int Recall()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_006b: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return 0;
			}
			int num = 0;
			CharacterMaster[] array = Living.ToArray();
			foreach (CharacterMaster val in array)
			{
				if (Role(((Component)val).GetComponent<ConstructIdentity>().Kind) == 2)
				{
					continue;
				}
				CharacterBody body = val.GetBody();
				Vector3 val2 = Quaternion.Euler(0f, (float)num * 72f, 0f) * Vector3.forward * 4f;
				if (Combat.SafeGround(body, owner.footPosition + val2 + Vector3.up * 4f, out var foot))
				{
					if (((Component)val).GetComponent<ConstructIdentity>().Kind == SummonKind.Healer)
					{
						foot += Vector3.up * 3f;
					}
					TeleportHelper.TeleportBody(body, foot);
					num++;
				}
			}
			return num;
		}

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

		private void Start()
		{
			if (NetworkServer.active)
			{
				owner.onInventoryChanged += SyncItems;
			}
		}

		private void Update()
		{
			//IL_0005: 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)
			if ((int)Plugin.RailHotkey.Value == 0 || !Input.GetKeyDown(Plugin.RailHotkey.Value) || PauseManager.isPaused || !LocalUserManager.readOnlyLocalUsersList.Any((LocalUser u) => (Object)(object)u.cachedBody == (Object)(object)owner))
			{
				return;
			}
			MPEventSystem combinedEventSystem = MPEventSystemManager.combinedEventSystem;
			if ((!Object.op_Implicit((Object)(object)combinedEventSystem) || !combinedEventSystem.isCursorVisible) && owner.healthComponent.alive && !owner.allSkillsDisabled)
			{
				ExtraSkillLocator component = ((Component)this).GetComponent<ExtraSkillLocator>();
				if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.extraFirst))
				{
					component.extraFirst.ExecuteIfReady();
				}
			}
		}

		public int Count(SummonKind kind)
		{
			return Living.Count((CharacterMaster s) => ((Component)s).GetComponent<ConstructIdentity>().Kind == kind);
		}

		public void CallSquad(Ray aim)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_0081: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)owner.master))
			{
				return;
			}
			ClearRole(0);
			for (int i = 0; i < Content.MiniMasters.Length; i++)
			{
				Vector3 val = Vector3.ProjectOnPlane(((Ray)(ref aim)).direction, Vector3.up);
				Vector3 val2 = ((Vector3)(ref val)).normalized;
				if (((Vector3)(ref val2)).sqrMagnitude < 0.1f)
				{
					val2 = ((Component)owner).transform.forward;
				}
				Vector3 val3 = val2 * 3f + Vector3.Cross(Vector3.up, val2) * ((float)(i - 1) * 2f);
				Spawn(Content.MiniMasters[i], GroundPoint(owner.footPosition + val3));
			}
		}

		public void CallEscort(Ray aim)
		{
			//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)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)owner.master))
			{
				return;
			}
			ClearOtherKinds(1, SummonKind.Escort);
			while (Count(SummonKind.Escort) >= 2)
			{
				Remove(Living.First((CharacterMaster s) => ((Component)s).GetComponent<ConstructIdentity>().Kind == SummonKind.Escort));
			}
			Spawn(Content.EscortMaster, DeploymentPoint(aim));
		}

		public void CallRail(Ray aim)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)owner.master))
			{
				ClearRole(2);
				Spawn(Content.RailMaster, DeploymentPoint(aim));
			}
		}

		private void Spawn(GameObject prefab, Vector3 point)
		{
			//IL_0000: 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)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			CharacterMaster val = new MasterSummon
			{
				masterPrefab = prefab,
				position = point,
				rotation = Quaternion.Euler(0f, ((Component)owner).transform.eulerAngles.y, 0f),
				summonerBodyObject = ((Component)owner).gameObject,
				teamIndexOverride = owner.teamComponent.teamIndex,
				ignoreTeamMemberLimit = true,
				useAmbientLevel = false,
				inventoryToCopy = owner.inventory
			}.Perform();
			if (!Object.op_Implicit((Object)(object)val))
			{
				Plugin.Log.LogWarning((object)("Construct summon failed: " + ((Object)prefab).name));
				return;
			}
			if (Object.op_Implicit((Object)(object)val.minionOwnership))
			{
				val.minionOwnership.SetOwner(owner.master);
			}
			val.destroyOnBodyDeath = true;
			summons.Add(val);
			CharacterBody body = val.GetBody();
			if (Object.op_Implicit((Object)(object)body))
			{
				body.AddTimedBuff(Buffs.HiddenInvincibility, 1f);
				if (!Object.op_Implicit((Object)(object)((Component)body).GetComponent<ConstructOrders>()))
				{
					((Component)body).gameObject.AddComponent<ConstructOrders>();
				}
			}
			Plugin.Log.LogDebug((object)("Deployed " + ((Object)prefab).name + " for " + ((object)((NetworkBehaviour)owner.master).netId/*cast due to .constrained prefix*/).ToString()));
		}

		public int Overclock()
		{
			if (!NetworkServer.active)
			{
				return 0;
			}
			int num = 0;
			CharacterMaster[] array = Living.ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				array[i].GetBody().AddTimedBuff(Content.Overclock, Plugin.BuffDuration.Value);
				num++;
			}
			return num;
		}

		private void SyncItems()
		{
			if (NetworkServer.active && Object.op_Implicit((Object)(object)owner.inventory))
			{
				CharacterMaster[] array = Living.ToArray();
				for (int i = 0; i < array.Length; i++)
				{
					array[i].inventory.CopyItemsFrom(owner.inventory);
				}
			}
		}

		private void Clear(SummonKind kind)
		{
			CharacterMaster[] array = summons.Where((CharacterMaster s) => Object.op_Implicit((Object)(object)s) && ((Component)s).GetComponent<ConstructIdentity>().Kind == kind).ToArray();
			foreach (CharacterMaster master in array)
			{
				Remove(master);
			}
			summons.RemoveAll((CharacterMaster s) => !Object.op_Implicit((Object)(object)s));
		}

		private void Remove(CharacterMaster master)
		{
			summons.Remove(master);
			if (Object.op_Implicit((Object)(object)master))
			{
				master.DestroyBody();
				NetworkServer.Destroy(((Component)master).gameObject);
			}
		}

		private Vector3 DeploymentPoint(Ray aim)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_005e: 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_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_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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			Ray val = aim;
			LayerIndex world = LayerIndex.world;
			RaycastHit val2 = default(RaycastHit);
			Vector3 val4;
			if (!Physics.Raycast(val, ref val2, 60f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
			{
				Vector3 footPosition = owner.footPosition;
				Vector3 val3 = Vector3.ProjectOnPlane(((Ray)(ref aim)).direction, Vector3.up);
				val4 = footPosition + ((Vector3)(ref val3)).normalized * 5f;
			}
			else
			{
				val4 = ((RaycastHit)(ref val2)).point;
			}
			Vector3 val5 = val4 + Vector3.up * 3f;
			Vector3 down = Vector3.down;
			world = LayerIndex.world;
			if (Physics.Raycast(val5, down, ref val2, 20f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1) && ((RaycastHit)(ref val2)).normal.y > 0.45f)
			{
				return ((RaycastHit)(ref val2)).point + Vector3.up * 0.2f;
			}
			return GroundPoint(owner.footPosition + ((Component)owner).transform.forward * 3f);
		}

		private static Vector3 GroundPoint(Vector3 point)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: 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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_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)
			Vector3 val = point + Vector3.up * 6f;
			Vector3 down = Vector3.down;
			LayerIndex world = LayerIndex.world;
			RaycastHit val2 = default(RaycastHit);
			if (!Physics.Raycast(val, down, ref val2, 20f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
			{
				return point + Vector3.up * 0.2f;
			}
			return ((RaycastHit)(ref val2)).point + Vector3.up * 0.2f;
		}

		private void OnDestroy()
		{
			if (NetworkServer.active)
			{
				if (Object.op_Implicit((Object)(object)owner))
				{
					owner.onInventoryChanged -= SyncItems;
				}
				CharacterMaster[] array = summons.ToArray();
				foreach (CharacterMaster master in array)
				{
					Remove(master);
				}
			}
		}
	}
	[DefaultExecutionOrder(500)]
	public sealed class ConstructOrders : MonoBehaviour
	{
		private CharacterBody body;

		private CharacterBody previousPing;

		private AISkillDriver approach;

		private float approachMin;

		private float approachMax;

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

		private void FixedUpdate()
		{
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.master) || !body.healthComponent.alive)
			{
				return;
			}
			SummonRoster summonRoster = Combat.Roster(body);
			if (!Object.op_Implicit((Object)(object)summonRoster))
			{
				return;
			}
			BaseAI component = ((Component)body.master).GetComponent<BaseAI>();
			ConstructIdentity component2 = ((Component)body.master).GetComponent<ConstructIdentity>();
			CharacterBody pingTarget = summonRoster.PingTarget;
			CharacterBody commandTarget = summonRoster.CommandTarget;
			bool flag = Object.op_Implicit((Object)(object)component2) && component2.Kind != SummonKind.Healer && component2.Kind != SummonKind.Aegis;
			if (!Object.op_Implicit((Object)(object)approach))
			{
				approach = ((IEnumerable<AISkillDriver>)((Component)body.master).GetComponents<AISkillDriver>()).FirstOrDefault((Func<AISkillDriver, bool>)((AISkillDriver driver) => driver.customName == "ConstructApproach"));
				if (Object.op_Implicit((Object)(object)approach))
				{
					approachMin = approach.minDistance;
					approachMax = approach.maxDistance;
				}
			}
			if (Object.op_Implicit((Object)(object)approach))
			{
				approach.minDistance = ((Object.op_Implicit((Object)(object)pingTarget) && flag) ? 0f : approachMin);
				approach.maxDistance = ((Object.op_Implicit((Object)(object)pingTarget) && flag) ? float.PositiveInfinity : approachMax);
			}
			if (Object.op_Implicit((Object)(object)component) && flag && Object.op_Implicit((Object)(object)previousPing) && !Object.op_Implicit((Object)(object)pingTarget) && (Object)(object)component.currentEnemy.gameObject == (Object)(object)((Component)previousPing).gameObject)
			{
				component.currentEnemy.Reset();
				component.enemyAttention = 0f;
			}
			previousPing = pingTarget;
			if (Object.op_Implicit((Object)(object)component) && flag && Object.op_Implicit((Object)(object)commandTarget) && (Object.op_Implicit((Object)(object)pingTarget) || (Vector3.Distance(body.corePosition, commandTarget.corePosition) < 100f && RailTargeting.HasLineOfSight(body, commandTarget))))
			{
				component.currentEnemy.gameObject = ((Component)commandTarget).gameObject;
				component.currentEnemy.Update();
				component.enemyAttention = 1f;
			}
			EntityStateMachine val = (Object.op_Implicit((Object)(object)body.skillLocator.primary) ? body.skillLocator.primary.stateMachine : null);
			bool flag2 = Object.op_Implicit((Object)(object)val) && val.state is SiegeNails;
			if (body.HasBuff(Content.Entrenched) || flag2)
			{
				body.inputBank.moveVector = Vector3.zero;
				if (Object.op_Implicit((Object)(object)body.characterMotor))
				{
					body.characterMotor.moveDirection = Vector3.zero;
				}
				if (Object.op_Implicit((Object)(object)body.rigidbody))
				{
					body.rigidbody.velocity = Vector3.zero;
				}
			}
		}
	}
	public static class Content
	{
		public static GameObject Body;

		public static GameObject EscortMaster;

		public static GameObject RailMaster;

		public static GameObject[] MiniMasters;

		public static SurvivorDef Survivor;

		public static BuffDef Overclock;

		public static GameObject RifleTracer;

		public static GameObject RailTracer;

		public static GameObject HitEffect;

		private static readonly Color Accent = new Color(0.25f, 0.9f, 1f);

		private static readonly FieldInfo SkillFamilyField = typeof(GenericSkill).GetField("_skillFamily", BindingFlags.Instance | BindingFlags.NonPublic);

		public static BuffDef ShieldActive;

		public static GameObject MortarWarningEffect;

		public static BuffDef Entrenched;

		public static BuffDef Marked;

		public static GameObject GuardMaster;

		public static GameObject RepairMaster;

		public static GameObject RangerMaster;

		public static GameObject SiegeMaster;

		public static GameObject InterceptorMaster;

		public static GameObject MortarMaster;

		public static GameObject PylonMaster;

		public static GameObject AegisMaster;

		public static GameObject ArrowProjectile;

		public static GameObject MortarProjectile;

		public static GameObject ShieldPrefab;

		public static SkillDef[][] Alternatives;

		public static GameObject[] AllMasters => MiniMasters.Concat((IEnumerable<GameObject>)(object)new GameObject[10] { EscortMaster, RailMaster, GuardMaster, RepairMaster, RangerMaster, SiegeMaster, InterceptorMaster, MortarMaster, PylonMaster, AegisMaster }).ToArray();

		public static T Load<T>(string path) where T : Object
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			T val = Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
			if (!Object.op_Implicit((Object)(object)val))
			{
				throw new InvalidOperationException("Missing required game asset: " + path);
			}
			return val;
		}

		private static GameObject Legacy(string path)
		{
			GameObject obj = LegacyResourcesAPI.Load<GameObject>(path);
			if (!Object.op_Implicit((Object)(object)obj))
			{
				throw new InvalidOperationException("Missing game prefab: " + path);
			}
			return obj;
		}

		public static void Build()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			//IL_0653: Unknown result type (might be due to invalid IL or missing references)
			//IL_0658: Unknown result type (might be due to invalid IL or missing references)
			//IL_0751: Unknown result type (might be due to invalid IL or missing references)
			//IL_0756: Unknown result type (might be due to invalid IL or missing references)
			Type[] array = new Type[7]
			{
				typeof(Rifle),
				typeof(OverclockState),
				typeof(CallSquad),
				typeof(CallEscort),
				typeof(CallRail),
				typeof(ConstructShot),
				typeof(RailShot)
			};
			bool flag = default(bool);
			for (int i = 0; i < array.Length; i++)
			{
				ContentAddition.AddEntityState(array[i], ref flag);
			}
			CharacterBody component = Legacy("Prefabs/CharacterBodies/EngiBody").GetComponent<CharacterBody>();
			GameObject source = Content.Load<GameObject>("RoR2/DLC1/Railgunner/RailgunnerBody.prefab");
			RifleTracer = Legacy("Prefabs/Effects/Tracers/TracerCommandoDefault");
			HitEffect = Legacy("Prefabs/Effects/ImpactEffects/HitsparkCommando");
			RailTracer = Content.Load<GameObject>("RoR2/DLC1/Railgunner/TracerRailgun.prefab");
			Body = CloneBody(source, "ManufacturingSummonerBody", genericMain: true);
			CharacterBody component2 = Body.GetComponent<CharacterBody>();
			component2.baseMaxHealth = component.baseMaxHealth;
			component2.levelMaxHealth = component.levelMaxHealth;
			component2.baseRegen = component.baseRegen;
			component2.levelRegen = component.levelRegen;
			component2.baseDamage = component.baseDamage;
			component2.levelDamage = component.levelDamage;
			component2.baseArmor = component.baseArmor;
			component2.baseMoveSpeed = 7f;
			component2.baseAttackSpeed = 1f;
			component2.baseCrit = 1f;
			component2.baseNameToken = "MANUFACTURING_SUMMONER_NAME";
			component2.subtitleNameToken = "MANUFACTURING_SUMMONER_SUBTITLE";
			component2.bodyColor = Accent;
			component2.portraitIcon = (Texture)(object)SkillIcons.Get(20).texture;
			component2.preferredPodPrefab = component.preferredPodPrefab;
			Body.AddComponent<SummonRoster>();
			SkillLocator component3 = Body.GetComponent<SkillLocator>();
			component3.primary = AssignSkill(Body, "Primary", Skill<Rifle>("PulseRifle", "Pulse Rifle", "Fire a rapid rifle for <style=cIsDamage>" + Percent(Plugin.RifleDamage.Value) + " damage</style> per shot.", 0f, press: false, Icon(0)));
			component3.secondary = AssignSkill(Body, "Secondary", Skill<OverclockState>("Overclock", "Overclock", "Empower your constructs for <style=cIsUtility>" + Plugin.BuffDuration.Value + " seconds</style>: <style=cIsDamage>+" + Percent(Plugin.BuffDamage.Value) + " damage</style> and <style=cIsDamage>+" + Percent(Plugin.BuffSpeed.Value) + " attack speed</style>.", Plugin.BuffCooldown.Value, press: true, Icon(1)));
			component3.utility = AssignSkill(Body, "Utility", Skill<CallSquad>("ConstructSquad", "Pocket Squad", "Summon <style=cIsUtility>3 miniature constructs</style>. They follow you and fire weak pulses. Replaces the previous squad.", Plugin.MiniCooldown.Value, press: true, Icon(2)));
			component3.special = AssignSkill(Body, "Special", Skill<CallEscort>("CommandoEscort", "Fireteam", "Summon a small <style=cIsUtility>Commando</style> who follows you and uses <style=cIsDamage>Double Tap</style>. Inherits your items. <style=cIsUtility>Maximum 2</style>; replaces the oldest.", Plugin.EscortCooldown.Value, press: true, Icon(3)));
			Body.AddComponent<ExtraSkillLocator>().extraFirst = AssignSkill(Body, "ExtraFirst", Skill<CallRail>("RailEmplacement", "Horizon Rail", "Deploy a large stationary railgun turret for <style=cIsDamage>" + Percent(Plugin.RailDamage.Value) + " piercing damage</style>. <style=cIsUtility>No target range limit</style>; terrain blocks shots. Maximum 1.", Plugin.RailCooldown.Value, press: true, Icon(4)));
			component3.passiveSkill = new PassiveSkill
			{
				enabled = true,
				skillNameToken = "MANUFACTURING_SUMMONER_PASSIVE",
				skillDescriptionToken = "MANUFACTURING_SUMMONER_PASSIVE_DESC",
				icon = SkillIcons.Get(20)
			};
			LanguageAPI.Add("MANUFACTURING_SUMMONER_PASSIVE", "Strings Attached");
			LanguageAPI.Add("MANUFACTURING_SUMMONER_PASSIVE_DESC", "<style=cIsUtility>All puppets inherit your items</style> and scale with your level. New pickups and removals update every puppet. Utility, Special and Extra Skill 1 each share their own summon limit across alternatives.");
			MiniMasters = new string[3] { "Commando", "Huntress", "Loader" }.Select(delegate(string hero, int index)
			{
				GameObject val4 = CloneBody(Legacy("Prefabs/CharacterBodies/" + hero + "Body"), "ManufacturingMini" + hero + "Body", genericMain: true);
				CharacterBody component5 = val4.GetComponent<CharacterBody>();
				component5.baseNameToken = "MANUFACTURING_MINI_" + hero.ToUpperInvariant();
				LanguageAPI.Add(component5.baseNameToken, "Pocket " + hero);
				ConfigureMinion(component5, Plugin.MiniHealth.Value, Plugin.MiniDamage.Value, 0.55f);
				component5.baseMoveSpeed = 8f;
				val4.GetComponent<SkillLocator>().primary = AssignSkill(val4, "Primary", Skill<ConstructShot>("Mini" + hero + "Pulse", "Construct Pulse", "Fire a weak pulse.", 0.5f, press: false, Icon(0)));
				AddDefaultSkin(val4, hero);
				return MakeFollowerMaster(val4, "ManufacturingMini" + hero + "Master", SummonKind.Mini);
			}).ToArray();
			GameObject obj = Legacy("Prefabs/CharacterBodies/CommandoBody");
			GameObject val = CloneBody(obj, "ManufacturingCommandoEscortBody", genericMain: true);
			CharacterBody component4 = val.GetComponent<CharacterBody>();
			component4.baseNameToken = "MANUFACTURING_ESCORT_NAME";
			component4.preferredPodPrefab = null;
			Transform modelTransform = val.GetComponent<ModelLocator>().modelTransform;
			modelTransform.localScale *= 0.65f;
			SkillDef skillDef = obj.GetComponent<SkillLocator>().primary.skillFamily.variants[0].skillDef;
			val.GetComponent<SkillLocator>().primary = AssignSkill(val, "Primary", skillDef);
			AddDefaultSkin(val, "CommandoEscort");
			EscortMaster = MakeFollowerMaster(val, "ManufacturingCommandoEscortMaster", SummonKind.Escort);
			GameObject val2 = CloneBody(Legacy("Prefabs/CharacterBodies/EngiTurretBody"), "ManufacturingRailBody", genericMain: false);
			ConfigureMinion(val2.GetComponent<CharacterBody>(), 350f, 12f, 1.6f);
			val2.GetComponent<CharacterBody>().baseNameToken = "MANUFACTURING_RAIL_NAME";
			val2.GetComponent<SkillLocator>().primary = AssignSkill(val2, "Primary", Skill<RailShot>("RailShot", "Rail Shot", "Piercing railgun shot.", 0f, press: false, Icon(4)));
			RailMaster = PrefabAPI.InstantiateClone(Legacy("Prefabs/CharacterMasters/EngiTurretMaster"), "ManufacturingRailMaster", true);
			MonoBehaviour[] components = RailMaster.GetComponents<MonoBehaviour>();
			foreach (MonoBehaviour val3 in components)
			{
				if (Object.op_Implicit((Object)(object)val3) && ((object)val3).GetType().Name == "AIOwnership")
				{
					Object.DestroyImmediate((Object)(object)val3);
				}
			}
			BaseAI[] components2 = RailMaster.GetComponents<BaseAI>();
			for (int i = 0; i < components2.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components2[i]);
			}
			AISkillDriver[] components3 = RailMaster.GetComponents<AISkillDriver>();
			for (int i = 0; i < components3.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components3[i]);
			}
			RailMaster.GetComponent<CharacterMaster>().bodyPrefab = val2;
			RailMaster.GetComponent<CharacterMaster>().destroyOnBodyDeath = true;
			RailMaster.AddComponent<ConstructIdentity>().Kind = SummonKind.Rail;
			RailMaster.AddComponent<RailTargeting>();
			ContentAddition.AddMaster(RailMaster);
			Overclock = ScriptableObject.CreateInstance<BuffDef>();
			((Object)Overclock).name = "ManufacturingOverclock";
			Overclock.buffColor = Accent;
			Overclock.iconSprite = Icon(1);
			Overclock.canStack = false;
			Overclock.isDebuff = false;
			ContentAddition.AddBuffDef(Overclock);
			SkinDef bodySkin = OriginalModel.Apply(((Component)Body.GetComponent<ModelLocator>().modelTransform).gameObject, display: false);
			Survivor = ScriptableObject.CreateInstance<SurvivorDef>();
			((Object)Survivor).name = "ManufacturingSummoner";
			Survivor.bodyPrefab = Body;
			Survivor.displayPrefab = PrefabAPI.InstantiateClone(Content.Load<GameObject>("RoR2/DLC1/Railgunner/RailgunnerDisplay.prefab"), "ManufacturingSummonerDisplay", false);
			OriginalModel.Apply(((Component)Survivor.displayPrefab.GetComponentInChildren<CharacterModel>()).gameObject, display: true, bodySkin);
			Survivor.displayNameToken = component2.baseNameToken;
			Survivor.descriptionToken = "MANUFACTURING_SUMMONER_DESCRIPTION";
			Survivor.outroFlavorToken = "MANUFACTURING_SUMMONER_OUTRO";
			Survivor.mainEndingEscapeFailureFlavorToken = "MANUFACTURING_SUMMONER_FAILURE";
			Survivor.primaryColor = Accent;
			Survivor.desiredSortPosition = 19f;
			Survivor.hidden = false;
			ContentAddition.AddSurvivorDef(Survivor);
			LanguageAPI.Add(component2.baseNameToken, "Puppet Master");
			LanguageAPI.Add(component2.subtitleNameToken, "Puller of Strings");
			LanguageAPI.Add(Survivor.descriptionToken, "The <style=cIsUtility>Puppet Master</style> directs a cast of constructs.\n\n<style=cSub>Choose from four skills in each of five slots: mark targets, repair or protect your puppets, and deploy specialists, fighting units and emplacements. Every puppet inherits your items.\n\nBind Extra Skill 1 to your preferred mouse button in Settings > Controls.\n\nBeta tuning: player and puppet attack damage is " + Percent(Plugin.GlobalDamage.Value) + " of the original balance, except Horizon Rail which retains full damage. Healing is unchanged.</style>");
			LanguageAPI.Add(Survivor.outroFlavorToken, "...and so they left, with every voice accounted for.");
			LanguageAPI.Add(Survivor.mainEndingEscapeFailureFlavorToken, "...and so they vanished, their last order still echoing.");
			LanguageAPI.Add("MANUFACTURING_ESCORT_NAME", "Commando Escort");
			LanguageAPI.Add("MANUFACTURING_RAIL_NAME", "Horizon Rail");
			BuildExpansion();
			foreach (GameObject item in AllMasters.Select((GameObject m) => m.GetComponent<CharacterMaster>().bodyPrefab).Append(Body).Distinct())
			{
				item.AddComponent<PuppetDamageScale>().UseOriginalDamage = (Object)(object)item == (Object)(object)RailMaster.GetComponent<CharacterMaster>().bodyPrefab;
			}
		}

		private static GameObject CloneBody(GameObject source, string name, bool genericMain)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(source, name, true);
			ExpansionRequirementComponent component = val.GetComponent<ExpansionRequirementComponent>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Object.DestroyImmediate((Object)(object)component);
			}
			GenericSkill[] components = val.GetComponents<GenericSkill>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components[i]);
			}
			SkillLocator component2 = val.GetComponent<SkillLocator>();
			component2.primary = (component2.secondary = (component2.utility = (component2.special = null)));
			component2.passiveSkill = default(PassiveSkill);
			MonoBehaviour[] components2 = val.GetComponents<MonoBehaviour>();
			foreach (MonoBehaviour val2 in components2)
			{
				if (Object.op_Implicit((Object)(object)val2) && (((object)val2).GetType().Name.StartsWith("Railgunner") || ((object)val2).GetType().Name.StartsWith("Loader") || ((object)val2).GetType().Name == "HuntressTracker"))
				{
					Object.DestroyImmediate((Object)(object)val2);
				}
			}
			CharacterBody component3 = val.GetComponent<CharacterBody>();
			component3.dontCull = true;
			component3.preferredInitialStateType = new SerializableEntityStateType(typeof(GenericCharacterMain));
			component3.skinIndex = 0u;
			EntityStateMachine[] components3 = val.GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val3 in components3)
			{
				if (!(val3.customName == "Body") || genericMain)
				{
					Type type = ((val3.customName == "Body") ? typeof(GenericCharacterMain) : typeof(Idle));
					val3.initialStateType = (val3.mainStateType = new SerializableEntityStateType(type));
				}
			}
			ContentAddition.AddBody(val);
			return val;
		}

		private static void ConfigureMinion(CharacterBody body, float health, float damage, float scale)
		{
			//IL_006c: 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_0074: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			body.baseMaxHealth = health;
			body.levelMaxHealth = health * 0.3f;
			body.baseDamage = damage;
			body.levelDamage = damage * 0.2f;
			body.baseRegen = 0f;
			body.levelRegen = 0f;
			body.baseCrit = 0f;
			body.baseAttackSpeed = 1f;
			body.levelAttackSpeed = 0f;
			body.baseArmor = 0f;
			body.bodyFlags = (BodyFlags)(body.bodyFlags & -17);
			body.preferredPodPrefab = null;
			Transform modelTransform = ((Component)body).GetComponent<ModelLocator>().modelTransform;
			modelTransform.localScale *= scale;
		}

		private static GameObject MakeFollowerMaster(GameObject body, string name, SummonKind kind)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00c7: 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_00fc: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(Legacy("Prefabs/CharacterMasters/CommandoMonsterMaster"), name, true);
			if (!Object.op_Implicit((Object)(object)val.GetComponent<AIOwnership>()))
			{
				val.AddComponent<AIOwnership>();
			}
			val.GetComponent<CharacterMaster>().bodyPrefab = body;
			val.GetComponent<CharacterMaster>().destroyOnBodyDeath = true;
			val.AddComponent<ConstructIdentity>().Kind = kind;
			AISkillDriver[] components = val.GetComponents<AISkillDriver>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components[i]);
			}
			AISkillDriver obj = val.AddComponent<AISkillDriver>();
			obj.customName = "ConstructFire";
			obj.skillSlot = (SkillSlot)0;
			obj.requireSkillReady = true;
			obj.minDistance = 0f;
			obj.maxDistance = 65f;
			obj.selectionRequiresTargetLoS = true;
			obj.activationRequiresTargetLoS = true;
			obj.activationRequiresAimConfirmation = true;
			obj.moveTargetType = (TargetType)0;
			obj.movementType = (MovementType)2;
			obj.aimType = (AimType)2;
			obj.buttonPressType = (ButtonPressType)0;
			AISkillDriver obj2 = val.AddComponent<AISkillDriver>();
			obj2.customName = "ConstructApproach";
			obj2.skillSlot = (SkillSlot)(-1);
			obj2.minDistance = 30f;
			obj2.maxDistance = 100f;
			obj2.moveTargetType = (TargetType)0;
			obj2.movementType = (MovementType)1;
			obj2.aimType = (AimType)2;
			AISkillDriver obj3 = val.AddComponent<AISkillDriver>();
			obj3.customName = "ConstructFollowOwner";
			obj3.skillSlot = (SkillSlot)(-1);
			obj3.minDistance = 12f;
			obj3.maxDistance = float.PositiveInfinity;
			obj3.moveTargetType = (TargetType)2;
			obj3.movementType = (MovementType)1;
			obj3.aimType = (AimType)1;
			BaseAI component = val.GetComponent<BaseAI>();
			component.fullVision = true;
			component.neverRetaliateFriendlies = true;
			component.aimVectorDampTime = 0.08f;
			component.aimVectorMaxSpeed = 360f;
			ContentAddition.AddMaster(val);
			return val;
		}

		private static SkillDef Skill<T>(string name, string title, string description, float cooldown, bool press, Sprite icon) where T : EntityState
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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)
			SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
			((Object)val).name = (val.skillName = "Manufacturing" + name);
			val.skillNameToken = "MANUFACTURING_" + name.ToUpperInvariant();
			val.skillDescriptionToken = val.skillNameToken + "_DESC";
			LanguageAPI.Add(val.skillNameToken, title);
			LanguageAPI.Add(val.skillDescriptionToken, description);
			val.activationState = new SerializableEntityStateType(typeof(T));
			val.activationStateMachineName = "Weapon";
			val.interruptPriority = (InterruptPriority)1;
			val.baseRechargeInterval = cooldown;
			val.attackSpeedBuffsRestockSpeed = typeof(T) == typeof(ConstructShot);
			val.attackSpeedBuffsRestockSpeed_Multiplier = 1f;
			val.baseMaxStock = (val.rechargeStock = (val.requiredStock = (val.stockToConsume = 1)));
			val.fullRestockOnAssign = true;
			val.resetCooldownTimerOnUse = true;
			val.beginSkillCooldownOnSkillEnd = false;
			val.cancelSprintingOnActivation = true;
			val.isCombatSkill = true;
			val.mustKeyPress = press;
			val.icon = icon;
			ContentAddition.AddSkillDef(val);
			return val;
		}

		private static GenericSkill AssignSkill(GameObject prefab, string slot, SkillDef def)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_004a: 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)
			SkillFamily val = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val).name = ((Object)prefab).name + slot + "Family";
			Variant[] array = new Variant[1];
			Variant val2 = new Variant
			{
				skillDef = def
			};
			((Variant)(ref val2)).viewableNode = new Node(def.skillNameToken, false, (Node)null);
			array[0] = val2;
			val.variants = (Variant[])(object)array;
			ContentAddition.AddSkillFamily(val);
			GenericSkill val3 = prefab.AddComponent<GenericSkill>();
			val3.skillName = slot;
			SkillFamilyField.SetValue(val3, val);
			return val3;
		}

		private static void AddDefaultSkin(GameObject prefab, string name)
		{
			//IL_005f: 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)
			GameObject gameObject = ((Component)prefab.GetComponent<ModelLocator>().modelTransform).gameObject;
			ModelSkinController val = gameObject.GetComponent<ModelSkinController>() ?? gameObject.AddComponent<ModelSkinController>();
			SkinDef val2 = ((val.skins != null && val.skins.Length != 0) ? val.skins[0] : null);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				throw new InvalidOperationException("No base appearance skin for " + ((Object)prefab).name);
			}
			SkinDef val3 = Skins.CreateNewSkinDef(new SkinDefParamsInfo
			{
				Name = "Manufacturing" + name + "Default",
				NameToken = "DEFAULT_SKIN_NAME",
				RootObject = gameObject,
				RendererInfos = Array.Empty<RendererInfo>(),
				Icon = Icon(2),
				BaseSkins = (SkinDef[])(object)new SkinDef[1] { val2 },
				MeshReplacements = Array.Empty<MeshReplacement>(),
				GameObjectActivations = Array.Empty<GameObjectActivation>(),
				ProjectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(),
				MinionSkinReplacements = Array.Empty<MinionSkinReplacement>()
			});
			val.skins = (SkinDef[])(object)new SkinDef[1] { val3 };
		}

		private static string Percent(float coefficient)
		{
			return (coefficient * 100f).ToString("0") + "%";
		}

		private static Sprite Icon(int glyph)
		{
			return SkillIcons.Get(glyph);
		}

		private static void BuildProjectiles()
		{
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Expected O, but got Unknown
			//IL_01ed: Expected O, but got Unknown
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Expected O, but got Unknown
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Expected O, but got Unknown
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Expected O, but got Unknown
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Expected O, but got Unknown
			ArrowProjectile = PrefabAPI.InstantiateClone(Content.Load<GameObject>("RoR2/Junk/Huntress/Arrow.prefab"), "ManufacturingRangerArrow", true);
			ProjectileSimple component = ArrowProjectile.GetComponent<ProjectileSimple>();
			component.desiredForwardSpeed = 55f;
			component.lifetime = 5f;
			component.updateAfterFiring = true;
			ArrowProjectile.GetComponent<ProjectileController>().allowPrediction = false;
			ArrowProjectile.GetComponent<ProjectileController>().procCoefficient = 0.5f;
			ArrowProjectile.AddComponent<PuppetProjectileAllies>();
			if (!Object.op_Implicit((Object)(object)ArrowProjectile.GetComponent<ProjectileTargetComponent>()))
			{
				ArrowProjectile.AddComponent<ProjectileTargetComponent>();
			}
			ProjectileSteerTowardTarget obj = ArrowProjectile.GetComponent<ProjectileSteerTowardTarget>() ?? ArrowProjectile.AddComponent<ProjectileSteerTowardTarget>();
			obj.rotationSpeed = 120f;
			obj.yAxisOnly = false;
			ContentAddition.AddProjectile(ArrowProjectile);
			MortarProjectile = PrefabAPI.InstantiateClone(Content.Load<GameObject>("RoR2/Base/Engi/EngiGrenadeProjectile.prefab"), "ManufacturingMortarShell", true);
			AntiGravityForce component2 = MortarProjectile.GetComponent<AntiGravityForce>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				Object.DestroyImmediate((Object)(object)component2);
			}
			ProjectileImpactExplosion component3 = MortarProjectile.GetComponent<ProjectileImpactExplosion>();
			component3.destroyOnWorld = true;
			component3.destroyOnEnemy = true;
			component3.timerAfterImpact = false;
			component3.lifetime = 8f;
			component3.lifetimeRandomOffset = 0f;
			((ProjectileExplosion)component3).blastRadius = 8f;
			((ProjectileExplosion)component3).blastDamageCoefficient = 1f;
			((ProjectileExplosion)component3).blastProcCoefficient = 1f;
			MortarProjectile.GetComponent<ProjectileController>().procCoefficient = 0.5f;
			MortarProjectile.GetComponent<ProjectileController>().allowPrediction = false;
			MortarProjectile.GetComponent<ProjectileSimple>().lifetime = 8f;
			MortarProjectile.AddComponent<PuppetProjectileAllies>();
			if (Environment.GetCommandLineArgs().Contains("--summoner-validate"))
			{
				MortarProjectile.AddComponent<MortarDiagnostics>();
			}
			ContentAddition.AddProjectile(MortarProjectile);
			GameObject val = new GameObject("PuppetWarningTemplate");
			val.SetActive(false);
			val.AddComponent<EffectComponent>();
			val.AddComponent<VFXAttributes>();
			val.AddComponent<MortarWarning>();
			MortarWarningEffect = PrefabAPI.InstantiateClone(val, "ManufacturingMortarWarning", false);
			Object.DestroyImmediate((Object)val);
			ContentAddition.AddEffect(MortarWarningEffect);
			MortarWarningEffect.SetActive(true);
			ShieldActive = MakeBuff("PuppetAegisActive", new Color(0.4f, 0.9f, 1f), debuff: false, 19);
			GameObject bodyPrefab = AegisMaster.GetComponent<CharacterMaster>().bodyPrefab;
			GameObject val2 = new GameObject("PuppetFrontalShield");
			val2.SetActive(false);
			val2.transform.SetParent(bodyPrefab.transform, false);
			val2.transform.localPosition = new Vector3(0f, 2f, 2.4f);
			val2.layer = LayerIndex.entityPrecise.intVal;
			val2.AddComponent<BoxCollider>().size = new Vector3(7f, 4.5f, 0.3f);
			HurtBox obj2 = val2.AddComponent<HurtBox>();
			obj2.healthComponent = bodyPrefab.GetComponent<HealthComponent>();
			obj2.isBullseye = false;
			obj2.isIgnoredByFriendlyProjectiles = true;
			GameObject val3 = new GameObject("PuppetShieldSurface");
			val3.transform.SetParent(val2.transform, false);
			Mesh val4 = new Mesh();
			((Object)val4).name = "PuppetShieldPanel";
			val4.vertices = (Vector3[])(object)new Vector3[4]
			{
				new Vector3(-3.5f, -2.25f, 0f),
				new Vector3(3.5f, -2.25f, 0f),
				new Vector3(3.5f, 2.25f, 0f),
				new Vector3(-3.5f, 2.25f, 0f)
			};
			val4.uv = (Vector2[])(object)new Vector2[4]
			{
				Vector2.zero,
				Vector2.right,
				Vector2.one,
				Vector2.up