Decompiled source of Ability Randomizer v1.1.1

DarknessExpansion.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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 BepInEx.Logging;
using EntityStates;
using EntityStates.Mage;
using Microsoft.CodeAnalysis;
using On;
using On.EntityStates;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DarknessExpansion")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DarknessExpansion")]
[assembly: AssemblyTitle("DarknessExpansion")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace DarknessExpansion
{
	[BepInPlugin("com.cybug.AbilityRandomizer", "AbilityRandomizer", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class AbilityRandomizer : BaseUnityPlugin
	{
		private struct StateMachine
		{
			public string name;

			public SerializableEntityStateType initial;

			public SerializableEntityStateType main;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Start <>9__8_0;

			public static hook_FindChild_string <>9__8_1;

			public static hook_FindChildIndex_string <>9__8_2;

			public static hook_Start <>9__8_3;

			public static hook_FindHitBoxGroup <>9__8_4;

			public static Predicate<HitBoxGroup> <>9__8_8;

			public static hook_Fire <>9__8_5;

			internal void <.ctor>b__8_0(orig_Start orig, CharacterBody self)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				orig.Invoke(self);
				ModelLocator component = ((Component)self).GetComponent<ModelLocator>();
				if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.modelTransform))
				{
					GameObject val = new GameObject("FallbackTransform");
					val.transform.SetParent(component.modelTransform);
				}
			}

			internal Transform <.ctor>b__8_1(orig_FindChild_string orig, ChildLocator self, string str)
			{
				<>c__DisplayClass8_0 CS$<>8__locals0 = new <>c__DisplayClass8_0();
				Transform val = orig.Invoke(self, str);
				if (Object.op_Implicit((Object)(object)val))
				{
					return val;
				}
				CS$<>8__locals0.muzzles = new List<string>();
				self.transformPairs.ToList().ForEach(delegate(NameTransformPair x)
				{
					//IL_0001: 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)
					if (x.name.ToLower().Contains("muzzle"))
					{
						CS$<>8__locals0.muzzles.Add(x.name);
					}
				});
				if (CS$<>8__locals0.muzzles.Count >= 1)
				{
					string text = CS$<>8__locals0.muzzles[0];
					return orig.Invoke(self, text);
				}
				return ((Component)self).transform.Find("FallbackTransform");
			}

			internal int <.ctor>b__8_2(orig_FindChildIndex_string orig, ChildLocator self, string str)
			{
				<>c__DisplayClass8_1 CS$<>8__locals0 = new <>c__DisplayClass8_1();
				int num = orig.Invoke(self, str);
				if (num != -1)
				{
					return num;
				}
				CS$<>8__locals0.muzzles = new List<string>();
				self.transformPairs.ToList().ForEach(delegate(NameTransformPair x)
				{
					//IL_0001: 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)
					if (x.name.ToLower().Contains("muzzle"))
					{
						CS$<>8__locals0.muzzles.Add(x.name);
					}
				});
				if (CS$<>8__locals0.muzzles.Count >= 1)
				{
					string text = CS$<>8__locals0.muzzles[0];
					return orig.Invoke(self, text);
				}
				return -1;
			}

			internal void <.ctor>b__8_3(orig_Start orig, CharacterBody self)
			{
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Expected O, but got Unknown
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_009a: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				ModelLocator component = ((Component)self).GetComponent<ModelLocator>();
				if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.modelTransform))
				{
					GameObject val = new GameObject("DefaultSSHitbox");
					BoxCollider val2 = val.AddComponent<BoxCollider>();
					val2.size = new Vector3(240f, 180f, 240f);
					HitBox val3 = val.AddComponent<HitBox>();
					val.layer = LayerIndex.triggerZone.intVal;
					((Collider)val2).isTrigger = true;
					val.transform.SetParent(component.modelTransform);
					val.transform.position = component.modelTransform.position;
					val.transform.localPosition = new Vector3(0f, 1f, 1.5f);
					Transform transform = val.transform;
					transform.localScale *= 3.5f;
					HitBoxGroup val4 = ((Component)component.modelTransform).gameObject.AddComponent<HitBoxGroup>();
					val4.groupName = "DefaultSSGroup";
					val4.hitBoxes = (HitBox[])(object)new HitBox[1] { val3 };
				}
			}

			internal HitBoxGroup <.ctor>b__8_4(orig_FindHitBoxGroup orig, BaseState self, string str)
			{
				HitBoxGroup val = orig.Invoke(self, str);
				if (Object.op_Implicit((Object)(object)val))
				{
					return val;
				}
				return orig.Invoke(self, "DefaultSSGroup");
			}

			internal bool <.ctor>b__8_5(orig_Fire orig, OverlapAttack self, List<HurtBox> res)
			{
				if ((Object)(object)self.hitBoxGroup == (Object)null && Object.op_Implicit((Object)(object)self.attacker))
				{
					CharacterBody component = self.attacker.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.modelLocator) && Object.op_Implicit((Object)(object)component.modelLocator.modelTransform))
					{
						HitBoxGroup[] components = ((Component)component.modelLocator.modelTransform).GetComponents<HitBoxGroup>();
						self.hitBoxGroup = Array.Find(components, (HitBoxGroup x) => x.groupName == "DefaultSSGroup");
						Debug.Log((object)self.hitBoxGroup.groupName);
					}
				}
				return orig.Invoke(self, res);
			}

			internal bool <.ctor>b__8_8(HitBoxGroup x)
			{
				return x.groupName == "DefaultSSGroup";
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass8_0
		{
			public List<string> muzzles;

			internal void <.ctor>b__6(NameTransformPair x)
			{
				//IL_0001: 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)
				if (x.name.ToLower().Contains("muzzle"))
				{
					muzzles.Add(x.name);
				}
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass8_1
		{
			public List<string> muzzles;

			internal void <.ctor>b__7(NameTransformPair x)
			{
				//IL_0001: 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)
				if (x.name.ToLower().Contains("muzzle"))
				{
					muzzles.Add(x.name);
				}
			}
		}

		private ConfigEntry<bool> keepSlot;

		private ConfigEntry<bool> workOnEnemies;

		private ConfigEntry<bool> workOnPlayers;

		private static List<SkillDef> primaries = new List<SkillDef>();

		private static List<SkillDef> secondaries = new List<SkillDef>();

		private static List<SkillDef> utilites = new List<SkillDef>();

		private static List<SkillDef> specials = new List<SkillDef>();

		private static List<SkillDef> all = new List<SkillDef>();

		private static List<StateMachine> machines = new List<StateMachine>();

		public AbilityRandomizer()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00df: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Expected O, but got Unknown
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Expected O, but got Unknown
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			keepSlot = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Stay in slot", true, "Whether the abilities stay in the slot they are in.");
			workOnEnemies = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Work On Enemies", false, "Whether enemy abilities are randomized.");
			workOnPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Work On Players", true, "Whether player abilities are randomized.");
			CharacterBody.OnSkillActivated += new hook_OnSkillActivated(CharacterBodyOnOnSkillActivated);
			SurvivorCatalog.Init += new hook_Init(SurvivorCatalogOnInit);
			object obj = <>c.<>9__8_0;
			if (obj == null)
			{
				hook_Start val = delegate(orig_Start orig, CharacterBody self)
				{
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_0036: Expected O, but got Unknown
					orig.Invoke(self);
					ModelLocator component3 = ((Component)self).GetComponent<ModelLocator>();
					if (Object.op_Implicit((Object)(object)component3) && Object.op_Implicit((Object)(object)component3.modelTransform))
					{
						GameObject val13 = new GameObject("FallbackTransform");
						val13.transform.SetParent(component3.modelTransform);
					}
				};
				<>c.<>9__8_0 = val;
				obj = (object)val;
			}
			CharacterBody.Start += (hook_Start)obj;
			object obj2 = <>c.<>9__8_1;
			if (obj2 == null)
			{
				hook_FindChild_string val2 = delegate(orig_FindChild_string orig, ChildLocator self, string str)
				{
					Transform val12 = orig.Invoke(self, str);
					if (Object.op_Implicit((Object)(object)val12))
					{
						return val12;
					}
					List<string> muzzles2 = new List<string>();
					self.transformPairs.ToList().ForEach(delegate(NameTransformPair x)
					{
						//IL_0001: 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)
						if (x.name.ToLower().Contains("muzzle"))
						{
							muzzles2.Add(x.name);
						}
					});
					if (muzzles2.Count >= 1)
					{
						string text2 = muzzles2[0];
						return orig.Invoke(self, text2);
					}
					return ((Component)self).transform.Find("FallbackTransform");
				};
				<>c.<>9__8_1 = val2;
				obj2 = (object)val2;
			}
			ChildLocator.FindChild_string += (hook_FindChild_string)obj2;
			object obj3 = <>c.<>9__8_2;
			if (obj3 == null)
			{
				hook_FindChildIndex_string val3 = delegate(orig_FindChildIndex_string orig, ChildLocator self, string str)
				{
					int num = orig.Invoke(self, str);
					if (num != -1)
					{
						return num;
					}
					List<string> muzzles = new List<string>();
					self.transformPairs.ToList().ForEach(delegate(NameTransformPair x)
					{
						//IL_0001: 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)
						if (x.name.ToLower().Contains("muzzle"))
						{
							muzzles.Add(x.name);
						}
					});
					if (muzzles.Count >= 1)
					{
						string text = muzzles[0];
						return orig.Invoke(self, text);
					}
					return -1;
				};
				<>c.<>9__8_2 = val3;
				obj3 = (object)val3;
			}
			ChildLocator.FindChildIndex_string += (hook_FindChildIndex_string)obj3;
			object obj4 = <>c.<>9__8_3;
			if (obj4 == null)
			{
				hook_Start val4 = delegate(orig_Start orig, CharacterBody self)
				{
					//IL_0033: Unknown result type (might be due to invalid IL or missing references)
					//IL_0039: Expected O, but got Unknown
					//IL_0050: Unknown result type (might be due to invalid IL or missing references)
					//IL_009a: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self);
					ModelLocator component2 = ((Component)self).GetComponent<ModelLocator>();
					if (Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component2.modelTransform))
					{
						GameObject val8 = new GameObject("DefaultSSHitbox");
						BoxCollider val9 = val8.AddComponent<BoxCollider>();
						val9.size = new Vector3(240f, 180f, 240f);
						HitBox val10 = val8.AddComponent<HitBox>();
						val8.layer = LayerIndex.triggerZone.intVal;
						((Collider)val9).isTrigger = true;
						val8.transform.SetParent(component2.modelTransform);
						val8.transform.position = component2.modelTransform.position;
						val8.transform.localPosition = new Vector3(0f, 1f, 1.5f);
						Transform transform = val8.transform;
						transform.localScale *= 3.5f;
						HitBoxGroup val11 = ((Component)component2.modelTransform).gameObject.AddComponent<HitBoxGroup>();
						val11.groupName = "DefaultSSGroup";
						val11.hitBoxes = (HitBox[])(object)new HitBox[1] { val10 };
					}
				};
				<>c.<>9__8_3 = val4;
				obj4 = (object)val4;
			}
			CharacterBody.Start += (hook_Start)obj4;
			object obj5 = <>c.<>9__8_4;
			if (obj5 == null)
			{
				hook_FindHitBoxGroup val5 = delegate(orig_FindHitBoxGroup orig, BaseState self, string str)
				{
					HitBoxGroup val7 = orig.Invoke(self, str);
					return Object.op_Implicit((Object)(object)val7) ? val7 : orig.Invoke(self, "DefaultSSGroup");
				};
				<>c.<>9__8_4 = val5;
				obj5 = (object)val5;
			}
			BaseState.FindHitBoxGroup += (hook_FindHitBoxGroup)obj5;
			object obj6 = <>c.<>9__8_5;
			if (obj6 == null)
			{
				hook_Fire val6 = delegate(orig_Fire orig, OverlapAttack self, List<HurtBox> res)
				{
					if ((Object)(object)self.hitBoxGroup == (Object)null && Object.op_Implicit((Object)(object)self.attacker))
					{
						CharacterBody component = self.attacker.GetComponent<CharacterBody>();
						if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.modelLocator) && Object.op_Implicit((Object)(object)component.modelLocator.modelTransform))
						{
							HitBoxGroup[] components = ((Component)component.modelLocator.modelTransform).GetComponents<HitBoxGroup>();
							self.hitBoxGroup = Array.Find(components, (HitBoxGroup x) => x.groupName == "DefaultSSGroup");
							Debug.Log((object)self.hitBoxGroup.groupName);
						}
					}
					return orig.Invoke(self, res);
				};
				<>c.<>9__8_5 = val6;
				obj6 = (object)val6;
			}
			OverlapAttack.Fire += (hook_Fire)obj6;
			CharacterBody.Start += new hook_Start(Components);
		}

		private void Components(orig_Start orig, CharacterBody self)
		{
			orig.Invoke(self);
			HuntressTracker component = ((Component)self).GetComponent<HuntressTracker>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				component = ((Component)self).gameObject.AddComponent<HuntressTracker>();
				component.maxTrackingDistance = 60f;
				component.maxTrackingAngle = 30f;
				component.trackerUpdateFrequency = 10f;
			}
			SeekerController component2 = ((Component)self).GetComponent<SeekerController>();
			if (!Object.op_Implicit((Object)(object)component2))
			{
				component2 = ((Component)self).gameObject.AddComponent<SeekerController>();
				component2.skillLocator = self.skillLocator;
				component2.characterBody = self;
			}
		}

		private void SurvivorCatalogOnInit(orig_Init orig)
		{
			//IL_001c: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke();
			SurvivorDef[] survivorDefs = SurvivorCatalog.survivorDefs;
			foreach (SurvivorDef val in survivorDefs)
			{
				if (val.survivorIndex != SurvivorCatalog.FindSurvivorIndex("Chef"))
				{
					GameObject bodyPrefab = val.bodyPrefab;
					SkillLocator component = bodyPrefab.GetComponent<SkillLocator>();
					if (val.survivorIndex != SurvivorCatalog.FindSurvivorIndex("FalseSon"))
					{
						CollectSkills(component.primary.skillFamily, ref primaries);
					}
					if (val.survivorIndex != SurvivorCatalog.FindSurvivorIndex("Railgunner"))
					{
						CollectSkills(component.secondary.skillFamily, ref secondaries);
					}
					if (val.survivorIndex != SurvivorCatalog.FindSurvivorIndex("Engi") && val.survivorIndex != SurvivorCatalog.FindSurvivorIndex("Captain"))
					{
						CollectSkills(component.utility.skillFamily, ref utilites);
					}
					if (val.survivorIndex != SurvivorCatalog.FindSurvivorIndex("Captain") && val.survivorIndex != SurvivorCatalog.FindSurvivorIndex("Toolbot") && val.survivorIndex != SurvivorCatalog.FindSurvivorIndex("Railgunner") && val.survivorIndex != SurvivorCatalog.FindSurvivorIndex("VoidSurvivor"))
					{
						CollectSkills(component.special.skillFamily, ref specials);
					}
					if (val.survivorIndex != SurvivorCatalog.FindSurvivorIndex("Toolbot"))
					{
						CollectMachines(val.bodyPrefab);
					}
				}
			}
			SurvivorDef[] survivorDefs2 = ContentManager.survivorDefs;
			foreach (SurvivorDef val2 in survivorDefs2)
			{
				GameObject bodyPrefab2 = val2.bodyPrefab;
				SetupStateMachines(bodyPrefab2);
			}
		}

		internal static void SetupStateMachines(GameObject survivor)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			foreach (StateMachine machine in machines)
			{
				if (!HasMachine(survivor, machine.name))
				{
					NetworkStateMachine component = survivor.GetComponent<NetworkStateMachine>();
					EntityStateMachine val = survivor.AddComponent<EntityStateMachine>();
					val.customName = machine.name;
					val.initialStateType = machine.initial;
					val.mainStateType = machine.main;
					List<EntityStateMachine> list = component.stateMachines.ToList();
					list.Add(val);
					component.stateMachines = list.ToArray();
				}
			}
		}

		internal static bool HasMachine(GameObject survivor, string name)
		{
			//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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			EntityStateMachine[] components = survivor.GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val in components)
			{
				if (val.customName != null && val.customName == name)
				{
					if (val.customName == "Body")
					{
						val.initialStateType = new SerializableEntityStateType(typeof(MageCharacterMain));
						val.mainStateType = new SerializableEntityStateType(typeof(MageCharacterMain));
					}
					return true;
				}
			}
			return false;
		}

		private void CharacterBodyOnOnSkillActivated(orig_OnSkillActivated orig, CharacterBody self, GenericSkill skill)
		{
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Expected O, but got Unknown
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Expected O, but got Unknown
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Expected O, but got Unknown
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Expected O, but got Unknown
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Expected O, but got Unknown
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Expected O, but got Unknown
			//IL_049a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Expected O, but got Unknown
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Expected O, but got Unknown
			orig.Invoke(self, skill);
			if ((!workOnEnemies.Value && !self.isPlayerControlled) || (!workOnPlayers.Value && self.isPlayerControlled) || !Object.op_Implicit((Object)(object)self.skillLocator))
			{
				return;
			}
			if ((Object)(object)self.skillLocator.primary == (Object)(object)skill)
			{
				self.skillLocator.primary.skillDef = (keepSlot.Value ? primaries[(int)((float)primaries.Count * Random.value)] : all[(int)((float)all.Count * Random.value)]);
				self.skillLocator.primary.cooldownOverride = self.skillLocator.primary.skillDef.baseRechargeInterval;
				if (self.skillLocator.primary.skillDef is HuntressTrackingSkillDef)
				{
					self.skillLocator.primary.skillInstanceData = (BaseSkillInstanceData)new InstanceData
					{
						huntressTracker = ((Component)self).gameObject.GetComponent<HuntressTracker>()
					};
				}
				if (self.skillLocator.primary.skillDef is ReloadSkillDef)
				{
					self.skillLocator.primary.skillInstanceData = (BaseSkillInstanceData)new InstanceData();
				}
				if (self.skillLocator.primary.skillDef is SteppedSkillDef)
				{
					self.skillLocator.primary.skillInstanceData = (BaseSkillInstanceData)new InstanceData();
				}
			}
			else if ((Object)(object)self.skillLocator.secondary == (Object)(object)skill)
			{
				self.skillLocator.secondary.skillDef = (keepSlot.Value ? secondaries[(int)((float)secondaries.Count * Random.value)] : all[(int)((float)all.Count * Random.value)]);
				self.skillLocator.secondary.cooldownOverride = self.skillLocator.secondary.skillDef.baseRechargeInterval;
				if (self.skillLocator.secondary.skillDef is HuntressTrackingSkillDef)
				{
					self.skillLocator.secondary.skillInstanceData = (BaseSkillInstanceData)new InstanceData
					{
						huntressTracker = ((Component)self).gameObject.GetComponent<HuntressTracker>()
					};
				}
				if (self.skillLocator.secondary.skillDef is SteppedSkillDef)
				{
					self.skillLocator.secondary.skillInstanceData = (BaseSkillInstanceData)new InstanceData();
				}
			}
			else if ((Object)(object)self.skillLocator.utility == (Object)(object)skill)
			{
				self.skillLocator.utility.skillDef = (keepSlot.Value ? utilites[(int)((float)utilites.Count * Random.value)] : all[(int)((float)all.Count * Random.value)]);
				self.skillLocator.utility.cooldownOverride = self.skillLocator.utility.skillDef.baseRechargeInterval;
				if (self.skillLocator.utility.skillDef is MercDashSkillDef)
				{
					self.skillLocator.utility.skillInstanceData = (BaseSkillInstanceData)new InstanceData();
				}
				if (self.skillLocator.utility.skillDef is SteppedSkillDef)
				{
					self.skillLocator.utility.skillInstanceData = (BaseSkillInstanceData)new InstanceData();
				}
			}
			else if ((Object)(object)self.skillLocator.special == (Object)(object)skill)
			{
				self.skillLocator.special.skillDef = (keepSlot.Value ? specials[(int)((float)specials.Count * Random.value)] : all[(int)((float)all.Count * Random.value)]);
				self.skillLocator.special.cooldownOverride = self.skillLocator.special.skillDef.baseRechargeInterval;
				if (self.skillLocator.special.skillDef is SteppedSkillDef)
				{
					self.skillLocator.special.skillInstanceData = (BaseSkillInstanceData)new InstanceData();
				}
			}
		}

		private void CollectSkills(SkillFamily secondarySkillFamily, ref List<SkillDef> skillDefs)
		{
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			Variant[] variants = secondarySkillFamily.variants;
			foreach (Variant val in variants)
			{
				skillDefs.Add(val.skillDef);
				all.Add(val.skillDef);
			}
		}

		internal static void CollectMachines(GameObject survivor)
		{
			//IL_003b: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			EntityStateMachine[] components = survivor.GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val in components)
			{
				if (!ContainsMachine(val))
				{
					StateMachine item = default(StateMachine);
					item.name = val.customName;
					item.initial = val.initialStateType;
					item.main = val.mainStateType;
					if (item.name == "Body")
					{
						item.initial = new SerializableEntityStateType(typeof(MageCharacterMain));
						item.main = item.initial;
					}
					machines.Add(item);
				}
			}
			static bool ContainsMachine(EntityStateMachine machine)
			{
				if (machine.customName == null)
				{
					return true;
				}
				foreach (StateMachine machine in machines)
				{
					if (machine.name == machine.customName)
					{
						return true;
					}
				}
				return false;
			}
		}
	}
	public class BigArtifact
	{
		public static ArtifactDef bigArtifact;

		public static Sprite iconDisabled = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/EliteOnly/texArtifactEliteOnlyDisabled.png").WaitForCompletion();

		public static Sprite iconEnabled = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/EliteOnly/texArtifactEliteOnlyEnabled.png").WaitForCompletion();

		public BigArtifact()
		{
			bigArtifact = ScriptableObject.CreateInstance<ArtifactDef>();
			bigArtifact.nameToken = "Artifact of Size";
			bigArtifact.descriptionToken = "Everything is Bigger";
			bigArtifact.smallIconDeselectedSprite = iconDisabled;
			bigArtifact.smallIconSelectedSprite = iconEnabled;
			ContentAddition.AddArtifactDef(bigArtifact);
			SpawnCard.onSpawnedServerGlobal += SpawnCardOnonSpawnedServerGlobal;
		}

		private void SpawnCardOnonSpawnedServerGlobal(SpawnResult obj)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if (RunArtifactManager.instance.IsArtifactEnabled(bigArtifact))
			{
				Transform transform = obj.spawnedInstance.transform;
				transform.localScale *= 3f;
				CharacterMaster component = obj.spawnedInstance.GetComponent<CharacterMaster>();
				if ((Object)(object)component != (Object)null)
				{
					Transform transform2 = component.GetBody().transform;
					transform2.localScale *= 3f;
				}
			}
		}
	}
	public class RandomArtifact
	{
		public static ArtifactDef randomArtifact;

		public static Sprite iconDisabled = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/TeamDeath/texArtifactDeathDisabled.png").WaitForCompletion();

		public static Sprite iconEnabled = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/TeamDeath/texArtifactDeathEnabled.png").WaitForCompletion();

		public ItemIndex itemToEquip = (ItemIndex)(-1);

		public int bigEnemiesLeft = 0;

		public int smallEnemiesLeft = 0;

		public int removeElites = 0;

		public int gainElites = 0;

		public RandomArtifact()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			randomArtifact = ScriptableObject.CreateInstance<ArtifactDef>();
			randomArtifact.nameToken = "Artifact of Fun";
			randomArtifact.descriptionToken = "Something random happens whenever you pickup an item.";
			randomArtifact.smallIconDeselectedSprite = iconDisabled;
			randomArtifact.smallIconSelectedSprite = iconEnabled;
			ContentAddition.AddArtifactDef(randomArtifact);
			Inventory.onServerItemGiven += InventoryOnonServerItemGiven;
			SpawnCard.onSpawnedServerGlobal += SpawnCardOnonSpawnedServerGlobal;
			CombatDirector.Spawn += new hook_Spawn(CombatDirectorOnSpawn);
		}

		private void InventoryOnonServerItemGiven(Inventory arg1, ItemIndex arg2, int arg3)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0065: 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_008e: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected O, but got Unknown
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Invalid comparison between Unknown and I4
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Expected O, but got Unknown
			//IL_01ae: 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: Invalid comparison between Unknown and I4
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Invalid comparison between Unknown and I4
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Expected O, but got Unknown
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Invalid comparison between Unknown and I4
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Invalid comparison between Unknown and I4
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Expected O, but got Unknown
			//IL_0291: 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_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Invalid comparison between Unknown and I4
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Expected O, but got Unknown
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Expected O, but got Unknown
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Expected O, but got Unknown
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Expected O, but got Unknown
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Expected O, but got Unknown
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Expected O, but got Unknown
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Expected O, but got Unknown
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Expected O, but got Unknown
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0473: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Expected O, but got Unknown
			//IL_0528: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Expected O, but got Unknown
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0540: 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_0519: Expected O, but got Unknown
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ab: Expected O, but got Unknown
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Unknown result type (might be due to invalid IL or missing references)
			//IL_0567: Expected O, but got Unknown
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_0591: Expected O, but got Unknown
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Expected O, but got Unknown
			//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bb: Expected O, but got Unknown
			//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ff: Expected O, but got Unknown
			//IL_0627: Unknown result type (might be due to invalid IL or missing references)
			//IL_062c: Unknown result type (might be due to invalid IL or missing references)
			//IL_063c: Expected O, but got Unknown
			//IL_063d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0642: 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_0663: Unknown result type (might be due to invalid IL or missing references)
			//IL_0677: Unknown result type (might be due to invalid IL or missing references)
			//IL_067c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0694: Unknown result type (might be due to invalid IL or missing references)
			//IL_0699: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a9: Expected O, but got Unknown
			//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_06f9: Expected O, but got Unknown
			//IL_0706: Unknown result type (might be due to invalid IL or missing references)
			//IL_0715: Unknown result type (might be due to invalid IL or missing references)
			//IL_0720: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e8: Expected O, but got Unknown
			//IL_074b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0750: Unknown result type (might be due to invalid IL or missing references)
			//IL_075b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0763: Unknown result type (might be due to invalid IL or missing references)
			//IL_0768: Unknown result type (might be due to invalid IL or missing references)
			//IL_076d: Unknown result type (might be due to invalid IL or missing references)
			//IL_077a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0781: Unknown result type (might be due to invalid IL or missing references)
			//IL_0788: Unknown result type (might be due to invalid IL or missing references)
			//IL_078e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0793: Unknown result type (might be due to invalid IL or missing references)
			//IL_079d: Expected O, but got Unknown
			//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c1: Expected O, but got Unknown
			int num = Random.RandomRangeInt(0, 25);
			int num2 = arg1.itemAcquisitionOrder.IndexOf(arg2);
			ItemTier tier = ItemCatalog.GetItemDef(arg2).tier;
			if (num == 0)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#FFFFFF>Nothing Happens!</color></style>"
				});
			}
			if (num == 1)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#FF0000>Lose your item.</color></style>"
				});
				arg1.RemoveItem(arg2, arg3);
			}
			if (num == 2)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#00FF00>Double your item.</color></style>"
				});
				arg1.itemStacks[arg1.itemAcquisitionOrder.IndexOf(arg2)] *= 2;
			}
			if (num == 3)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#0000FF>Randomize your item.</color></style>"
				});
				List<ItemIndex> items = getItems(tier);
				arg1.itemAcquisitionOrder[num2] = items[Random.RandomRangeInt(0, items.Count)];
			}
			if (num == 4)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#00FF00>Upgrade your item.</color></style>"
				});
				ItemTier val = (ItemTier)4;
				if ((int)tier == 0)
				{
					val = (ItemTier)1;
				}
				else if ((int)tier == 1)
				{
					val = (ItemTier)2;
				}
				List<ItemIndex> items2 = getItems(val);
				arg1.itemAcquisitionOrder[num2] = items2[Random.RandomRangeInt(0, items2.Count)];
				if ((int)val == 4)
				{
					arg1.itemStacks[num2] *= 2;
				}
			}
			if (num == 5)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#FF0000>Downgrade your item.</color></style>"
				});
				ItemTier val2 = (ItemTier)4;
				if ((int)tier == 1)
				{
					val2 = (ItemTier)0;
				}
				else if ((int)tier == 2)
				{
					val2 = (ItemTier)1;
				}
				List<ItemIndex> items3 = getItems(val2);
				arg1.itemAcquisitionOrder[num2] = items3[Random.RandomRangeInt(0, items3.Count)];
				if ((int)val2 == 4)
				{
					arg1.itemStacks[num2] = Mathf.Max(1, arg1.itemStacks[num2] / 2);
				}
			}
			if (num == 6)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#00FFFF>Get Bigger!</color></style>"
				});
				Transform transform = ((Component)arg1).gameObject.transform;
				transform.localScale *= 1.25f;
			}
			if (num == 7)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#FF00FF>Get Smaller!</color></style>"
				});
				Transform transform2 = ((Component)arg1).gameObject.transform;
				transform2.localScale *= 0.75f;
			}
			if (num == 8)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#FF0000>Lose your Bead Stats.</color></style>"
				});
				arg1.beadAppliedDamage = 0f;
				arg1.beadAppliedHealth = 0f;
				arg1.beadAppliedRegen = 0f;
				arg1.beadAppliedShield = 0f;
			}
			if (num == 9)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#00FF00>Get some Bonus Health!</color></style>"
				});
				arg1.beadAppliedHealth += 100f;
			}
			if (num == 10)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#FFFF00>Get some Bonus Damage!</color></style>"
				});
				arg1.beadAppliedDamage += 5f;
			}
			if (num == 11)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#00FFFF>Big Enemies Incoming!</color></style>"
				});
				bigEnemiesLeft += 10;
			}
			if (num == 12)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#FF00FF>Small Enemies Incoming!</color></style>"
				});
				smallEnemiesLeft += 10;
			}
			if (num == 13)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#00FF00>Heal to Full.</color></style>"
				});
				CharacterBody component = ((Component)arg1).GetComponent<CharacterBody>();
				component.healthComponent.Heal((float)(int)component.maxHealth, default(ProcChainMask), true);
			}
			if (num == 14)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#FF0000>Damage!!!!</color></style>"
				});
				CharacterBody component2 = ((Component)arg1).GetComponent<CharacterBody>();
				component2.healthComponent.TakeDamage(new DamageInfo
				{
					damage = component2.maxHealth * Random.value
				});
			}
			if (num == 15)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#000000>Spinning the death roulette.</color></style>"
				});
				if (Random.RandomRangeInt(0, 100) == 0)
				{
					Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
					{
						baseToken = "<style=cEvent><color=#000000>YOU HAVE BEEN DOOMED TO DIE!!!!</color></style>"
					});
					CharacterBody component3 = ((Component)arg1).GetComponent<CharacterBody>();
					for (int i = 0; i < 10; i++)
					{
						component3.healthComponent.TakeDamage(new DamageInfo
						{
							damage = component3.maxHealth * 10f
						});
					}
					component3.healthComponent.Die(false);
				}
				else
				{
					Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
					{
						baseToken = "<style=cEvent><color=#000000>You survive this time.</color></style>"
					});
				}
			}
			if (num == 16)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#FF0000>An enemy equips this item.</color></style>"
				});
				itemToEquip = arg2;
			}
			if (num == 17)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#00FF00>The next 5 elites will become normal enemies.</color></style>"
				});
				removeElites = 5;
			}
			if (num == 18)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#0000FF>The next 5 normal enemies will become a random elite.</color></style>"
				});
				removeElites = 5;
			}
			if (num == 19)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#FF00FF>Enable a random artifact.</color></style>"
				});
				RunArtifactManager.instance.SetArtifactEnabled(ArtifactCatalog.artifactDefs[(int)((float)ArtifactCatalog.artifactDefs.Length * Random.value)], true);
			}
			if (num == 20)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#00FFFF>Gain a barrier!</color></style>"
				});
				CharacterBody component4 = ((Component)arg1).GetComponent<CharacterBody>();
				component4.healthComponent.AddBarrier(100f);
			}
			if (num == 21)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#FFAA00>Random teleport!</color></style>"
				});
				Vector3 onUnitSphere = Random.onUnitSphere;
				onUnitSphere.y = 0f;
				Transform transform3 = ((Component)arg1).gameObject.transform;
				transform3.position += ((Vector3)(ref onUnitSphere)).normalized * Random.Range(5f, 10f);
			}
			if (num == 22)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#8888FF>Random Buff for 20 seconds!</color></style>"
				});
				CharacterBody component5 = ((Component)arg1).GetComponent<CharacterBody>();
				component5.AddTimedBuff(BuffCatalog.buffDefs[(int)((float)BuffCatalog.buffDefs.Length * Random.value)], 20f);
			}
			if (num == 23)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#FFFF00>A Meteor strikes the nearest foe!</color></style>"
				});
				CharacterBody component6 = ((Component)arg1).GetComponent<CharacterBody>();
				Ray val3 = default(Ray);
				((Ray)(ref val3)).direction = component6.transform.forward;
				CharacterBody enemyEasyTarget = Util.GetEnemyEasyTarget(component6, val3, 100f, 100f);
				if (Object.op_Implicit((Object)(object)enemyEasyTarget))
				{
					enemyEasyTarget.healthComponent.TakeDamage(new DamageInfo
					{
						damage = 150f,
						position = enemyEasyTarget.transform.position,
						attacker = ((Component)component6).gameObject,
						inflictor = null,
						crit = false,
						damageType = DamageTypeCombo.op_Implicit((DamageType)16777216)
					});
					EffectManager.SpawnEffect(CommonAssets.runicMeteorEffect, new EffectData
					{
						origin = enemyEasyTarget.transform.position
					}, true);
				}
			}
			if (num == 24)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cEvent><color=#FFFF00>Swap health with a random enemy!</color></style>"
				});
				CharacterBody component7 = ((Component)arg1).GetComponent<CharacterBody>();
				List<CharacterBody> list = CharacterBody.instancesList.Where((CharacterBody b) => (int)b.teamComponent.teamIndex == 2).ToList();
				if (list.Count > 0)
				{
					CharacterBody val4 = list[Random.Range(0, list.Count)];
					float health = component7.healthComponent.health;
					float health2 = val4.healthComponent.health;
					component7.healthComponent.health = Mathf.Clamp(health2, 1f, component7.healthComponent.fullHealth);
					val4.healthComponent.health = Mathf.Clamp(health, 1f, val4.healthComponent.fullHealth);
				}
			}
		}

		private void SpawnCardOnonSpawnedServerGlobal(SpawnResult obj)
		{
			//IL_000f: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_00e1: Invalid comparison between Unknown and I4
			//IL_0079: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: 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)
			if (bigEnemiesLeft > 0)
			{
				Transform transform = obj.spawnedInstance.transform;
				transform.localScale *= 2f;
				CharacterMaster component = obj.spawnedInstance.GetComponent<CharacterMaster>();
				if ((Object)(object)component != (Object)null)
				{
					Transform transform2 = component.GetBody().transform;
					transform2.localScale *= 2f;
				}
			}
			if (smallEnemiesLeft > 0)
			{
				Transform transform3 = obj.spawnedInstance.transform;
				transform3.localScale *= 0.5f;
				CharacterMaster component2 = obj.spawnedInstance.GetComponent<CharacterMaster>();
				if ((Object)(object)component2 != (Object)null)
				{
					Transform transform4 = component2.GetBody().transform;
					transform4.localScale *= 0.5f;
				}
			}
			if ((int)itemToEquip != -1)
			{
				obj.spawnedInstance.GetComponent<Inventory>().GiveItem(itemToEquip, 1);
				itemToEquip = (ItemIndex)(-1);
			}
		}

		private bool CombatDirectorOnSpawn(orig_Spawn origSpawn, CombatDirector self, SpawnCard spawncard, EliteDef elitedef, Transform spawntarget, MonsterSpawnDistance spawndistance, bool preventoverhead, float valuemultiplier, PlacementMode placementmode)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			if (removeElites > 0 && (Object)(object)elitedef != (Object)null)
			{
				elitedef = null;
				removeElites--;
			}
			if ((Object)(object)elitedef == (Object)null && gainElites > 0)
			{
				elitedef = EliteCatalog.eliteDefs[(int)((float)EliteCatalog.eliteDefs.Length * Random.value)];
				gainElites--;
			}
			return origSpawn.Invoke(self, spawncard, elitedef, spawntarget, spawndistance, preventoverhead, valuemultiplier, placementmode);
		}

		public List<ItemIndex> getItems(ItemTier tier)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Invalid comparison between Unknown and I4
			if ((int)tier == 0)
			{
				return ItemCatalog.tier1ItemList;
			}
			if ((int)tier == 1)
			{
				return ItemCatalog.tier2ItemList;
			}
			if ((int)tier == 2)
			{
				return ItemCatalog.tier3ItemList;
			}
			if ((int)tier == 3)
			{
				return ItemCatalog.lunarItemList;
			}
			return ItemCatalog.itemNameToIndex.Values.ToList();
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}