Decompiled source of Mortician v0.1.4

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 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.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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Morris")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+846f655b102dd7b7e73b92746583858a00643e97")]
[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(Assets.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 = Assets.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();
			TemporaryOverlay val = ((Component)modelTransform).gameObject.AddComponent<TemporaryOverlay>();
			val.duration = duration * 1.2f;
			val.animateShaderAlpha = true;
			val.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0.1f);
			val.destroyComponentOnEnd = true;
			val.originalMaterial = Assets.TombstoneSpawnMat;
			val.AddToCharacerModel(((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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			//IL_0178: 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_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: 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();
				((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 = 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)4;
		}
	}
}
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>(Assets.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(Assets.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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: 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_01e9: 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 = (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 = Assets.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.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 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(Assets.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 projectilePrefab = 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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 = (Object.op_Implicit((Object)(object)minionController.owner) ? minionController.owner : ((EntityState)this).gameObject);
					val.position = ((Ray)(ref aimRay)).origin;
					val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
					val.projectilePrefab = projectilePrefab;
					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_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: 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(Assets.GhoulBiteEffect, val, true);
			EffectManager.SpawnEffect(Assets.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 = (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.fakeActor.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)4;
		}
	}
	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();
				TemporaryOverlay val = ((Component)modelTransform).gameObject.AddComponent<TemporaryOverlay>();
				val.duration = duration * 1.5f;
				val.animateShaderAlpha = true;
				val.alphaCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
				val.destroyComponentOnEnd = true;
				val.originalMaterial = Assets.GhoulSacrificedMat;
				val.AddToCharacerModel(((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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: 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_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			EffectData val = new EffectData
			{
				origin = ((EntityState)this).characterBody.footPosition,
				scale = radius
			};
			EffectManager.SpawnEffect(Assets.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 = (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(Assets.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 = Assets.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.fakeActor.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_016e: 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_01c8: 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)
			((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 = (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 = Assets.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(Assets.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 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);
		}
	}
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Bog.Morris", "Mortician", "0.1.4")]
	public class MorrisPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.Bog.Morris";

		public const string MODNAME = "Mortician";

		public const string MODVERSION = "0.1.4";

		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");
			Assets.Initialize();
			((MonoBehaviour)this).StartCoroutine(ShaderSwapper.UpgradeStubbedShadersAsync(Assets.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)
			{
				CustomEmoteAPICompat();
			}
		}

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

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

		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 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 = Assets.mainAssetBundle.LoadAsset<GameObject>("MorrisHumanoidSkeleton");
			CustomEmotesAPI.ImportArmature(MorrisBodyPrefab, val, 0, true);
			val.GetComponentInChildren<BoneMapper>().scale = 1f;
			Log.Warning("Creating Ghoul emote skeleton");
			GameObject val2 = Assets.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 Assets.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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (Object.op_Implicit((Object)(object)((Orb)this).target))
			{
				GameObject soulOrbExplosion = Assets.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 = (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
{
	internal static class Assets
	{
		internal static AssetBundle mainAssetBundle;

		internal static NetworkSoundEventDef swordHitSoundEvent;

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

		internal static Material commandoMat;

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

		private const string assetFolder = "MorrisAssets";

		private const string assetbundleName = "morrisassetbundle";

		private const string soundbankFolder = "MorrisSoundbanks";

		private const string soundbankName = "MorrisBank.bnk";

		private const string csProjName = "Morris";

		public static GameObject LanternIndicator;

		public static GameObject ShovelSwingVFX;

		public static GameObject MorrisShovelHitGhoul;

		public static GameObject MorrisShovelHit;

		public static GameObject MorrisFingerSnap;

		public static Material GhoulSacrificedMat;

		public static GameObject GhoulSacrificeExplosion;

		public static GameObject OmniImpactVFXGhoul;

		public static Dictionary<int, GameObject> GhoulMeleeEffects = new Dictionary<int, GameObject>();

		public static GameObject GhoulBiteEffect;

		public static GameObject GhoulLickEffect;

		public static GameObject GhoulSlashEffect;

		public static GameObject TombstoneBlueprintsPrefab;

		public static Material TombstoneSpawnMat;

		public static GameObject SoulOrbActivatedEffect;

		public static GameObject SoulOrbTrailEffect;

		public static GameObject SoulOrbExplosion;

		public static GameObject OmniImpactVFXTombstone;

		public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(MorrisPlugin.PInfo.Location), "MorrisAssets", "morrisassetbundle");

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

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

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

		internal static void LoadSoundbank()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_0073: Invalid comparison between Unknown and I4
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			Log.Info("Loading Morris soundbank now");
			AKRESULT val = AkSoundEngine.AddBasePath(SoundBankPath);
			if ((int)val == 1)
			{
				Log.Warning("Added bank base path : " + SoundBankPath);
			}
			else
			{
				Log.Error("Error adding base path : " + SoundBankPath + " " + $"Error code : {val}");
			}
			uint num = default(uint);
			val = AkSoundEngine.LoadBank("MorrisBank.bnk", ref num);
			if ((int)val == 1)
			{
				Log.Warning("Added bank : MorrisBank.bnk");
			}
			else
			{
				Log.Error("Error loading bank : MorrisBank.bnk " + $"Error code : {val}");
			}
		}

		internal static void PopulateAssets()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)mainAssetBundle))
			{
				Log.Error("There is no AssetBundle to load assets from.");
				return;
			}
			LanternIndicator = mainAssetBundle.LoadAsset<GameObject>("LanternTrackingIndicator");
			ShovelSwingVFX = LoadEffect("MorrisSwing", parentToTransform: true);
			MorrisShovelHit = LoadEffect("OmniImpactVFXMorris", "Morris_ShovelImpact");
			MorrisFingerSnap = LoadEffect("HitsparkMorrisFinger", "Morris_FingerSnap", parentToTransform: true);
			Material val = mainAssetBundle.LoadAsset<Material>("matGhoulExplosion");
			Texture2D val2 = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/ColorRamps/texRampTritone.png").WaitForCompletion();
			val.SetTexture("_RemapTex", (Texture)(object)val2);
			GhoulSacrificeExplosion = LoadEffect("GhoulSacrificeExplosion", "Play_bleedOnCritAndExplode_explode");
			GhoulSacrificedMat = mainAssetBundle.LoadAsset<Material>("matGhoulSacrificed");
			OmniImpactVFXGhoul = LoadEffect("OmniImpactVFXGhoul", "Play_acrid_m1_hit");
			GhoulBiteEffect = LoadEffect("GhoulBite", parentToTransform: true);
			GhoulLickEffect = LoadEffect("GhoulLick", parentToTransform: true);
			GhoulSlashEffect = LoadEffect("GhoulSlash", parentToTransform: true);
			GhoulMeleeEffects.Add(1, GhoulBiteEffect);
			GhoulMeleeEffects.Add(2, GhoulLickEffect);
			GhoulMeleeEffects.Add(3, GhoulSlashEffect);
			GhoulMeleeEffects.Add(4, GhoulSlashEffect);
			OmniImpactVFXTombstone = LoadEffect("OmniImpactVFXTombstone", "Play_golem_step");
			TombstoneBlueprintsPrefab = mainAssetBundle.LoadAsset<GameObject>("mdlTombstoneBlueprint");
			BlueprintController component = TombstoneBlueprintsPrefab.GetComponent<BlueprintController>();
			component.okMaterial = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Engi/matBlueprintsOk.mat").WaitForCompletion();
			component.invalidMaterial = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Engi/matBlueprintsInvalid.mat").WaitForCompletion();
			TombstoneSpawnMat = mainAssetBundle.LoadAsset<Material>("matTombstoneSpawn");
			SoulOrbActivatedEffect = LoadEffect("SoulOrbActivatedEffect", "Play_item_proc_igniteOnKill");
			SoulOrbTrailEffect = mainAssetBundle.LoadAsset<GameObject>("SoulOrbEffect");
			SoulOrbTrailEffect.AddComponent<EffectComponent>();
			OrbEffect val3 = SoulOrbTrailEffect.AddComponent<OrbEffect>();
			val3.startVelocity1 = new Vector3(-5f, 16f, -5f);
			val3.startVelocity2 = new Vector3(5f, 8f, 5f);
			val3.movementCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
			val3.faceMovement = true;
			SoulOrbTrailEffect.AddComponent<Rigidbody>();
			VFXAttributes val4 = SoulOrbTrailEffect.AddComponent<VFXAttributes>();
			val4.vfxIntensity = (VFXIntensity)0;
			val4.vfxPriority = (VFXPriority)1;
			AddNewEffectDef(SoulOrbTrailEffect);
			SoulOrbExplosion = LoadEffect("SoulOrbExplosion");
			GameObject gameObject = ((Component)SoulOrbExplosion.transform.Find("Point Light")).gameObject;
			LightIntensityCurve val5 = gameObject.AddComponent<LightIntensityCurve>();
			val5.curve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
			val5.timeMax = 0.3f;
		}

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

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

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

		internal static RendererInfo[] SetupRendererInfos(GameObject obj)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>();
			RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length];
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				array[i] = new RendererInfo
				{
					defaultMaterial = ((Renderer)componentsInChildren[i]).sharedMaterial,
					renderer = (Renderer)(object)componentsInChildren[i],
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false
				};
			}
			return array;
		}

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

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

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

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

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

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

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

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

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