Decompiled source of Deflation Artifact v1.2.1

DeflationArtifact/DarknessExpansion.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[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+5f6978728e5e34a15635f684fbce69a2e1249e31")]
[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
{
	public class Deflation
	{
		public static string[] yellowItemNames = new string[11]
		{
			"BeetleGland", "Knurl", "NovaOnLowHealth", "SprintWisp", "BleedOnHitAndExplode", "SiphonOnLowHealth", "MinorConstructOnKill", "ParentEgg", "LightningStrikeOnHit", "FireballsOnHit",
			"RoboBallBuddy"
		};

		public static ArtifactDef deflationArtifact;

		public static AssetBundle ab = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(DeflationArtifact.PInfo.Location), "assets"));

		public static Sprite deselected1 = ab.LoadAsset<Sprite>("DeflationDisabled1.png");

		public static Sprite selected1 = ab.LoadAsset<Sprite>("Deflation1.png");

		public static Sprite deselected2 = ab.LoadAsset<Sprite>("DeflationDisabled2.png");

		public static Sprite selected2 = ab.LoadAsset<Sprite>("Deflation2.png");

		private int baazarVisitsLeft = 0;

		private bool fillWithItems = false;

		public Deflation()
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Expected O, but got Unknown
			deflationArtifact = ScriptableObject.CreateInstance<ArtifactDef>();
			deflationArtifact.nameToken = "Artifact of Deflation";
			deflationArtifact.descriptionToken = "Start with items, but you can't get any more.";
			deflationArtifact.smallIconDeselectedSprite = (DeflationArtifact.useOldIcon.Value ? deselected1 : deselected2);
			deflationArtifact.smallIconSelectedSprite = (DeflationArtifact.useOldIcon.Value ? selected1 : selected2);
			ContentAddition.AddArtifactDef(deflationArtifact);
			Run.Start += new hook_Start(RunOnStart);
			Run.PickNextStageScene += new hook_PickNextStageScene(RunOnPickNextStageScene);
			SceneDirector.Start += new hook_Start(SceneDirectorOnStart);
			SceneDirector.onPrePopulateSceneServer += SceneDirectorOnonPrePopulateSceneServer;
			SceneDirector.onGenerateInteractableCardSelection += SceneDirectorOnonGenerateInteractableCardSelection;
			BossGroup.DropRewards += new hook_DropRewards(BossGroupOnDropRewards);
			SceneExitController.Begin += new hook_Begin(SceneExitControllerOnBegin);
		}

		private void SceneExitControllerOnBegin(orig_Begin orig, SceneExitController self)
		{
			if (!NetworkServer.active)
			{
				return;
			}
			if (baazarVisitsLeft > 0)
			{
				baazarVisitsLeft--;
				if (baazarVisitsLeft == 0)
				{
					Run.instance.NetworkstageClearCount = DeflationArtifact.stagesToSkip.Value;
					Run.instance.runStopwatch.offsetFromFixedTime += DeflationArtifact.timeToSkip.Value;
					for (int i = 0; i < PlayerCharacterMasterController.instances.Count; i++)
					{
						PlayerCharacterMasterController.instances[i].master.GiveExperience(DeflationArtifact.xpToGet.Value);
					}
					WeightedSelection<SceneDef> val = new WeightedSelection<SceneDef>(8);
					Run.instance.startingSceneGroup.AddToWeightedSelection(val, (Func<SceneDef, bool>)Run.instance.CanPickStage);
					Run.instance.PickNextStageScene(val);
					for (int j = 0; j < Run.instance.NetworkstageClearCount; j++)
					{
						SceneCatalog.mostRecentSceneDef = Run.instance.nextStageScene;
						Run.instance.PickNextStageSceneFromCurrentSceneDestinations();
					}
				}
			}
			orig.Invoke(self);
		}

		private void BossGroupOnDropRewards(orig_DropRewards orig, BossGroup self)
		{
			if (!RunArtifactManager.instance.IsArtifactEnabled(deflationArtifact))
			{
				orig.Invoke(self);
			}
		}

		private void SceneDirectorOnonGenerateInteractableCardSelection(SceneDirector arg1, DirectorCardCategorySelection arg2)
		{
			if (!RunArtifactManager.instance.IsArtifactEnabled(deflationArtifact))
			{
				return;
			}
			arg2.RemoveCardsThatFailFilter((Predicate<DirectorCard>)delegate(DirectorCard card)
			{
				SpawnCard spawnCard2 = card.spawnCard;
				InteractableSpawnCard val2 = (InteractableSpawnCard)(object)((spawnCard2 is InteractableSpawnCard) ? spawnCard2 : null);
				if (((Object)val2).name.Contains("Halcyonite") || ((Object)val2).name.Contains("Chest"))
				{
					Log.Debug("Blocked One");
				}
				return !((Object)val2).name.Contains("Halcyonite") && !((Object)val2).name.Contains("Chest");
			});
			arg2.RemoveCardsThatFailFilter((Predicate<DirectorCard>)delegate(DirectorCard card)
			{
				SpawnCard spawnCard = card.spawnCard;
				InteractableSpawnCard val = (InteractableSpawnCard)(object)((spawnCard is InteractableSpawnCard) ? spawnCard : null);
				return (Object)(object)val == (Object)null || !val.skipSpawnWhenSacrificeArtifactEnabled;
			});
		}

		private void SceneDirectorOnonPrePopulateSceneServer(SceneDirector obj)
		{
			if (RunArtifactManager.instance.IsArtifactEnabled(deflationArtifact))
			{
				obj.onPopulateCreditMultiplier *= DeflationArtifact.creditMultiplier.Value;
			}
		}

		private void SceneDirectorOnStart(orig_Start orig, SceneDirector self)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			if (fillWithItems)
			{
				createItem(new List<EquipmentIndex> { EquipmentCatalog.FindEquipmentIndex("Recycle") }, new Vector3(-70f, -20f, -2f));
				List<ItemIndex> tier1ItemList = ItemCatalog.tier1ItemList;
				int num = 0;
				for (int i = 0; i < DeflationArtifact.whitesToGive.Value; i++)
				{
					createItem(tier1ItemList, new Vector3((float)(-85 - num / 5 * 5), -20f, (float)(-10 - num % 5 * 5)));
					num++;
				}
				List<ItemIndex> tier2ItemList = ItemCatalog.tier2ItemList;
				for (int j = 0; j < DeflationArtifact.greensToGive.Value; j++)
				{
					createItem(tier2ItemList, new Vector3((float)(-85 - num / 5 * 5), -20f, (float)(-10 - num % 5 * 5)));
					num++;
				}
				List<ItemIndex> tier3ItemList = ItemCatalog.tier3ItemList;
				for (int k = 0; k < DeflationArtifact.redsToGive.Value; k++)
				{
					createItem(tier3ItemList, new Vector3((float)(-85 - num / 5 * 5), -20f, (float)(-10 - num % 5 * 5)));
					num++;
				}
				List<ItemIndex> list = new List<ItemIndex>();
				for (int l = 0; l < yellowItemNames.Length; l++)
				{
					list.Add(ItemCatalog.FindItemIndex(yellowItemNames[l]));
				}
				for (int m = 0; m < DeflationArtifact.yellowsToGive.Value; m++)
				{
					createItem(list, new Vector3((float)(-85 - num / 5 * 5), -20f, (float)(-10 - num % 5 * 5)));
					num++;
				}
				Pair[] array = ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem];
				List<ItemIndex> list2 = new List<ItemIndex>();
				for (int n = 0; n < array.Length; n++)
				{
					if (tier1ItemList.Contains(array[n].itemDef1.itemIndex))
					{
						list2.Add(array[n].itemDef2.itemIndex);
					}
				}
				for (int num2 = 0; num2 < DeflationArtifact.voidTier1ToGive.Value; num2++)
				{
					createItem(list2, new Vector3((float)(-85 - num / 5 * 5), -20f, (float)(-10 - num % 5 * 5)));
					num++;
				}
				List<ItemIndex> list3 = new List<ItemIndex>();
				for (int num3 = 0; num3 < array.Length; num3++)
				{
					if (tier2ItemList.Contains(array[num3].itemDef1.itemIndex))
					{
						list3.Add(array[num3].itemDef2.itemIndex);
					}
				}
				for (int num4 = 0; num4 < DeflationArtifact.voidTier2ToGive.Value; num4++)
				{
					createItem(list3, new Vector3((float)(-85 - num / 5 * 5), -20f, (float)(-10 - num % 5 * 5)));
					num++;
				}
				List<EquipmentIndex> equipmentList = EquipmentCatalog.equipmentList;
				for (int num5 = 0; num5 < DeflationArtifact.equipmentToGive.Value; num5++)
				{
					createItem(equipmentList, new Vector3((float)(-85 - num / 5 * 5), -20f, (float)(-10 - num % 5 * 5)));
					num++;
				}
			}
			orig.Invoke(self);
		}

		private void RunOnPickNextStageScene(orig_PickNextStageScene orig, Run self, WeightedSelection<SceneDef> choices)
		{
			if (baazarVisitsLeft > 0)
			{
				SceneDef nextStageScene = SceneCatalog.FindSceneDef("bazaar");
				self.nextStageScene = nextStageScene;
				fillWithItems = true;
			}
			else
			{
				fillWithItems = false;
				orig.Invoke(self, choices);
			}
		}

		private void RunOnStart(orig_Start orig, Run self)
		{
			if (RunArtifactManager.instance.IsArtifactEnabled(deflationArtifact))
			{
				baazarVisitsLeft = NetworkUser.instancesList.Count;
				RunArtifactManager.instance.SetArtifactEnabled(Artifacts.Sacrifice, false);
				Equipment.Recycle.cooldown = 0f;
			}
			else
			{
				baazarVisitsLeft = 0;
				Equipment.Recycle.cooldown = 45f;
			}
			orig.Invoke(self);
		}

		private void createItem(List<ItemIndex> options, Vector3 position)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			ItemIndex val = options[Random.RandomRangeInt(0, options.Count)];
			while (ItemCatalog.GetItemDef(val).tags.Contains((ItemTag)10))
			{
				val = options[Random.RandomRangeInt(0, options.Count)];
			}
			PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(val), position, Vector3.zero);
		}

		private void createItem(List<EquipmentIndex> options, Vector3 position)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//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_0041: Unknown result type (might be due to invalid IL or missing references)
			EquipmentIndex val = options[Random.RandomRangeInt(0, options.Count)];
			while (EquipmentCatalog.GetEquipmentDef(val).isLunar)
			{
				val = options[Random.RandomRangeInt(0, options.Count)];
			}
			PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(val), position, Vector3.zero);
		}
	}
	[BepInPlugin("com.cybug.DeflationArtifact", "DeflationArtifact", "1.2.1")]
	[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 DeflationArtifact : BaseUnityPlugin
	{
		public static PluginInfo PInfo;

		public static ConfigEntry<bool> useOldIcon;

		public static ConfigEntry<int> stagesToSkip;

		public static ConfigEntry<float> timeToSkip;

		public static ConfigEntry<ulong> xpToGet;

		public static ConfigEntry<float> creditMultiplier;

		public static ConfigEntry<int> whitesToGive;

		public static ConfigEntry<int> greensToGive;

		public static ConfigEntry<int> redsToGive;

		public static ConfigEntry<int> yellowsToGive;

		public static ConfigEntry<int> voidTier1ToGive;

		public static ConfigEntry<int> voidTier2ToGive;

		public static ConfigEntry<int> equipmentToGive;

		private void Awake()
		{
			useOldIcon = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Use Old Icon", false, "Whether the icon for the artifact will be the btd6 version (true), or the ror2 version (false).");
			stagesToSkip = ((BaseUnityPlugin)this).Config.Bind<int>("", "Stages To Skip", 2, "How many stages should be skipped when the artifact is enabled.");
			timeToSkip = ((BaseUnityPlugin)this).Config.Bind<float>("", "Time To Skip", 600f, "How much time should be skipped when the artifact is enabled in seconds.");
			xpToGet = ((BaseUnityPlugin)this).Config.Bind<ulong>("", "Starting XP", 746uL, "How much XP should be granted to the player when the artifact is enabled.");
			creditMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("", "Credit Multiplier", 0.5f, "How much credit the director should get while the artifact is enabled.");
			whitesToGive = ((BaseUnityPlugin)this).Config.Bind<int>("", "White Items", 15, "How many whites deflation gives.");
			greensToGive = ((BaseUnityPlugin)this).Config.Bind<int>("", "Green Items", 5, "How many greens deflation gives.");
			redsToGive = ((BaseUnityPlugin)this).Config.Bind<int>("", "Red Items", 1, "How many reds deflation gives.");
			yellowsToGive = ((BaseUnityPlugin)this).Config.Bind<int>("", "Yellow Items", 2, "How many yellows deflation gives.");
			voidTier1ToGive = ((BaseUnityPlugin)this).Config.Bind<int>("", "Void White Items", 1, "How many void whites deflation gives.");
			voidTier2ToGive = ((BaseUnityPlugin)this).Config.Bind<int>("", "Void Green Items", 1, "How many void greens deflation gives.");
			equipmentToGive = ((BaseUnityPlugin)this).Config.Bind<int>("", "Equipment", 2, "How many equipments deflation gives.");
			PInfo = ((BaseUnityPlugin)this).Info;
			Log.Init(((BaseUnityPlugin)this).Logger);
			new Deflation();
		}

		private void Update()
		{
		}
	}
	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);
		}
	}
}