Decompiled source of Clay Men v1.5.8

plugins/Moffein-ClayMen/ClayMen.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.ClaymanMonster;
using EntityStates.MoffeinClayMan;
using On.EntityStates.ClaymanMonster;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Navigation;
using SneedUtils;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using Zio.FileSystems;

[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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ClayMen")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0e34ee2017d0aa7adcaf2f378e8e89a7a70237a7")]
[assembly: AssemblyProduct("ClayMen")]
[assembly: AssemblyTitle("ClayMen")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SneedUtils
{
	public class SneedUtils
	{
		public static int FindEnemiesInSphere(float radius, Vector3 position, TeamIndex team, bool airborneOnly = false)
		{
			//IL_0009: 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_00a3: 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)
			int num = 0;
			List<HealthComponent> list = new List<HealthComponent>();
			Collider[] array = Physics.OverlapSphere(position, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask));
			for (int i = 0; i < array.Length; i++)
			{
				HurtBox component = ((Component)array[i]).GetComponent<HurtBox>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					continue;
				}
				HealthComponent healthComponent = component.healthComponent;
				if (Object.op_Implicit((Object)(object)healthComponent) && !list.Contains(healthComponent))
				{
					list.Add(healthComponent);
					if (Object.op_Implicit((Object)(object)healthComponent.body) && Object.op_Implicit((Object)(object)healthComponent.body.teamComponent) && healthComponent.body.teamComponent.teamIndex != team && (!airborneOnly || healthComponent.body.isFlying || (Object.op_Implicit((Object)(object)healthComponent.body.characterMotor) && !healthComponent.body.characterMotor.isGrounded)))
					{
						num++;
					}
				}
			}
			return num;
		}

		public static void RemoveItemTag(ItemDef itemDef, ItemTag tag)
		{
			//IL_0002: 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)
			if (itemDef.ContainsTag(tag))
			{
				List<ItemTag> list = itemDef.tags.ToList();
				list.Remove(tag);
				itemDef.tags = list.ToArray();
			}
		}

		public static void AddItemTag(ItemDef itemDef, ItemTag tag)
		{
			//IL_0002: 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 (!itemDef.ContainsTag(tag))
			{
				List<ItemTag> list = itemDef.tags.ToList();
				list.Add(tag);
				itemDef.tags = list.ToArray();
			}
		}

		public static void DumpEntityStateConfig(EntityStateConfiguration esc)
		{
			for (int i = 0; i < esc.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (Object.op_Implicit(esc.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue))
				{
					Debug.Log((object)(esc.serializedFieldsCollection.serializedFields[i].fieldName + " - " + (object)esc.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue));
				}
				else
				{
					Debug.Log((object)(esc.serializedFieldsCollection.serializedFields[i].fieldName + " - " + esc.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue));
				}
			}
		}

		public static void DumpEntityStateConfig(string entityStateName)
		{
			EntityStateConfiguration esc = LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/" + entityStateName);
			DumpEntityStateConfig(esc);
		}

		public static Object GetEntityStateFieldObject(string entityStateName, string fieldName)
		{
			EntityStateConfiguration val = LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/" + entityStateName);
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					return val.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue;
				}
			}
			return null;
		}

		public static string GetEntityStateFieldString(string entityStateName, string fieldName)
		{
			EntityStateConfiguration val = LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/" + entityStateName);
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					return val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue;
				}
			}
			return string.Empty;
		}

		public static bool SetEntityStateField(string entityStateName, string fieldName, Object newObject)
		{
			EntityStateConfiguration val = LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/" + entityStateName);
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue = newObject;
					return true;
				}
			}
			return false;
		}

		public static bool SetEntityStateField(string entityStateName, string fieldName, string value)
		{
			EntityStateConfiguration val = LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/" + entityStateName);
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = value;
					return true;
				}
			}
			return false;
		}
	}
}
namespace EntityStates.MoffeinClayMan
{
	public class DeathState : GenericCharacterDeath
	{
		public static GameObject initialExplosion = LegacyResourcesAPI.Load<GameObject>("prefabs/effects/impacteffects/claypotprojectileexplosion");

