Decompiled source of DwarfMushrum v1.1.2

DwarfMushrum.dll

Decompiled a month 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.Configuration;
using DwarfMushrum.Modules;
using DwarfMushrum.States;
using EntityStates;
using EntityStates.Mage.Weapon;
using EntityStates.MiniMushroom;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("DwarfMushrum")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DwarfMushrum")]
[assembly: AssemblyTitle("DwarfMushrum")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace DwarfMushrum
{
	[BepInPlugin("com.rob.DwarfMushrum", "DwarfMushrum", "1.1.2")]
	public class DwarfMushrumPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.rob.DwarfMushrum";

		public static DwarfMushrumPlugin instance;

		public static Material commandoMat;

		private void Awake()
		{
			instance = this;
			DMAssets.PopulateAssets();
			Config.ReadConfig();
			Tokens.RegisterLanguageTokens();
			Prefabs.CreatePrefab();
			DwarfMushrum.Modules.States.RegisterStates();
			Skills.RegisterSkills();
			Projectiles.CreateProjectiles();
			SpawnCards.CreateSpawnCards();
			new ContentPacks().Initialize();
		}
	}
	internal class SkillDefInfo
	{
		public string skillName;

		public string skillNameToken;

		public string skillDescriptionToken;

		public string[] keywordTokens = new string[0];

		public Sprite skillIcon;

		public SerializableEntityStateType activationState;

		public InterruptPriority interruptPriority;

		public string activationStateMachineName;

		public float baseRechargeInterval;

		public int baseMaxStock = 1;

		public int rechargeStock = 1;

		public int requiredStock = 1;

		public int stockToConsume = 1;

		public bool isCombatSkill = true;

		public bool canceledFromSprinting;

		public bool forceSprintDuringState;

		public bool cancelSprintingOnActivation = true;

		public bool beginSkillCooldownOnSkillEnd;

		public bool fullRestockOnAssign = true;

		public bool resetCooldownTimerOnUse;

		public bool mustKeyPress;

		public SkillDefInfo()
		{
		}

		public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName, InterruptPriority interruptPriority, bool isCombatSkill, float baseRechargeInterval)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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)
			this.skillName = skillName;
			this.skillNameToken = skillNameToken;
			this.skillDescriptionToken = skillDescriptionToken;
			this.skillIcon = skillIcon;
			this.activationState = activationState;
			this.activationStateMachineName = activationStateMachineName;
			this.interruptPriority = interruptPriority;
			this.isCombatSkill = isCombatSkill;
			this.baseRechargeInterval = baseRechargeInterval;
		}

		public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName = "Weapon", bool agile = false)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			this.skillName = skillName;
			this.skillNameToken = skillNameToken;
			this.skillDescriptionToken = skillDescriptionToken;
			this.skillIcon = skillIcon;
			this.activationState = activationState;
			this.activationStateMachineName = activationStateMachineName;
			interruptPriority = (InterruptPriority)0;
			isCombatSkill = true;
			baseRechargeInterval = 0f;
			requiredStock = 0;
			stockToConsume = 0;
			cancelSprintingOnActivation = !agile;
			if (agile)
			{
				keywordTokens = new string[1] { "KEYWORD_AGILE" };
			}
		}
	}
}
namespace DwarfMushrum.States
{
	public class Burrow : BaseState
	{
		public static float burrowDistance = 256f;

		public static float duration = 0.8f;

		public static float delayDuration = 0.4f;

		public static float exitDuration = 2.5f;

		private Transform modelTransform;

		private Vector3 burrowDestination = Vector3.zero;

		private Vector3 burrowStart = Vector3.zero;

		private Animator animator;

		private CharacterModel characterModel;

		private HurtBoxGroup hurtboxGroup;

		private ChildLocator childLocator;

		private bool isExiting;

		private bool hasBurrowed;

