Decompiled source of MithrixWank v1.0.5

plugins/MithrixWank/MithrixWank.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using MithrixWank.Content;
using MithrixWank.Content.Common;
using MithrixWank.Modules;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Hologram;
using RoR2.Navigation;
using RoR2.UI;
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("MithrixWank")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4039a6537a08dc37108ae2bc9645bc4d35d8ff58")]
[assembly: AssemblyProduct("MithrixWank")]
[assembly: AssemblyTitle("MithrixWank")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace MithrixWank
{
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.RiskySleeps.MithrixWank", "MithrixWank", "1.0.5")]
	public class MithrixWankPlugin : BaseUnityPlugin
	{
		private void Awake()
		{
			Files.PluginInfo = ((BaseUnityPlugin)this).Info;
			new PluginContentPack().Initialize();
			Assets.LoadAssetBundle();
			LanguageTokens.RegisterLanguageTokens();
			AddToAssembly();
		}

		private void AddToAssembly()
		{
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(ContentBase))
				select type;
			foreach (Type item in enumerable)
			{
				ContentBase contentBase = (ContentBase)Activator.CreateInstance(item);
				contentBase.Init(((BaseUnityPlugin)this).Config);
			}
		}
	}
	internal class PluginUtils
	{
		internal enum MonsterCategories
		{
			BasicMonsters,
			Minibosses,
			Champions
		}

		internal static DirectorCard BuildDirectorCard(CharacterSpawnCard spawnCard)
		{
			return BuildDirectorCard(spawnCard, 1, 0, (MonsterSpawnDistance)0);
		}

		internal static DirectorCard BuildDirectorCard(CharacterSpawnCard spawnCard, int weight, int minStages, MonsterSpawnDistance spawnDistance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_001b: 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_0023: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			return new DirectorCard
			{
				spawnCard = (SpawnCard)(object)spawnCard,
				selectionWeight = weight,
				preventOverhead = false,
				minimumStageCompletions = minStages,
				spawnDistance = spawnDistance,
				forbiddenUnlockableDef = null,
				requiredUnlockableDef = null
			};
		}

		internal static bool AddMonsterDirectorCardToCategory(DirectorCardCategorySelection categorySelection, DirectorCard directorCard, MonsterCategories monsterCategory)
		{
			int num = FindCategoryIndexByName(categorySelection, monsterCategory);
			if (num >= 0)
			{
				categorySelection.AddCard(num, directorCard);
				return true;
			}
			return false;
		}

		internal static int FindCategoryIndexByName(DirectorCardCategorySelection dcs, MonsterCategories category)
		{
			string categoryName;
			switch (category)
			{
			case MonsterCategories.BasicMonsters:
				categoryName = "Basic Monsters";
				break;
			case MonsterCategories.Minibosses:
				categoryName = "Minibosses";
				break;
			case MonsterCategories.Champions:
				categoryName = "Champions";
				break;
			default:
				return -1;
			}
			return FindCategoryIndexByName(dcs, categoryName);
		}

		internal static int FindCategoryIndexByName(DirectorCardCategorySelection dcs, string categoryName)
		{
			for (int i = 0; i < dcs.categories.Length; i++)
			{
				if (string.CompareOrdinal(dcs.categories[i].name, categoryName) == 0)
				{
					return i;
				}
			}
			return -1;
		}
	}
}
namespace MithrixWank.Modules
{
	public static class Assets
	{
		public static AssetBundle mainAssetBundle;

		internal static void LoadAssetBundle()
		{
			if ((Object)(object)mainAssetBundle == (Object)null)
			{
				mainAssetBundle = AssetBundle.LoadFromFile(Files.GetPathToFile("AssetBundles", "mithrixwankassetbundle"));
			}
		}
	}
	internal static class Files
	{
		public static PluginInfo PluginInfo;

		internal static string assemblyDir => Path.GetDirectoryName(PluginInfo.Location);

		internal static void Init(PluginInfo info)
		{
			PluginInfo = info;
		}

		internal static string GetPathToFile(string folderName, string fileName)
		{
			return Path.Combine(assemblyDir, folderName, fileName);
		}
	}
	internal class LanguageTokens
	{
		internal static string languageRoot => Path.Combine(assemblyDir, "language");

