Decompiled source of Path Of The Colossus Configurable v1.1.0

ColossusPathConfig/DarknessExpansion.dll

Decompiled 3 weeks 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 Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
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+e21aa486239a08d72755d72f5f78166835080ede")]
[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 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);
		}
	}
	[BepInPlugin("com.cybug.ColossusPath", "ColossusPath", "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 PathOfTheColossus : BaseUnityPlugin
	{
		private ConfigEntry<string> goAfterStage1;

		private ConfigEntry<string> goAfterStage2;

		private ConfigEntry<string> goAfterStage3;

		private ConfigEntry<string> goAfterStage4;

		private ConfigEntry<string> goAfterStage5;

		private ConfigEntry<bool> startOverAfterLooping;

		private ConfigEntry<bool> blacklistStages;

		private InteractableSpawnCard portalSpawnCard = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC2/iscColossusPortal.asset").WaitForCompletion();

		private List<SceneDef> stages = new List<SceneDef>();

		private bool shouldSpawnPortal = false;

		private bool shouldIncrementStageCount = false;

		public PathOfTheColossus()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			goAfterStage1 = ((BaseUnityPlugin)this).Config.Bind<string>("", "Stage 1 Leads to", "lemuriantemple", "Where the green portal leads after stage 1.");
			goAfterStage2 = ((BaseUnityPlugin)this).Config.Bind<string>("", "Stage 2 Leads to", "habitat", "Where the green portal leads after stage 2.");
			goAfterStage3 = ((BaseUnityPlugin)this).Config.Bind<string>("", "Stage 3 Leads to", "goldshores", "Where the green portal leads after stage 3.");
			goAfterStage4 = ((BaseUnityPlugin)this).Config.Bind<string>("", "Stage 4 Leads to", "helminthroost", "Where the green portal leads after stage 4.");
			goAfterStage5 = ((BaseUnityPlugin)this).Config.Bind<string>("", "Stage 5 Leads to", "meridian", "Where the green portal leads after stage 5.");
			startOverAfterLooping = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Start over After Looping", false, "Whether the stage number resets after stage 5. If set to false, all green portals after looping will lead to prime meridian.");
			blacklistStages = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Blacklist Stages", false, "Whether chosen stages will not be able to show up outside of the path.");
			SceneExitController.SetState += new hook_SetState(SceneExitControllerOnSetState);
			TeleporterInteraction.AttemptToSpawnAllEligiblePortals += new hook_AttemptToSpawnAllEligiblePortals(TeleporterInteractionOnAttemptToSpawnAllEligiblePortals);
			Run.PickNextStageSceneFromCurrentSceneDestinations += new hook_PickNextStageSceneFromCurrentSceneDestinations(RunOnPickNextStageSceneFromCurrentSceneDestinations);
			stages.Add(SceneCatalog.FindSceneDef(goAfterStage1.Value));
			stages.Add(SceneCatalog.FindSceneDef(goAfterStage2.Value));
			stages.Add(SceneCatalog.FindSceneDef(goAfterStage3.Value));
			stages.Add(SceneCatalog.FindSceneDef(goAfterStage4.Value));
			stages.Add(SceneCatalog.FindSceneDef(goAfterStage5.Value));
			Run.AdvanceStage += new hook_AdvanceStage(RunOnAdvanceStage);
		}

		private void FixedUpdate()
		{
			if (Input.GetKeyDown((KeyCode)283))
			{
				PlayerCharacterMasterController.instances[0].master.GiveMoney(100u);
			}
		}

		private void RunOnAdvanceStage(orig_AdvanceStage orig, Run self, SceneDef nextscene)
		{
			SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
			if (((sceneDefForCurrentScene != null) ? sceneDefForCurrentScene.baseSceneName : null) == "goldshores")
			{
				Log.Debug("Here");
				self.NetworkstageClearCount = self.stageClearCount + 1;
			}
			orig.Invoke(self, nextscene);
		}

		private void RunOnPickNextStageSceneFromCurrentSceneDestinations(orig_PickNextStageSceneFromCurrentSceneDestinations orig, Run self)
		{
			WeightedSelection<SceneDef> val = new WeightedSelection<SceneDef>(8);
			SceneCatalog.mostRecentSceneDef.AddDestinationsToWeightedSelection(val, (Func<SceneDef, bool>)((SceneDef def) => CanPickStage(def, self)));
			self.PickNextStageScene(val);
		}

		public bool CanPickStage(SceneDef sceneDef, Run self)
		{
			if (!self.CanPickStage(sceneDef))
			{
				return false;
			}
			if (blacklistStages.Value && stages.Contains(sceneDef))
			{
				return false;
			}
			return true;
		}

		private void TeleporterInteractionOnAttemptToSpawnAllEligiblePortals(orig_AttemptToSpawnAllEligiblePortals orig, TeleporterInteraction self)
		{
			orig.Invoke(self);
			if (shouldSpawnPortal)
			{
				Log.Debug("Spawning portal");
				self.AttemptSpawnPortal((SpawnCard)(object)portalSpawnCard, 10f, 40f, "PORTAL_COLOSSUS_OPEN");
				shouldSpawnPortal = false;
			}
		}

		private void SceneExitControllerOnSetState(orig_SetState orig, SceneExitController self, ExitState newstate)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			orig.Invoke(self, newstate);
			if ((int)newstate != 3 || !self.isColossusPortal)
			{
				return;
			}
			string text = null;
			if (!startOverAfterLooping.Value && Run.instance.stageClearCount >= 5)
			{
				text = "meridian";
			}
			else
			{
				int num = Run.instance.stageClearCount % 5;
				if (num == 0)
				{
					text = goAfterStage1.Value;
				}
				if (num == 1)
				{
					text = goAfterStage2.Value;
				}
				if (num == 2)
				{
					text = goAfterStage3.Value;
				}
				if (num == 3)
				{
					text = goAfterStage4.Value;
				}
				if (num == 4)
				{
					text = goAfterStage5.Value;
				}
			}
			Log.Debug("Switching Stage to " + text);
			if (text == "gildedcoast")
			{
				shouldIncrementStageCount = true;
			}
			self.destinationScene = SceneCatalog.FindSceneDef(text);
			Log.Debug(self.useRunNextStageScene);
			if (self.useRunNextStageScene)
			{
				self.useRunNextStageScene = false;
			}
			shouldSpawnPortal = true;
			Stage.instance.BeginAdvanceStage(self.destinationScene);
		}
	}
}