		public override void OnEnter()
		{
			//IL_0086: 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)
			((GenericCharacterDeath)this).OnEnter();
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator.modelBaseTransform))
				{
					EntityState.Destroy((Object)(object)((Component)((EntityState)this).modelLocator.modelBaseTransform).gameObject);
				}
				if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator.modelTransform))
				{
					EntityState.Destroy((Object)(object)((Component)((EntityState)this).modelLocator.modelTransform).gameObject);
				}
			}
			if (NetworkServer.active)
			{
				EffectManager.SimpleEffect(initialExplosion, ((EntityState)this).transform.position, ((EntityState)this).transform.rotation, true);
				EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
			}
		}
	}
	public class SwipeForwardTar : BaseState
	{
		public static float baseDuration = 1f;

		public static float damageCoefficient = 1.5f;

		public static float forceMagnitude = 1000f;

		public static float selfForceMagnitude = 1800f;

		public static GameObject hitEffectPrefab = LegacyResourcesAPI.Load<GameObject>("prefabs/effects/impacteffects/squidturrethiteffect");

		public static GameObject swingEffectPrefab = LegacyResourcesAPI.Load<GameObject>("prefabs/effects/claymanswordswing");

		public static string attackString = "Play_merc_sword_swing";

		private OverlapAttack attack;

		private Animator modelAnimator;

		private float duration;

		private bool hasSlashed;

		public override void OnEnter()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0061: 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)
			((BaseState)this).OnEnter();
			duration = baseDuration / base.attackSpeedStat;
			modelAnimator = ((EntityState)this).GetModelAnimator();
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			attack = new OverlapAttack();
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.damage = damageCoefficient * base.damageStat;
			attack.hitEffectPrefab = hitEffectPrefab;
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.procCoefficient = 0.5f;
			Util.PlaySound(attackString, ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				attack.hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == "Sword");
			}
			if (Object.op_Implicit((Object)(object)modelAnimator))
			{
				((EntityState)this).PlayAnimation("Gesture, Override", "SwipeForward", "SwipeForward.playbackRate", duration, 0f);
				((EntityState)this).PlayAnimation("Gesture, Additive", "SwipeForward", "SwipeForward.playbackRate", duration, 0f);
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.SetAimTimer(2f);
			}
		}

		public override void FixedUpdate()
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (NetworkServer.active && Object.op_Implicit((Object)(object)modelAnimator) && modelAnimator.GetFloat("SwipeForward.hitBoxActive") > 0.1f)
			{
				if (!hasSlashed)
				{
					EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, "SwingCenter", true);
					HealthComponent healthComponent = ((EntityState)this).characterBody.healthComponent;
					CharacterDirection characterDirection = ((EntityState)this).characterDirection;
					if (Object.op_Implicit((Object)(object)healthComponent))
					{
						healthComponent.TakeDamageForce(selfForceMagnitude * characterDirection.forward, true, false);
					}
					hasSlashed = true;
				}
				attack.forceVector = ((EntityState)this).transform.forward * forceMagnitude;
				attack.Fire((List<HurtBox>)null);
			}
			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)2;
		}
	}
}
namespace ClayMen
{
	public class ClayMenContent : IContentPackProvider
	{
		public static ContentPack content = new ContentPack();

		public static GameObject ClayManObject;

		public static GameObject ClayManMaster;

		public static UnlockableDef ClayManLogbookUnlockable;

		public static DirectorCardHolder ClayManCard;

		public static DirectorCardHolder ClayManLoopCard;

