Decompiled source of ChaosMode v2.5.2

chaos.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.ExpansionManagement;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;

[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("chaos")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("chaos")]
[assembly: AssemblyTitle("chaos")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ChaosMode;

internal static class Actions
{
	public static Events eventing = new Events();

	public static int testValue = 0;

	public static void StartingItems()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: 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_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		List<PickupIndex> list = RollType(0);
		PickupIndex val = list[ChaosMode.random.Next(0, list.Count)];
		for (int i = 0; i < 3; i++)
		{
			val = list[ChaosMode.random.Next(0, list.Count)];
			GiveToAllPlayers(val);
		}
		list = RollType(1);
		for (int j = 0; j < 2; j++)
		{
			val = list[ChaosMode.random.Next(0, list.Count)];
			GiveToAllPlayers(val);
		}
		list = RollType(2);
		val = list[ChaosMode.random.Next(0, list.Count)];
		GiveToAllPlayers(val);
	}

	public static void SpawnEveryMinute()
	{
		//IL_0534: Unknown result type (might be due to invalid IL or missing references)
		List<SpawnCardData> list = new List<SpawnCardData>
		{
			Models.ADBeetleGuard,
			Models.ADGreaterWisp,
			Models.ADGolem,
			Models.ADTitan,
			Models.ADParent,
			Models.ADBigLemurian,
			Models.ADRoboBall,
			Models.ADTemplar,
			Models.ADArchWisp,
			Models.ADBeetleQueen,
			Models.ADLunarGolem,
			Models.ADLunarWisp
		};
		List<SpawnCardData> list2 = new List<SpawnCardData>
		{
			Models.ADBeetleQueen,
			Models.ADTitan,
			Models.ADTitanGold,
			Models.ADOverlord,
			Models.ADMagmaWorm,
			Models.ADOverWorm,
			Models.ADNullifier,
			Models.ADDunestrider,
			Models.ADGhibli,
			Models.ADGrandparent,
			Models.ADMagmaWorm,
			Models.ADBrother,
			Models.ADScav
		};
		List<SpawnCardData> list3 = new List<SpawnCardData>
		{
			Models.ADBeetle,
			Models.ADWisp,
			Models.ADGreaterWisp,
			Models.ADBell,
			Models.ADBison,
			Models.ADImp,
			Models.ADGolem,
			Models.ADLemurian,
			Models.ADJellyfish,
			Models.ADHermitCrab,
			Models.ADParent,
			Models.ADVulture,
			Models.ADLunarBomb,
			Models.ADMushroom
		};
		if (Init.expansion1)
		{
			List<SpawnCardData> collection = new List<SpawnCardData>
			{
				Models.ADGup,
				Models.ADJailer,
				Models.ADApothecary,
				Models.ADBarnacle
			};
			List<SpawnCardData> collection2 = new List<SpawnCardData>
			{
				Models.ADJailer,
				Models.ADMegaCrab,
				Models.ADMega,
				Models.ADMajor,
				Models.ADVoidling
			};
			List<SpawnCardData> collection3 = new List<SpawnCardData>
			{
				Models.ADLarva,
				Models.ADPest,
				Models.ADVermin,
				Models.ADMinor,
				Models.ADApothecary,
				Models.ADAssassin,
				Models.ADInfestor,
				Models.ADBarnacle
			};
			list.AddRange(collection);
			list2.AddRange(collection2);
			list3.AddRange(collection3);
		}
		SpawnCardData spawnCardData = null;
		List<PickupIndex> list4 = null;
		int num = 0;
		int num2 = 1;
		ChaosMode.directorValue += (float)Run.instance.GetDifficultyScaledCost(ChaosMode.random.Next(1, 3)) / Mathf.Clamp(10f - (float)Init.ambushRate.Value / 100f * 8f, 2f, 10f);
		Console.WriteLine("[CHAOS] Director Aggro Value: {0}", ChaosMode.directorValue);
		switch (Tables.SummonDropTable())
		{
		case 0:
			spawnCardData = list3[ChaosMode.random.Next(0, list3.Count)];
			num2 = Mathf.Clamp(Run.instance.GetDifficultyScaledCost(ChaosMode.random.Next(5, 10)) * Mathf.Clamp(Init.swarmAggression.Value, 1, Init.spawnLimit.Value ? 3 : 1024), 5, Init.spawnLimit.Value ? Init.maxEnemies.Value : 65536);
			SummonEnemy(spawnCardData, num2);
			ItemEveryMinute();
			break;
		case 1:
			spawnCardData = list[ChaosMode.random.Next(0, list.Count)];
			num2 = Mathf.Clamp(Run.instance.GetDifficultyScaledCost(ChaosMode.random.Next(1, 3)), 1, Init.spawnLimit.Value ? Init.maxEnemies.Value : 65536);
			SummonEnemy(spawnCardData, num2);
			ItemEveryMinute();
			break;
		case 2:
		{
			List<IEnumerator> events = eventing.GetEvents();
			IEnumerator enumerator = events[Tables.EventDropTable()];
			((MonoBehaviour)ChaosMode.instance).StartCoroutine(enumerator);
			break;
		}
		case 3:
			spawnCardData = list2[ChaosMode.random.Next(0, list2.Count)];
			num2 = Mathf.Clamp(Run.instance.GetDifficultyScaledCost(1), 1, Init.spawnLimit.Value ? Init.maxEnemies.Value : 65536);
			SummonEnemy(spawnCardData, num2);
			if (Init.giveItems.Value)
			{
				num = Tables.GetDropTable(restrictVoid: false, restrictEquipment: true);
				list4 = RollType(Tables.GetDropTable());
				GiveToAllPlayers(list4[ChaosMode.random.Next(0, list4.Count)]);
			}
			break;
		}
	}

	private static void ItemEveryMinute()
	{
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		if (Init.giveItems.Value)
		{
			int dropTable = Tables.GetDropTable(restrictVoid: false, restrictEquipment: true, Init.includeLunar.Value);
			List<PickupIndex> list = RollType(dropTable);
			GiveToAllPlayers(list[ChaosMode.random.Next(0, list.Count)]);
		}
	}

	public static void GiveToAllPlayers(PickupIndex pickupIndex, int count = 1)
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
		{
			try
			{
				string displayName = instance.GetDisplayName();
				Console.WriteLine(displayName);
				CharacterMaster master = instance.master;
				master.inventory.GiveItem(PickupCatalog.GetPickupDef(pickupIndex).itemIndex, count);
				MethodInfo method = typeof(GenericPickupController).GetMethod("SendPickupMessage", BindingFlags.Static | BindingFlags.NonPublic);
				method.Invoke(null, new object[2] { master, pickupIndex });
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex.Message);
			}
		}
	}

	public static void GiveToOnePlayer(PlayerCharacterMasterController playerCharacterMasterController, PickupIndex pickupIndex, int count = 1)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			string displayName = playerCharacterMasterController.GetDisplayName();
			CharacterMaster master = playerCharacterMasterController.master;
			master.inventory.GiveItem(PickupCatalog.GetPickupDef(pickupIndex).itemIndex, count);
		}
		catch (Exception ex)
		{
			Console.WriteLine(ex.Message);
		}
	}

	public static void EquipAllPlayers(int pickupIndex)
	{
		foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
		{
			string displayName = instance.GetDisplayName();
			CharacterMaster master = instance.master;
			master.inventory.SetEquipmentIndex((EquipmentIndex)pickupIndex);
			MethodInfo method = typeof(GenericPickupController).GetMethod("SendPickupMessage", BindingFlags.Static | BindingFlags.NonPublic);
			method.Invoke(null, new object[2] { master, pickupIndex });
		}
	}

	public static void EquipOneElite(Inventory inventory, EliteEquipment eliteType)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		EquipmentDef val = null;
		val = Addressables.LoadAssetAsync<EquipmentDef>((object)eliteType.addressable).WaitForCompletion();
		inventory.SetEquipmentIndex(val.equipmentIndex);
	}

	public static void SummonEnemy(SpawnCardData enemyType, int reps)
	{
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0254: Unknown result type (might be due to invalid IL or missing references)
		//IL_025b: Expected O, but got Unknown
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		int num = 0;
		string text = "";
		float num2 = 0f;
		float num3 = 1f;
		List<EliteEquipment> list = new List<EliteEquipment>
		{
			Models.ADFire,
			Models.ADIce,
			Models.ADLightning,
			Models.ADGhost,
			Models.ADPoison,
			Models.ADEcho
		};
		if (Init.expansion1)
		{
			list.AddRange(new List<EliteEquipment>
			{
				Models.ADEarth,
				Models.ADVoid
			});
		}
		num3 = 1.9f - (float)Init.eliteRate.Value / 100f * 1.5f;
		num2 = Mathf.Clamp(2f - Mathf.Clamp((float)Run.instance.GetDifficultyScaledCost(reps) * enemyType.difficultyBase * ((float)ChaosMode.random.Next(7, 13) / 10f) / (float)Run.instance.GetDifficultyScaledCost(reps), 0.5f, 2f), 0.5f, 2f);
		Console.WriteLine("[Chaos Log] Difficulty is {0} >= Elite Threshold is {1}", num2, num3);
		bool flag = num2 >= num3 && ((ChaosMode.random.Next(0, 2) == 0) ? true : false);
		EliteEquipment eliteEquipment = list[Tables.EliteDropTable()];
		try
		{
			int num4 = Mathf.RoundToInt((float)(reps / PlayerCharacterMasterController.instances.Count));
			CharacterSpawnCard val = null;
			val = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)enemyType.location).WaitForCompletion();
			for (int i = 0; i < num4; i++)
			{
				foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
				{
					GameObject spawnedInstance = SpawnEnemy(val, ((Component)instance.master.GetBody()).transform.position).spawnedInstance;
					if (flag & Object.op_Implicit((Object)(object)spawnedInstance))
					{
						EquipOneElite(spawnedInstance.GetComponent<CharacterMaster>().inventory, eliteEquipment);
						text = eliteEquipment.prefix;
						num4 = Mathf.Clamp(num4 - 1, 1, 50);
					}
					((MonoBehaviour)ChaosMode.instance).StartCoroutine(eventing.CheckIfEnemyDied(spawnedInstance, (int)enemyType.rewardBase));
					num++;
				}
			}
			SimpleChatMessage val2 = new SimpleChatMessage();
			val2.baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Summoning " + num + (flag ? (" " + text + " ") : " ") + enemyType.name + ((num > 1) ? "s" : "") + "!</color>";
			Chat.SendBroadcastChat((ChatMessageBase)(object)val2);
		}
		catch
		{
			Console.WriteLine("[Chaos Log] Can't find SpawnCard: {0}!", enemyType.name);
		}
	}

	public static SpawnResult SpawnEnemy(CharacterSpawnCard spawnCard, Vector3 center, bool ally = false)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Expected O, but got Unknown
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		spawnCard.noElites = false;
		((SpawnCard)spawnCard).eliteRules = (EliteRules)0;
		DirectorPlacementRule val = new DirectorPlacementRule
		{
			placementMode = (PlacementMode)0,
			preventOverhead = true
		};
		DirectorSpawnRequest val2 = new DirectorSpawnRequest((SpawnCard)(object)spawnCard, val, new Xoroshiro128Plus((ulong)Run.instance.stageRng.nextUint))
		{
			teamIndexOverride = (TeamIndex)(ally ? 1 : 2),
			ignoreTeamMemberLimit = true
		};
		return ((SpawnCard)spawnCard).DoSpawn(center + new Vector3((float)ChaosMode.random.Next(-25, 25), 10f, (float)ChaosMode.random.Next(-25, 25)), Quaternion.identity, val2);
	}

	public static List<PickupIndex> RollType(int item)
	{
		List<PickupIndex> result = Run.instance.availableTier1DropList;
		switch (item)
		{
		case 0:
			result = Run.instance.availableTier1DropList;
			break;
		case 1:
			result = Run.instance.availableTier2DropList;
			break;
		case 2:
			result = Run.instance.availableTier3DropList;
			break;
		case 3:
			result = Run.instance.availableBossDropList;
			break;
		case 4:
			result = Run.instance.availableLunarItemDropList;
			break;
		case 5:
			result = Run.instance.availableEquipmentDropList;
			break;
		case 6:
		{
			List<List<PickupIndex>> list = new List<List<PickupIndex>>
			{
				Run.instance.availableVoidTier1DropList,
				Run.instance.availableVoidTier2DropList,
				Run.instance.availableVoidTier3DropList,
				Run.instance.availableVoidBossDropList
			};
			result = list[Tables.VoidDropTable()];
			break;
		}
		}
		return result;
	}
}
public class Tables
{
	public static int GetDropTable(bool restrictVoid = false, bool restrictEquipment = false, bool restrictLunar = false)
	{
		int[] array = new int[7]
		{
			Init.commonRate.Value,
			Init.uncommonRate.Value,
			Init.legendRate.Value,
			Init.bossRate.Value,
			(!restrictLunar) ? Init.lunarRate.Value : 0,
			(!restrictEquipment) ? 15 : 0,
			Init.expansion1 ? ((!restrictVoid) ? Init.corruptRate.Value : 0) : 0
		};
		int num = 0;
		int num2 = 0;
		int[] array2 = array;
		foreach (int num3 in array2)
		{
			num += num3;
		}
		int num4 = ChaosMode.random.Next(0, num);
		for (int j = 0; j < array.Length; j++)
		{
			if (array[j] != 0)
			{
				num2 += array[j];
				if (num4 < num2)
				{
					return j;
				}
			}
		}
		return 0;
	}

