Decompiled source of Archaic Wisp v1.1.4

plugins/Moffein-ArchaicWisp/ArchaicWisp.dll

Decompiled 7 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.GreaterWispMonster;
using On.EntityStates.GreaterWispMonster;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Navigation;
using RoR2.Projectile;
using SneedUtils;
using UnityEngine;
using UnityEngine.AddressableAssets;
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.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ArchaicWisp")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ArchaicWisp")]
[assembly: AssemblyTitle("ArchaicWisp")]
[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_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_0013: 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)
			int num = 0;
			List<HealthComponent> list = new List<HealthComponent>();
			LayerIndex entityPrecise = LayerIndex.entityPrecise;
			Collider[] array = Physics.OverlapSphere(position, radius, LayerMask.op_Implicit(((LayerIndex)(ref 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 ArchaicWisp
{
	public class ArchaicWispContent : IContentPackProvider
	{
		public static AssetBundle assets;

		public static ContentPack content = new ContentPack();

		public static GameObject ArchaicWispObject;

		public static GameObject ArchaicWispMaster;

		public static UnlockableDef ArchaicWispLogbookUnlockable;

		public static DirectorCardHolder ArchaicWispCard;

		public static DirectorCardHolder ArchaicWispLoopCard;

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

		public string identifier => "MoffeinArchaicWisp.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.bodyPrefabs.Add((GameObject[])(object)new GameObject[1] { ArchaicWispObject });
			content.masterPrefabs.Add((GameObject[])(object)new GameObject[1] { ArchaicWispMaster });
			content.unlockableDefs.Add((UnlockableDef[])(object)new UnlockableDef[1] { ArchaicWispLogbookUnlockable });
			content.projectilePrefabs.Add(projectilePrefabs.ToArray());
			yield break;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Moffein.ArchaicWisp", "Archaic Wisp", "1.1.1")]
	[R2APISubmoduleDependency(new string[] { "DirectorAPI", "PrefabAPI" })]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class ArchaicWispPlugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__2_0;

			public static Func<char, bool> <>9__4_0;

			public static Func<char, bool> <>9__4_1;

			internal void <Awake>b__2_0(orig_OnEnter orig, ChargeCannons self)
			{
				orig.Invoke(self);
				Debug.Log((object)self.baseDuration);
			}

			internal bool <ReadConfig>b__4_0(char c)
			{
				return !char.IsWhiteSpace(c);
			}

			internal bool <ReadConfig>b__4_1(char c)
			{
				return !char.IsWhiteSpace(c);
			}
		}

		public static PluginInfo pluginInfo;

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

		public void Awake()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//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_00a6: Expected O, but got Unknown
			pluginInfo = ((BaseUnityPlugin)this).Info;
			new LanguageTokens();
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ArchaicWisp.archwispbundle"))
			{
				ArchaicWispContent.assets = AssetBundle.LoadFromStream(stream);
			}
			ReadConfig();
			Prefab.Init();
			Director.Init();
			ModifySkills.Init();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(LateSetup));
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
			object obj = <>c.<>9__2_0;
			if (obj == null)
			{
				hook_OnEnter val = delegate(orig_OnEnter orig, ChargeCannons self)
				{
					orig.Invoke(self);
					Debug.Log((object)self.baseDuration);
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			ChargeCannons.OnEnter += (hook_OnEnter)obj;
		}

		public void LateSetup()
		{
			ItemDisplays.DisplayRules(ArchaicWispContent.ArchaicWispObject);
		}

		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_019e: Unknown result type (might be due to invalid IL or missing references)
			string value = ((BaseUnityPlugin)this).Config.Bind<string>(new ConfigDefinition("Spawns", "Stage List"), "goldshores, dampcavesimple, itdampcave, sulfurpools, skymeadow, itskymeadow, wispgraveyard - loop", 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 Greater Wisps"), "goldshores, dampcavesimple, itdampcave, sulfurpools, skymeadow, itskymeadow", new ConfigDescription("Remove Greater Wisps 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(new char[1] { ',' });
			string[] array2 = array;
			foreach (string text in array2)
			{
				string[] array3 = text.Split(new char[1] { '-' });
				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(new char[1] { ',' });
			string[] array5 = array4;
			foreach (string text2 in array5)
			{
				string[] array6 = text2.Split(new char[1] { '-' });
				string text3 = array6[0];
				SceneDef val = ScriptableObject.CreateInstance<SceneDef>();
				val.baseSceneNameOverride = text3;
				Helpers.RemoveExistingMonsterFromStage(MonsterNames.GreaterWisp, DirectorAPI.GetStageEnumFromSceneDef(val), text3);
			}
		}

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)new ArchaicWispContent());
		}
	}
	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
	{
		private static bool initialized;

		public static void Init()
		{
			//IL_001c: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_0097: 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_00aa: 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)
			//IL_00b8: 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_00c0: Expected O, but got Unknown
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			//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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: 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)
			if (initialized)
			{
				return;
			}
			initialized = true;
			CharacterSpawnCard val = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/GreaterWisp/cscGreaterWisp.asset").WaitForCompletion();
			CharacterSpawnCard val2 = ScriptableObject.CreateInstance<CharacterSpawnCard>();
			((Object)val2).name = "cscArchWisp";
			((SpawnCard)val2).prefab = ArchaicWispContent.ArchaicWispMaster;
			((SpawnCard)val2).sendOverNetwork = true;
			((SpawnCard)val2).hullSize = (HullClassification)0;
			((SpawnCard)val2).nodeGraphType = (GraphType)1;
			((SpawnCard)val2).requiredFlags = (NodeFlags)0;
			((SpawnCard)val2).forbiddenFlags = (NodeFlags)4;
			((SpawnCard)val2).directorCreditCost = 240;
			((SpawnCard)val2).occupyPosition = false;
			val2.loadout = new SerializableLoadout();
			val2.noElites = false;
			val2.forbiddenAsBoss = false;
			DirectorCard val3 = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)val2,
				selectionWeight = 1,
				preventOverhead = false,
				minimumStageCompletions = 0,
				spawnDistance = (MonsterSpawnDistance)0
			};
			DirectorCardHolder archaicWispCard = new DirectorCardHolder
			{
				Card = val3,
				MonsterCategory = (MonsterCategory)3
			};
			DirectorCard card = new DirectorCard
			{
				spawnCard = (SpawnCard)(object)val2,
				selectionWeight = 1,
				preventOverhead = false,
				minimumStageCompletions = 5,
				spawnDistance = (MonsterSpawnDistance)0
			};
			DirectorCardHolder archaicWispLoopCard = new DirectorCardHolder
			{
				Card = card,
				MonsterCategory = (MonsterCategory)3
			};
			ArchaicWispContent.ArchaicWispCard = archaicWispCard;
			ArchaicWispContent.ArchaicWispLoopCard = archaicWispLoopCard;
			int num = -1;
			DirectorCardCategorySelection val4 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/MixEnemy/dccsMixEnemy.asset").WaitForCompletion();
			num = FindCategoryIndexByName(val4, "Minibosses");
			if (num >= 0)
			{
				val4.AddCard(num, val3);
			}
			DirectorCardCategorySelection val5 = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/Common/dccsWispFamily.asset").WaitForCompletion();
			num = FindCategoryIndexByName(val5, "Minibosses");
			if (num >= 0)
			{
				val5.AddCard(num, val3);
			}
			foreach (StageSpawnInfo stage in ArchaicWispPlugin.StageList)
			{
				DirectorCardHolder val6 = ((stage.GetMinStages() == 0) ? ArchaicWispContent.ArchaicWispCard : ArchaicWispContent.ArchaicWispLoopCard);
				SceneDef val7 = ScriptableObject.CreateInstance<SceneDef>();
				val7.baseSceneNameOverride = stage.GetStageName();
				Helpers.AddNewMonsterToStage(val6, false, DirectorAPI.GetStageEnumFromSceneDef(val7), 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;
		}
	}
	public 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 bodyObject)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: 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)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: 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_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: 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_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: 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_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: 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_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: 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_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: 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_03dc: 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_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: 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_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Unknown result type (might be due to invalid IL or missing references)
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0504: Unknown result type (might be due to invalid IL or missing references)
			//IL_0509: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_0533: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0544: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Unknown result type (might be due to invalid IL or missing references)
			//IL_056e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0580: Unknown result type (might be due to invalid IL or missing references)
			//IL_0589: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_059a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e0: 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_05fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0600: Unknown result type (might be due to invalid IL or missing references)
			//IL_0608: Unknown result type (might be due to invalid IL or missing references)
			//IL_060d: 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_0619: 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_0620: Unknown result type (might be due to invalid IL or missing references)
			//IL_062f: Unknown result type (might be due to invalid IL or missing references)
			//IL_064a: Unknown result type (might be due to invalid IL or missing references)
			//IL_065c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0665: Unknown result type (might be due to invalid IL or missing references)
			//IL_0671: Unknown result type (might be due to invalid IL or missing references)
			//IL_0676: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e4: 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_06f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
			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 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElitePoison/DisplayEliteUrchinCrown.prefab").WaitForCompletion(),
							childName = "HealthBarOrigin",
							localPos = new Vector3(0f, -0.6f, -0.85f),
							localAngles = new Vector3(0f, 0f, 0f),
							localScale = new Vector3(0.25f, 0.25f, 0.25f),
							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 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteHaunted/DisplayEliteStealthCrown.prefab").WaitForCompletion(),
							childName = "HealthBarOrigin",
							localPos = new Vector3(0f, -0.6f, -0.6f),
							localAngles = new Vector3(0f, 0f, 0f),
							localScale = new Vector3(0.25f, 0.25f, 0.25f),
							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 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteIce/DisplayEliteIceCrown.prefab").WaitForCompletion(),
							childName = "HealthBarOrigin",
							localPos = new Vector3(0f, -0.6f, -0.45f),
							localAngles = new Vector3(0f, 0f, 0f),
							localScale = new Vector3(0.12f, 0.12f, 0.12f),
							limbMask = (LimbFlags)0
						}
					}
				}
			});
			GameObject followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteLightning/DisplayEliteRhinoHorn.prefab").WaitForCompletion();
			equipmentList.Add(new KeyAssetRuleGroup
			{
				keyAsset = (Object)(object)Equipment.AffixBlue,
				displayRuleGroup = new DisplayRuleGroup
				{
					rules = (ItemDisplayRule[])(object)new ItemDisplayRule[2]
					{
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = followerPrefab,
							childName = "HealthBarOrigin",
							localPos = new Vector3(0f, -0.7874f, -0.92505f),
							localAngles = new Vector3(80.00003f, 0f, 0f),
							localScale = new Vector3(0.5f, 0.5f, 0.5f),
							limbMask = (LimbFlags)0
						},
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = followerPrefab,
							childName = "HealthBarOrigin",
							localPos = new Vector3(0f, -0.81623f, -1.2465f),
							localAngles = new Vector3(90f, 0f, 0f),
							localScale = new Vector3(0.8f, 0.8f, 0.8f),
							limbMask = (LimbFlags)0
						}
					}
				}
			});
			GameObject followerPrefab2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteFire/DisplayEliteHorn.prefab").WaitForCompletion();
			equipmentList.Add(new KeyAssetRuleGroup
			{
				keyAsset = (Object)(object)Equipment.AffixRed,
				displayRuleGroup = new DisplayRuleGroup
				{
					rules = (ItemDisplayRule[])(object)new ItemDisplayRule[2]
					{
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = followerPrefab2,
							childName = "HealthBarOrigin",
							localPos = new Vector3(0.7f, -1f, -1.1f),
							localAngles = new Vector3(0f, 190f, 180f),
							localScale = new Vector3(0.4f, 0.4f, 0.4f)
						},
						new ItemDisplayRule
						{
							ruleType = (ItemDisplayRuleType)0,
							followerPrefab = followerPrefab2,
							childName = "HealthBarOrigin",
							localPos = new Vector3(-0.7f, -1f, -1.1f),
							localAngles = new Vector3(0f, 170f, 180f),
							localScale = new Vector3(-0.4f, 0.4f, 0.4f),
							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 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/EliteEarth/DisplayEliteMendingAntlers.prefab").WaitForCompletion(),
							childName = "HealthBarOrigin",
							localPos = new Vector3(0f, -0.63f, -0.75f),
							localAngles = new Vector3(90f, 0f, 0f),
							localScale = new Vector3(2.5f, 2.5f, 2.5f),
							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 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/EliteVoid/DisplayAffixVoid.prefab").WaitForCompletion(),
							childName = "HealthBarOrigin",
							localPos = new Vector3(0f, -0.98165f, -1.88916f),
							localAngles = new Vector3(0f, 180f, 180f),
							localScale = new Vector3(0.68414f, 0.68414f, 0.68414f),
							limbMask = (LimbFlags)0
						}
					}
				}
			});
			val.keyAssetRuleGroups = equipmentList.ToArray();
			CharacterModel component = ((Component)bodyObject.GetComponent<ModelLocator>().modelTransform).GetComponent<CharacterModel>();
			component.itemDisplayRuleSet = val;
			component.itemDisplayRuleSet.GenerateRuntimeValues();
			itemDisplayPrefabs.Clear();
		}
	}
	internal class LanguageTokens
	{
		public static SubFileSystem fileSystem;

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

		internal static string assemblyDir => Path.GetDirectoryName(ArchaicWispPlugin.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 ModifySkills
	{
		private static bool initialized;

		public static void Init()
		{
			//IL_001c: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			if (!initialized)
			{
				initialized = true;
				GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/ArchWisp/ArchWispCannon.prefab").WaitForCompletion(), "MoffeinArchWispCannon", true);
				ArchaicWispContent.projectilePrefabs.Add(val);
				val.GetComponent<Rigidbody>().useGravity = false;
				ProjectileImpactExplosion component = val.GetComponent<ProjectileImpactExplosion>();
				component.lifetime = 7f;
				((ProjectileExplosion)component).falloffModel = (FalloffModel)2;
				ProjectileSimple component2 = ((Component)component).GetComponent<ProjectileSimple>();
				component2.lifetime = 7f;
				GameObject val2 = (((ProjectileExplosion)component).childrenProjectilePrefab = PrefabAPI.InstantiateClone(((ProjectileExplosion)component).childrenProjectilePrefab, "MoffeinArchWispCannonGround", true));
				ArchaicWispContent.projectilePrefabs.Add(val2);
				ProjectileDamageTrail component3 = val2.GetComponent<ProjectileDamageTrail>();
				component3.damageToTrailDpsFactor = 0.35f;
				component3.trailLifetimeAfterExpiration = 8f;
				ProjectileImpactExplosion component4 = val2.GetComponent<ProjectileImpactExplosion>();
				((ProjectileExplosion)component4).falloffModel = (FalloffModel)2;
				global::SneedUtils.SneedUtils.SetEntityStateField("EntityStates.ArchWispMonster.ChargeCannons", "baseDuration", "2");
				global::SneedUtils.SneedUtils.SetEntityStateField("EntityStates.ArchWispMonster.FireCannons", "damageCoefficient", "3.6");
				global::SneedUtils.SneedUtils.SetEntityStateField("EntityStates.ArchWispMonster.FireCannons", "projectilePrefab", (Object)(object)val);
			}
		}
	}
	public class Prefab
	{
		private static bool initialized;

		public static void Init()
		{
			if (!initialized)
			{
				initialized = true;
				CreateBody();
				CreateMaster();
				AddSniperTarget();
			}
		}

		private static void AddSniperTarget()
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			ModelLocator component = ArchaicWispContent.ArchaicWispObject.GetComponent<ModelLocator>();
			HurtBoxGroup component2 = ((Component)component.modelTransform).gameObject.GetComponent<HurtBoxGroup>();
			GameObject gameObject = ((Component)((Component)component2.mainHurtBox).transform).gameObject;
			Collider component3 = ((Component)component2.mainHurtBox).GetComponent<Collider>();
			Object.Destroy((Object)(object)component2.mainHurtBox);
			Object.Destroy((Object)(object)component3);
			CapsuleCollider val = gameObject.AddComponent<CapsuleCollider>();
			val.height = 3.6f;
			val.radius = 1f;
			val.direction = 2;
			HurtBox val2 = gameObject.AddComponent<HurtBox>();
			val2.isBullseye = true;
			val2.healthComponent = ArchaicWispContent.ArchaicWispObject.GetComponent<HealthComponent>();
			val2.damageModifier = (DamageModifier)0;
			val2.isSniperTarget = true;
			val2.hurtBoxGroup = component2;
			val2.indexInGroup = 0;
			component2.mainHurtBox = val2;
			component2.hurtBoxes[0] = val2;
		}

		private static void CreateMaster()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			ArchaicWispContent.ArchaicWispMaster = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/ArchWisp/ArchWispMaster.prefab").WaitForCompletion(), "MoffeinArchWispMaster", true);
			CharacterMaster component = ArchaicWispContent.ArchaicWispMaster.GetComponent<CharacterMaster>();
			component.bodyPrefab = ArchaicWispContent.ArchaicWispObject;
		}

		private static void CreateBody()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			ArchaicWispContent.ArchaicWispObject = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/ArchWisp/ArchWispBody.prefab").WaitForCompletion(), "MoffeinArchWisp", true);
			CharacterBody component = ArchaicWispContent.ArchaicWispObject.GetComponent<CharacterBody>();
			component.baseNameToken = "MOFFEIN_ARCHWISP_BODY_NAME";
			component.baseMaxHealth = 900f;
			component.baseDamage = 15f;
			component.baseRegen = 0f;
			component.bodyFlags = (BodyFlags)0;
			component.portraitIcon = (Texture)(object)ArchaicWispContent.assets.LoadAsset<Texture2D>("icon");
			component.baseArmor = 0f;
			component.levelMaxHealth = component.baseMaxHealth * 0.3f;
			component.levelDamage = component.baseDamage * 0.2f;
			component.levelRegen = component.baseRegen * 0.2f;
			component.levelArmor = 0f;
			component.preferredInitialStateType = new SerializableEntityStateType(typeof(SpawnState));
			AddSSoH(ArchaicWispContent.ArchaicWispObject);
			DeathRewards component2 = ArchaicWispContent.ArchaicWispObject.GetComponent<DeathRewards>();
			ArchaicWispContent.ArchaicWispLogbookUnlockable = ScriptableObject.CreateInstance<UnlockableDef>();
			ArchaicWispContent.ArchaicWispLogbookUnlockable.nameToken = "UNLOCKABLE_LOG_MOFFEIN_MOFFEIN_ARCHWISP";
			ArchaicWispContent.ArchaicWispLogbookUnlockable.cachedName = "MOFFEIN_ARCHWISP_BODY_NAME";
			component2.logUnlockableDef = ArchaicWispContent.ArchaicWispLogbookUnlockable;
		}

		private static void AddSSoH(GameObject enemyObject)
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			EntityStateMachine val = null;
			EntityStateMachine val2 = null;
			EntityStateMachine[] components = enemyObject.GetComponents<EntityStateMachine>();
			EntityStateMachine[] array = components;
			foreach (EntityStateMachine val3 in array)
			{
				string customName = val3.customName;
				string text = customName;
				if (!(text == "Body"))
				{
					if (text == "Weapon")
					{
						val2 = val3;
					}
				}
				else
				{
					val = val3;
				}
			}
			SetStateOnHurt val4 = enemyObject.GetComponent<SetStateOnHurt>();
			if (!Object.op_Implicit((Object)(object)val4))
			{
				val4 = enemyObject.AddComponent<SetStateOnHurt>();
			}
			val4.canBeFrozen = true;
			val4.canBeStunned = true;
			val4.canBeHitStunned = false;
			val4.hitThreshold = 0.5f;
			val4.targetStateMachine = val;
			val4.idleStateMachine = (EntityStateMachine[])(object)new EntityStateMachine[1] { val2 };
			val4.hurtState = new SerializableEntityStateType(typeof(HurtStateFlyer));
			val.initialStateType = new SerializableEntityStateType(typeof(SpawnState));
		}
	}
}