		private bool hasFinishedBurrow;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			((BaseState)this).StartAimMode(2f, false);
			modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				animator = ((Component)modelTransform).GetComponent<Animator>();
				characterModel = ((Component)modelTransform).GetComponent<CharacterModel>();
				hurtboxGroup = ((Component)modelTransform).GetComponent<HurtBoxGroup>();
				childLocator = ((Component)modelTransform).GetComponent<ChildLocator>();
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((Behaviour)((EntityState)this).characterMotor).enabled = false;
			}
			((EntityState)this).gameObject.layer = LayerIndex.fakeActor.intVal;
			((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
			CalculateBurrowDestination();
			((EntityState)this).PlayAnimation("FullBody, Override", "Burrow", "Burrow.playbackRate", duration - delayDuration, 0f);
		}

		private void CalculateBurrowDestination()
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_0015: 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_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)
			//IL_0025: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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_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_0106: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.zero;
			Ray aimRay = ((BaseState)this).GetAimRay();
			BullseyeSearch val2 = new BullseyeSearch();
			Ray val3 = aimRay;
			val2.searchOrigin = ((Ray)(ref val3)).origin;
			val3 = aimRay;
			val2.searchDirection = ((Ray)(ref val3)).direction;
			val2.maxDistanceFilter = burrowDistance;
			val2.teamMaskFilter = TeamMask.allButNeutral;
			val2.filterByLoS = false;
			((TeamMask)(ref val2.teamMaskFilter)).RemoveTeam(TeamComponent.GetObjectTeam(((EntityState)this).gameObject));
			val2.sortMode = (SortMode)2;
			val2.RefreshCandidates();
			HurtBox val4 = val2.GetResults().FirstOrDefault();
			if (Object.op_Implicit((Object)(object)val4))
			{
				val = ((Component)val4).transform.position - ((EntityState)this).transform.position;
			}
			burrowDestination = ((EntityState)this).transform.position;
			burrowStart = ((EntityState)this).transform.position;
			NodeGraph groundNodes = SceneInfo.instance.groundNodes;
			NodeIndex val5 = groundNodes.FindClosestNode(((EntityState)this).transform.position + val, ((EntityState)this).characterBody.hullClassification, float.PositiveInfinity);
			groundNodes.GetNodePosition(val5, ref burrowDestination);
			burrowDestination += ((EntityState)this).transform.position - ((EntityState)this).characterBody.footPosition;
			((EntityState)this).characterDirection.forward = val;
		}

		private void CreateBurrowEffect(Vector3 origin)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//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_0019: Unknown result type (might be due to invalid IL or missing references)
			EffectData val = new EffectData();
			val.rotation = modelTransform.rotation;
			val.origin = origin;
			EffectManager.SpawnEffect(InPlant.burrowPrefab, val, false);
		}

		private void SetPosition(Vector3 newPosition)
		{
			//IL_001c: 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 (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.SetPositionAndRotation(newPosition, Quaternion.identity, true);
			}
		}

		public override void FixedUpdate()
		{
			//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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			if (((EntityState)this).fixedAge >= duration - delayDuration && !hasBurrowed)
			{
				hasBurrowed = true;
				Util.PlaySound(InPlant.burrowInSoundString, ((EntityState)this).gameObject);
				CreateBurrowEffect(Util.GetCorePosition(((EntityState)this).gameObject));
			}
			if (((EntityState)this).fixedAge >= duration && !hasFinishedBurrow)
			{
				hasFinishedBurrow = true;
				ExitCleanup();
				((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
				((EntityState)this).PlayAnimation("Body", "Spawn", "Spawn.playbackRate", exitDuration, 0f);
				SetPosition(burrowDestination);
				Util.PlaySound(UnPlant.UnplantOutSoundString, ((EntityState)this).gameObject);
				CreateBurrowEffect(burrowDestination);
			}
			if (((EntityState)this).fixedAge >= duration + exitDuration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void ExitCleanup()
		{
			if (!isExiting)
			{
				isExiting = true;
				((EntityState)this).gameObject.layer = LayerIndex.defaultLayer.intVal;
				((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers();
				modelTransform = ((EntityState)this).GetModelTransform();
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					((Behaviour)((EntityState)this).characterMotor).enabled = true;
				}
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			ExitCleanup();
		}
	}
	public class ChargeProjectile : BaseSkillState
	{
		public static float baseDuration = 1.75f;

		private float duration;

		private GameObject chargeVfxInstance;

		private uint playID;

		public override void OnEnter()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			((BaseState)this).StartAimMode(2f, false);
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			playID = Util.PlayAttackSpeedSound(SporeGrenade.chargeUpSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				Transform val = ((BaseState)this).FindModelChild("Muzzle");
				chargeVfxInstance = Object.Instantiate<GameObject>(SporeGrenade.chargeEffectPrefab, val.position, val.rotation);
				chargeVfxInstance.transform.parent = val;
				chargeVfxInstance.transform.localPosition = new Vector3(0f, -0.065f, 0f);
				chargeVfxInstance.transform.localRotation = Quaternion.identity;
			}
			((EntityState)this).PlayAnimation("FullBody, Override", "ShootSpores", "ShootSpores.playbackRate", duration * 2.5f, 0f);
		}

		public override void OnExit()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			((EntityState)this).OnExit();
			if (Object.op_Implicit((Object)(object)chargeVfxInstance))
			{
				EntityState.Destroy((Object)chargeVfxInstance);
			}
			AkSoundEngine.StopPlayingID(playID);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				FireProjectile nextState = new FireProjectile();
				((EntityState)this).outer.SetNextState((EntityState)(object)nextState);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)1;
		}
	}
	public class DeathState : GenericCharacterDeath
	{
		public override void OnEnter()
		{
			((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
			((GenericCharacterDeath)this).OnEnter();
		}
	}
	public class FireProjectile : BaseSkillState
	{
		public static float baseDuration = 0.1f;

		public static float damageCoefficient = 1.2f;

		public static float force = 10f;

		private float duration;

		public override void OnEnter()
		{
			//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)
			//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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			Util.PlaySound(SporeGrenade.attackSoundString, ((EntityState)this).gameObject);
			Ray aimRay = ((BaseState)this).GetAimRay();
			string text = "Muzzle";
			if (Object.op_Implicit((Object)(object)FireLaserbolt.muzzleEffectPrefab))
			{
				EffectManager.SimpleMuzzleFlash(FireLaserbolt.muzzleEffectPrefab, ((EntityState)this).gameObject, text, false);
			}
			if (((EntityState)this).isAuthority)
			{
				ProjectileManager instance = ProjectileManager.instance;
				GameObject projectilePrefab = SporeGrenade.projectilePrefab;
				Ray val = aimRay;
				Vector3 origin = ((Ray)(ref val)).origin;
				val = aimRay;
				instance.FireProjectile(projectilePrefab, origin, Util.QuaternionSafeLookRotation(((Ray)(ref val)).direction), ((EntityState)this).gameObject, ((BaseState)this).damageStat * damageCoefficient, force, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f);
			}
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)1;
		}
	}
	public class ForceDeath : BaseSkillState
	{
		public override void OnEnter()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).healthComponent.Suicide((GameObject)null, (GameObject)null, DamageTypeCombo.op_Implicit((DamageType)0));
			}
			((EntityState)this).outer.SetNextStateToMain();
		}
	}
}
namespace DwarfMushrum.Modules
{
	internal static class Config
	{
		public static List<StageSpawnInfo> StageList = new List<StageSpawnInfo>();