	public static int GetInstanceTable()
	{
		int[] array = new int[3]
		{
			Init.swarmRate.Value,
			Mathf.Clamp(100 - Init.swarmRate.Value - Init.eventRate.Value, 0, 100),
			Init.eventRate.Value
		};
		int num = 0;
		int num2 = 0;
		int[] array2 = array;
		foreach (int num3 in array2)
		{
			num += num3;
		}
		int num4 = ChaosMode.random.Next(0, num);
		for (int j = 0; j < array.Length; j++)
		{
			num2 += array[j];
			if (num4 < num2)
			{
				return j;
			}
		}
		return 0;
	}

	public static int ItemDropTable(bool restrictVoid = false, bool restrictEquipment = false, bool restrictLunar = false)
	{
		int[] weights = new int[7]
		{
			Init.commonRate.Value,
			Init.uncommonRate.Value,
			Init.legendRate.Value,
			Init.bossRate.Value,
			(!restrictLunar) ? Init.lunarRate.Value : 0,
			(!restrictEquipment) ? 15 : 0,
			Init.expansion1 ? ((!restrictVoid) ? Init.corruptRate.Value : 0) : 0
		};
		return CreateDropTable(weights);
	}

	public static int VoidDropTable()
	{
		int[] weights = new int[4] { 40, 35, 20, 5 };
		return CreateDropTable(weights);
	}

