Decompiled source of Mortician v0.1.5

plugins/Morris.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EmotesAPI;
using EntityStates;
using EntityStates.SurvivorPod;
using HG;
using HG.BlendableTypes;
using JetBrains.Annotations;
using KinematicCharacterController;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using Morris;
using Morris.Components;
using Morris.Content;
using Morris.Modules;
using Morris.Modules.Characters;
using Morris.Modules.NPC;
using Morris.Modules.Survivors;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Achievements;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Navigation;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using ShaderSwapper;
using SkillStates.CoffinPod;
using SkillStates.Ghoul;
using SkillStates.Morris;
using SkillStates.SharedStates;
using SkillStates.Tombstone;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Morris")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c346115485ec0a14284147d6289de929408937ea")]
[assembly: AssemblyProduct("Morris")]
[assembly: AssemblyTitle("Morris")]
[assembly: CompilationRelaxations(8)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
public class SoulOrbLocator : MonoBehaviour
{
	[SerializeField]
	private GameObject[] soulOrbs;

	public void ActivateSphere(int i)
	{
		//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_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		soulOrbs[i].SetActive(true);
		EffectData val = new EffectData
		{
			origin = soulOrbs[i].transform.position
		};
		EffectManager.SpawnEffect(MorrisAssets.SoulOrbActivatedEffect, val, true);
	}

	public void DeactivateSphere(int i)
	{
		soulOrbs[i].SetActive(false);
	}

	public Vector3 GetPosition(int i)
	{
		//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_0016: Unknown result type (might be due to invalid IL or missing references)
		return soulOrbs[i].transform.position;
	}
}
namespace SkillStates.Tombstone
{
	internal class TombstoneDeath : GenericCharacterDeath
	{
		public override void OnEnter()
		{
			((GenericCharacterDeath)this).OnEnter();
		}

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

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

		public override void OnExit()
		{
			((GenericCharacterDeath)this).OnExit();
		}
	}
	internal class TombstoneLaunched : BaseLaunchedState
	{
		public override void OnEnter()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			launchPower = 60f;
			damageType = (DamageType)32;
			impactVFX = MorrisAssets.OmniImpactVFXTombstone;
			base.OnEnter();
			((EntityState)this).gameObject.layer = LayerIndex.fakeActor.intVal;
			((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
			((EntityState)this).characterMotor.muteWalkMotion = false;
		}

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

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

		public override void OnExit()
		{
			((EntityState)this).gameObject.layer = LayerIndex.defaultLayer.intVal;
			((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
			((EntityState)this).characterMotor.muteWalkMotion = true;
			base.OnExit();
		}
	}
	internal class TombstoneMain : GenericCharacterMain
	{
		private MorrisMinionController minionController;

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

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

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

		public override void OnExit()
		{
			((GenericCharacterMain)this).OnExit();
		}
	}
	internal class TombstoneSpawn : BaseState
	{
		public static float duration = 1f;

		public string spawnSoundString = "Morris_TombstoneSpawn";

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			Util.PlaySound(spawnSoundString, ((EntityState)this).gameObject);
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			TemporaryOverlayInstance val = TemporaryOverlayManager.AddOverlay(((EntityState)this).gameObject);
			val.duration = duration * 1.2f;
			val.animateShaderAlpha = true;
			val.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0.1f);
			val.destroyComponentOnEnd = true;
			val.originalMaterial = MorrisAssets.TombstoneSpawnMat;
			val.AddToCharacterModel(((Component)modelTransform).GetComponent<CharacterModel>());
		}

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

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

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}
	}
}
namespace SkillStates.SharedStates
{
	internal class BaseLaunchedState : BaseState
	{
		public static float minDuration = 0.3f;

		public static float maxDuration = 5f;

		public static float damageCoefficient = 3.5f;

		public static float yOffset = 0.1f;

		public static float minMassToExitState = 200f;

		public static Vector3 downwardForce = Vector3.zero;

		public float launchPower;

		public DamageType damageType;

		private MorrisMinionController minionController;

		private OverlapAttack attack;

		public Vector3 launchVector;

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

		private float cachedAirControl;

		protected GameObject impactVFX;

		public override void OnEnter()
		{
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//IL_007e: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			PlayLaunchEntry();
			minionController = ((EntityState)this).GetComponent<MorrisMinionController>();
			launchVector.y += yOffset;
			cachedAirControl = ((EntityState)this).characterMotor.airControl;
			((EntityState)this).characterMotor.airControl = 0.15f;
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.HiddenInvincibility);
			}
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterDirection.forward = launchVector;
				((EntityState)this).characterBody.isSprinting = true;
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				CharacterMotor characterMotor = ((EntityState)this).characterMotor;
				characterMotor.velocity += launchVector * launchPower;
			}
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			HitBoxGroup hitBoxGroup = new HitBoxGroup();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == "LaunchHitbox");
			}
			attack = new OverlapAttack();
			attack.attacker = (Object.op_Implicit((Object)(object)minionController.owner) ? minionController.owner : ((EntityState)this).gameObject);
			attack.inflictor = ((EntityState)this).gameObject;
			attack.damageType = DamageTypeCombo.op_Implicit(damageType);
			attack.procCoefficient = 1f;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.isCrit = (Object.op_Implicit((Object)(object)minionController.owner) ? Util.CheckRoll(minionController.ownerBody.crit, minionController.ownerBody.master) : ((BaseState)this).RollCrit());
			attack.forceVector = downwardForce;
			attack.pushAwayForce = 1f;
			attack.damage = damageCoefficient * base.damageStat;
			attack.hitBoxGroup = hitBoxGroup;
			attack.hitEffectPrefab = impactVFX;
		}

		public override void FixedUpdate()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Invalid comparison between Unknown and I4
			((EntityState)this).FixedUpdate();
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			((EntityState)this).characterDirection.forward = ((Vector3)(ref ((EntityState)this).characterMotor.velocity)).normalized;
			if (attack.Fire(victims))
			{
				foreach (HurtBox victim in victims)
				{
					if (!Object.op_Implicit((Object)(object)victim.healthComponent) || !victim.healthComponent.alive)
					{
						continue;
					}
					Rigidbody component = ((Component)victim.healthComponent).GetComponent<Rigidbody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						float mass = component.mass;
						if (mass >= minMassToExitState)
						{
							OnHitLargeEnemy(victim);
						}
					}
					else
					{
						CharacterBody body = victim.healthComponent.body;
						if ((int)body.hullClassification == 1 || (int)body.hullClassification == 2)
						{
							OnHitLargeEnemy(victim);
						}
					}
				}
			}
			if ((((EntityState)this).fixedAge >= minDuration && ((BaseCharacterController)((EntityState)this).characterMotor).Motor.GroundingStatus.IsStableOnGround) || ((EntityState)this).fixedAge >= maxDuration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public virtual void PlayLaunchEntry()
		{
		}

		public virtual void PlayLaunchExit()
		{
		}

		public virtual void OnHitLargeEnemy(HurtBox target)
		{
		}

		public override void OnExit()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			PlayLaunchExit();
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.HiddenInvincibility);
			}
			CharacterMotor characterMotor = ((EntityState)this).characterMotor;
			characterMotor.velocity *= 0.05f;
			((EntityState)this).characterMotor.airControl = cachedAirControl;
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)5;
		}
	}
}
namespace SkillStates.Morris
{
	internal class PlaceTombstone : BaseState
	{
		private struct PlacementInfo
		{
			public bool ok;