		internal static void ReadConfig()
		{
			string value = ((BaseUnityPlugin)DwarfMushrumPlugin.instance).Config.Bind<string>("Dwarf Mushrum", "Stage List", "arena, blackbeach, blackbeach2, foggyswamp, itgoolake, itskymeadow, rootjungle, shipgraveyard, skymeadow, sulfurpools, goldshores, slumberingsatellite, habitat, habitatfall, helminthroost, lakes, lakesnight", "What stages the monster will show up on. Add a '- loop' after the stagename to make it only spawn after looping. List of stage names can be found at https://github.com/risk-of-thunder/R2Wiki/wiki/Mod-Creation_Developer-Reference_Scene-Names").Value;
			value = new string((from c in value.ToCharArray()
				where !char.IsWhiteSpace(c)
				select c).ToArray());
			string[] array = value.Split(new char[1] { ',' });
			string[] array2 = array;
			string[] array3 = array2;
			foreach (string text in array3)
			{
				string[] array4 = text.Split(new char[1] { '-' });
				string stageName = array4[0];
				int minStages = 0;
				if (array4.Length > 1)
				{
					minStages = 5;
				}
				StageList.Add(new StageSpawnInfo(stageName, minStages));
			}
		}

		internal static ConfigEntry<bool> EnemyEnableConfig(string characterName)
		{
			//IL_0011: 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: Expected O, but got Unknown
			//IL_002c: Expected O, but got Unknown
			return ((BaseUnityPlugin)DwarfMushrumPlugin.instance).Config.Bind<bool>(new ConfigDefinition(characterName, "Enabled"), true, new ConfigDescription("Set to false to disable this enemy", (AcceptableValueBase)null, Array.Empty<object>()));
		}

		internal static ConfigEntry<bool> CharacterEnableConfig(string characterName)
		{
			//IL_0011: 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: Expected O, but got Unknown
			//IL_002c: Expected O, but got Unknown
			return ((BaseUnityPlugin)DwarfMushrumPlugin.instance).Config.Bind<bool>(new ConfigDefinition(characterName, "Enabled"), false, new ConfigDescription("Set to false to disable this character", (AcceptableValueBase)null, Array.Empty<object>()));
		}
	}
	internal class ContentPacks : IContentPackProvider
	{
		internal ContentPack contentPack = new ContentPack();

		public string identifier => "com.rob.DwarfMushrum";

		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(Prefabs.bodyPrefabs.ToArray());
			contentPack.effectDefs.Add(DMAssets.effectDefs.ToArray());
			contentPack.entityStateTypes.Add(States.entityStates.ToArray());
			contentPack.masterPrefabs.Add(Prefabs.masterPrefabs.ToArray());
			contentPack.projectilePrefabs.Add(Projectiles.projectilePrefabs.ToArray());
			contentPack.skillDefs.Add(Skills.skillDefs.ToArray());
			contentPack.skillFamilies.Add(Skills.skillFamilies.ToArray());
			args.ReportProgress(1f);
			yield break;
		}

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

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
	public static class DMAssets
	{
		public static AssetBundle mainAssetBundle;

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

		public static Texture charPortrait;

		public static void PopulateAssets()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			if ((Object)mainAssetBundle == (Object)null)
			{
				using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("DwarfMushrum.dwarfmushrum");
				mainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
			charPortrait = (Texture)mainAssetBundle.LoadAsset<Sprite>("texFuckerIcon").texture;
		}