	public static int SummonDropTable()
	{
		int[] weights = new int[4]
		{
			Mathf.Clamp(Init.swarmRate.Value - (int)ChaosMode.directorValue / 3, 0, 100),
			Mathf.Clamp(50 - (int)ChaosMode.directorValue / 3, 0, 100),
			Mathf.Clamp(Init.eventRate.Value, 0, 100),
			Mathf.Clamp(5 + (int)ChaosMode.directorValue, 0, 100)
		};
		return CreateDropTable(weights);
	}

	public static int EventDropTable()
	{
		List<int> list = new List<int> { 30, 20, 5, 25 };
		if (Init.purgeRate.Value > 0)
		{
			list.Add(5);
		}
		if (Init.enableOrder.Value)
		{
			list.Add(5);
		}
		if (Init.expansion1)
		{
			list.AddRange(new List<int> { 5, 15 });
		}
		return CreateDropTable(list.ToArray());
	}

	public static int EliteDropTable()
	{
		List<int> list = new List<int> { 22, 22, 21, 15, 10, 5 };
		if (Init.expansion1)
		{
			list.AddRange(new List<int> { 25, 5 });
		}
		return CreateDropTable(list.ToArray());
	}

	public static int CreateDropTable(int[] weights)
	{
		double num = 0.0;
		double num2 = 0.0;
		double[] array = new double[weights.Length];
		foreach (int num3 in weights)
		{
			num += (double)num3;
		}
		for (int j = 0; j < weights.Length; j++)
		{
			array[j] = (double)weights[j] / num;
		}
		double num4 = ChaosMode.random.NextDouble() * 100.0;
		for (int k = 0; k < array.Length; k++)
		{
			num2 += array[k] * 100.0;
			if (array[k] != 0.0 && num4 < num2)
			{
				return k;
			}
		}
		return 0;
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Pocket.ChaosMode", "ChaosMode", "2.5.2")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
internal class ChaosMode : BaseUnityPlugin
{
	public static ChaosMode instance;

	public static Random random = new Random();

	private static int oldTimer;

	public static float directorValue;

	private static bool initialized;

	private static bool spawning;

	public void Awake()
	{
		Init.Initialize(((BaseUnityPlugin)this).Config);
		instance = this;
	}

	public static void Reset()
	{
		directorValue = (oldTimer = 0);
		spawning = (initialized = false);
		((MonoBehaviour)instance).StartCoroutine(instance.GameLoop());
	}

	public IEnumerator GameLoop()
	{
		yield return null;
		if (!Object.op_Implicit((Object)(object)Run.instance) || Init.artifactShutoff)
		{
			yield break;
		}
		Scene activeScene = SceneManager.GetActiveScene();
		string scene = ((Scene)(ref activeScene)).name;
		if (!initialized)
		{
			if (scene == "lobby")
			{
				((MonoBehaviour)this).StartCoroutine(GameLoop());
			}
			initialized = true;
			((MonoBehaviour)instance).StartCoroutine(instance.RunInit());
		}
		float t = Run.instance.GetRunStopwatch();
		bool onTimer = Mathf.FloorToInt(t) % Mathf.Clamp(Init.chaosSpeed.Value, 5, 600) == 0;
		bool timeParam = t > 5f && t != (float)oldTimer;
		if (onTimer && timeParam && scene != "bazaar")
		{
			oldTimer = (int)t;
			if (!spawning)
			{
				spawning = true;
				Actions.SpawnEveryMinute();
				((MonoBehaviour)instance).StartCoroutine(instance.FailSafeDelay());
			}
		}
		else
		{
			spawning = false;
		}
		((MonoBehaviour)this).StartCoroutine(GameLoop());
	}

	private unsafe IEnumerator RunInit()
	{
		Init.expansion1 = Run.instance.IsExpansionEnabled((ExpansionDef)Unsafe.Read<object>((void*)ExpansionCatalog.expansionDefs[0]));
		Console.WriteLine("[CHAOS] Expansion1 loaded: {0}", Init.expansion1);
		random = new Random((int)Run.instance.seed);
		if (Init.startingItems.Value)
		{
			Actions.StartingItems();
		}
		yield return (object)new WaitForSeconds(20f);
		Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
		{
			baseToken = "<color=#bb0011>[CHAOS] The Avatar of Chaos invades!"
		});
	}

	private IEnumerator FailSafeDelay()
	{
		yield return (object)new WaitForSeconds(1f);
		spawning = false;
	}

	public void Shutdown()
	{
		((MonoBehaviour)this).StopAllCoroutines();
	}
}
public class Events
{
	public List<IEnumerator> GetEvents()
	{
		bool expansion = Init.expansion1;
		bool value = Init.enableOrder.Value;
		int value2 = Init.purgeRate.Value;
		List<IEnumerator> list = new List<IEnumerator>
		{
			Actions.eventing.JellyfishEvent(),
			Actions.eventing.EliteParentEvent(),
			Actions.eventing.FinalEncounter(),
			Actions.eventing.GainFriend()
		};
		if (value2 > 0)
		{
			list.Add(Actions.eventing.PurgeAllItems());
		}
		if (value)
		{
			list.Add(Actions.eventing.SequenceEvent());
		}
		if (expansion)
		{
			list.AddRange(new List<IEnumerator>
			{
				Actions.eventing.Corruption(),
				Actions.eventing.VoidEncounter()
			});
		}
		foreach (IEnumerator item in list)
		{
			Console.WriteLine(item.ToString());
		}
		return list;
	}

	public void JellyfishEventVoid()
	{
		((MonoBehaviour)ChaosMode.instance).StartCoroutine(JellyfishEvent());
	}