			public Vector3 position;

			public Quaternion rotation;
		}

		public static GameObject tombstoneMasterPrefab;

		private const float tombstoneHeight = 7f;

		private const float tombstoneRadius = 1f;

		private float entryDelay = 0.1f;

		private float exitDelay = 0.25f;

		private bool exitPending;

		private BlueprintController blueprintController;

		private PlacementInfo currentPlacementInfo;

		public override void OnEnter()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			if (((EntityState)this).isAuthority)
			{
				currentPlacementInfo = GetPlacementInfo();
				blueprintController = Object.Instantiate<GameObject>(MorrisAssets.TombstoneBlueprintsPrefab, currentPlacementInfo.position, currentPlacementInfo.rotation).GetComponent<BlueprintController>();
			}
		}

		public override void FixedUpdate()
		{
			//IL_00a8: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			entryDelay -= Time.fixedDeltaTime;
			if (entryDelay <= 0f && !exitPending)
			{
				if ((((EntityState)this).inputBank.skill1.down || ((ButtonState)(ref ((EntityState)this).inputBank.skill4)).justPressed) && currentPlacementInfo.ok)
				{
					((EntityState)this).PlayCrossfade("Gesture, Override", "LanternRaise", 0.05f);
					((EntityState)this).characterBody.SendConstructTurret(((EntityState)this).characterBody, currentPlacementInfo.position, currentPlacementInfo.rotation, MasterCatalog.FindMasterIndex(tombstoneMasterPrefab));
					((BaseState)this).StartAimMode(2f, false);
					((EntityState)this).skillLocator.special.DeductStock(1);
					DestroyBlueprints();
					exitPending = true;
				}
				if (((ButtonState)(ref ((EntityState)this).inputBank.skill2)).justPressed)
				{
					DestroyBlueprints();
					exitPending = true;
				}
			}
			else if (exitPending)
			{
				exitDelay -= Time.fixedDeltaTime;
				if (exitDelay <= 0f)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		public override void Update()
		{
			//IL_0030: 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)
			((EntityState)this).Update();
			currentPlacementInfo = GetPlacementInfo();
			if (Object.op_Implicit((Object)(object)blueprintController))
			{
				blueprintController.PushState(currentPlacementInfo.position, currentPlacementInfo.rotation, currentPlacementInfo.ok);
			}
		}

		private void DestroyBlueprints()
		{
			EntityState.Destroy((Object)(object)((Component)blueprintController).gameObject);
		}

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

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

		private PlacementInfo GetPlacementInfo()
		{
			//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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_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_0086: 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_00a8: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			direction.y = 0f;
			((Vector3)(ref direction)).Normalize();
			((Ray)(ref aimRay)).direction = direction;
			PlacementInfo result = default(PlacementInfo);
			result.ok = false;
			result.rotation = Util.QuaternionSafeLookRotation(-direction);
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(((Ray)(ref aimRay)).GetPoint(4f) + Vector3.up * 2f, Vector3.down);
			float num = 8f;
			float num2 = num;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.SphereCast(val, 1f, ref val2, num, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)) && ((RaycastHit)(ref val2)).normal.y > 0.5f)
			{
				num2 = ((RaycastHit)(ref val2)).distance;
				result.ok = true;
			}
			Vector3 point = ((Ray)(ref val)).GetPoint(num2 + 1f);
			result.position = point;
			if (result.ok && Physics.CheckCapsule(result.position + Vector3.up * 1f, result.position + Vector3.up * 7f, 0.9f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.defaultLayer)).mask)))
			{
				result.ok = false;
			}
			return result;
		}
	}
	internal class Sacrifice : BaseState
	{
		public static float baseDuration = 1.333f;

		public static float sacrificePercentHealAmount = 0.15f;

		private LanternTracker lanternTracker;

		private float duration;

		private float effectTime;

		private float earlyExitTime;

		private bool hasSnapped;

		private HurtBox target;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration / base.attackSpeedStat;
			effectTime = duration * 0.35f;
			earlyExitTime = duration * 0.625f;
			lanternTracker = ((EntityState)this).GetComponent<LanternTracker>();
			if (!Object.op_Implicit((Object)(object)target))
			{
				target = lanternTracker.GetTrackingTarget();
			}
			((EntityState)this).PlayCrossfade("Right Arm, Override", "FingerSnap", "Swing.playbackRate", duration, 0.05f);
			SacrificeGhoul(target);
			((BaseState)this).StartAimMode(2f, false);
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			NetworkExtensions.Write(writer, HurtBoxReference.FromHurtBox(target));
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0003: 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)
			HurtBoxReference val = NetworkExtensions.ReadHurtBoxReference(reader);
			target = ((HurtBoxReference)(ref val)).ResolveHurtBox();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= effectTime && !hasSnapped)
			{
				hasSnapped = true;
				EffectManager.SimpleMuzzleFlash(MorrisAssets.MorrisFingerSnap, ((EntityState)this).gameObject, "IndexFingerR", false);
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public void SacrificeGhoul(HurtBox sacrificeTarget)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			MorrisMinionController component = ((Component)sacrificeTarget.healthComponent).GetComponent<MorrisMinionController>();
			HealOrb val = new HealOrb();
			((Orb)val).origin = ((Component)component).transform.position;
			((Orb)val).target = ((EntityState)this).characterBody.mainHurtBox;
			val.healValue = ((EntityState)this).characterBody.maxHealth * sacrificePercentHealAmount;
			val.overrideDuration = 0.5f;
			if (NetworkServer.active)
			{
				OrbManager.instance.AddOrb((Orb)(object)val);
			}
			component.Sacrifice(((EntityState)this).gameObject);
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0013: 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)
			return (InterruptPriority)((!(((EntityState)this).fixedAge >= earlyExitTime)) ? 2 : 0);
		}
	}
	internal class SpawnGhoul : BaseState
	{
		public static float baseDuration = 1f;

		private float duration;

		private float earlyExitTime;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration / base.attackSpeedStat;
			earlyExitTime = duration * 0.3f;
			((EntityState)this).PlayCrossfade("Gesture, Override", "LanternRaise", "Swing.playbackRate", duration, 0.05f);
			((BaseState)this).StartAimMode(2f, false);
			AttemptSpawnGhoul();
		}

		private void AttemptSpawnGhoul()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//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_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_0054: Unknown result type (might be due to invalid IL or missing references)
			MasterSummon val = new MasterSummon();
			val.masterPrefab = GhoulMinion.ghoulMasterPrefab;
			val.ignoreTeamMemberLimit = true;
			val.teamIndexOverride = (TeamIndex)1;
			val.summonerBodyObject = ((EntityState)this).gameObject;
			val.position = GetBestSpawnPosition(((BaseState)this).GetAimRay());
			val.rotation = Util.QuaternionSafeLookRotation(((EntityState)this).characterDirection.forward);
			if (NetworkServer.active)
			{
				CharacterMaster val2 = val.Perform();
				if (Object.op_Implicit((Object)(object)val2))
				{
					val2.inventory.CopyEquipmentFrom(((EntityState)this).characterBody.inventory);
				}
			}
		}

		private Vector3 GetBestSpawnPosition(Ray aimRay)
		{
			//IL_0003: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0041: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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)
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			direction.y = 0f;
			((Vector3)(ref direction)).Normalize();
			((Ray)(ref aimRay)).origin = ((Ray)(ref aimRay)).origin + Vector3.up * 2f;
			((Ray)(ref aimRay)).direction = direction;
			RaycastHit val = default(RaycastHit);
			Ray val2 = default(Ray);
			if (Physics.Raycast(aimRay, ref val, 3f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)))
			{
				((Ray)(ref val2))..ctor(((RaycastHit)(ref val)).point + Vector3.up * 2f, Vector3.down);
			}
			else
			{
				((Ray)(ref val2))..ctor(((Ray)(ref aimRay)).GetPoint(3f) + Vector3.up * 2f, Vector3.down);
			}
			Physics.Raycast(val2, ref val, (float)LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask));
			return ((RaycastHit)(ref val)).point;
		}

		private bool ValidateRaycastHit(Ray ray, RaycastHit hit)
		{
			//IL_0003: 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_001d: Unknown result type (might be due to invalid IL or missing references)
			if (((RaycastHit)(ref hit)).normal.y > 0.5f && Vector3.Distance(((RaycastHit)(ref hit)).point, ((Ray)(ref ray)).origin) <= 10f)
			{
				return true;
			}
			return false;
		}

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

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0013: 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)
			return (InterruptPriority)((!(((EntityState)this).fixedAge >= earlyExitTime)) ? 2 : 0);
		}
	}
	internal class SwingShovel : BaseState, IStepSetter
	{
		public static float baseDuration = 1.833f;

		public static float damageCoefficient = 8f;

		public static float smallHopVelocity = 6f;

		public static float hitPauseDuration = 0.12f;

		private Animator animator;

		private OverlapAttack attack;

		private HitBoxGroup hitBoxGroup;

		private float duration;

		private float step;

		private float fireTime;

		private float fireEndTime;

		private float earlyExitTime;

		private bool hasFired;

		private bool hasHopped;

		public string swingSoundString = "Morris_SwingShovel";

		public string hitGhoulSoundString = "Morris_HitGhoulWithShovel";

		public string hitTombstoneSoundString = "";

		private HitStopCachedState hitStopCachedState;

		private float stopWatch;

		private float hitPauseTimer;

		private bool inHitPause;

		public override void OnEnter()
		{
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Expected O, but got Unknown
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			animator = ((EntityState)this).GetModelAnimator();
			duration = baseDuration / base.attackSpeedStat;
			fireTime = duration * 0.18f;
			fireEndTime = duration * 0.22f;
			earlyExitTime = duration * 0.54f;
			((BaseState)this).StartAimMode(2f, false);
			string text = "Swing" + step;
			if (!animator.GetBool("isMoving") && ((EntityState)this).characterMotor.isGrounded)
			{
				((EntityState)this).PlayCrossfade("FullBody, Override", text, "Swing.playbackRate", duration, 0.1f);
			}
			((EntityState)this).PlayCrossfade("Gesture, Override", text, "Swing.playbackRate", duration, 0.1f);
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == "Swing");
			}
			attack = new OverlapAttack();
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.damageType = DamageTypeCombo.op_Implicit((DamageType)0);
			attack.procCoefficient = 1f;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.forceVector = Vector3.zero;
			attack.pushAwayForce = 1f;
			attack.damage = damageCoefficient * base.damageStat;
			attack.hitBoxGroup = hitBoxGroup;
			attack.hitEffectPrefab = MorrisAssets.MorrisShovelHit;
			DamageAPI.AddModdedDamageType(attack, MorrisPlugin.LaunchGhoul);
		}

		public override void FixedUpdate()
		{
			//IL_0065: 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)
			((EntityState)this).FixedUpdate();
			hitPauseTimer -= Time.fixedDeltaTime;
			if (((EntityState)this).fixedAge >= fireTime && !hasFired)
			{
				HitGhoul();
				FireAttack();
			}
			if (hitPauseTimer <= 0f && inHitPause)
			{
				((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator);
				inHitPause = false;
			}
			if (!inHitPause)
			{
				stopWatch += Time.fixedDeltaTime;
			}
			else
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				animator.SetFloat("Swing.playbackRate", 0f);
			}
			if (stopWatch >= duration && hasFired && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public void FireAttack()
		{
			//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_0017: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((BaseState)this).FindModelChild("SwingPivot");
			Ray aimRay = ((BaseState)this).GetAimRay();
			val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
			if (!hasFired)
			{
				PlaySwingEffect();
				hasFired = true;
			}
			if (((EntityState)this).isAuthority && attack.Fire((List<HurtBox>)null))
			{
				if (!((EntityState)this).characterMotor.isGrounded && !hasHopped)
				{
					hasHopped = true;
					((BaseState)this).SmallHop(((EntityState)this).characterMotor, smallHopVelocity);
				}
				if (!inHitPause)
				{
					hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, "Swing.playbackRate");
					hitPauseTimer = hitPauseDuration / base.attackSpeedStat;
					inHitPause = true;
				}
			}
		}

		public void HitGhoul()
		{
			//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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			Transform val = ((BaseState)this).FindModelChild("LaunchHitbox");
			Vector3 position = val.position;
			Vector3 val2 = val.lossyScale * 0.5f;
			Quaternion rotation = val.rotation;
			Collider[] array = Physics.OverlapBox(position, val2, rotation, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.defaultLayer)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.playerFakeActor)).mask));
			Collider[] array2 = array;
			foreach (Collider val3 in array2)
			{
				MorrisMinionController component = ((Component)val3).GetComponent<MorrisMinionController>();
				if (Object.op_Implicit((Object)(object)component) && component.teamIndex == ((EntityState)this).teamComponent.teamIndex)
				{
					switch (component.minionType)
					{
					case MorrisMinionController.MorrisMinionType.Ghoul:
						Util.PlaySound(hitGhoulSoundString, ((Component)component).gameObject);
						break;
					case MorrisMinionController.MorrisMinionType.Tombstone:
						Util.PlaySound(hitTombstoneSoundString, ((Component)component).gameObject);
						break;
					}
					component.Launch(direction);
				}
			}
		}

		public void HitGhoul(HitBoxGroup hitBoxGroup)
		{
			//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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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)
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			HitBox[] hitBoxes = hitBoxGroup.hitBoxes;
			foreach (HitBox val in hitBoxes)
			{
				Transform transform = ((Component)val).transform;
				Vector3 position = transform.position;
				Vector3 val2 = transform.lossyScale * 0.5f;
				Quaternion rotation = transform.rotation;
				Collider[] array = Physics.OverlapBox(position, val2, rotation, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.defaultLayer)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.fakeActor)).mask));
				Collider[] array2 = array;
				foreach (Collider val3 in array2)
				{
					MorrisMinionController component = ((Component)val3).GetComponent<MorrisMinionController>();
					if (Object.op_Implicit((Object)(object)component) && component.teamIndex == ((EntityState)this).teamComponent.teamIndex)
					{
						switch (component.minionType)
						{
						case MorrisMinionController.MorrisMinionType.Ghoul:
							Util.PlaySound(hitGhoulSoundString, ((Component)component).gameObject);
							break;
						case MorrisMinionController.MorrisMinionType.Tombstone:
							Util.PlaySound(hitTombstoneSoundString, ((Component)component).gameObject);
							break;
						}
						component.Launch(direction);
					}
				}
			}
		}

		public void PlaySwingEffect()
		{
			string text = ((step == 0f) ? "SwingLeft" : "SwingRight");
			string text2 = ((step == 0f) ? "1" : "2");
			text2 = swingSoundString + text2;
			Util.PlaySound(text2, ((EntityState)this).gameObject);
			EffectManager.SimpleMuzzleFlash(MorrisAssets.ShovelSwingVFX, ((EntityState)this).gameObject, text, false);
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)((!(((EntityState)this).fixedAge >= earlyExitTime) || !hasFired) ? 1 : 0);
		}

		public void SetStep(int i)
		{
			step = i;
		}
	}
	internal class SkillTemplate : BaseState
	{
		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			((BaseState)this).StartAimMode(2f, false);
		}

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

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
}
namespace SkillStates.Ghoul
{
	internal class BileSpit : BaseState
	{
		public static GameObject spitPrefab = Projectiles.ghoulBilePrefab;