		internal static string assemblyDir => Path.GetDirectoryName(Files.PluginInfo.Location);

		public LanguageTokens()
		{
			RegisterLanguageTokens();
		}

		internal static void RegisterLanguageTokens()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			Language.SetFolders += new hook_SetFolders(fixme);
		}

		private static void fixme(orig_SetFolders orig, Language self, IEnumerable<string> newFolders)
		{
			if (Directory.Exists(languageRoot))
			{
				IEnumerable<string> second = Directory.EnumerateDirectories(Path.Combine(languageRoot), self.name);
				orig.Invoke(self, newFolders.Union(second));
			}
			else
			{
				orig.Invoke(self, newFolders);
			}
		}
	}
	public class PluginContentPack : IContentPackProvider
	{
		[CompilerGenerated]
		private sealed class <FinalizeAsync>d__11 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public FinalizeAsyncArgs args;

			public PluginContentPack <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FinalizeAsync>d__11(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				args.ReportProgress(1f);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <GenerateContentPackAsync>d__12 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public GetContentPackAsyncArgs args;

			public PluginContentPack <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GenerateContentPackAsync>d__12(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				ContentPack.Copy(content, args.output);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <LoadStaticContentAsync>d__13 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public LoadStaticContentAsyncArgs args;

			public PluginContentPack <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadStaticContentAsync>d__13(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				content.networkedObjectPrefabs.Add(networkedObjectPrefabs.ToArray());
				content.bodyPrefabs.Add(bodyPrefabs.ToArray());
				content.masterPrefabs.Add(masterPrefabs.ToArray());
				content.buffDefs.Add(buffDefs.ToArray());
				content.effectDefs.Add(effectDefs.ToArray());
				content.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray());
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static ContentPack content = new ContentPack();

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

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

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

		public static List<BuffDef> buffDefs = new List<BuffDef>();

		public static List<EffectDef> effectDefs = new List<EffectDef>();

		public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>();

		public string identifier => "MithrixWank.content";

		internal void Initialize()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
		}

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)this);
		}

		[IteratorStateMachine(typeof(<FinalizeAsync>d__11))]
		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FinalizeAsync>d__11(0)
			{
				<>4__this = this,
				args = args
			};
		}

		[IteratorStateMachine(typeof(<GenerateContentPackAsync>d__12))]
		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GenerateContentPackAsync>d__12(0)
			{
				<>4__this = this,
				args = args
			};
		}

		[IteratorStateMachine(typeof(<LoadStaticContentAsync>d__13))]
		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadStaticContentAsync>d__13(0)
			{
				<>4__this = this,
				args = args
			};
		}
	}
}
namespace MithrixWank.Content
{
	public abstract class ContentBase<T> : ContentBase where T : ContentBase<T>
	{
		public static T Instance { get; private set; }

		public ContentBase()
		{
			if (Instance != null)
			{
				throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting ContentBase was instantiated twice");
			}
			Instance = this as T;
		}
	}
	public abstract class ContentBase
	{
		public abstract string ConfigCategoryString { get; }

		public abstract string ConfigOptionName { get; }

		public abstract string ConfigDescriptionString { get; }

		public ConfigEntry<bool> Enabled { get; private set; }

		protected virtual void ReadConfig(ConfigFile config)
		{
			Enabled = config.Bind<bool>(ConfigCategoryString, ConfigOptionName, true, ConfigDescriptionString);
		}

		internal void Init(ConfigFile config)
		{
			ReadConfig(config);
			if (Enabled.Value)
			{
				Setup();
			}
		}

		protected virtual void Setup()
		{
		}
	}
}
namespace MithrixWank.Content.VanillaTweaks
{
	public class LunarGolemStage5 : ContentBase<LunarGolemStage5>
	{
		public static GameObject LunarGolemStage5BodyObject;

		public static GameObject LunarGolemStage5MasterObject;

		public static CharacterSpawnCard LunarGolemStage5SpawnCard;

		public static DirectorCard lunarGolemStage5DirectorCard;

		public override string ConfigCategoryString => "Lunar Golems on Stage 5";

		public override string ConfigOptionName => "Enable Content";

		public override string ConfigDescriptionString => "Add Lunar Golems to Sky Meadow and Helminth Hatchery.";