	public IEnumerator JellyfishEvent()
	{
		Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
		{
			baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Jellyfish event! Zzzap!</color>"
		});
		CharacterSpawnCard spawnCard = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)Models.ADJellyfish.location).WaitForCompletion();
		for (int i = 0; i < 50; i++)
		{
			foreach (PlayerCharacterMasterController player in PlayerCharacterMasterController.instances)
			{
				GameObject spawnedInstance = Actions.SpawnEnemy(spawnCard, ((Component)player.master.GetBody()).transform.position).spawnedInstance;
				((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance));
			}
			yield return (object)new WaitForSeconds(0.5f - (float)(i / 100));
		}
	}

	public IEnumerator EliteParentEvent()
	{
		Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
		{
			baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Elite Parent event! The council will see you now!</color>"
		});
		PlayerCharacterMasterController[] players = Object.FindObjectsOfType<PlayerCharacterMasterController>();
		PlayerCharacterMasterController chosen = players[ChaosMode.random.Next(0, players.Length)];
		CharacterSpawnCard spawnCard = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)Models.ADParent.location).WaitForCompletion();
		GameObject spawnedInstance7 = Actions.SpawnEnemy(spawnCard, ((Component)chosen.master.GetBody()).transform.position).spawnedInstance;
		Actions.EquipOneElite(spawnedInstance7.GetComponent<CharacterMaster>().inventory, Models.ADFire);
		((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance7));
		spawnedInstance7 = Actions.SpawnEnemy(spawnCard, ((Component)chosen.master.GetBody()).transform.position).spawnedInstance;
		Actions.EquipOneElite(spawnedInstance7.GetComponent<CharacterMaster>().inventory, Models.ADIce);
		((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance7));
		spawnedInstance7 = Actions.SpawnEnemy(spawnCard, ((Component)chosen.master.GetBody()).transform.position).spawnedInstance;
		Actions.EquipOneElite(spawnedInstance7.GetComponent<CharacterMaster>().inventory, Models.ADLightning);
		((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance7));
		spawnedInstance7 = Actions.SpawnEnemy(spawnCard, ((Component)chosen.master.GetBody()).transform.position).spawnedInstance;
		Actions.EquipOneElite(spawnedInstance7.GetComponent<CharacterMaster>().inventory, Models.ADGhost);
		((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance7));
		spawnedInstance7 = Actions.SpawnEnemy(spawnCard, ((Component)chosen.master.GetBody()).transform.position).spawnedInstance;
		Actions.EquipOneElite(spawnedInstance7.GetComponent<CharacterMaster>().inventory, Models.ADPoison);
		((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance7));
		spawnedInstance7 = Actions.SpawnEnemy(spawnCard, ((Component)chosen.master.GetBody()).transform.position).spawnedInstance;
		Actions.EquipOneElite(spawnedInstance7.GetComponent<CharacterMaster>().inventory, Models.ADEcho);
		((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance7));
		spawnedInstance7 = Actions.SpawnEnemy(spawnCard, ((Component)chosen.master.GetBody()).transform.position).spawnedInstance;
		Actions.EquipOneElite(spawnedInstance7.GetComponent<CharacterMaster>().inventory, Models.ADEarth);
		((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance7));
		yield return null;
	}

	public IEnumerator FinalEncounter()
	{
		if (Init.expansion1)
		{
			Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
			{
				baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Mutated event! The King of Nothing loses control!</color>"
			});
		}
		else
		{
			Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
			{
				baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Empty event! The King of Nothing invades!</color>"
			});
		}
		foreach (PlayerCharacterMasterController player in PlayerCharacterMasterController.instances)
		{
			((MonoBehaviour)ChaosMode.instance).StartCoroutine(Purge(player));
		}
		ReadOnlyCollection<PlayerCharacterMasterController> instances = PlayerCharacterMasterController.instances;
		PlayerCharacterMasterController chosen = instances[ChaosMode.random.Next(0, instances.Count)];
		CharacterSpawnCard spawnCard = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)Models.ADBrother.location).WaitForCompletion();
		GameObject spawnedInstance = Actions.SpawnEnemy(spawnCard, ((Component)chosen.master.GetBody()).transform.position).spawnedInstance;
		if (Init.expansion1)
		{
			Actions.EquipOneElite(spawnedInstance.GetComponent<CharacterMaster>().inventory, Models.ADVoid);
		}
		((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance));
		yield return null;
	}

	public IEnumerator VoidEncounter()
	{
		Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
		{
			baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>[VO?ID E??VEN?T][E?SCA?PE!]</color>"
		});
		ReadOnlyCollection<PlayerCharacterMasterController> instances = PlayerCharacterMasterController.instances;
		PlayerCharacterMasterController chosen = instances[ChaosMode.random.Next(0, instances.Count)];
		CharacterSpawnCard spawnCard = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)Models.ADVoidling.location).WaitForCompletion();
		GameObject spawnedInstance = Actions.SpawnEnemy(spawnCard, ((Component)chosen.master.GetBody()).transform.position).spawnedInstance;
		((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance));
		yield return null;
	}

	public IEnumerator PurgeAllItems()
	{
		Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
		{
			baseToken = "<color=#bb0011>[Chaos] <color=#ff0000>Purge event! You don't need these, right?</color>"
		});
		foreach (PlayerCharacterMasterController player in PlayerCharacterMasterController.instances)
		{
			((MonoBehaviour)ChaosMode.instance).StartCoroutine(Purge(player));
		}
		yield return null;
	}

	public IEnumerator Purge(PlayerCharacterMasterController player)
	{
		CharacterMaster master = player.master;
		List<ItemIndex> inventory = master.inventory.itemAcquisitionOrder;
		int cap = ChaosMode.random.Next(3, inventory.Count - 2);
		int j = 0;
		for (int i = inventory.Count - 1; i >= cap; i--)
		{
			ItemIndex slot = inventory[ChaosMode.random.Next(0, inventory.Count)];
			master.inventory.RemoveItem(slot, Mathf.Min(master.inventory.GetItemCount(slot), int.MaxValue));
			yield return (object)new WaitForSeconds(1f);
			j++;
			if (j > Init.purgeRate.Value)
			{
				break;
			}
		}
	}

	public IEnumerator Corruption()
	{
		Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
		{
			baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>[VO?ID E??VEN?T][B?EC?OME O??NE OF U?S]</color>"
		});
		int corrupt = ChaosMode.random.Next(1, 5);
		for (int i = 0; i < corrupt; i++)
		{
			List<PickupIndex> corruption = Actions.RollType(6);
			Actions.GiveToAllPlayers(corruption[ChaosMode.random.Next(0, corruption.Count)]);
			yield return (object)new WaitForSeconds(1f);
		}
	}

	public IEnumerator GainFriend()
	{
		List<SpawnCardData> allies = new List<SpawnCardData>
		{
			Models.ADBeetleGuard,
			Models.ADBrother,
			Models.ADNullifier,
			Models.ADTitanGold,
			Models.ADLunarGolem,
			Models.ADVagrant
		};
		if (Init.expansion1)
		{
			allies.Add(Models.ADGup);
		}
		SpawnCardData ally = allies[ChaosMode.random.Next(0, allies.Count)];
		CharacterSpawnCard spawnCard = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)ally.location).WaitForCompletion();
		Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
		{
			baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Friendly event! " + ally.name + " wants to help you this stage!</color>"
		});
		ReadOnlyCollection<PlayerCharacterMasterController> instances = PlayerCharacterMasterController.instances;
		PlayerCharacterMasterController chosen = instances[ChaosMode.random.Next(0, instances.Count)];
		_ = Actions.SpawnEnemy(spawnCard, ((Component)chosen.master.GetBody()).transform.position, ally: true).spawnedInstance;
		yield return null;
	}

	public IEnumerator SequenceEvent()
	{
		foreach (PlayerCharacterMasterController player in PlayerCharacterMasterController.instances)
		{
			CharacterMaster master = player.master;
			int[] tiers = new int[6]
			{
				master.inventory.GetTotalItemCountOfTier((ItemTier)0),
				master.inventory.GetTotalItemCountOfTier((ItemTier)1),
				master.inventory.GetTotalItemCountOfTier((ItemTier)2),
				master.inventory.GetTotalItemCountOfTier((ItemTier)4),
				master.inventory.GetTotalItemCountOfTier((ItemTier)3),
				0
			};
			if (Init.expansion1)
			{
				tiers[5] = master.inventory.GetTotalItemCountOfTier((ItemTier)6);
				tiers[5] += master.inventory.GetTotalItemCountOfTier((ItemTier)7);
				tiers[5] += master.inventory.GetTotalItemCountOfTier((ItemTier)8);
				tiers[5] += master.inventory.GetTotalItemCountOfTier((ItemTier)9);
			}
			Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}", tiers[0], tiers[1], tiers[2], tiers[3], tiers[4], tiers[5]);
			List<ItemIndex> inventory = master.inventory.itemAcquisitionOrder;
			while (master.inventory.itemAcquisitionOrder.Count > 0)
			{
				ItemIndex slot = inventory[0];
				master.inventory.RemoveItem(slot, Mathf.Min(master.inventory.GetItemCount(slot), int.MaxValue));
			}
			try
			{
				for (int i = 0; i <= 4; i++)
				{
					Console.WriteLine("Tier {0} = {1}", i, tiers[i]);
					if (tiers[i] > 0)
					{
						List<PickupIndex> tieredItem2 = Actions.RollType(i);
						Console.WriteLine("tieredItem is {0}: Size is {1}", tieredItem2 == null, tieredItem2?.Count ?? (-1));
						PickupIndex item = tieredItem2[ChaosMode.random.Next(0, tieredItem2.Count)];
						Console.WriteLine("Tier {0}: {1}", i, PickupCatalog.GetPickupDef(item).nameToken);
						Actions.GiveToOnePlayer(player, item, tiers[i]);
					}
				}
			}
			catch (Exception e)
			{
				Console.WriteLine("Error: {0}", e.Message);
			}
			if (Init.expansion1 && tiers[5] > 0)
			{
				List<PickupIndex> tieredItem = Actions.RollType(6);
				Actions.GiveToOnePlayer(player, tieredItem[ChaosMode.random.Next(0, tieredItem.Count)], tiers[5]);
			}
			Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
			{
				baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Order event! Your body has been sequenced!</color>"
			});
		}
		yield return null;
	}

	public IEnumerator CheckIfEnemyDied(GameObject enemy, int reward = 20)
	{
		while ((Object)(object)enemy != (Object)null)
		{
			yield return (object)new WaitForSeconds(0.1f);
		}
		foreach (PlayerCharacterMasterController player in PlayerCharacterMasterController.instances)
		{
			((Component)player).GetComponent<CharacterMaster>().GiveMoney((uint)Run.instance.GetDifficultyScaledCost(reward));
		}
	}
}
internal class Hooks
{
	public static void ChestBehavior_ItemDrop(orig_ItemDrop orig, ChestBehavior self)
	{
		//IL_0050: 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_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: 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)
		if (Init.artifactShutoff)
		{
			orig.Invoke(self);
			return;
		}
		if (!CheckChestTypeIsValid(self))
		{
			orig.Invoke(self);
			return;
		}
		PropertyInfo property = typeof(ChestBehavior).GetProperty("dropPickup", BindingFlags.Instance | BindingFlags.Public);
		if (!((PickupIndex)property.GetValue(self) == PickupIndex.none))
		{
			List<PickupIndex> list = Actions.RollType(Tables.ItemDropTable());
			PickupIndex val = list[ChaosMode.random.Next(0, list.Count)];
			property.SetValue(self, val);
			orig.Invoke(self);
		}
	}