		public static GameObject muzzleEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Croco/MuzzleflashCroco.prefab").WaitForCompletion();

		public static float baseDuration = 1f;

		public static float damageCoefficient = 1f;

		private MorrisMinionController minionController;

		private float duration;

		private float fireTime;

		private bool hasFired;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			minionController = ((EntityState)this).GetComponent<MorrisMinionController>();
			duration = baseDuration / base.attackSpeedStat;
			fireTime = duration * 0.2f;
			((EntityState)this).PlayCrossfade("Gesture, Override", "BileSpit", "Attack.playbackRate", duration, 0.1f);
			((BaseState)this).StartAimMode(duration, false);
		}

		public override void FixedUpdate()
		{
			//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_005f: 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_00e0: 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_00f3: 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)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= fireTime && !hasFired)
			{
				hasFired = true;
				EffectManager.SimpleMuzzleFlash(muzzleEffect, ((EntityState)this).gameObject, "UpperJaw", true);
				if (((EntityState)this).isAuthority)
				{
					Ray aimRay = ((BaseState)this).GetAimRay();
					FireProjectileInfo val = default(FireProjectileInfo);
					val.crit = (Object.op_Implicit((Object)(object)minionController.owner) ? Util.CheckRoll(minionController.ownerBody.crit, minionController.ownerBody.master) : ((BaseState)this).RollCrit());
					val.damage = damageCoefficient * base.damageStat;
					val.force = 100f;
					val.owner = ((EntityState)this).gameObject;
					val.position = ((Ray)(ref aimRay)).origin;
					val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
					val.projectilePrefab = spitPrefab;
					ProjectileManager.instance.FireProjectile(val);
				}
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

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

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

		public static float biteInterval = 0.7f;

		public static Vector3 downwardForce = Vector3.down * 800f;

		public HurtBox initialTarget;

		public HurtBoxGroup targetGroup;

		private Transform modelTransform;

		private HurtBox clingHurtbox;

		private Collider targetCollider;

		private bool negativeOffset;

		private MorrisMinionController minionController;

		private float stopwatch;

		public override void OnEnter()
		{
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			((EntityState)this).PlayAnimation("FullBody, Override", "ClingLoop");
			((EntityState)this).PlayCrossfade("FullBody, Additive", "ClingBite", "Attack.playbackRate", biteInterval, 0.1f);
			((Behaviour)((EntityState)this).modelLocator).enabled = false;
			((Behaviour)((EntityState)this).characterDirection).enabled = false;
			modelTransform = ((EntityState)this).GetModelTransform();
			negativeOffset = Random.value > 0.5f;
			if (Object.op_Implicit((Object)(object)initialTarget))
			{
				targetGroup = initialTarget.hurtBoxGroup;
				int num = Random.Range(0, targetGroup.hurtBoxes.Length);
				clingHurtbox = targetGroup.hurtBoxes[num];
				targetCollider = ((Component)clingHurtbox).GetComponent<Collider>();
			}
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			minionController = ((EntityState)this).GetComponent<MorrisMinionController>();
			minionController.isInClingState = true;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			NetworkExtensions.Write(writer, HurtBoxReference.FromHurtBox(initialTarget));
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0003: 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)
			HurtBoxReference val = NetworkExtensions.ReadHurtBoxReference(reader);
			initialTarget = ((HurtBoxReference)(ref val)).ResolveHurtBox();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			UpdateClingPoint();
			stopwatch += Time.fixedDeltaTime;
			if (stopwatch >= biteInterval && initialTarget.healthComponent.alive)
			{
				stopwatch = 0f;
				Bite();
			}
			if (!initialTarget.healthComponent.alive && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public void UpdateClingPoint()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_00ae: 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_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)
			((EntityState)this).characterMotor.velocity = Vector3.zero;
			((EntityState)this).characterMotor.rootMotion = Vector3.zero;
			Bounds bounds = targetCollider.bounds;
			Vector3 center = ((Bounds)(ref bounds)).center;
			bounds = targetCollider.bounds;
			float num = ((Bounds)(ref bounds)).extents.z;
			Quaternion val = ((Component)targetCollider).transform.rotation;
			if (negativeOffset)
			{
				num *= -1f;
				val = Quaternion.Inverse(val);
			}
			center.z -= num;
			((BaseCharacterController)((EntityState)this).characterMotor).Motor.SetPosition(center, true);
			modelTransform.position = center;
			modelTransform.rotation = val;
		}

		public void Bite()
		{
			//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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			((EntityState)this).PlayCrossfade("FullBody, Additive", "ClingBite", "Attack.playbackRate", biteInterval, 0.1f);
			EffectData val = new EffectData
			{
				origin = ((Component)clingHurtbox).transform.position,
				rotation = modelTransform.rotation,
				scale = 1.5f
			};
			EffectManager.SpawnEffect(MorrisAssets.GhoulBiteEffect, val, true);
			EffectManager.SpawnEffect(MorrisAssets.OmniImpactVFXGhoul, val, true);
			Util.PlaySound("Play_acrid_m2_bite_hit", ((EntityState)this).gameObject, "Volume_SFX", 0.2f);
			try
			{
				DamageInfo val2 = new DamageInfo
				{
					position = ((Component)initialTarget).transform.position,
					attacker = (Object.op_Implicit((Object)(object)minionController.owner) ? minionController.owner : ((EntityState)this).gameObject),
					inflictor = ((EntityState)this).gameObject,
					damage = damageCoefficient * base.damageStat,
					damageColorIndex = (DamageColorIndex)0,
					damageType = DamageTypeCombo.op_Implicit((DamageType)0),
					crit = (Object.op_Implicit((Object)(object)minionController.owner) ? Util.CheckRoll(minionController.ownerBody.crit, minionController.ownerBody.master) : ((BaseState)this).RollCrit()),
					force = downwardForce,
					procChainMask = default(ProcChainMask),
					procCoefficient = 0.8f
				};
				if (NetworkServer.active)
				{
					initialTarget.healthComponent.TakeDamage(val2);
					GlobalEventManager.instance.OnHitEnemy(val2, ((Component)initialTarget.healthComponent).gameObject);
					GlobalEventManager.instance.OnHitAll(val2, ((Component)initialTarget.healthComponent).gameObject);
				}
			}
			catch (Exception)
			{
				Log.Warning("NRE in Bite()");
			}
		}

		public override void OnExit()
		{
			((Behaviour)((EntityState)this).modelLocator).enabled = true;
			((Behaviour)((EntityState)this).characterDirection).enabled = true;
			minionController.isInClingState = false;
			((EntityState)this).gameObject.layer = LayerIndex.playerFakeActor.intVal;
			((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
			((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)5;
		}
	}
	internal class GhoulDeath : GenericCharacterDeath
	{
		public static float duration = 0.375f;

		public static float sacrificedDamageCoefficient = 7f;

		public static float sacrificedRadius = 18f;

		public static float smallHopVelocity = 7f;

		private MorrisMinionController minionController;

		private bool sacrificed;

		private BlastAttack attack;

		private float radius;

		private bool hasExploded;

		public override void OnEnter()
		{
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			((GenericCharacterDeath)this).OnEnter();
			minionController = ((EntityState)this).gameObject.GetComponent<MorrisMinionController>();
			sacrificed = minionController.sacrificed;
			if (sacrificed)
			{
				((EntityState)this).PlayCrossfade("FullBody, Override", "Sacrificed", 0.1f);
				Transform modelTransform = ((EntityState)this).GetModelTransform();
				TemporaryOverlayInstance val = TemporaryOverlayManager.AddOverlay(((EntityState)this).gameObject);
				val.duration = duration * 1.5f;
				val.animateShaderAlpha = true;
				val.alphaCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
				val.destroyComponentOnEnd = true;
				val.originalMaterial = MorrisAssets.GhoulSacrificedMat;
				val.AddToCharacterModel(((Component)modelTransform).GetComponent<CharacterModel>());
			}
			else
			{
				RagdollController component = ((Component)((GenericCharacterDeath)this).cachedModelTransform).GetComponent<RagdollController>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Vector3 val2 = ((EntityState)this).characterMotor.velocity + Vector3.up * 3f;
					component.BeginRagdoll(val2);
				}
			}
			if (sacrificed && ((EntityState)this).isAuthority)
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				((BaseState)this).SmallHop(((EntityState)this).characterMotor, smallHopVelocity);
			}
		}

		public override void FixedUpdate()
		{
			((GenericCharacterDeath)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration && !hasExploded)
			{
				hasExploded = true;
				if (sacrificed)
				{
					((GenericCharacterDeath)this).DestroyModel();
					Explode();
				}
				if (NetworkServer.active)
				{
					((GenericCharacterDeath)this).DestroyBodyAsapServer();
				}
			}
		}

		public void Explode()
		{
			//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_000d: 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_0025: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0098: 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_011a: 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_0140: 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_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			EffectData val = new EffectData
			{
				origin = ((EntityState)this).characterBody.footPosition,
				scale = radius
			};
			EffectManager.SpawnEffect(MorrisAssets.GhoulSacrificeExplosion, val, true);
			if (((EntityState)this).isAuthority)
			{
				attack = new BlastAttack();
				attack.attacker = (Object.op_Implicit((Object)(object)minionController.sacrificeOwner) ? minionController.sacrificeOwner : minionController.owner);
				attack.inflictor = ((EntityState)this).gameObject;
				attack.teamIndex = ((BaseState)this).GetTeam();
				attack.baseDamage = sacrificedDamageCoefficient * ((BaseState)this).damageStat;
				attack.crit = (Object.op_Implicit((Object)(object)minionController.owner) ? Util.CheckRoll(minionController.ownerBody.crit, minionController.ownerBody.master) : ((BaseState)this).RollCrit());
				attack.procCoefficient = 1f;
				attack.damageType = DamageTypeCombo.op_Implicit((DamageType)0);
				attack.baseForce = 0f;
				attack.position = ((EntityState)this).transform.position;
				attack.radius = sacrificedRadius;
				attack.attackerFiltering = (AttackerFiltering)2;
				attack.falloffModel = (FalloffModel)0;
				attack.impactEffect = EffectCatalog.FindEffectIndexFromPrefab(MorrisAssets.OmniImpactVFXGhoul);
				attack.Fire();
			}
		}

		public override void OnExit()
		{
			((GenericCharacterDeath)this).OnExit();
		}
	}
	internal class GhoulLaunched : BaseLaunchedState
	{
		private Transform launchTrail;

		private Transform launchRings;

		private bool willCling;

		public override void OnEnter()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			launchPower = 85f;
			damageType = (DamageType)0;
			impactVFX = MorrisAssets.OmniImpactVFXGhoul;
			base.OnEnter();
			((EntityState)this).gameObject.layer = LayerIndex.debris.intVal;
			((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
			launchTrail = ((BaseState)this).FindModelChild("LaunchTrail");
			((Component)launchTrail).gameObject.SetActive(true);
			launchRings = ((BaseState)this).FindModelChild("LaunchRings");
			((Component)launchRings).gameObject.SetActive(true);
		}

		public override void OnHitLargeEnemy(HurtBox target)
		{
			if (((EntityState)this).isAuthority)
			{
				willCling = true;
				ClingState nextState = new ClingState
				{
					initialTarget = target
				};
				((EntityState)this).outer.SetNextState((EntityState)(object)nextState);
			}
		}

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

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

		public override void OnExit()
		{
			if (!willCling)
			{
				((EntityState)this).gameObject.layer = LayerIndex.playerFakeActor.intVal;
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
			}
			((Component)launchTrail).gameObject.SetActive(false);
			((Component)launchRings).gameObject.SetActive(false);
			if (((EntityState)this).isAuthority && ((EntityState)this).healthComponent.alive)
			{
				GameObject masterObject = ((EntityState)this).characterBody.masterObject;
				BaseAI component = masterObject.GetComponent<BaseAI>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.currentEnemy.Reset();
					component.ForceAcquireNearestEnemyIfNoCurrentEnemy();
				}
			}
			base.OnExit();
		}
	}
	internal class GhoulMelee : BaseState
	{
		public static float baseDuration = 1f;

		public static float damageCoefficient = 1.5f;

		private MorrisMinionController minionController;

		private OverlapAttack attack;

		private string animString = "Melee";

		private string muzzleName = "MuzzleMelee";

		private int meleeIndex;

		private float duration;

		private float fireTime;

		private bool hasFired;

		public override void OnEnter()
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Expected O, but got Unknown
			//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_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / base.attackSpeedStat;
			fireTime = duration * 0.2f;
			((BaseState)this).StartAimMode(2f, false);
			minionController = ((EntityState)this).GetComponent<MorrisMinionController>();
			if (meleeIndex == 0)
			{
				meleeIndex = Random.RandomRangeInt(1, 5);
			}
			animString += meleeIndex;
			muzzleName += meleeIndex;
			((EntityState)this).PlayCrossfade("Gesture, Override", animString, "Attack.playbackRate", duration, 0.1f);
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			HitBoxGroup hitBoxGroup = new HitBoxGroup();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == "GhoulMelee");
			}
			attack = new OverlapAttack();
			attack.attacker = (Object.op_Implicit((Object)(object)minionController.owner) ? minionController.owner : ((EntityState)this).gameObject);
			attack.inflictor = ((EntityState)this).gameObject;
			attack.damageType = DamageTypeCombo.op_Implicit((DamageType)0);
			attack.procCoefficient = 1f;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.isCrit = (Object.op_Implicit((Object)(object)minionController.owner) ? Util.CheckRoll(minionController.ownerBody.crit, minionController.ownerBody.master) : ((BaseState)this).RollCrit());
			attack.forceVector = Vector3.zero;
			attack.pushAwayForce = 1f;
			attack.damage = damageCoefficient * base.damageStat;
			attack.hitBoxGroup = hitBoxGroup;
			attack.hitEffectPrefab = MorrisAssets.OmniImpactVFXGhoul;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((EntityState)this).OnSerialize(writer);
			writer.Write((byte)meleeIndex);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((EntityState)this).OnDeserialize(reader);
			meleeIndex = reader.ReadByte();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= fireTime && !hasFired)
			{
				hasFired = true;
				EffectManager.SimpleMuzzleFlash(MorrisAssets.GhoulMeleeEffects[meleeIndex], ((EntityState)this).gameObject, muzzleName, true);
				if (((EntityState)this).isAuthority)
				{
					attack.Fire((List<HurtBox>)null);
				}
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)1;
		}
	}
	internal class GhoulSpawn : BaseState
	{
		public static GameObject spawnEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/SpawnLemurian.prefab").WaitForCompletion();

		public static float baseDuration = 0.5f;

		public override void OnEnter()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			((BaseState)this).OnEnter();
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.HiddenInvincibility);
			}
			EffectData val = new EffectData
			{
				origin = ((EntityState)this).characterBody.footPosition
			};
			EffectManager.SpawnEffect(spawnEffect, val, true);
			Util.PlaySound("Play_treeBot_sprint_end", ((EntityState)this).gameObject);
		}

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

		public override void OnExit()
		{
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.HiddenInvincibility);
			}
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
}
namespace SkillStates.CoffinPod
{
	internal class Descent : SurvivorPodBaseState
	{
		private const float duration = 4f;