		private static GameObject LoadEffect(string resourceName, string soundName)
		{
			//IL_002b: 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)
			GameObject val = mainAssetBundle.LoadAsset<GameObject>(resourceName);
			val.AddComponent<DestroyOnTimer>().duration = 12f;
			val.AddComponent<NetworkIdentity>();
			val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
			EffectComponent val2 = val.AddComponent<EffectComponent>();
			val2.applyScale = false;
			val2.effectIndex = (EffectIndex)(-1);
			val2.parentToReferencedTransform = true;
			val2.positionAtReferencedTransform = true;
			val2.soundName = soundName;
			AddNewEffectDef(val, soundName);
			return val;
		}

		public static Material CreateMaterial(string materialName, float emission, Color emissionColor, float normalStrength)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)DwarfMushrumPlugin.commandoMat))
			{
				DwarfMushrumPlugin.commandoMat = Resources.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<CharacterModel>().baseRendererInfos[0].defaultMaterial;
			}
			Material val = Object.Instantiate<Material>(DwarfMushrumPlugin.commandoMat);
			Material val2 = mainAssetBundle.LoadAsset<Material>(materialName);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				Debug.LogError((object)(materialName + " does not exist you fucking dumbass"));
				return DwarfMushrumPlugin.commandoMat;
			}
			val.SetColor("_Color", val2.GetColor("_Color"));
			val.SetTexture("_MainTex", val2.GetTexture("_MainTex"));
			val.SetColor("_EmColor", emissionColor);
			val.SetFloat("_EmPower", emission);
			val.SetTexture("_EmTex", val2.GetTexture("_EmissionMap"));
			val.SetFloat("_NormalStrength", normalStrength);
			return val;
		}

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

		internal 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;
			effectDefs.Add(val);
		}
	}
	internal class ItemDisplays
	{
	}
	public static class Prefabs
	{
		public static GameObject bodyPrefab;

		public static GameObject masterPrefab;

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

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

		public static void CreatePrefab()
		{
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			bodyPrefab = PrefabAPI.InstantiateClone(Resources.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody"), "DwarfMushrumBody");
			CharacterBody component = bodyPrefab.GetComponent<CharacterBody>();
			((Object)component).name = "DwarfMushrumBody";
			component.baseNameToken = "DWARFMUSHRUM_BODY_NAME";
			component.subtitleNameToken = "NULL_SUBTITLE";
			component.baseMoveSpeed = 0f;
			component.baseMaxHealth = 160f;
			component.levelMaxHealth = 48f;
			component.baseDamage = 8f;
			component.levelDamage = component.baseDamage * 0.2f;
			component.isChampion = false;
			component.baseJumpCount = 0;
			component.portraitIcon = DMAssets.charPortrait;
			SfxLocator component2 = bodyPrefab.GetComponent<SfxLocator>();
			component2.barkSound = "Play_minimushroom_idle_VO";
			component2.deathSound = "Play_minimushroom_death";
			component2.fallDamageSound = "";
			component2.landingSound = "Play_minimushroom_step";
			DeathRewards val = bodyPrefab.AddComponent<DeathRewards>();
			val.logUnlockableDef = Addressables.LoadAssetAsync<UnlockableDef>((object)"RoR2/Base/MiniMushroom/Logs.MiniMushroom.0.asset").WaitForCompletion();
			SetStateOnHurt component3 = bodyPrefab.GetComponent<SetStateOnHurt>();
			component3.canBeFrozen = true;
			component3.canBeHitStunned = true;
			component3.canBeStunned = true;
			component3.hitThreshold = 0.1f;
			component3.hurtState = new SerializableEntityStateType(typeof(HurtState));
			bodyPrefab.GetComponent<CharacterDeathBehavior>().deathState = new SerializableEntityStateType(typeof(DeathState));
			SetupModel();
			masterPrefab = PrefabAPI.InstantiateClone(Resources.Load<GameObject>("Prefabs/CharacterMasters/SquidTurretMaster"), "DwarfMushrumMaster");
			CharacterMaster component4 = masterPrefab.GetComponent<CharacterMaster>();
			CreateAI();
			component4.bodyPrefab = bodyPrefab;
			component4.isBoss = false;
			bodyPrefabs.Add(bodyPrefab);
			masterPrefabs.Add(masterPrefab);
		}

		private static void CreateAI()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			AISkillDriver[] componentsInChildren = masterPrefab.GetComponentsInChildren<AISkillDriver>();
			AISkillDriver[] array = componentsInChildren;
			foreach (AISkillDriver val in array)
			{
				Object.DestroyImmediate((Object)val);
			}
			AISkillDriver val2 = masterPrefab.AddComponent<AISkillDriver>();
			val2.customName = "Burrow";
			val2.movementType = (MovementType)1;
			val2.moveTargetType = (TargetType)0;
			val2.activationRequiresAimConfirmation = false;
			val2.activationRequiresTargetLoS = false;
			val2.selectionRequiresTargetLoS = false;
			val2.maxDistance = 512f;
			val2.minDistance = 25f;
			val2.requireSkillReady = true;
			val2.aimType = (AimType)0;
			val2.ignoreNodeGraph = false;
			val2.moveInputScale = 1f;
			val2.driverUpdateTimerOverride = -1f;
			val2.buttonPressType = (ButtonPressType)0;
			val2.minTargetHealthFraction = float.NegativeInfinity;
			val2.maxTargetHealthFraction = float.PositiveInfinity;
			val2.minUserHealthFraction = float.NegativeInfinity;
			val2.maxUserHealthFraction = float.PositiveInfinity;
			val2.skillSlot = (SkillSlot)2;
			AISkillDriver val3 = masterPrefab.AddComponent<AISkillDriver>();
			val3.customName = "Shoot";
			val3.movementType = (MovementType)1;
			val3.moveTargetType = (TargetType)0;
			val3.activationRequiresAimConfirmation = true;
			val3.activationRequiresTargetLoS = false;
			val3.selectionRequiresTargetLoS = true;
			val3.maxDistance = 32f;
			val3.minDistance = 0f;
			val3.requireSkillReady = true;
			val3.aimType = (AimType)2;
			val3.ignoreNodeGraph = false;
			val3.moveInputScale = 1f;
			val3.driverUpdateTimerOverride = -1f;
			val3.buttonPressType = (ButtonPressType)0;
			val3.minTargetHealthFraction = float.NegativeInfinity;
			val3.maxTargetHealthFraction = float.PositiveInfinity;
			val3.minUserHealthFraction = float.NegativeInfinity;
			val3.maxUserHealthFraction = float.PositiveInfinity;
			val3.skillSlot = (SkillSlot)0;
			AISkillDriver val4 = masterPrefab.AddComponent<AISkillDriver>();
			val4.customName = "Idle";
			val4.movementType = (MovementType)1;
			val4.moveTargetType = (TargetType)0;
			val4.activationRequiresAimConfirmation = false;
			val4.activationRequiresTargetLoS = false;
			val4.selectionRequiresTargetLoS = false;
			val4.maxDistance = 512f;
			val4.minDistance = 0f;
			val4.requireSkillReady = true;
			val4.aimType = (AimType)2;
			val4.ignoreNodeGraph = false;
			val4.moveInputScale = 1f;
			val4.driverUpdateTimerOverride = -1f;
			val4.buttonPressType = (ButtonPressType)1;
			val4.minTargetHealthFraction = float.NegativeInfinity;
			val4.maxTargetHealthFraction = float.PositiveInfinity;
			val4.minUserHealthFraction = float.NegativeInfinity;
			val4.maxUserHealthFraction = float.PositiveInfinity;
			val4.skillSlot = (SkillSlot)(-1);
		}

		private static GameObject CreateModel(GameObject main)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)main.transform.Find("ModelBase")))
			{
				Object.Destroy((Object)((Component)main.transform.Find("ModelBase")).gameObject);
			}
			if (Object.op_Implicit((Object)(object)main.transform.Find("CameraPivot")))
			{
				Object.Destroy((Object)((Component)main.transform.Find("CameraPivot")).gameObject);
			}
			if (Object.op_Implicit((Object)(object)main.transform.Find("AimOrigin")))
			{
				Object.Destroy((Object)((Component)main.transform.Find("AimOrigin")).gameObject);
			}
			GameObject val = null;
			return DMAssets.mainAssetBundle.LoadAsset<GameObject>("mdlDwarfMushrum");
		}

		private static void SetupModel()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0042: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00b4: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: 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_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Expected O, but got Unknown
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Expected O, but got Unknown
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateModel(bodyPrefab);
			GameObject val2 = new GameObject("ModelBase");
			val2.transform.parent = bodyPrefab.transform;
			val2.transform.localPosition = new Vector3(0f, -0.81f, 0f);
			val2.transform.localRotation = Quaternion.identity;
			val2.transform.localScale = new Vector3(1f, 1f, 1f);
			GameObject val3 = new GameObject("CameraPivot");
			val3.transform.parent = bodyPrefab.transform;
			val3.transform.localPosition = new Vector3(0f, 1.6f, 0f);
			val3.transform.localRotation = Quaternion.identity;
			val3.transform.localScale = Vector3.one;
			GameObject val4 = new GameObject("AimOrigin");
			val4.transform.parent = bodyPrefab.transform;
			val4.transform.localPosition = new Vector3(0f, 0.5f, 0f);
			val4.transform.localRotation = Quaternion.identity;
			val4.transform.localScale = Vector3.one;
			Transform transform = val.transform;
			transform.parent = val2.transform;
			transform.localPosition = Vector3.zero;
			transform.localRotation = Quaternion.identity;
			CharacterDirection component = bodyPrefab.GetComponent<CharacterDirection>();
			component.moveVector = Vector3.zero;
			component.targetTransform = val2.transform;
			component.overrideAnimatorForwardTransform = null;
			component.rootMotionAccumulator = null;
			component.modelAnimator = val.GetComponentInChildren<Animator>();
			component.driveFromRootRotation = false;
			component.turnSpeed = 720f;
			ModelLocator component2 = bodyPrefab.GetComponent<ModelLocator>();
			component2.modelTransform = transform;
			component2.modelBaseTransform = val2.transform;
			ChildLocator component3 = val.GetComponent<ChildLocator>();
			CharacterModel val5 = val.AddComponent<CharacterModel>();
			val5.body = null;
			val5.baseRendererInfos = (RendererInfo[])(object)new RendererInfo[1]
			{
				new RendererInfo
				{
					defaultMaterial = DMAssets.CreateMaterial("matDwarfMushrum", 0.5f, Color.white, 0f),
					renderer = (Renderer)((Component)component3.FindChild("Model")).GetComponent<SkinnedMeshRenderer>(),
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false
				}
			};
			val5.autoPopulateLightInfos = true;
			val5.invisibilityCount = 0;
			val5.temporaryOverlays = new List<TemporaryOverlayInstance>();
			val5.body = bodyPrefab.GetComponent<CharacterBody>();
			val5.mainSkinnedMeshRenderer = ((Component)val5.baseRendererInfos[0].renderer).gameObject.GetComponent<SkinnedMeshRenderer>();
			CreateHurtbox(val, bodyPrefab.GetComponent<HealthComponent>(), component3);
			AimAnimator val6 = val.AddComponent<AimAnimator>();
			val6.directionComponent = component;
			val6.pitchRangeMax = 60f;
			val6.pitchRangeMin = -60f;
			val6.yawRangeMin = -80f;
			val6.yawRangeMax = 80f;
			val6.pitchGiveupRange = 30f;
			val6.yawGiveupRange = 10f;
			val6.giveupDuration = 3f;
			val6.inputBank = bodyPrefab.GetComponent<InputBankTest>();
			Transform parent = component3.FindChild("Head");
			GameObject val7 = new GameObject();
			Transform transform2 = val7.transform;
			transform2.parent = parent;
			transform2.localPosition = new Vector3(-0.006f, 0f, 0.005f);
			transform2.localRotation = Quaternion.Euler(new Vector3(90f, 230f, 0f));
			transform2.localScale = Vector3.one * 0.03f;
			for (int i = 0; i < component3.transformPairs.Length; i++)
			{
				if (component3.transformPairs[i].name == "Head")
				{
					component3.transformPairs[i].transform = transform2;
				}
			}
			val5.itemDisplayRuleSet = Addressables.LoadAssetAsync<ItemDisplayRuleSet>((object)"RoR2/Base/Beetle/idrsBeetle.asset").WaitForCompletion();
		}

		private static void CreateHurtbox(GameObject model, HealthComponent healthComponent, ChildLocator childLocator)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			HurtBoxGroup val = model.AddComponent<HurtBoxGroup>();
			HurtBox val2 = ((Component)childLocator.FindChild("MainHurtbox")).gameObject.AddComponent<HurtBox>();
			((Component)val2).gameObject.layer = LayerIndex.entityPrecise.intVal;
			val2.healthComponent = healthComponent;
			val2.isBullseye = true;
			val2.damageModifier = (DamageModifier)0;
			val2.hurtBoxGroup = val;
			val2.indexInGroup = 0;
			val2.isSniperTarget = true;
			val.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val2 };
			val.mainHurtBox = val2;
			val.bullseyeCount = 1;
		}
	}
	public static class Projectiles
	{
		public static GameObject sporeProjectile;

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

		public static void CreateProjectiles()
		{
			sporeProjectile = PrefabAPI.InstantiateClone(Resources.Load<GameObject>("Prefabs/Projectiles/Fireball"), "DwarfMushrumSpore", true);
			sporeProjectile.GetComponent<ProjectileController>().ghostPrefab = Resources.Load<GameObject>("Prefabs/Projectiles/SporeGrenadeProjectile").GetComponent<ProjectileController>().ghostPrefab;
			projectilePrefabs.Add(sporeProjectile);
		}
	}
	internal static class Skills
	{
		internal static List<SkillFamily> skillFamilies = new List<SkillFamily>();

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

		public static void RegisterSkills()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			GameObject bodyPrefab = Prefabs.bodyPrefab;
			CreateSkillFamilies(bodyPrefab);
			SkillLocator component = bodyPrefab.GetComponent<SkillLocator>();
			SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
			val.activationState = new SerializableEntityStateType(typeof(ChargeProjectile));
			val.activationStateMachineName = "Weapon";
			val.baseMaxStock = 1;
			val.baseRechargeInterval = 12f;
			val.beginSkillCooldownOnSkillEnd = true;
			val.canceledFromSprinting = false;
			val.fullRestockOnAssign = true;
			val.interruptPriority = (InterruptPriority)0;
			val.beginSkillCooldownOnSkillEnd = false;
			val.isCombatSkill = true;
			val.mustKeyPress = false;
			val.cancelSprintingOnActivation = false;
			val.rechargeStock = 1;
			val.requiredStock = 1;
			val.stockToConsume = 1;
			AddPrimarySkills(bodyPrefab, val);
			val = ScriptableObject.CreateInstance<SkillDef>();
			val.activationState = new SerializableEntityStateType(typeof(InPlant));
			val.activationStateMachineName = "Body";
			val.baseMaxStock = 1;
			val.baseRechargeInterval = 0f;
			val.beginSkillCooldownOnSkillEnd = false;
			val.canceledFromSprinting = false;
			val.fullRestockOnAssign = true;
			val.interruptPriority = (InterruptPriority)0;
			val.beginSkillCooldownOnSkillEnd = false;
			val.isCombatSkill = true;
			val.mustKeyPress = false;
			val.cancelSprintingOnActivation = false;
			val.rechargeStock = 1;
			val.requiredStock = 1;
			val.stockToConsume = 0;
			AddSecondarySkills(bodyPrefab, val);
			val = ScriptableObject.CreateInstance<SkillDef>();
			val.activationState = new SerializableEntityStateType(typeof(Burrow));
			val.activationStateMachineName = "Body";
			val.baseMaxStock = 1;
			val.baseRechargeInterval = 8f;
			val.beginSkillCooldownOnSkillEnd = false;
			val.canceledFromSprinting = false;
			val.fullRestockOnAssign = true;
			val.interruptPriority = (InterruptPriority)0;
			val.beginSkillCooldownOnSkillEnd = false;
			val.isCombatSkill = true;
			val.mustKeyPress = false;
			val.cancelSprintingOnActivation = false;
			val.rechargeStock = 1;
			val.requiredStock = 1;
			val.stockToConsume = 1;
			AddUtilitySkills(bodyPrefab, val);
			AddSpecialSkills(bodyPrefab, val);
		}

		public static void CreateSkillFamilies(GameObject targetPrefab, int families = 15, bool destroyExisting = true)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			if (destroyExisting)
			{
				GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren<GenericSkill>();
				GenericSkill[] array = componentsInChildren;
				foreach (GenericSkill val in array)
				{
					Object.DestroyImmediate((Object)val);
				}
			}
			SkillLocator component = targetPrefab.GetComponent<SkillLocator>();
			if (((uint)families & (true ? 1u : 0u)) != 0)
			{
				component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary");
			}
			if (((uint)families & 2u) != 0)
			{
				component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary");
			}
			if (((uint)families & 4u) != 0)
			{
				component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility");
			}
			if (((uint)families & 8u) != 0)
			{
				component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special");
			}
		}

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

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

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

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

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

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

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

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

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

		public static T CreateSkillDef<T>(SkillDefInfo skillDefInfo) where T : SkillDef
		{
			T val = ScriptableObject.CreateInstance<T>();
			popuplateSKillDef(skillDefInfo, (SkillDef)(object)val);
			skillDefs.Add((SkillDef)(object)val);
			return val;
		}

		private static void popuplateSKillDef(SkillDefInfo skillDefInfo, SkillDef skillDef)
		{
			//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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			skillDef.skillName = skillDefInfo.skillName;
			((Object)skillDef).name = skillDefInfo.skillName;
			skillDef.skillNameToken = skillDefInfo.skillNameToken;
			skillDef.skillDescriptionToken = skillDefInfo.skillDescriptionToken;
			skillDef.icon = skillDefInfo.skillIcon;
			skillDef.activationState = skillDefInfo.activationState;
			skillDef.activationStateMachineName = skillDefInfo.activationStateMachineName;
			skillDef.baseMaxStock = skillDefInfo.baseMaxStock;
			skillDef.baseRechargeInterval = skillDefInfo.baseRechargeInterval;
			skillDef.beginSkillCooldownOnSkillEnd = skillDefInfo.beginSkillCooldownOnSkillEnd;
			skillDef.canceledFromSprinting = skillDefInfo.canceledFromSprinting;
			skillDef.forceSprintDuringState = skillDefInfo.forceSprintDuringState;
			skillDef.fullRestockOnAssign = skillDefInfo.fullRestockOnAssign;
			skillDef.interruptPriority = skillDefInfo.interruptPriority;
			skillDef.resetCooldownTimerOnUse = skillDefInfo.resetCooldownTimerOnUse;
			skillDef.isCombatSkill = skillDefInfo.isCombatSkill;
			skillDef.mustKeyPress = skillDefInfo.mustKeyPress;
			skillDef.cancelSprintingOnActivation = skillDefInfo.cancelSprintingOnActivation;
			skillDef.rechargeStock = skillDefInfo.rechargeStock;
			skillDef.requiredStock = skillDefInfo.requiredStock;
			skillDef.stockToConsume = skillDefInfo.stockToConsume;
			skillDef.keywordTokens = skillDefInfo.keywordTokens;
		}

		internal static SkillDef CreatePrimarySkillDef(SerializableEntityStateType state, string stateMachine, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, bool agile)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			SkillDefInfo skillDefInfo = new SkillDefInfo(skillNameToken, skillNameToken, skillDescriptionToken, skillIcon, state, stateMachine, agile);
			return CreateSkillDef(skillDefInfo);
		}
	}
	public static class SpawnCards
	{
		public static CharacterSpawnCard monsterSpawnCard;

		internal static ConfigEntry<int> minimumStageCount;

		internal static ConfigEntry<int> spawnCost;

		public static void CreateSpawnCards()
		{
			//IL_0015: 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_0030: Expected O, but got Unknown
			//IL_0030: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_0065: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			minimumStageCount = ((BaseUnityPlugin)DwarfMushrumPlugin.instance).Config.Bind<int>(new ConfigDefinition("Dwarf Mushrum", "Minimum Stage Clear Count"), 0, new ConfigDescription("Number of stages that must be completed before this monster can spawn", (AcceptableValueBase)null, Array.Empty<object>()));
			spawnCost = ((BaseUnityPlugin)DwarfMushrumPlugin.instance).Config.Bind<int>(new ConfigDefinition("Dwarf Mushrum", "Spawn Cost"), 27, new ConfigDescription("How many director credits does this monster cost", (AcceptableValueBase)null, Array.Empty<object>()));
			CharacterSpawnCard val = ScriptableObject.CreateInstance<CharacterSpawnCard>();
			((Object)val).name = "cscDwarfMushrum";
			((SpawnCard)val).prefab = Prefabs.masterPrefab;
			((SpawnCard)val).sendOverNetwork = true;
			((SpawnCard)val).hullSize = (HullClassification)0;
			((SpawnCard)val).nodeGraphType = (GraphType)0;
			((SpawnCard)val).requiredFlags = (NodeFlags)0;
			((SpawnCard)val).forbiddenFlags = (NodeFlags)2;
			((SpawnCard)val).directorCreditCost = spawnCost.Value;
			((SpawnCard)val).occupyPosition = false;
			val.loadout = new SerializableLoadout();
			val.noElites = false;
			val.forbiddenAsBoss = false;
			DirectorCard val2 = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)val,
				selectionWeight = 1,
				preventOverhead = false,
				minimumStageCompletions = minimumStageCount.Value,
				spawnDistance = (MonsterSpawnDistance)0
			};
			DirectorCardHolder val3 = new DirectorCardHolder
			{
				Card = val2,
				MonsterCategory = (MonsterCategory)2
			};
			DirectorCard card = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)val,
				selectionWeight = 1,
				preventOverhead = false,
				minimumStageCompletions = 5,
				spawnDistance = (MonsterSpawnDistance)2
			};
			DirectorCardHolder val4 = new DirectorCardHolder
			{
				Card = card,
				MonsterCategory = (MonsterCategory)2
			};
			DirectorCardCategorySelection val5 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/MixEnemy/dccsMixEnemy.asset").WaitForCompletion();
			val5.AddCard(1, val2);
			foreach (StageSpawnInfo stage in Config.StageList)
			{
				DirectorCardHolder val6 = ((stage.GetMinStages() == 0) ? val3 : val4);
				Helpers.AddNewMonsterToStage(val6, false, DirectorAPI.ParseInternalStageName(stage.GetStageName()), stage.GetStageName());
			}
		}
	}
	public class StageSpawnInfo
	{
		private string stageName;

		private int minStages;

		public StageSpawnInfo(string stageName, int minStages)
		{
			this.stageName = stageName;
			this.minStages = minStages;
		}

		public string GetStageName()
		{
			return stageName;
		}

		public int GetMinStages()
		{
			return minStages;
		}
	}
	public class States
	{
		internal static List<Type> entityStates = new List<Type>();

		internal static void AddSkill(Type t)
		{
			entityStates.Add(t);
		}

		public static void RegisterStates()
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			GameObject bodyPrefab = Prefabs.bodyPrefab;
			AddSkill(typeof(ChargeProjectile));
			AddSkill(typeof(FireProjectile));
			AddSkill(typeof(Burrow));
			AddSkill(typeof(DeathState));
			EntityStateMachine componentInChildren = bodyPrefab.GetComponentInChildren<EntityStateMachine>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				componentInChildren.initialStateType = new SerializableEntityStateType(typeof(SpawnState));
			}
		}
	}
	public static class StaticValues
	{
		public const string monsterName = "Dwarf Mushrum";

		public const string monsterLore = "Bottom text";
	}
	public static class Tokens
	{
		public static void RegisterLanguageTokens()
		{
			LanguageAPI.Add("DWARFMUSHRUM_BODY_NAME", "Dwarf Mushrum");
			LanguageAPI.Add("DWARFMUSHRUM_BODY_LORE", "Bottom text");
		}
	}
}