	public static void ShrineChanceBehavior_AddShrineStack(orig_AddShrineStack orig, ShrineChanceBehavior self, Interactor activator)
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: 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_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Expected O, but got Unknown
		if (!Init.artifactShutoff)
		{
			int num = Reflection.GetFieldValue<int>((object)self, "successfulPurchaseCount") + 1;
			Reflection.SetFieldValue<int>((object)self, "successfulPurchaseCount", num);
			List<PickupIndex> list = Actions.RollType(Tables.GetDropTable(restrictVoid: false, restrictEquipment: true));
			PickupIndex val = list[ChaosMode.random.Next(0, list.Count)];
			PickupDropletController.CreatePickupDroplet(val, self.dropletOrigin.position, self.dropletOrigin.forward * 20f);
			Chat.SendBroadcastChat((ChatMessageBase)new SubjectFormatChatMessage
			{
				subjectAsCharacterBody = ((Component)activator).GetComponent<CharacterBody>(),
				baseToken = "SHRINE_CHANCE_SUCCESS_MESSAGE"
			});
			Reflection.GetFieldValue<Action<bool, Interactor>>((object)self, "onShrineChancePurchaseGlobal")?.Invoke(arg1: true, activator);
			Reflection.SetFieldValue<bool>((object)self, "waitingForRefresh", true);
			Reflection.SetFieldValue<float>((object)self, "refreshTimer", 2f);
			if (Reflection.GetFieldValue<int>((object)self, "successfulPurchaseCount") >= self.maxPurchaseCount)
			{
				((Component)self.symbolTransform).gameObject.SetActive(false);
			}
		}
	}

	public static bool CheckChestTypeIsValid(ChestBehavior self)
	{
		string text = ((Object)((Component)self).gameObject).name.Replace("(Clone)", "").Trim();
		Console.WriteLine("[CHAOS] ChestBehavior gameobject name: {0}", text);
		return text != "EquipmentBarrel" && text != "LunarChest" && text != "VoidChest" && text != "GoldChest";
	}

	public static void Run_Start(orig_Start orig, Run self)
	{
		if (Init.artifactShutoff)
		{
			ChaosMode.instance.Shutdown();
		}
		else
		{
			ChaosMode.Reset();
		}
		orig.Invoke(self);
	}
}
internal class Init
{
	public static ArtifactDef ChaosArtifact;

	public static bool expansion1;

	public static bool artifactShutoff;

	public static ConfigEntry<bool> artifactMode { get; set; }

	public static ConfigEntry<int> chaosSpeed { get; set; }

	public static ConfigEntry<bool> startingItems { get; set; }

	public static ConfigEntry<bool> giveItems { get; set; }

	public static ConfigEntry<bool> randomShrines { get; set; }

	public static ConfigEntry<bool> randomSpecialChests { get; set; }

	public static ConfigEntry<bool> includeLunar { get; set; }

	public static ConfigEntry<int> commonRate { get; set; }

	public static ConfigEntry<int> uncommonRate { get; set; }

	public static ConfigEntry<int> legendRate { get; set; }

	public static ConfigEntry<int> bossRate { get; set; }

	public static ConfigEntry<int> lunarRate { get; set; }

	public static ConfigEntry<int> corruptRate { get; set; }

	public static ConfigEntry<int> swarmRate { get; set; }

	public static ConfigEntry<int> eventRate { get; set; }

	public static ConfigEntry<int> ambushRate { get; set; }

	public static ConfigEntry<int> eliteRate { get; set; }

	public static ConfigEntry<bool> spawnLimit { get; set; }

	public static ConfigEntry<int> maxEnemies { get; set; }

	public static ConfigEntry<int> swarmAggression { get; set; }

	public static ConfigEntry<bool> enableOrder { get; set; }

	public static ConfigEntry<int> purgeRate { get; set; }

	public static void Initialize(ConfigFile Config)
	{
		InitConfig(Config);
		switch (artifactMode.Value)
		{
		case true:
			InitArtifact();
			break;
		case false:
			CommandHelper.AddToConsoleWhenReady();
			AddHooks();
			break;
		}
	}