		private ShakeEmitter shakeEmitter;

		public override void OnEnter()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			((SurvivorPodBaseState)this).OnEnter();
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (!Object.op_Implicit((Object)(object)modelTransform))
			{
				return;
			}
			ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Transform val = component.FindChild("Pivot");
				if (Object.op_Implicit((Object)(object)val))
				{
					shakeEmitter = ((Component)val).gameObject.AddComponent<ShakeEmitter>();
					shakeEmitter.wave = new Wave
					{
						amplitude = 1f,
						frequency = 180f,
						cycleOffset = 0f
					};
					shakeEmitter.duration = 10000f;
					shakeEmitter.radius = 400f;
					shakeEmitter.amplitudeTimeDecay = false;
				}
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge > 4f)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new Landed());
			}
		}

		public override void OnExit()
		{
			EntityState.Destroy((Object)(object)shakeEmitter);
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	internal class Landed : SurvivorPodBaseState
	{
		public override void OnEnter()
		{
			((SurvivorPodBaseState)this).OnEnter();
			((SurvivorPodBaseState)this).vehicleSeat.handleVehicleExitRequestServer.AddCallback((CallbackDelegate<bool, GameObject>)HandleVehicleExitRequest);
		}

		private void HandleVehicleExitRequest(GameObject arg, ref bool? resultOverride)
		{
			((SurvivorPodBaseState)this).survivorPodController.exitAllowed = false;
			((EntityState)this).outer.SetNextState((EntityState)(object)new Release());
			resultOverride = true;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge > 0f)
			{
				((SurvivorPodBaseState)this).survivorPodController.exitAllowed = true;
			}
		}

		public override void OnExit()
		{
			((SurvivorPodBaseState)this).vehicleSeat.handleVehicleExitRequestServer.RemoveCallback((CallbackDelegate<bool, GameObject>)HandleVehicleExitRequest);
			((SurvivorPodBaseState)this).survivorPodController.exitAllowed = false;
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	internal class Release : SurvivorPodBaseState
	{
		public override void OnEnter()
		{
			((SurvivorPodBaseState)this).OnEnter();
			((EntityState)this).PlayAnimation("Base", "OpenDoor");
			if (NetworkServer.active && Object.op_Implicit((Object)(object)((SurvivorPodBaseState)this).vehicleSeat) && Object.op_Implicit((Object)(object)((SurvivorPodBaseState)this).vehicleSeat.currentPassengerBody))
			{
				((SurvivorPodBaseState)this).vehicleSeat.EjectPassenger(((Component)((SurvivorPodBaseState)this).vehicleSeat.currentPassengerBody).gameObject);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (NetworkServer.active && !Object.op_Implicit((Object)(object)((SurvivorPodBaseState)this).vehicleSeat.currentPassengerBody))
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
}
namespace Morris
{
	internal static class Log
	{
		internal static ManualLogSource _logSource;

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

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

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

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

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

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

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Bog.Morris", "Mortician", "0.1.5")]
	public class MorrisPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.Bog.Morris";

		public const string MODNAME = "Mortician";

		public const string MODVERSION = "0.1.5";

		public const string DEVELOPER_PREFIX = "BOG";

		public static MorrisPlugin instance;

		public static PluginInfo PInfo;

		public static GameObject MorrisBodyPrefab;

		public static BodyIndex MorrisBodyIndex;

		public static GameObject GhoulBodyPrefab;

		public static BodyIndex GhoulBodyIndex;

		internal static GameObject TombstoneBodyPrefab;

		internal static BodyIndex TombstoneBodyIndex;

		public static ModdedDamageType LaunchGhoul;

		public static bool containsCustomEmoteAPI;

		private void Awake()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			PInfo = ((BaseUnityPlugin)this).Info;
			Config.ReadConfig(this);
			containsCustomEmoteAPI = Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.CustomEmotesAPI");
			MorrisAssets.Initialize();
			((MonoBehaviour)this).StartCoroutine(ShaderSwapper.UpgradeStubbedShadersAsync(MorrisAssets.mainAssetBundle));
			States.RegisterStates();
			Buffs.RegisterBuffs();
			Projectiles.RegisterProjectiles();
			Tokens.AddTokens();
			ItemDisplays.PopulateDisplays();
			LaunchGhoul = DamageAPI.ReserveDamageType();
			new Morris.Modules.Survivors.Morris().Initialize();
			new GhoulMinion().Initialize();
			new TombstoneDeployable().Initialize();
			new ContentPacks().Initialize();
			Subscriptions();
			Hook();
			if (!containsCustomEmoteAPI)
			{
			}
		}

		public IEnumerator CoroutineMaterialStuff()
		{
			yield return ShaderSwapper.UpgradeStubbedShadersAsync(MorrisAssets.mainAssetBundle);
			yield return Materials.FixRenderQueues();
		}

		private void Start()
		{
		}

		private void Subscriptions()
		{
		}

		private void ShowHealthBarToOwner(DamageDealtMessage obj)
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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)
			if (!Object.op_Implicit((Object)(object)obj.attacker) || !Object.op_Implicit((Object)(object)obj.victim) || obj.isSilent)
			{
				return;
			}
			MorrisMinionController component = obj.attacker.GetComponent<MorrisMinionController>();
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.owner))
			{
				return;
			}
			HealthComponent component2 = obj.victim.GetComponent<HealthComponent>();
			if (!Object.op_Implicit((Object)(object)component2) || component2.dontShowHealthbar)
			{
				return;
			}
			TeamIndex teamIndex = component2.body.teamComponent.teamIndex;
			foreach (CombatHealthBarViewer instances in CombatHealthBarViewer.instancesList)
			{
				if ((Object)(object)component.owner == (Object)(object)instances.viewerBodyObject && Object.op_Implicit((Object)(object)instances.viewerBodyObject))
				{
					instances.HandleDamage(component2, teamIndex);
				}
			}
		}

		private void Hook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			BodyCatalog.SetBodyPrefabs += new hook_SetBodyPrefabs(BodyCatalog_SetBodyPrefabs);
		}

		private EntityState EntityStateCatalog_InstantiateState_Type(orig_InstantiateState_Type orig, Type stateType)
		{
			Log.Warning(Environment.StackTrace);
			return orig.Invoke(stateType);
		}

		private void GlobalEventManager_OnCharacterDeath(ILContext il)
		{
		}

		private void MinionGroup_AddMinion(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(Component).GetMethod("GetComponent", new Type[0])),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1)
			});
			val.Index += 4;
			Log.Warning(val);
		}

		private void BodyCatalog_SetBodyPrefabs(orig_SetBodyPrefabs orig, GameObject[] newBodyPrefabs)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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)
			orig.Invoke(newBodyPrefabs);
			MorrisBodyIndex = BodyCatalog.FindBodyIndex(MorrisBodyPrefab);
			GhoulBodyIndex = BodyCatalog.FindBodyIndex(GhoulBodyPrefab);
			TombstoneBodyIndex = BodyCatalog.FindBodyIndex(TombstoneBodyPrefab);
		}

		private void CustomEmoteAPICompat()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			BodyCatalog.SetBodyPrefabs += new hook_SetBodyPrefabs(CreateEmoteSkeletons);
			CustomEmotesAPI.boneMapperCreated += new BoneMapperCreated(CustomEmotesAPI_boneMapperCreated);
			CustomEmotesAPI.animChanged += new AnimationChanged(CustomEmotesAPI_animChanged);
		}

		private void CreateEmoteSkeletons(orig_SetBodyPrefabs orig, GameObject[] newBodyPrefabs)
		{
			orig.Invoke(newBodyPrefabs);
			Log.Warning("Creating Morris emote skeleton");
			GameObject val = MorrisAssets.mainAssetBundle.LoadAsset<GameObject>("MorrisHumanoidSkeleton");
			CustomEmotesAPI.ImportArmature(MorrisBodyPrefab, val, 0, true);
			val.GetComponentInChildren<BoneMapper>().scale = 1f;
			Log.Warning("Creating Ghoul emote skeleton");
			GameObject val2 = MorrisAssets.mainAssetBundle.LoadAsset<GameObject>("GhoulHumanoidSkeleton");
			CustomEmotesAPI.ImportArmature(GhoulBodyPrefab, val2, 0, true);
			val2.GetComponentInChildren<BoneMapper>().scale = 1f;
		}

		private void CustomEmotesAPI_boneMapperCreated(BoneMapper mapper)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if (mapper.mapperBody.bodyIndex != GhoulBodyIndex)
			{
				return;
			}
			MorrisMinionController component = ((Component)mapper.mapperBody).GetComponent<MorrisMinionController>();
			if (Object.op_Implicit((Object)(object)component.owner))
			{
				BoneMapper componentInChildren = ((Component)component.owner.GetComponent<ModelLocator>().modelTransform).GetComponentInChildren<BoneMapper>();
				if (Object.op_Implicit((Object)(object)componentInChildren) && componentInChildren.currentClipName != "none")
				{
					CustomEmotesAPI.PlayAnimation(componentInChildren.currentClipName, mapper, -2);
				}
			}
		}

		private void CustomEmotesAPI_animChanged(string newAnimation, BoneMapper mapper)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if (mapper.mapperBody.bodyIndex != MorrisBodyIndex)
			{
				return;
			}
			IEnumerable<CharacterMaster> enumerable = CharacterMaster.readOnlyInstancesList.Where((CharacterMaster el) => (Object)(object)el.minionOwnership.ownerMaster == (Object)(object)mapper.mapperBody.master);
			foreach (CharacterMaster item in enumerable)
			{
				if (item.GetBody().bodyIndex == GhoulBodyIndex && item.GetBody().healthComponent.alive)
				{
					ModelLocator component = item.GetBodyObject().GetComponent<ModelLocator>();
					if (Object.op_Implicit((Object)(object)component))
					{
						BoneMapper componentInChildren = ((Component)component.modelTransform).GetComponentInChildren<BoneMapper>();
						CustomEmotesAPI.PlayAnimation(newAnimation, componentInChildren, -2);
					}
				}
			}
		}
	}
}
namespace Morris.Content
{
	internal class TombstoneSoulOrb : GenericDamageOrb
	{
		public static string explodeSoundString = "Play_engi_M2_explo";