		protected override void Setup()
		{
			base.Setup();
			CreateStage5LunarGolem();
			AddToStages();
		}

		private void AddToStages()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			string[] array = new string[3] { "RoR2/Base/skymeadow/dccsSkyMeadowMonsters.asset", "RoR2/DLC1/itskymeadow/dccsITSkyMeadowMonsters.asset", "RoR2/DLC2/helminthroost/dccsHelminthRoostMonstersDLC2Only.asset" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				DirectorCardCategorySelection categorySelection = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)text).WaitForCompletion();
				PluginUtils.AddMonsterDirectorCardToCategory(categorySelection, lunarGolemStage5DirectorCard, PluginUtils.MonsterCategories.Minibosses);
			}
		}

		private void CreateStage5LunarGolem()
		{
			//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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			LunarGolemStage5BodyObject = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarGolem/LunarGolemBody.prefab").WaitForCompletion(), "MithrixWank_LunarGolemStage5Body", true);
			DeathRewards component = LunarGolemStage5BodyObject.GetComponent<DeathRewards>();
			component.logUnlockableDef = null;
			PluginContentPack.bodyPrefabs.Add(LunarGolemStage5BodyObject);
			ModifyStats(LunarGolemStage5BodyObject);
			LunarGolemStage5BodyObject.AddComponent<SwapToLunarTeamComponent>();
			LunarGolemStage5MasterObject = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarGolem/LunarGolemMaster.prefab").WaitForCompletion(), "MithrixWank_LunarGolemStage5Master", true);
			LunarGolemStage5MasterObject.GetComponent<CharacterMaster>().bodyPrefab = LunarGolemStage5BodyObject;
			PluginContentPack.masterPrefabs.Add(LunarGolemStage5MasterObject);
			SetupSpawnCard();
		}

		private void ModifyStats(GameObject go)
		{
			CharacterBody component = go.GetComponent<CharacterBody>();
			component.baseMaxHealth = 1000f;
			component.levelMaxHealth = component.baseMaxHealth * 0.3f;
		}

		private void SetupSpawnCard()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			LunarGolemStage5SpawnCard = ScriptableObject.CreateInstance<CharacterSpawnCard>();
			((Object)LunarGolemStage5SpawnCard).name = "cscMithrixWankLunarGolemStage5";
			((SpawnCard)LunarGolemStage5SpawnCard).prefab = LunarGolemStage5MasterObject;
			((SpawnCard)LunarGolemStage5SpawnCard).sendOverNetwork = true;
			((SpawnCard)LunarGolemStage5SpawnCard).hullSize = (HullClassification)1;
			((SpawnCard)LunarGolemStage5SpawnCard).nodeGraphType = (GraphType)0;
			((SpawnCard)LunarGolemStage5SpawnCard).requiredFlags = (NodeFlags)0;
			((SpawnCard)LunarGolemStage5SpawnCard).forbiddenFlags = (NodeFlags)4;
			((SpawnCard)LunarGolemStage5SpawnCard).directorCreditCost = 115;
			((SpawnCard)LunarGolemStage5SpawnCard).occupyPosition = false;
			LunarGolemStage5SpawnCard.loadout = new SerializableLoadout();
			LunarGolemStage5SpawnCard.noElites = false;
			LunarGolemStage5SpawnCard.forbiddenAsBoss = true;
			lunarGolemStage5DirectorCard = PluginUtils.BuildDirectorCard(LunarGolemStage5SpawnCard);
		}
	}
}
namespace MithrixWank.Content.Interactables.ShrineMithrix
{
	[RequireComponent(typeof(PurchaseInteraction))]
	public class ShrineMithrixBehavior : MonoBehaviour
	{
		public CharacterSpawnCard lunarScavSpawncard = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/ScavLunar/cscScavLunar.asset").WaitForCompletion();

		public float refreshDuration = 2f;

		public Transform dropletOrigin;

		public GameObject rewardEffectPrefab;

		public Color rewardEffectColor;

		public float chanceGreen = 25f;

		public float chanceRed = 5f;

		public float chanceWhite = 70f;

		private Xoroshiro128Plus rng;

		private PurchaseInteraction purchaseInteraction;

		private bool waitingForRefresh = false;

		private float refreshTimer = 0f;