	public static void InitArtifact()
	{
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Expected O, but got Unknown
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Expected O, but got Unknown
		ChaosArtifact = ScriptableObject.CreateInstance<ArtifactDef>();
		ChaosArtifact.cachedName = "ChaosModeArtifact";
		ChaosArtifact.nameToken = "Artifact of ChaosMode";
		ChaosArtifact.descriptionToken = "Randomizes chest drops, spawns enemies on a timer, manipulates items and causes ABSOLUTE CHAOS!";
		AssetBundle val = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("chaos.chaosmode_assets"));
		ChaosArtifact.smallIconSelectedSprite = val.LoadAsset<Sprite>("Assets/ChaosMode/Selected.png");
		ChaosArtifact.smallIconDeselectedSprite = val.LoadAsset<Sprite>("Assets/ChaosMode/Unselected.png");
		ContentAddition.AddArtifactDef(ChaosArtifact);
		RunArtifactManager.onArtifactEnabledGlobal += new ArtifactStateChangeDelegate(OnArtifactEnabled);
		RunArtifactManager.onArtifactDisabledGlobal += new ArtifactStateChangeDelegate(OnArtifactDisabled);
	}

	public static void OnArtifactEnabled(RunArtifactManager runArtifactManager, ArtifactDef artifactDef)
	{
		if ((Object)(object)artifactDef == (Object)(object)ChaosArtifact && NetworkServer.active)
		{
			artifactShutoff = false;
			AddHooks();
			Console.WriteLine("Artifact enabled!");
		}
	}

	public static void OnArtifactDisabled(RunArtifactManager runArtifactManager, ArtifactDef artifactDef)
	{
		if ((Object)(object)artifactDef == (Object)(object)ChaosArtifact)
		{
			artifactShutoff = true;
			RemoveHooks();
			Console.WriteLine("Artifact disabled!");
		}
	}

	public static void AddHooks()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Expected O, but got Unknown
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		ChestBehavior.ItemDrop += new hook_ItemDrop(Hooks.ChestBehavior_ItemDrop);
		if (randomShrines.Value)
		{
			ShrineChanceBehavior.AddShrineStack += new hook_AddShrineStack(Hooks.ShrineChanceBehavior_AddShrineStack);
		}
		Run.Start += new hook_Start(Hooks.Run_Start);
	}

	public static void RemoveHooks()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Expected O, but got Unknown
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		ChestBehavior.ItemDrop -= new hook_ItemDrop(Hooks.ChestBehavior_ItemDrop);
		if (randomShrines.Value)
		{
			ShrineChanceBehavior.AddShrineStack -= new hook_AddShrineStack(Hooks.ShrineChanceBehavior_AddShrineStack);
		}
		Run.Start -= new hook_Start(Hooks.Run_Start);
		ChaosMode.instance.Shutdown();
	}

	[ConCommand(/*Could not decode attribute arguments.*/)]
	private static void EnableMultiplayer(ConCommandArgs args)
	{
		if (!artifactMode.Value)
		{
			if (bool.Parse(((ConCommandArgs)(ref args))[0]))
			{
				Console.WriteLine("Chaos Mode has been enabled!");
				AddHooks();
			}
			if (!bool.Parse(((ConCommandArgs)(ref args))[0]))
			{
				Console.WriteLine("Chaos Mode has been disabled!");
				RemoveHooks();
			}
		}
	}

	public static void InitConfig(ConfigFile Config)
	{
		artifactMode = Config.Bind<bool>("Mode Settings", "ArtifactMode", true, "Enable or disable the mod as an artifact.\nTurn this off if playing multiplayer with unmodded clients.");
		chaosSpeed = Config.Bind<int>("Chaos Settings", "ChaosSpeed", 60, "Raises the speed that Chaos Mode activates.\nIndicates how many seconds to wait before each Event or Spawn.");
		startingItems = Config.Bind<bool>("Chaos Settings", "StartingItems", true, "Start each run with 3 Common items, 2 Uncommon items and 1 Legendary item.\nApplies to all players.");
		giveItems = Config.Bind<bool>("Chaos Settings", "GiveItems", true, "Turn random item distribution on or off.\nItems either will or won't be added to your inventory when an event triggers.");
		randomShrines = Config.Bind<bool>("Chaos Settings", "RandomShrines", true, "Randomizes drop pools for Shrines of Chance.\nItems either will or won't be added to your inventory when an event triggers.");
		randomSpecialChests = Config.Bind<bool>("Chaos Settings", "RandomSpecialChests", false, "Randomizes drop pools for Special Chest types.\nItems dropped from Legendary Chests, Lunar Pods, Equipment Barrels, and Void Chests are randomized.");
		includeLunar = Config.Bind<bool>("Item Settings", "IncludeLunar", false, "Include or exclude Lunar items with randomly dispersed items.\nLunar items can still be found in chests.");
		commonRate = Config.Bind<int>("Item Settings", "CommonRate", 20, "Raises the likelyhood that a common item will be rolled.\nRoughly CommonRate% of items.");
		uncommonRate = Config.Bind<int>("Item Settings", "UncommonRate", 15, "Raises the likelyhood that an uncommon item will be rolled.\nRoughly UncommonRate% of items.");
		legendRate = Config.Bind<int>("Item Settings", "LegendRate", 10, "Raises the likelyhood that a legendary item will be rolled.\nRoughly LegendRate% of items.");
		bossRate = Config.Bind<int>("Item Settings", "BossRate", 10, "Raises the likelyhood that a boss item will be rolled.\nRoughly BossRate% of items.");
		lunarRate = Config.Bind<int>("Item Settings", "LunarRate", 10, "Raises the likelyhood that a lunar item will be rolled.\nRoughly LunarRate% of items.");
		corruptRate = Config.Bind<int>("Item Settings", "CorruptRate", 10, "Raises the likelyhood that a corrupted item will be rolled.\nRoughly CorruptRate% of items. (Requires Survivors of The Void)");
		swarmRate = Config.Bind<int>("Spawn Settings", "SwarmRate", 35, "Boosts the lilelyhood of enemies being spawned in swarms.\nRoughly SwarmRate% of spawns.");
		eventRate = Config.Bind<int>("Spawn Settings", "EventRate", 15, "Boosts how often events are triggered.\nRoughly EventRate% of spawns.");
		ambushRate = Config.Bind<int>("Spawn Settings", "AmbushRate", 15, "Boosts how often higher-tier boss enemies are spawned (not during swarms).\nRoughly AmbushRate% of enemies.");
		eliteRate = Config.Bind<int>("Spawn Settings", "EliteRate", 50, "Percent likelyhood that enemies spawned will be Elite.\nRoughly EliteRate% of enemies.");
		spawnLimit = Config.Bind<bool>("Spawn Settings", "SpawnLimit", true, "Places or removes an internal cap on enemy spawns.\n*WARNING! EXPERIMENTAL AND CAN CAUSE MASSIVE LAG!*");
		maxEnemies = Config.Bind<int>("Spawn Settings", "MaxEnemies", 20, "Maximum amount of enemies that *CAN* be spawned during a swarm.\n*Disabling SpawnLimit will cause the mod to ignore this value.*");
		swarmAggression = Config.Bind<int>("Spawn Settings", "SwarmAggression", 1, "Multiplies the amount of enemies that are spawned during swarms!");
		enableOrder = Config.Bind<bool>("Event Settings", "EnableOrder", false, "Enable or disable the Sequencing order event.\nThe order event takes your items and redistributes them similar to the Shrine of Order.");
		purgeRate = Config.Bind<int>("Event Settings", "PurgeRate", 5, "Limits how many items a Purge can take (limited to all but 3).\nPurge will remove *UP TO* PurgeRate of your items. (Set to 0 to disable Purge events.)");
	}
}
internal static class Models
{
	public static EliteEquipment ADFire = new EliteEquipment
	{
		prefix = "Blazing",
		addressable = "RoR2/Base/EliteFire/EliteFireEquipment.asset"
	};