		public static float orbSpeed = 100f;

		public static float blastRadius = 15f;

		public override void Begin()
		{
			base.speed = orbSpeed;
			((GenericDamageOrb)this).Begin();
		}

		public override GameObject GetOrbEffect()
		{
			return MorrisAssets.SoulOrbTrailEffect;
		}

		public override void OnArrival()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((Orb)this).target))
			{
				GameObject soulOrbExplosion = MorrisAssets.SoulOrbExplosion;
				EffectData val = new EffectData
				{
					origin = ((Component)((Orb)this).target).transform.position,
					scale = blastRadius
				};
				EffectManager.SpawnEffect(soulOrbExplosion, val, true);
				Util.PlaySound(explodeSoundString, ((Component)((Orb)this).target).gameObject);
				if (Object.op_Implicit((Object)(object)base.attacker))
				{
					new BlastAttack
					{
						attacker = base.attacker,
						baseDamage = base.damageValue,
						baseForce = 0f,
						bonusForce = Vector3.down * 1000f,
						crit = base.isCrit,
						damageColorIndex = (DamageColorIndex)3,
						damageType = DamageTypeCombo.op_Implicit((DamageType)0),
						falloffModel = (FalloffModel)0,
						inflictor = null,
						position = ((Component)((Orb)this).target).transform.position,
						procChainMask = base.procChainMask,
						procCoefficient = base.procCoefficient,
						radius = blastRadius,
						teamIndex = TeamComponent.GetObjectTeam(base.attacker)
					}.Fire();
				}
			}
		}
	}
}
namespace Morris.Modules
{
	public static class Buffs
	{
		internal static BuffDef exhaustionDebuff;

