Decompiled source of DwarfMushrum v1.1.6

DwarfMushrum.dll

Decompiled 2 weeks 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 HG.GeneralSerializer;
using HG.Reflection;
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 RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DwarfMushrum")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c988079955e49d627ea90ee7f89be9a0c0585f20")]
[assembly: AssemblyProduct("DwarfMushrum")]
[assembly: AssemblyTitle("DwarfMushrum")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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.6")]
	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();
			MiniMushroomValues.LoadValues();
			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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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)
			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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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;

		private static bool loggedMissingBurrowPrefab;

		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>();
			}
			((EntityState)this).gameObject.layer = LayerIndex.fakeActor.intVal;
			CalculateBurrowDestination();
			((EntityState)this).PlayAnimation("FullBody, Override", "Burrow", "Burrow.playbackRate", duration - delayDuration, 0f);
		}

		private void CalculateBurrowDestination()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_0023: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003e: 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_004f: 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: 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_00a8: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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)
			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);
			Collider component = ((EntityState)this).GetComponent<Collider>();
			if (Object.op_Implicit((Object)(object)component))
			{
				ref float y = ref burrowDestination.y;
				float num = y;
				float y2 = ((EntityState)this).transform.position.y;
				Bounds bounds = component.bounds;
				y = num + (y2 - ((Bounds)(ref bounds)).min.y);
			}
			((EntityState)this).characterDirection.forward = val;
		}

		private void CreateBurrowEffect(Vector3 origin)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_004b: 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)
			GameObject burrowPrefab = MiniMushroomValues.burrowPrefab;
			if (!Object.op_Implicit((Object)(object)burrowPrefab))
			{
				if (!loggedMissingBurrowPrefab)
				{
					loggedMissingBurrowPrefab = true;
					Debug.LogWarning((object)"[DwarfMushrum] Burrow effect prefab is null; skipping burrow effect.");
				}
				return;
			}
			EffectData val = new EffectData();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				val.rotation = modelTransform.rotation;
			}
			val.origin = origin;
			EffectManager.SpawnEffect(burrowPrefab, val, false);
		}

		private void SetPosition(Vector3 newPosition)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).transform.position = newPosition;
			}
		}

		public override void FixedUpdate()
		{
			//IL_0040: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration - delayDuration && !hasBurrowed)
			{
				hasBurrowed = true;
				Util.PlaySound(MiniMushroomValues.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(MiniMushroomValues.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;
				modelTransform = ((EntityState)this).GetModelTransform();
			}
		}

		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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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)
			((BaseState)this).OnEnter();
			((BaseState)this).StartAimMode(2f, false);
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			playID = Util.PlayAttackSpeedSound(MiniMushroomValues.sporeGrenadeChargeUpSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
			if (Object.op_Implicit((Object)(object)modelTransform) && Object.op_Implicit((Object)(object)MiniMushroomValues.sporeGrenadeChargeEffectPrefab))
			{
				Transform val = ((BaseState)this).FindModelChild("Muzzle");
				chargeVfxInstance = Object.Instantiate<GameObject>(MiniMushroomValues.sporeGrenadeChargeEffectPrefab, 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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()
		{
			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_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_0066: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			Util.PlaySound(MiniMushroomValues.sporeGrenadeAttackSoundString, ((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 sporeGrenadeProjectilePrefab = MiniMushroomValues.sporeGrenadeProjectilePrefab;
				Ray val = aimRay;
				Vector3 origin = ((Ray)(ref val)).origin;
				val = aimRay;
				instance.FireProjectile(sporeGrenadeProjectilePrefab, origin, Util.QuaternionSafeLookRotation(((Ray)(ref val)).direction), ((EntityState)this).gameObject, ((BaseState)this).damageStat * damageCoefficient, force, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null);
			}
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public class ForceDeath : BaseSkillState
	{
		public override void OnEnter()
		{
			//IL_0017: 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[] array = new string((from c in ((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.ToCharArray()
				where !char.IsWhiteSpace(c)
				select c).ToArray()).Split(new char[1] { ',' });
			for (int num = 0; num < array.Length; num++)
			{
				string[] array2 = array[num].Split(new char[1] { '-' });
				string stageName = array2[0];
				int minStages = 0;
				if (array2.Length > 1)
				{
					minStages = 5;
				}
				StageList.Add(new StageSpawnInfo(stageName, minStages));
			}
		}

		internal static ConfigEntry<bool> EnemyEnableConfig(string characterName)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_002b: 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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_002b: 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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0029: 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)
			GameObject obj = mainAssetBundle.LoadAsset<GameObject>(resourceName);
			obj.AddComponent<DestroyOnTimer>().duration = 12f;
			obj.AddComponent<NetworkIdentity>();
			obj.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
			EffectComponent obj2 = obj.AddComponent<EffectComponent>();
			obj2.applyScale = false;
			obj2.effectIndex = (EffectIndex)(-1);
			obj2.parentToReferencedTransform = true;
			obj2.positionAtReferencedTransform = true;
			obj2.soundName = soundName;
			AddNewEffectDef(obj, soundName);
			return obj;
		}

		public static Material CreateMaterial(string materialName, float emission, Color emissionColor, float normalStrength)
		{
			//IL_0071: 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)
			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_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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 MiniMushroomValues
	{
		public static GameObject burrowPrefab;

		public static string burrowInSoundString;

		public static string unplantOutSoundString;

		public static GameObject sporeGrenadeProjectilePrefab;

		public static string sporeGrenadeChargeUpSoundString;

		public static string sporeGrenadeAttackSoundString;

		public static GameObject sporeGrenadeChargeEffectPrefab;

		public static void LoadValues()
		{
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			EntityStateConfiguration config = LoadConfig(RoR2_Base_MiniMushroom.EntityStates_MiniMushroom_InPlant_asset);
			burrowPrefab = GetValue<GameObject>(config, typeof(InPlant), "burrowPrefab");
			burrowInSoundString = GetValue<string>(config, typeof(InPlant), "burrowInSoundString");
			unplantOutSoundString = GetValue<string>(LoadConfig(RoR2_Base_MiniMushroom.EntityStates_MiniMushroom_UnPlant_asset), typeof(UnPlant), "UnplantOutSoundString");
			EntityStateConfiguration config2 = LoadConfig(RoR2_Base_MiniMushroom.EntityStates_MiniMushroom_SporeGrenade_asset);
			sporeGrenadeProjectilePrefab = GetValue<GameObject>(config2, typeof(SporeGrenade), "projectilePrefab");
			sporeGrenadeChargeUpSoundString = GetValue<string>(config2, typeof(SporeGrenade), "chargeUpSoundString");
			sporeGrenadeAttackSoundString = GetValue<string>(config2, typeof(SporeGrenade), "attackSoundString");
			sporeGrenadeChargeEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_MiniMushroom.SporeGrenadeChargeEffect_prefab).WaitForCompletion();
		}

		private static EntityStateConfiguration LoadConfig(string address)
		{
			//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)
			EntityStateConfiguration obj = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)address).WaitForCompletion();
			if (!Object.op_Implicit((Object)(object)obj))
			{
				Debug.LogWarning((object)("[SMALLMUSHY XDXDDDD] coudlnt load EntityStateConfig " + address));
			}
			return obj;
		}

		private static T GetValue<T>(EntityStateConfiguration config, Type stateType, string fieldName)
		{
			//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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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)
			if (!Object.op_Implicit((Object)(object)config))
			{
				return default(T);
			}
			FieldInfo field = stateType.GetField(fieldName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			SerializedField[] serializedFields = config.serializedFieldsCollection.serializedFields;
			foreach (SerializedField val in serializedFields)
			{
				if (field != null && val.fieldName == fieldName)
				{
					SerializedValue fieldValue = val.fieldValue;
					return (T)((SerializedValue)(ref fieldValue)).GetValue(field);
				}
			}
			Debug.LogWarning((object)("[SMALLMUSHY XDXDDDD] " + ((Object)config).name + " has no value for " + fieldName));
			return default(T);
		}
	}
	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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: 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_015d: 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.baseAcceleration = 0f;
			component.baseJumpPower = 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";
			bodyPrefab.AddComponent<DeathRewards>().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));
			RemoveMotor();
			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 RemoveMotor()
		{
			CharacterMotor component = bodyPrefab.GetComponent<CharacterMotor>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Object.DestroyImmediate((Object)(object)component);
			}
			KinematicCharacterMotor component2 = bodyPrefab.GetComponent<KinematicCharacterMotor>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				Object.DestroyImmediate((Object)(object)component2);
			}
			Rigidbody component3 = bodyPrefab.GetComponent<Rigidbody>();
			if (Object.op_Implicit((Object)(object)component3))
			{
				component3.isKinematic = true;
				component3.useGravity = false;
			}
		}

		private static void CreateAI()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//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_007d: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			AISkillDriver[] componentsInChildren = masterPrefab.GetComponentsInChildren<AISkillDriver>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.DestroyImmediate((Object)componentsInChildren[i]);
			}
			AISkillDriver obj = masterPrefab.AddComponent<AISkillDriver>();
			obj.customName = "Burrow";
			obj.movementType = (MovementType)0;
			obj.moveTargetType = (TargetType)0;
			obj.activationRequiresAimConfirmation = false;
			obj.activationRequiresTargetLoS = false;
			obj.selectionRequiresTargetLoS = false;
			obj.maxDistance = 512f;
			obj.minDistance = 25f;
			obj.requireSkillReady = true;
			obj.aimType = (AimType)0;
			obj.ignoreNodeGraph = false;
			obj.moveInputScale = 1f;
			obj.driverUpdateTimerOverride = -1f;
			obj.buttonPressType = (ButtonPressType)0;
			obj.minTargetHealthFraction = float.NegativeInfinity;
			obj.maxTargetHealthFraction = float.PositiveInfinity;
			obj.minUserHealthFraction = float.NegativeInfinity;
			obj.maxUserHealthFraction = float.PositiveInfinity;
			obj.skillSlot = (SkillSlot)2;
			AISkillDriver obj2 = masterPrefab.AddComponent<AISkillDriver>();
			obj2.customName = "Shoot";
			obj2.movementType = (MovementType)0;
			obj2.moveTargetType = (TargetType)0;
			obj2.activationRequiresAimConfirmation = true;
			obj2.activationRequiresTargetLoS = false;
			obj2.selectionRequiresTargetLoS = true;
			obj2.maxDistance = 32f;
			obj2.minDistance = 0f;
			obj2.requireSkillReady = true;
			obj2.aimType = (AimType)2;
			obj2.ignoreNodeGraph = false;
			obj2.moveInputScale = 1f;
			obj2.driverUpdateTimerOverride = -1f;
			obj2.buttonPressType = (ButtonPressType)0;
			obj2.minTargetHealthFraction = float.NegativeInfinity;
			obj2.maxTargetHealthFraction = float.PositiveInfinity;
			obj2.minUserHealthFraction = float.NegativeInfinity;
			obj2.maxUserHealthFraction = float.PositiveInfinity;
			obj2.skillSlot = (SkillSlot)0;
			AISkillDriver obj3 = masterPrefab.AddComponent<AISkillDriver>();
			obj3.customName = "Idle";
			obj3.movementType = (MovementType)0;
			obj3.moveTargetType = (TargetType)0;
			obj3.activationRequiresAimConfirmation = false;
			obj3.activationRequiresTargetLoS = false;
			obj3.selectionRequiresTargetLoS = false;
			obj3.maxDistance = 512f;
			obj3.minDistance = 0f;
			obj3.requireSkillReady = true;
			obj3.aimType = (AimType)2;
			obj3.ignoreNodeGraph = false;
			obj3.moveInputScale = 1f;
			obj3.driverUpdateTimerOverride = -1f;
			obj3.buttonPressType = (ButtonPressType)1;
			obj3.minTargetHealthFraction = float.NegativeInfinity;
			obj3.maxTargetHealthFraction = float.PositiveInfinity;
			obj3.minUserHealthFraction = float.NegativeInfinity;
			obj3.maxUserHealthFraction = float.PositiveInfinity;
			obj3.skillSlot = (SkillSlot)(-1);
		}

		private static GameObject CreateModel(GameObject main)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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);
			}
			return DMAssets.mainAssetBundle.LoadAsset<GameObject>("mdlDwarfMushrum");
		}

		private static void SetupModel()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: 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_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: 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_022d: Expected O, but got Unknown
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: 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 obj = val.AddComponent<AimAnimator>();
			obj.directionComponent = component;
			obj.pitchRangeMax = 60f;
			obj.pitchRangeMin = -60f;
			obj.yawRangeMin = -80f;
			obj.yawRangeMax = 80f;
			obj.pitchGiveupRange = 30f;
			obj.yawGiveupRange = 10f;
			obj.giveupDuration = 3f;
			obj.inputBank = bodyPrefab.GetComponent<InputBankTest>();
			Transform parent = component3.FindChild("Head");
			Transform transform2 = new GameObject().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_0042: 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_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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: 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_018f: Unknown result type (might be due to invalid IL or missing references)
			GameObject bodyPrefab = Prefabs.bodyPrefab;
			CreateSkillFamilies(bodyPrefab);
			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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			if (destroyExisting)
			{
				GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren<GenericSkill>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					Object.DestroyImmediate((Object)componentsInChildren[i]);
				}
			}
			SkillLocator component = targetPrefab.GetComponent<SkillLocator>();
			if ((families & 1) != 0)
			{
				component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary");
			}
			if ((families & 2) != 0)
			{
				component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary");
			}
			if ((families & 4) != 0)
			{
				component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility");
			}
			if ((families & 8) != 0)
			{
				component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special");
			}
		}

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

		public static void AddSkillToFamily(SkillFamily skillFamily, SkillDef skillDef, UnlockableDef unlockableDef = null)
		{
			//IL_0027: 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_0051: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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)
			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_003e: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			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_0005: Unknown result type (might be due to invalid IL or missing references)
			return CreateSkillDef(new SkillDefInfo(skillNameToken, skillNameToken, skillDescriptionToken, skillIcon, state, stateMachine, agile));
		}
	}
	public static class SpawnCards
	{
		public static CharacterSpawnCard monsterSpawnCard;

		internal static ConfigEntry<int> minimumStageCount;

		internal static ConfigEntry<int> spawnCost;

		public static void CreateSpawnCards()
		{
			//IL_0014: 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: Expected O, but got Unknown
			//IL_002f: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_0064: Expected O, but got Unknown
			//IL_008e: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			//IL_00d8: 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_00e4: 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_00f2: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			//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)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: 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_015c: Expected O, but got Unknown
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: 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
			};
			Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/MixEnemy/dccsMixEnemy.asset").WaitForCompletion().AddCard(1, val2);
			foreach (StageSpawnInfo stage in Config.StageList)
			{
				Helpers.AddNewMonsterToStage((stage.GetMinStages() == 0) ? val3 : val4, 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			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");
		}
	}
}