	public static EliteEquipment ADIce = new EliteEquipment
	{
		prefix = "Glacial",
		addressable = "RoR2/Base/EliteIce/EliteIceEquipment.asset"
	};

	public static EliteEquipment ADLightning = new EliteEquipment
	{
		prefix = "Overloading",
		addressable = "RoR2/Base/EliteLightning/EliteLightningEquipment.asset"
	};

	public static EliteEquipment ADGhost = new EliteEquipment
	{
		prefix = "Celestine",
		addressable = "RoR2/Base/EliteHaunted/EliteHauntedEquipment.asset"
	};

	public static EliteEquipment ADPoison = new EliteEquipment
	{
		prefix = "Malachite",
		addressable = "RoR2/Base/ElitePoison/ElitePoisonEquipment.asset"
	};

	public static EliteEquipment ADEcho = new EliteEquipment
	{
		prefix = "Perfected",
		addressable = "RoR2/Base/EliteLunar/EliteLunarEquipment.asset"
	};

	public static EliteEquipment ADEarth = new EliteEquipment
	{
		prefix = "Mending",
		addressable = "RoR2/DLC1/EliteEarth/EliteEarthEquipment.asset"
	};

	public static EliteEquipment ADVoid = new EliteEquipment
	{
		prefix = "Voidtouched",
		addressable = "RoR2/DLC1/EliteVoid/EliteVoidEquipment.asset"
	};

	public static EliteEquipment ADSpeed = new EliteEquipment
	{
		prefix = "Speedy?",
		addressable = "RoR2/DLC1/EliteSecretSpeedEquipment.asset"
	};

	public static EliteEquipment ADGold = new EliteEquipment
	{
		prefix = "Golden?",
		addressable = "RoR2/Junk/EliteGold/EliteGoldEquipment.asset"
	};

	public static EliteEquipment ADYellow = new EliteEquipment
	{
		prefix = "Yellow?",
		addressable = "RoR2/Junk/EliteYellow/EliteYellowEquipment.asset"
	};

	public static SpawnCardData ADBeetle = new SpawnCardData
	{
		name = "Beetle",
		location = "RoR2/Base/Beetle/cscBeetle.asset",
		difficultyBase = 0.1f,
		rewardBase = 5f
	};

	public static SpawnCardData ADBeetleGuard = new SpawnCardData
	{
		name = "Beetle Guard",
		location = "RoR2/Base/Beetle/cscBeetleGuard.asset",
		difficultyBase = 0.4f,
		rewardBase = 12f
	};

	public static SpawnCardData ADBeetleQueen = new SpawnCardData
	{
		name = "Beetle Queen",
		location = "RoR2/Base/Beetle/cscBeetleQueen.asset",
		difficultyBase = 1f,
		rewardBase = 23f
	};

	public static SpawnCardData ADLemurian = new SpawnCardData
	{
		name = "Lemurian",
		location = "RoR2/Base/Lemurian/cscLemurian.asset",
		difficultyBase = 0.2f,
		rewardBase = 23f
	};

	public static SpawnCardData ADBigLemurian = new SpawnCardData
	{
		name = "Elder Lemurian",
		location = "RoR2/Base/LemurianBruiser/cscLemurianBruiser.asset",
		difficultyBase = 0.9f,
		rewardBase = 23f
	};

	public static SpawnCardData ADBell = new SpawnCardData
	{
		name = "Brass Contraption",
		location = "RoR2/Base/Bell/cscBell.asset",
		difficultyBase = 0.8f,
		rewardBase = 16f
	};

	public static SpawnCardData ADBison = new SpawnCardData
	{
		name = "Bison",
		location = "RoR2/Base/Bison/cscBison.asset",
		difficultyBase = 0.3f,
		rewardBase = 9f
	};

	public static SpawnCardData ADTemplar = new SpawnCardData
	{
		name = "Clay Templar",
		location = "RoR2/Base/ClayBruiser/cscClayBruiser.asset",
		difficultyBase = 0.9f,
		rewardBase = 21f
	};

	public static SpawnCardData ADApothecary = new SpawnCardData
	{
		name = "Clay Apothecary",
		location = "RoR2/DLC1/ClayGrenadier/cscClayGrenadier.asset",
		difficultyBase = 0.8f,
		rewardBase = 18f
	};

	public static SpawnCardData ADGolem = new SpawnCardData
	{
		name = "Stone Golem",
		location = "RoR2/Base/Golem/cscGolem.asset",
		difficultyBase = 0.4f,
		rewardBase = 10f
	};

	public static SpawnCardData ADWisp = new SpawnCardData
	{
		name = "Lesser Wisp",
		location = "RoR2/Base/Wisp/cscLesserWisp.asset",
		difficultyBase = 0.1f,
		rewardBase = 4f
	};

	public static SpawnCardData ADGreaterWisp = new SpawnCardData
	{
		name = "Greater Wisp",
		location = "RoR2/Base/GreaterWisp/cscGreaterWisp.asset",
		difficultyBase = 0.7f,
		rewardBase = 14f
	};

	public static SpawnCardData ADJellyfish = new SpawnCardData
	{
		name = "Jellyfish",
		location = "RoR2/Base/Jellyfish/cscJellyfish.asset",
		difficultyBase = 0.2f,
		rewardBase = 7f
	};

	public static SpawnCardData ADMushroom = new SpawnCardData
	{
		name = "Mini Mushroom",
		location = "RoR2/Base/MiniMushroom/cscMiniMushroom.asset",
		difficultyBase = 0.9f,
		rewardBase = 19f
	};

	public static SpawnCardData ADVulture = new SpawnCardData
	{
		name = "Alloy Vulture",
		location = "RoR2/Base/Vulture/cscVulture.asset",
		difficultyBase = 0.7f,
		rewardBase = 14f
	};

	public static SpawnCardData ADImp = new SpawnCardData
	{
		name = "Imp",
		location = "RoR2/Base/Imp/cscImp.asset",
		difficultyBase = 0.6f,
		rewardBase = 16f
	};

	public static SpawnCardData ADParent = new SpawnCardData
	{
		name = "Parent",
		location = "RoR2/Base/Parent/cscParent.asset",
		difficultyBase = 0.9f,
		rewardBase = 23f
	};

	public static SpawnCardData ADLunarGolem = new SpawnCardData
	{
		name = "Lunar Chimera",
		location = "RoR2/Base/LunarGolem/cscLunarGolem.asset",
		difficultyBase = 1.1f,
		rewardBase = 25f
	};

	public static SpawnCardData ADLunarWisp = new SpawnCardData
	{
		name = "Lunar Chimera",
		location = "RoR2/Base/LunarWisp/cscLunarWisp.asset",
		difficultyBase = 1.3f,
		rewardBase = 27f
	};

	public static SpawnCardData ADLunarBomb = new SpawnCardData
	{
		name = "Lunar Chimera",
		location = "RoR2/Base/LunarExploder/cscLunarExploder.asset",
		difficultyBase = 0.8f,
		rewardBase = 19f
	};

	public static SpawnCardData ADNullifier = new SpawnCardData
	{
		name = "Void Reaver",
		location = "RoR2/Base/Nullifier/cscNullifier.asset",
		difficultyBase = 1.5f,
		rewardBase = 32f
	};