		public static float exhaustStatReduction = 0.7f;

		public static float exhaustCooldownScale = 1.2f;

		internal static void RegisterBuffs()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			BuffDef val = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Treebot/bdWeak.asset").WaitForCompletion();
			exhaustionDebuff = AddNewBuff("Exhaustion", val.iconSprite, new Color(79f, 255f, 244f), canStack: false, isDebuff: true);
		}

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

		private void Subscriptions()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			if (Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.CustomEmotesAPI"))
			{
				CustomEmotesAPI.animChanged += new AnimationChanged(CustomEmotesAPI_animChanged);
			}
		}

		private void CustomEmotesAPI_animChanged(string newAnimation, BoneMapper mapper)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if (mapper.mapperBody.bodyIndex != MorrisPlugin.MorrisBodyIndex)
			{
				return;
			}
			IEnumerable<CharacterMaster> enumerable = CharacterMaster.readOnlyInstancesList.Where((CharacterMaster el) => (Object)(object)el.minionOwnership.ownerMaster == (Object)(object)mapper.mapperBody.master);
			foreach (CharacterMaster item in enumerable)
			{
				if (item.GetBody().bodyIndex == MorrisPlugin.GhoulBodyIndex)
				{
					Chat.AddMessage("Getting bone mapper for ghoul");
					ModelLocator component = item.GetBodyObject().GetComponent<ModelLocator>();
					if (Object.op_Implicit((Object)(object)component))
					{
						BoneMapper componentInChildren = ((Component)component.modelTransform).GetComponentInChildren<BoneMapper>();
						CustomEmotesAPI.PlayAnimation(newAnimation, componentInChildren, -2);
					}
				}
			}
		}
	}
	public static class Config
	{
		private static ConfigEntry<string> modVersion;

		public static ConfigEntry<float> sortPosition;

		public static ConfigEntry<int> ghoulLimit;

		public static string passiveTitle = "Passive";

		public static string primaryTitle = "Primary";

		public static string secondaryTitle = "Secondary";

		public static string utilityTitle = "Utility";

		public static string specialTitle = "Special";

		public static void ReadConfig(MorrisPlugin plugin)
		{
			sortPosition = ((BaseUnityPlugin)plugin).Config.Bind<float>("General", "Lobby Sort Position", 16f, "Sort position of Mortician in the character select lobby");
			ghoulLimit = ((BaseUnityPlugin)plugin).Config.Bind<int>("General", "Ghoul limit", 0, "The maximum amount of ghouls that you can have out in the field. Set this to 0 or a negative number to have no limit. The intended experience is to have no limit at all, so I highly suggest only touching this if you are experiencing lag.");
		}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		public static void AddNetworkedObject(GameObject networkedObject)
		{
			ContentPacks.networkedObjects.Add(networkedObject);
		}

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

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

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

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

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

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

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

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

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

		public static IEnumerator FixRenderQueues()
		{
			Material blueFire = MorrisAssets.mainAssetBundle.LoadAsset<Material>("matMorrisFireBlue");
			Material greenFire = MorrisAssets.mainAssetBundle.LoadAsset<Material>("matMorrisFireGreen");
			blueFire.renderQueue = 2950;
			greenFire.renderQueue = 2900;
			yield return null;
		}

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

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

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

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

		public static Material SetEmission(t