		private void PurchaseInteractionHack(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			bool flag = (Object)(object)self == (Object)(object)purchaseInteraction && (Object)(object)purchaseInteraction != (Object)null;
			Inventory val = null;
			int num = -1;
			if (flag)
			{
				CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory))
				{
					val = component.inventory;
					num = val.GetItemCount(Items.LunarTrinket);
				}
			}
			orig.Invoke(self, activator);
			if (flag)
			{
				OnPurchaseServer();
				if (num > 0 && Object.op_Implicit((Object)(object)val) && num > val.GetItemCount(Items.LunarTrinket))
				{
					SpawnTwistedScavServer();
				}
			}
		}

		private void Awake()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteractionHack);
			purchaseInteraction = ((Component)this).GetComponent<PurchaseInteraction>();
		}

		private void OnDestroy()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			PurchaseInteraction.OnInteractionBegin -= new hook_OnInteractionBegin(PurchaseInteractionHack);
		}

		private void Start()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			if (NetworkServer.active)
			{
				rng = new Xoroshiro128Plus(Run.instance.treasureRng.nextUlong);
			}
		}

		private void FixedUpdate()
		{
			if (waitingForRefresh)
			{
				refreshTimer -= Time.fixedDeltaTime;
				if (refreshTimer <= 0f)
				{
					purchaseInteraction.SetAvailable(true);
					waitingForRefresh = false;
				}
			}
		}

		public void OnPurchaseServer()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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_0116: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Expected O, but got Unknown
			if (NetworkServer.active)
			{
				purchaseInteraction.SetAvailable(false);
				waitingForRefresh = true;
				refreshTimer = refreshDuration;
				PickupIndex none = PickupIndex.none;
				float num = rng.RangeFloat(0f, chanceWhite + chanceGreen + chanceRed);
				PickupDropTable val = ((num <= chanceRed) ? Addressables.LoadAssetAsync<PickupDropTable>((object)"RoR2/Base/Common/dtTier3Item.asset").WaitForCompletion() : ((!(num <= chanceRed + chanceGreen)) ? Addressables.LoadAssetAsync<PickupDropTable>((object)"RoR2/Base/Common/dtTier1Item.asset").WaitForCompletion() : Addressables.LoadAssetAsync<PickupDropTable>((object)"RoR2/Base/Common/dtTier2Item.asset").WaitForCompletion()));
				UniquePickup val2 = val.GeneratePickup(rng);
				PickupDropletController.CreatePickupDroplet(val2, dropletOrigin.position, dropletOrigin.forward * 5f);
				EffectManager.SpawnEffect(rewardEffectPrefab, new EffectData
				{
					origin = ((Component)this).transform.position,
					rotation = Quaternion.identity,
					scale = 1f,
					color = Color32.op_Implicit(rewardEffectColor)
				}, true);
			}
		}

		public void SpawnTwistedScavServer()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			if (NetworkServer.active && Object.op_Implicit((Object)(object)lunarScavSpawncard))
			{
				DirectorSpawnRequest val = new DirectorSpawnRequest((SpawnCard)(object)lunarScavSpawncard, new DirectorPlacementRule
				{
					minDistance = 10f,
					maxDistance = 60f,
					placementMode = (PlacementMode)1,
					position = ((Component)this).transform.position,
					preventOverhead = false
				}, rng)
				{
					ignoreTeamMemberLimit = true,
					teamIndexOverride = (TeamIndex)3,
					onSpawnedServer = SetSpecialScaling
				};
				if (Object.op_Implicit((Object)(object)DirectorCore.instance))
				{
					DirectorCore.instance.TrySpawnObject(val);
				}
			}
		}

		private void SetSpecialScaling(SpawnResult spawnResult)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)spawnResult.spawnedInstance))
			{
				return;
			}
			Inventory component = spawnResult.spawnedInstance.GetComponent<Inventory>();
			if (Object.op_Implicit((Object)(object)component))
			{
				float num = 1f;
				float num2 = 1f;
				num += Run.instance.difficultyCoefficient / 2.5f;
				num2 += Run.instance.difficultyCoefficient / 30f;
				int num3 = Mathf.Max(1, Run.instance.livingPlayerCount);
				num *= Mathf.Pow((float)num3, 0.5f);
				int num4 = Mathf.FloorToInt((num - 1f) * 10f);
				if (num4 > 0)
				{
					component.GiveItem(Items.BoostHp, num4);
				}
				int num5 = Mathf.FloorToInt((num2 - 1f) * 10f);
				if (num5 > 0)
				{
					component.GiveItem(Items.BoostDamage, num5);
				}
				if (component.GetItemCount(Items.UseAmbientLevel) <= 0)
				{
					component.GiveItem(Items.UseAmbientLevel, 1);
				}
			}
		}
	}
	public class ShrineMithrixContent : ContentBase<ShrineMithrixContent>
	{
		public static List<string> guaranteedStages = new List<string> { "itskymeadow" };

		public static List<string> forbiddenStages = new List<string>();

		public static InteractableSpawnCard iscShrineMithrix;

		public static GameObject ShrineMithrixInteractable;

		public override string ConfigCategoryString => "Shrine of Mithrix";

		public override string ConfigOptionName => "Enable Content";

		public override string ConfigDescriptionString => "Enables the Shrine of Mithrix";

		protected override void Setup()
		{
			base.Setup();
			CreateShrinePrefab();
			AddToSpawnpool();
		}

		private void AddToSpawnpool()
		{
			SceneDirector.onPrePopulateSceneServer += SceneDirector_onPrePopulateSceneServer;
		}

		private void SceneDirector_onPrePopulateSceneServer(SceneDirector sceneDirector)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Expected O, but got Unknown
			bool flag = false;
			SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
			if (Object.op_Implicit((Object)(object)sceneDefForCurrentScene))
			{
				bool flag2 = forbiddenStages.Contains(sceneDefForCurrentScene.baseSceneName);
				bool flag3 = guaranteedStages.Contains(sceneDefForCurrentScene.baseSceneName);
				bool flag4 = sceneDefForCurrentScene.stageOrder == 5;
				flag = flag3 || (flag4 && !flag2);
			}
			if (flag && sceneDirector.interactableCredit >= ((SpawnCard)iscShrineMithrix).directorCreditCost)
			{
				sceneDirector.interactableCredit -= ((SpawnCard)iscShrineMithrix).directorCreditCost;
				DirectorPlacementRule val = new DirectorPlacementRule
				{
					placementMode = (PlacementMode)4
				};
				GameObject val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)iscShrineMithrix, val, sceneDirector.rng));
			}
		}

		private void CreateSpawncard()
		{
			//IL_001b: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			InteractableSpawnCard val = ScriptableObject.CreateInstance<InteractableSpawnCard>();
			((SpawnCard)val).prefab = ShrineMithrixInteractable;
			((SpawnCard)val).sendOverNetwork = true;
			((SpawnCard)val).hullSize = (HullClassification)0;
			((SpawnCard)val).nodeGraphType = (GraphType)0;
			((SpawnCard)val).requiredFlags = (NodeFlags)2;
			((SpawnCard)val).occupyPosition = true;
			((SpawnCard)val).directorCreditCost = 20;
			val.slightlyRandomizeOrientation = false;
			iscShrineMithrix = val;
		}

		private void CreateShrinePrefab()
		{
			//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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: 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_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Expected O, but got Unknown
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)ShrineMithrixInteractable))
			{
				return;
			}
			GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("ShrineMithrix");
			ChildLocator component = val.GetComponent<ChildLocator>();
			Transform val2 = component.FindChild("StatueBase");
			Transform val3 = component.FindChild("StatueMoon");
			Transform val4 = component.FindChild("StatuePlatform");
			Transform val5 = component.FindChild("StatueDebris");
			GameObject gameObject = ((Component)component.FindChild("Symbol")).gameObject;
			Material material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/moon/matMoonBridge.mat").WaitForCompletion();
			((Renderer)((Component)val2).GetComponent<MeshRenderer>()).material = material;
			((Renderer)((Component)val3).GetComponent<MeshRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/LunarExploder/matLunarExploderCore.mat").WaitForCompletion();
			((Renderer)((Component)val4).GetComponent<MeshRenderer>()).material = material;
			((Renderer)((Component)val5).GetComponent<MeshRenderer>()).material = material;
			((Renderer)gameObject.GetComponent<MeshRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/LunarWisp/matLunarWispBombChargeTrail.mat").WaitForCompletion();
			gameObject.AddComponent<Billboard>();
			val.AddComponent<NetworkIdentity>();
			PrefabAPI.RegisterNetworkPrefab(val);
			ModelLocator val6 = val.AddComponent<ModelLocator>();
			val6.modelTransform = component.FindChild("Model");
			val6.modelBaseTransform = component.FindChild("Base");
			Highlight val7 = val.AddComponent<Highlight>();
			val7.targetRenderer = ((Component)val2).GetComponent<Renderer>();
			PurchaseInteraction val8 = val.AddComponent<PurchaseInteraction>();
			val8.costType = (CostTypeIndex)9;
			val8.displayNameToken = "MITHRIXWANK_SHRINE_MITHRIX_NAME";
			val8.contextToken = "MITHRIXWANK_SHRINE_MITHRIX_CONTEXT";
			val8.available = true;
			val8.cost = 1;
			val8.automaticallyScaleCostWithDifficulty = false;
			val8.isShrine = true;
			val8.shouldProximityHighlight = true;
			HologramProjector val9 = val.AddComponent<HologramProjector>();
			val9.displayDistance = 30f;
			val9.hologramPivot = component.FindChild("HologramPivot");
			val.AddComponent<GenericDisplayNameProvider>().displayToken = "MITHRIXWANK_SHRINE_MITHRIX_NAME";
			ShrineMithrixBehavior shrineMithrixBehavior = val.AddComponent<ShrineMithrixBehavior>();
			shrineMithrixBehavior.refreshDuration = 2f;
			shrineMithrixBehavior.rewardEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/ShrineUseEffect.prefab").WaitForCompletion();
			shrineMithrixBehavior.rewardEffectColor = Color32.op_Implicit(new Color32((byte)114, byte.MaxValue, (byte)236, byte.MaxValue));
			shrineMithrixBehavior.dropletOrigin = component.FindChild("DropletOrigin");
			val.AddComponent<PurchaseAvailabilityIndicator>().indicatorObject = gameObject;
			GenericInspectInfoProvider val10 = val.AddComponent<GenericInspectInfoProvider>();
			InspectDef val11 = ScriptableObject.CreateInstance<InspectDef>();
			val11.Info = new InspectInfo();
			val11.Info.Visual = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/ShrineIcon.png").WaitForCompletion();
			val11.Info.TitleToken = "MITHRIXWANK_SHRINE_MITHRIX_NAME";
			val11.Info.DescriptionToken = "MITHRIXWANK_SHRINE_MITHRIX_DESCRIPTION";
			val11.Info.FlavorToken = "MITHRIXWANK_SHRINE_MITHRIX_FLAVOR";
			val10.InspectInfo = val11;
			Collider[] componentsInChildren = val.GetComponentsInChildren<Collider>();
			Collider[] array = componentsInChildren;
			foreach (Collider val12 in array)
			{
				if (!((Object)(object)((Component)val12).gameObject == (Object)(object)val) && !((Object)(object)((Component)val12).gameObject == (Object)(object)val4))
				{
					EntityLocator component2 = ((Component)val12).GetComponent<EntityLocator>();
					if (!Object.op_Implicit((Object)(object)component2))
					{
						((Component)val12).gameObject.AddComponent<EntityLocator>().entity = val;
					}
				}
			}
			ShrineMithrixInteractable = val;
			CreateSpawncard();
		}
	}
}
namespace MithrixWank.Content.Common
{
	public class SwapToLunarTeamComponent : MonoBehaviour
	{
		public void Start()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Invalid comparison between Unknown and I4
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Invalid comparison between Unknown and I4
			if (NetworkServer.active)
			{
				TeamComponent component = ((Component)this).GetComponent<TeamComponent>();
				if (Object.op_Implicit((Object)(object)component) && (int)component.teamIndex == 2)
				{
					component.teamIndex = (TeamIndex)3;
				}
				CharacterBody component2 = ((Component)this).GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component2.master) && (int)component2.master.teamIndex == 2)
				{
					component2.master.teamIndex = (TeamIndex)3;
					if (component2.master.aiComponents != null)
					{
						BaseAI[] aiComponents = component2.master.aiComponents;
						foreach (BaseAI val in aiComponents)
						{
							val.UpdateTargets();
						}
					}
				}
			}
			Object.Destroy((Object)(object)this);
		}
	}
}