	public static SpawnCardData ADArchWisp = new SpawnCardData
	{
		name = "Archaic Wisp",
		location = "RoR2/Junk/ArchWisp/cscArchWisp.asset",
		difficultyBase = 0.8f,
		rewardBase = 23f
	};

	public static SpawnCardData ADHermitCrab = new SpawnCardData
	{
		name = "Hermit Crab",
		location = "RoR2/Base/HermitCrab/cscHermitCrab.asset",
		difficultyBase = 0.5f,
		rewardBase = 8f
	};

	public static SpawnCardData ADTitan = new SpawnCardData
	{
		name = "Stone Titan",
		location = "RoR2/Base/Titan/cscTitanBlackBeach.asset",
		difficultyBase = 1.2f,
		rewardBase = 24f
	};

	public static SpawnCardData ADVagrant = new SpawnCardData
	{
		name = "Wandering Vagrant",
		location = "RoR2/Base/Vagrant/cscVagrant.asset",
		difficultyBase = 0.7f,
		rewardBase = 17f
	};

	public static SpawnCardData ADOverlord = new SpawnCardData
	{
		name = "Imp Overlord",
		location = "RoR2/Base/ImpBoss/cscImpBoss.asset",
		difficultyBase = 1.3f,
		rewardBase = 19f
	};

	public static SpawnCardData ADTitanGold = new SpawnCardData
	{
		name = "Aurelionite",
		location = "RoR2/Base/Titan/cscTitanGold.asset",
		difficultyBase = 1.4f,
		rewardBase = 30f
	};

	public static SpawnCardData ADDunestrider = new SpawnCardData
	{
		name = "Clay Dunestrider",
		location = "RoR2/Base/ClayBoss/cscClayBoss.asset",
		difficultyBase = 1f,
		rewardBase = 22f
	};

	public static SpawnCardData ADGrandparent = new SpawnCardData
	{
		name = "Grandparent",
		location = "RoR2/Base/Grandparent/cscGrandparent.asset",
		difficultyBase = 1.6f,
		rewardBase = 34f
	};

	public static SpawnCardData ADGhibli = new SpawnCardData
	{
		name = "Grovetender",
		location = "RoR2/Base/Gravekeeper/cscGravekeeper.asset",
		difficultyBase = 1.3f,
		rewardBase = 31f
	};

	public static SpawnCardData ADMagmaWorm = new SpawnCardData
	{
		name = "Magma Worm",
		location = "RoR2/Base/MagmaWorm/cscMagmaWorm.asset",
		difficultyBase = 1.5f,
		rewardBase = 32f
	};

	public static SpawnCardData ADOverWorm = new SpawnCardData
	{
		name = "Overloading Worm",
		location = "RoR2/Base/ElectricWorm/cscElectricWorm.asset",
		difficultyBase = 1.8f,
		rewardBase = 36f
	};

	public static SpawnCardData ADRoboBall = new SpawnCardData
	{
		name = "Solus Control Unit",
		location = "RoR2/Base/RoboBallBoss/cscRoboBallBoss.asset",
		difficultyBase = 1.4f,
		rewardBase = 23f
	};

	public static SpawnCardData ADScav = new SpawnCardData
	{
		name = "Scavenger",
		location = "RoR2/Base/Scav/cscScav.asset",
		difficultyBase = 1.6f,
		rewardBase = 37f
	};

	public static SpawnCardData ADLarva = new SpawnCardData
	{
		name = "Acid Larva",
		location = "RoR2/DLC1/AcidLarva/cscAcidLarva.asset",
		difficultyBase = 0.6f,
		rewardBase = 10f
	};

	public static SpawnCardData ADAssassin = new SpawnCardData
	{
		name = "Assassin",
		location = "RoR2/DLC1/Assassin2/cscAssassin2.asset",
		difficultyBase = 0.5f,
		rewardBase = 14f
	};

	public static SpawnCardData ADPest = new SpawnCardData
	{
		name = "Blind Pest",
		location = "RoR2/DLC1/FlyingVermin/cscFlyingVermin.asset",
		difficultyBase = 0.7f,
		rewardBase = 16f
	};

	public static SpawnCardData ADVermin = new SpawnCardData
	{
		name = "Blind Vermin",
		location = "RoR2/DLC1/Vermin/cscVermin.asset",
		difficultyBase = 0.6f,
		rewardBase = 12f
	};

	public static SpawnCardData ADBarnacle = new SpawnCardData
	{
		name = "Void Barnacle",
		location = "RoR2/DLC1/VoidBarnacle/cscVoidBarnacle.asset",
		difficultyBase = 1f,
		rewardBase = 20f
	};

	public static SpawnCardData ADJailer = new SpawnCardData
	{
		name = "Void Jailer",
		location = "RoR2/DLC1/VoidJailer/cscVoidJailer.asset",
		difficultyBase = 1.8f,
		rewardBase = 38f
	};

	public static SpawnCardData ADMegaCrab = new SpawnCardData
	{
		name = "Void Devastator",
		location = "RoR2/DLC1/VoidMegaCrab/cscVoidMegaCrab.asset",
		difficultyBase = 2f,
		rewardBase = 43f
	};

	public static SpawnCardData ADGup = new SpawnCardData
	{
		name = "Gup",
		location = "RoR2/DLC1/Gup/cscGupBody.asset",
		difficultyBase = 1f,
		rewardBase = 20f
	};

	public static SpawnCardData ADInfestor = new SpawnCardData
	{
		name = "Void Infestor",
		location = "RoR2/DLC1/EliteVoid/cscVoidInfestor.asset",
		difficultyBase = 0.6f,
		rewardBase = 13f
	};

	public static SpawnCardData ADMajor = new SpawnCardData
	{
		name = "??? Construct",
		location = "RoR2/DLC1/MajorAndMinorConstruct/cscMajorConstruct.asset",
		difficultyBase = 1f,
		rewardBase = 20f
	};

	public static SpawnCardData ADMinor = new SpawnCardData
	{
		name = "Alpha Construct",
		location = "RoR2/DLC1/MajorAndMinorConstruct/cscMinorConstruct.asset",
		difficultyBase = 0.5f,
		rewardBase = 11f
	};

	public static SpawnCardData ADMega = new SpawnCardData
	{
		name = "Xi Construct",
		location = "RoR2/DLC1/MajorAndMinorConstruct/cscMegaConstruct.asset",
		difficultyBase = 1f,
		rewardBase = 20f
	};

	public static SpawnCardData ADBrother = new SpawnCardData
	{
		name = "Mithrix",
		location = "RoR2/Base/Brother/cscBrother.asset",
		difficultyBase = 2f,
		rewardBase = 40f
	};

	public static SpawnCardData ADVoidling = new SpawnCardData
	{
		name = "Voidling",
		location = "RoR2/DLC1/VoidRaidCrab/cscMiniVoidRaidCrabBase.asset",
		difficultyBase = 2f,
		rewardBase = 45f
	};
}
internal class SpawnCardData
{
	public string name { get; set; }

	public string location { get; set; }

	public float difficultyBase { get; set; }

	public float rewardBase { get; set; }

	public int spawnCost { get; set; }

	public SpawnCardData()
	{
		name = "Test Enemy";
		location = "RoR2/Base/Beetle/cscBeetle.asset";
		difficultyBase = 0.1f;
		rewardBase = 5f;
		spawnCost = 1;
	}
}
internal class EliteEquipment
{
	public string prefix { get; set; }

	public string addressable { get; set; }
}