		public string identifier => "MoffeinClayMen.content";

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(content, args.output);
			yield break;
		}

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			content.entityStateTypes.Add(new Type[2]
			{
				typeof(SwipeForwardTar),
				typeof(DeathState)
			});
			content.bodyPrefabs.Add((GameObject[])(object)new GameObject[1] { ClayManObject });
			content.masterPrefabs.Add((GameObject[])(object)new GameObject[1] { ClayManMaster });
			content.unlockableDefs.Add((UnlockableDef[])(object)new UnlockableDef[1] { ClayManLogbookUnlockable });
			yield break;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Moffein.ClayMen", "Clay Men", "1.5.8")]
	[R2APISubmoduleDependency(new string[] { "DirectorAPI", "PrefabAPI" })]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class ClayMenPlugin : BaseUnityPlugin
	{
		public static Transform headTransform;

		public static PluginInfo pluginInfo;

		public static List<StageSpawnInfo> StageList = new List<StageSpawnInfo>();

		public void LateSetup()
		{
			ItemDisplays.DisplayRules(ClayMenContent.ClayManObject);
		}

		public void ReadConfig()
		{
			//IL_0011: 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_0046: 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_017e: Unknown result type (might be due to invalid IL or missing references)
			string value = ((BaseUnityPlugin)this).Config.Bind<string>(new ConfigDefinition("Spawns", "Stage List"), "goolake, ancientloft, wispgraveyard, sulfurpools, arena, itgoolake, itancientloft, village - loop, villagenight, habitat, habitatfall, ", new ConfigDescription("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/List-of-scene-names", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			string value2 = ((BaseUnityPlugin)this).Config.Bind<string>(new ConfigDefinition("Spawns", "Remove Imps"), "wispgraveyard", new ConfigDescription("Remove Imps from these stages to prevent role overlap.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			value = new string((from c in value.ToCharArray()
				where !char.IsWhiteSpace(c)
				select c).ToArray());
			string[] array = value.Split(',');
			string[] array2 = array;
			foreach (string text in array2)
			{
				string[] array3 = text.Split('-');
				string stageName = array3[0];
				int minStages = 0;
				if (array3.Length > 1)
				{
					minStages = 5;
				}
				StageList.Add(new StageSpawnInfo(stageName, minStages));
			}
			value2 = new string((from c in value2.ToCharArray()
				where !char.IsWhiteSpace(c)
				select c).ToArray());
			string[] array4 = value.Split(',');
			string[] array5 = array4;
			foreach (string text2 in array5)
			{
				string[] array6 = text2.Split('-');
				string text3 = array6[0];
				SceneDef val = ScriptableObject.CreateInstance<SceneDef>();
				val.baseSceneNameOverride = text3;
				Helpers.RemoveExistingMonsterFromStage(MonsterNames.Imp, DirectorAPI.GetStageEnumFromSceneDef(val), text3);
			}
		}

		private void SetEntityStateFieldValues()
		{
			global::SneedUtils.SneedUtils.SetEntityStateField("EntityStates.ClaymanMonster.Leap", "verticalJumpSpeed", "20");
			global::SneedUtils.SneedUtils.SetEntityStateField("EntityStates.ClaymanMonster.Leap", "horizontalJumpSpeedCoefficient", "2.3");
			global::SneedUtils.SneedUtils.SetEntityStateField("EntityStates.ClaymanMonster.SpawnState", "duration", "3.2");
		}

		public void Awake()
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			pluginInfo = ((BaseUnityPlugin)this).Info;
			new LanguageTokens();
			ReadConfig();
			ClayMenContent.ClayManObject = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/characterbodies/ClayBody"), "MoffeinClayManBody", true);
			ClayMenContent.ClayManMaster = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/charactermasters/ClaymanMaster"), "MoffeinClayManMaster", true);
			SetEntityStateFieldValues();
			Prefab.Modify(ClayMenContent.ClayManObject);
			ModifyAI();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(LateSetup));
			Director.Setup();
			ModifySkills(ClayMenContent.ClayManObject);
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
		}

		private void ModifySkills(GameObject bodyObject)
		{
			//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)
			SkillLocator component = bodyObject.GetComponent<SkillLocator>();
			component.primary.skillFamily.variants[0].skillDef.activationState = new SerializableEntityStateType(typeof(SwipeForwardTar));
			component.primary.skillFamily.variants[0].skillDef.isCombatSkill = true;
			component.primary.skillFamily.variants[0].skillDef.baseRechargeInterval = 1.4f;
		}

		private void ModifyAI()
		{
			AISkillDriver component = ClayMenContent.ClayManMaster.GetComponent<AISkillDriver>();
			component.maxDistance = 12f;
			ClayMenContent.ClayManMaster.GetComponent<CharacterMaster>().bodyPrefab = ClayMenContent.ClayManObject;
		}

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)new ClayMenContent());
		}
	}
	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 Director
	{
		public static void Setup()
		{
			//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_0056: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00cb: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: 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_00de: 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_00ec: 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: Expected O, but got Unknown
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_010b: 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_01a2: Unknown result type (might be due to invalid IL or missing references)
			CharacterSpawnCard val = LegacyResourcesAPI.Load<CharacterSpawnCard>("SpawnCards/CharacterSpawnCards/cscBeetle");
			CharacterSpawnCard val2 = LegacyResourcesAPI.Load<CharacterSpawnCard>("SpawnCards/CharacterSpawnCards/cscImp");
			CharacterSpawnCard val3 = LegacyResourcesAPI.Load<CharacterSpawnCard>("SpawnCards/CharacterSpawnCards/cscLesserWisp");
			CharacterSpawnCard val4 = ScriptableObject.CreateInstance<CharacterSpawnCard>();
			((Object)val4).name = "cscClayMan";
			((SpawnCard)val4).prefab = ClayMenContent.ClayManMaster;
			((SpawnCard)val4).sendOverNetwork = true;
			((SpawnCard)val4).hullSize = (HullClassification)0;
			((SpawnCard)val4).nodeGraphType = (GraphType)0;
			((SpawnCard)val4).requiredFlags = (NodeFlags)0;
			((SpawnCard)val4).forbiddenFlags = (NodeFlags)4;
			((SpawnCard)val4).directorCreditCost = 28;
			((SpawnCard)val4).occupyPosition = false;
			val4.loadout = new SerializableLoadout();
			val4.noElites = false;
			val4.forbiddenAsBoss = false;
			DirectorCard val5 = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)val4,
				selectionWeight = 1,
				preventOverhead = false,
				minimumStageCompletions = 0,
				spawnDistance = (MonsterSpawnDistance)0
			};
			DirectorCardHolder clayManCard = new DirectorCardHolder
			{
				Card = val5,
				MonsterCategory = (MonsterCategory)2
			};
			DirectorCard card = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)val4,
				selectionWeight = 1,
				preventOverhead = false,
				minimumStageCompletions = 5,
				spawnDistance = (MonsterSpawnDistance)0
			};
			DirectorCardHolder clayManLoopCard = new DirectorCardHolder
			{
				Card = card,
				MonsterCategory = (MonsterCategory)2
			};
			ClayMenContent.ClayManCard = clayManCard;
			ClayMenContent.ClayManLoopCard = clayManLoopCard;
			DirectorCardCategorySelection val6 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/MixEnemy/dccsMixEnemy.asset").WaitForCompletion();
			int num = FindCategoryIndexByName(val6, "Basic Monsters");
			if (num >= 0)
			{
				val6.AddCard(num, val5);
			}
			foreach (StageSpawnInfo stage in ClayMenPlugin.StageList)
			{
				DirectorCardHolder val7 = ((stage.GetMinStages() == 0) ? ClayMenContent.ClayManCard : ClayMenContent.ClayManLoopCard);
				SceneDef val8 = ScriptableObject.CreateInstance<SceneDef>();
				val8.baseSceneNameOverride = stage.GetStageName();
				Helpers.AddNewMonsterToStage(val7, false, DirectorAPI.GetStageEnumFromSceneDef(val8), stage.GetStageName());
			}
		}

		public static int FindCategoryIndexByName(DirectorCardCategorySelection dcs, string categoryName)
		{
			for (int i = 0; i < dcs.categories.Length; i++)
			{
				if (string.CompareOrdinal(dcs.categories[i].name, categoryName) == 0)
				{
					return i;
				}
			}
			return -1;
		}
	}
	internal class ItemDisplays
	{
		private static Dictionary<string, GameObject> itemDisplayPrefabs = new Dictionary<string, GameObject>();

		public static List<KeyAssetRuleGroup> equipmentList;

		public static Transform headTransform;

		public static void DisplayRules(GameObject clayObject)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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_00f0: 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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: 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_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: 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_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: 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_0387: 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_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Unknown result type (might be due to invalid IL or missing references)
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0512: Unknown result type (might be due to invalid IL or missing references)
			//IL_0517: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_055c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_056d: Unknown result type (might be due to invalid IL or missing references)
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_060a: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0611: Unknown result type (might be due to invalid IL or missing references)
			//IL_061b: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0622: Unknown result type (might be due to invalid IL or missing references)
			//IL_0631: Unknown result type (might be due to invalid IL or missing references)
			//IL_064c: Unknown result type (might be due to invalid IL or missing references)
			//IL_065e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0667: Unknown result type (might be due to invalid IL or missing references)
			//IL_069a: Unknown result type (might be due to invalid IL or missing references)
			//IL_069f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06df: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_071a: Unknown result type (might be due to invalid IL or missing references)
			//IL_072c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0735: Unknown result type (might be due to invalid IL or missing references)
			//IL_0768: Unknown result type (might be due to invalid IL or missing references)
			//IL_076d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0783: Unknown result type (might be due to invalid IL or missing references)
			//IL_0788: Unknown result type (might be due to invalid IL or missing references)
			//IL_079e: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_07be: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0808: Unknown result type (might be due to invalid IL or missing references)
			//IL_083b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0840: Unknown result type (might be due to invalid IL or missing references)
			//IL_0856: Unknown result type (might be due to invalid IL or missing references)
			//IL_085b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0871: Unknown result type (might be due to invalid IL or missing references)
			//IL_0876: Unknown result type (might be due to invalid IL or missing references)
			//IL_087e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0883: Unknown result type (might be due to invalid IL or missing references)
			//IL_0885: Unknown result type (might be due to invalid IL or missing references)
			//IL_088f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0891: Unknown result type (might be due to invalid IL or missing references)
			//IL_0896: Unknown result type (might be due to invalid IL or missing references)
			ChildLocator componentInChildren = clayObject.GetComponentInChildren<ChildLocator>();
			Array.Resize(ref componentInChildren.transformPairs, componentInChildren.transformPairs.Length + 1);
			componentInChildren.transformPairs[componentInChildren.transformPairs.Length - 1] = new NameTransformPair
			{
				name = "Head",
				transform = headTransform
			};
			PopulateDisplays();
			ItemDisplayRuleSet val = ScriptableObject.CreateInstance<ItemDisplayRuleSet>();
			equipmentList = new List<KeyAssetRuleGroup>();
			equipmentList.Add(new KeyAssetRuleGroup
			{
				keyAsset = (Object)(object)Equipment.AffixPoison,
				displayRuleGroup = new DisplayRuleGroup
				{
					rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
					{
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = LoadDisplay("DisplayEliteUrchinCrown"),
							childName = "Head",
							localPos = new Vector3(0f, 0.4f, 0f),
							localAngles = new Vector3(255f, 0f, 0f),
							localScale = 0.07f * Vector3.one,
							limbMask = (LimbFlags)0
						}
					}
				}
			});
			equipmentList.Add(new KeyAssetRuleGroup
			{
				keyAsset = (Object)(object)Equipment.AffixHaunted,
				displayRuleGroup = new DisplayRuleGroup
				{
					rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
					{
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = LoadDisplay("DisplayEliteStealthCrown"),
							childName = "Head",
							localPos = new Vector3(0f, 0.3f, 0f),
							localAngles = new Vector3(260f, 0f, 0f),
							localScale = 0.07f * Vector3.one,
							limbMask = (LimbFlags)0
						}
					}
				}
			});
			equipmentList.Add(new KeyAssetRuleGroup
			{
				keyAsset = (Object)(object)Equipment.AffixWhite,
				displayRuleGroup = new DisplayRuleGroup
				{
					rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
					{
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = LoadDisplay("DisplayEliteIceCrown"),
							childName = "Head",
							localPos = new Vector3(0f, 0.33f, -0.05f),
							localAngles = new Vector3(260f, 0f, 0f),
							localScale = 0.035f * Vector3.one,
							limbMask = (LimbFlags)0
						}
					}
				}
			});
			equipmentList.Add(new KeyAssetRuleGroup
			{
				keyAsset = (Object)(object)Equipment.AffixBlue,
				displayRuleGroup = new DisplayRuleGroup
				{
					rules = (ItemDisplayRule[])(object)new ItemDisplayRule[2]
					{
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = LoadDisplay("DisplayEliteRhinoHorn"),
							childName = "Head",
							localPos = new Vector3(0f, 0.28f, 0.1f),
							localAngles = new Vector3(-20f, 0f, 0f),
							localScale = 0.18f * Vector3.one,
							limbMask = (LimbFlags)0
						},
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = LoadDisplay("DisplayEliteRhinoHorn"),
							childName = "Head",
							localPos = new Vector3(0f, 0.21f, 0.1f),
							localAngles = new Vector3(-10f, 0f, 0f),
							localScale = 0.25f * Vector3.one,
							limbMask = (LimbFlags)0
						}
					}
				}
			});
			equipmentList.Add(new KeyAssetRuleGroup
			{
				keyAsset = (Object)(object)Equipment.AffixRed,
				displayRuleGroup = new DisplayRuleGroup
				{
					rules = (ItemDisplayRule[])(object)new ItemDisplayRule[2]
					{
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = LoadDisplay("DisplayEliteHorn"),
							childName = "Head",
							localPos = new Vector3(-0.1f, 0.25f, -0.1f),
							localAngles = new Vector3(0f, 20f, 0f),
							localScale = new Vector3(-0.1f, 0.1f, 0.1f),
							limbMask = (LimbFlags)0
						},
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = LoadDisplay("DisplayEliteHorn"),
							childName = "Head",
							localPos = new Vector3(0.1f, 0.25f, -0.1f),
							localAngles = new Vector3(0f, -20f, 0f),
							localScale = new Vector3(0.1f, 0.1f, 0.1f),
							limbMask = (LimbFlags)0
						}
					}
				}
			});
			equipmentList.Add(new KeyAssetRuleGroup
			{
				keyAsset = (Object)(object)Elites.Earth.eliteEquipmentDef,
				displayRuleGroup = new DisplayRuleGroup
				{
					rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
					{
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = LoadDisplay("DisplayEliteMendingAntlers"),
							childName = "Head",
							localPos = new Vector3(0f, 0.25f, 0f),
							localAngles = Vector3.zero,
							localScale = Vector3.one,
							limbMask = (LimbFlags)0
						}
					}
				}
			});
			equipmentList.Add(new KeyAssetRuleGroup
			{
				keyAsset = (Object)(object)Elites.Void.eliteEquipmentDef,
				displayRuleGroup = new DisplayRuleGroup
				{
					rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
					{
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = LoadDisplay("DisplayAffixVoid"),
							childName = "Head",
							localPos = new Vector3(0f, 0.14f, 0.15f),
							localAngles = new Vector3(90f, 0f, 0f),
							localScale = 0.2f * Vector3.one,
							limbMask = (LimbFlags)0
						}
					}
				}
			});
			equipmentList.Add(new KeyAssetRuleGroup
			{
				keyAsset = (Object)(object)Elites.Aurelionite.eliteEquipmentDef,
				displayRuleGroup = new DisplayRuleGroup
				{
					rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
					{
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = LoadDisplay("DisplayEliteAurelioniteEquipment"),
							childName = "Head",
							localPos = new Vector3(0f, 0.28f, 0.14f),
							localAngles = new Vector3(0f, 0f, 0f),
							localScale = new Vector3(0.4f, 0.4f, 0.4f),
							limbMask = (LimbFlags)0
						}
					}
				}
			});
			equipmentList.Add(new KeyAssetRuleGroup
			{
				keyAsset = (Object)(object)Elites.Bead.eliteEquipmentDef,
				displayRuleGroup = new DisplayRuleGroup
				{
					rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
					{
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = LoadDisplay("DisplayEliteBeadSpike"),
							childName = "Head",
							localPos = new Vector3(0f, 0.3f, -0.075f),
							localAngles = new Vector3(326f, 0f, 0f),
							localScale = new Vector3(0.025f, 0.025f, 0.025f),
							limbMask = (LimbFlags)0
						}
					}
				}
			});
			val.keyAssetRuleGroups = equipmentList.ToArray();
			CharacterModel component = ((Component)clayObject.GetComponent<ModelLocator>().modelTransform).GetComponent<CharacterModel>();
			component.itemDisplayRuleSet = val;
			component.itemDisplayRuleSet.GenerateRuntimeValues();
			itemDisplayPrefabs.Clear();
		}

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

		public static GameObject LoadDisplay(string name)
		{
			if (itemDisplayPrefabs.ContainsKey(name.ToLower()) && Object.op_Implicit((Object)(object)itemDisplayPrefabs[name.ToLower()]))
			{
				return itemDisplayPrefabs[name.ToLower()];
			}
			return null;
		}
	}
	internal class LanguageTokens
	{
		public static SubFileSystem fileSystem;

		internal static string languageRoot => Path.Combine(assemblyDir, "language");

		internal static string assemblyDir => Path.GetDirectoryName(ClayMenPlugin.pluginInfo.Location);

		public LanguageTokens()
		{
			RegisterLanguageTokens();
		}

		public static void RegisterLanguageTokens()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			Language.SetFolders += new hook_SetFolders(fixme);
		}

		private static void fixme(orig_SetFolders orig, Language self, IEnumerable<string> newFolders)
		{
			if (Directory.Exists(languageRoot))
			{
				IEnumerable<string> second = Directory.EnumerateDirectories(Path.Combine(languageRoot), self.name);
				orig.Invoke(self, newFolders.Union(second));
			}
			else
			{
				orig.Invoke(self, newFolders);
			}
		}
	}
	public class Prefab
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__0_0;

			internal void <Modify>b__0_0(orig_OnEnter orig, SpawnState self)
			{
				orig.Invoke(self);
				Util.PlayAttackSpeedSound("Play_clayBruiser_attack2_shoot", ((Component)((EntityState)self).outer).gameObject, 1f);
			}
		}

		public static void Modify(GameObject clayObject)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Expected O, but got Unknown
			clayObject.AddComponent<Interactor>().maxInteractionDistance = 3f;
			clayObject.AddComponent<InteractionDriver>();
			ModelLocator component = clayObject.GetComponent<ModelLocator>();
			((Component)component.modelTransform).gameObject.layer = LayerIndex.entityPrecise.intVal;
			Transform modelTransform = component.modelTransform;
			modelTransform.localScale *= 1.4f;
			component.noCorpse = true;
			CharacterDeathBehavior component2 = clayObject.GetComponent<CharacterDeathBehavior>();
			component2.deathState = new SerializableEntityStateType(typeof(DeathState));
			CharacterBody component3 = clayObject.GetComponent<CharacterBody>();
			component3.baseNameToken = "MOFFEIN_CLAY_BODY_NAME";
			component3.baseJumpPower = 22f;
			component3.baseMaxHealth = 140f;
			component3.levelMaxHealth = component3.baseMaxHealth * 0.3f;
			component3.baseArmor = 0f;
			component3.baseDamage = 12f;
			component3.levelDamage = component3.baseDamage * 0.2f;
			component3.baseMoveSpeed = 10f;
			component3.baseRegen = 0f;
			component3.levelRegen = 0f;
			component3.bodyFlags = (BodyFlags)8;
			SfxLocator component4 = clayObject.GetComponent<SfxLocator>();
			component4.deathSound = "Play_clayboss_M1_explo";
			component4.barkSound = "";
			EntityLocator val = clayObject.AddComponent<EntityLocator>();
			val.entity = clayObject;
			FixHitbox(clayObject, component);
			AddSSoH(clayObject);
			DeathRewards component5 = clayObject.GetComponent<DeathRewards>();
			ClayMenContent.ClayManLogbookUnlockable = ScriptableObject.CreateInstance<UnlockableDef>();
			ClayMenContent.ClayManLogbookUnlockable.nameToken = "UNLOCKABLE_LOG_MOFFEIN_CLAY_BODY";
			ClayMenContent.ClayManLogbookUnlockable.cachedName = "MOFFEIN_CLAY_BODY_NAME";
			component5.logUnlockableDef = ClayMenContent.ClayManLogbookUnlockable;
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				hook_OnEnter val2 = delegate(orig_OnEnter orig, SpawnState self)
				{
					orig.Invoke(self);
					Util.PlayAttackSpeedSound("Play_clayBruiser_attack2_shoot", ((Component)((EntityState)self).outer).gameObject, 1f);
				};
				<>c.<>9__0_0 = val2;
				obj = (object)val2;
			}
			SpawnState.OnEnter += (hook_OnEnter)obj;
		}

		public static void FixHitbox(GameObject enemyObject, ModelLocator modelLocator)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			Component[] componentsInChildren = (Component[])(object)enemyObject.GetComponentsInChildren<Transform>();
			Component[] array = componentsInChildren;
			Transform val = null;
			Transform val2 = null;
			Transform val3 = null;
			Component[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				Transform val4 = (Transform)array2[i];
				if (((Object)val4).name == "chest")
				{
					val = val4;
				}
				else if (((Object)val4).name == "head")
				{
					val2 = val4;
				}
				else if (((Object)val4).name == "Hitbox")
				{
					val3 = val4;
				}
				if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null)
				{
					break;
				}
			}
			ItemDisplays.headTransform = val2;
			HurtBoxGroup val5 = ((Component)modelLocator.modelTransform).gameObject.AddComponent<HurtBoxGroup>();
			val3.localScale = new Vector3(1f, 3.4f, 1.6f);
			ChildLocator component = ((Component)modelLocator.modelTransform).GetComponent<ChildLocator>();
			Transform val6 = component.FindChild("SwingCenter");
			val6.localPosition += new Vector3(0f, 0.7f, 1.8f);
			((Component)val2).gameObject.layer = LayerIndex.entityPrecise.intVal;
			CapsuleCollider val7 = ((Component)val2).gameObject.AddComponent<CapsuleCollider>();
			val7.height = 2f;
			val7.radius = 0.4f;
			val7.center = new Vector3(0f, -0.5f, 0f);
			HurtBox val8 = ((Component)val2).gameObject.AddComponent<HurtBox>();
			val8.isBullseye = true;
			val8.healthComponent = enemyObject.GetComponent<HealthComponent>();
			val8.damageModifier = (DamageModifier)0;
			val8.hurtBoxGroup = val5;
			val8.indexInGroup = 0;
			val8.isSniperTarget = true;
			HurtBox[] hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val8 };
			val5.mainHurtBox = val8;
			val5.hurtBoxes = hurtBoxes;
		}

		private static void AddSSoH(GameObject enemyObject)
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			EntityStateMachine targetStateMachine = null;
			EntityStateMachine val = null;
			EntityStateMachine[] components = enemyObject.GetComponents<EntityStateMachine>();
			EntityStateMachine[] array = components;
			foreach (EntityStateMachine val2 in array)
			{
				string customName = val2.customName;
				string text = customName;
				if (!(text == "Body"))
				{
					if (text == "Weapon")
					{
						val = val2;
					}
				}
				else
				{
					targetStateMachine = val2;
				}
			}
			SetStateOnHurt val3 = enemyObject.AddComponent<SetStateOnHurt>();
			val3.canBeFrozen = true;
			val3.canBeStunned = true;
			val3.canBeHitStunned = true;
			val3.hitThreshold = 0.35f;
			val3.targetStateMachine = targetStateMachine;
			val3.idleStateMachine = (EntityStateMachine[])(object)new EntityStateMachine[1] { val };
			val3.hurtState = new SerializableEntityStateType(typeof(HurtState));
		}
	}
}