Decompiled source of Expedition v0.1.9

EXPEDITION.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Timers;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Duplicator;
using ExpeditionDemo;
using HG;
using HG.Reflection;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MoreStats;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.ScriptableObjects;
using RoR2;
using RoR2.Achievements;
using RoR2.Achievements.Artifacts;
using RoR2.Artifacts;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ExpansionManagement;
using RoR2.Items;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.UI;
using RoR2BepInExPack.GameAssetPathsBetter;
using ShaderSwapper;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyCompany("EXPEDITION")]
[assembly: AssemblyProduct("EXPEDITION")]
[assembly: AssemblyTitle("EXPEDITION")]
[assembly: AssemblyInformationalVersion("1.0.0+140ce0e2e379bd76775074a707e458ee31cc8adf")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[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]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	[Microsoft.CodeAnalysis.Embedded]
	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;
		}
	}
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class RepairStationInfoPanelHelper : NetworkBehaviour
{
	public InspectPanelController inspectPanelController;

	public Image correspondingItemImage;

	public TextMeshProUGUI correspondingItemCountText;

	public SpriteAsNumberManager correspondingItemSpriteAsNumberManager;

	private MPEventSystem eventSystem;

	private Inventory cachedBodyInventory;

	private void Awake()
	{
		MPEventSystemLocator component = ((Component)this).GetComponent<MPEventSystemLocator>();
		eventSystem = component.eventSystem;
		if ((Object)(object)eventSystem != (Object)null && eventSystem.localUser != null && (Object)(object)eventSystem.localUser.cachedBody != (Object)null)
		{
			cachedBodyInventory = eventSystem.localUser.cachedBody.inventory;
		}
	}

	private void Update()
	{
		if (eventSystem.player.GetButtonDown(15))
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}

	public void ShowInfo(MPButton button, PickupDef pickupDef)
	{
		inspectPanelController.Show(InspectInfo.op_Implicit(pickupDef), false, (UserProfile)null);
		ShowTierInfoInternal(button, pickupDef);
	}

	private void ShowTierInfoInternal(MPButton button, PickupDef pickupDef)
	{
		ShowTierInfoInternal(button, pickupDef, 1);
	}

	private void ShowTierInfoInternal(MPButton button, PickupDef pickupDef, int scrapCount)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		string name = ((Object)ItemCatalog.GetItemDef(pickupDef.itemIndex)).name;
		name.Replace("Consumed", "");
		PickupDef val = ItemCatalog.GetItemDef(ItemCatalog.FindItemIndex(name)).CreatePickupDef();
		if (val == null)
		{
			return;
		}
		if ((Object)(object)correspondingItemImage != (Object)null)
		{
			correspondingItemImage.sprite = val.iconSprite;
		}
		if ((Object)(object)correspondingItemCountText != (Object)null)
		{
			string text = ((scrapCount > 0) ? scrapCount.ToString() : string.Empty);
			((TMP_Text)correspondingItemCountText).text = text;
		}
		if ((Object)(object)correspondingItemSpriteAsNumberManager != (Object)null)
		{
			if (scrapCount == 1)
			{
				correspondingItemSpriteAsNumberManager.SetVisible(false);
			}
			else
			{
				correspondingItemSpriteAsNumberManager.SetItemCount(scrapCount);
			}
		}
	}

	public void AddQuantityToPickerButton(MPButton button, PickupDef pickupDef)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)cachedBodyInventory))
		{
			return;
		}
		int itemCountEffective = cachedBodyInventory.GetItemCountEffective(pickupDef.itemIndex);
		TextMeshProUGUI val = ((Component)button).GetComponent<ChildLocator>().FindChildComponent<TextMeshProUGUI>("Quantity");
		if (Object.op_Implicit((Object)(object)val))
		{
			if (itemCountEffective > 1)
			{
				((TMP_Text)val).SetText($"{itemCountEffective}", true);
			}
			else
			{
				((Component)val).gameObject.SetActive(false);
			}
		}
	}

	private void UNetVersion()
	{
	}

	public override bool OnSerialize(NetworkWriter writer, bool forceAll)
	{
		bool result = default(bool);
		return result;
	}

	public override void OnDeserialize(NetworkReader reader, bool initialState)
	{
	}
}
internal class Junk
{
}
namespace EXPEDITION.Junk
{
	public class WingsRotation : NetworkBehaviour
	{
		public GameObject currentWings;

		private Transform wingsTransform;

		public float wingsSizeModifier;

		public GameObject theOneWhoIsWinging;

		private static int kRpcRpcSetupWings;

		private void OnEnable()
		{
		}

		private void OnDestroy()
		{
			Object.Destroy((Object)(object)currentWings);
		}

		[ClientRpc]
		public void RpcSetupWings()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			currentWings = theOneWhoIsWinging.GetComponent<Feathers2Behaviour>().wingusDingus;
			wingsSizeModifier = theOneWhoIsWinging.GetComponent<CharacterBody>().radius;
			currentWings.transform.localScale = new Vector3(1.5f * wingsSizeModifier, 1.5f * wingsSizeModifier, 1.5f * wingsSizeModifier);
			currentWings.transform.SetParent(theOneWhoIsWinging.GetComponent<CharacterBody>().coreTransform);
		}

		private void UNetVersion()
		{
		}

		protected static void InvokeRpcRpcSetupWings(NetworkBehaviour obj, NetworkReader reader)
		{
			if (!NetworkClient.active)
			{
				Debug.LogError((object)"RPC RpcSetupWings called on server.");
			}
			else
			{
				((WingsRotation)(object)obj).RpcSetupWings();
			}
		}

		public void CallRpcSetupWings()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				Debug.LogError((object)"RPC Function RpcSetupWings called on client.");
				return;
			}
			NetworkWriter val = new NetworkWriter();
			val.Write((short)0);
			val.Write((short)2);
			val.WritePackedUInt32((uint)kRpcRpcSetupWings);
			val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
			((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcSetupWings");
		}

		static WingsRotation()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			kRpcRpcSetupWings = -214307129;
			NetworkBehaviour.RegisterRpcDelegate(typeof(WingsRotation), kRpcRpcSetupWings, new CmdDelegate(InvokeRpcRpcSetupWings));
			NetworkCRC.RegisterBehaviour("WingsRotation", 0);
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			bool result = default(bool);
			return result;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
		}
	}
}
namespace ExpeditionDemo
{
	[RegisterAchievement("ARTIFACT_DESTINATION", "ACHIEVEMENT_EXPEDITION_DESTINATION", null, 3u, null)]
	public class DestinationAchievement : BaseObtainArtifactAchievement
	{
		public override ArtifactDef artifactDef => Destination.Instance.artifactDef;
	}
	[RegisterAchievement("EXPEDITION_BIODUDE", "ACHIEVEMENT_EXPEDITION_BIODUDE", null, 3u, typeof(BiodudeAchievementTracker))]
	public class BiodudeAchievement : BaseAchievement
	{
		public class BiodudeAchievementTracker : BaseServerAchievement
		{
			public override void OnInstall()
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Expected O, but got Unknown
				((BaseServerAchievement)this).OnInstall();
				CharacterBody.FixedUpdate += new hook_FixedUpdate(CheckDebuffsOnCharacter);
			}

			private void CheckDebuffsOnCharacter(orig_FixedUpdate orig, CharacterBody self)
			{
				//IL_0016: 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_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Invalid comparison between Unknown and I4
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Invalid comparison between Unknown and I4
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				int num = 0;
				BuffIndex[] debuffBuffIndices = BuffCatalog.debuffBuffIndices;
				foreach (BuffIndex val in debuffBuffIndices)
				{
					if (Object.op_Implicit((Object)(object)self) && self.HasBuff(val) && ((BaseServerAchievement)this).IsCurrentBody(self))
					{
						num++;
					}
				}
				DotController val2 = DotController.FindDotController(((Component)self).gameObject);
				if (Object.op_Implicit((Object)(object)val2))
				{
					for (DotIndex val3 = (DotIndex)0; (int)val3 < 12; val3 = (DotIndex)(val3 + 1))
					{
						if (val2.HasDotActive(val3))
						{
							num++;
						}
					}
					for (DotIndex val4 = (DotIndex)1; (int)val4 < 12; val4 = (DotIndex)(val4 + 1))
					{
						if (val2.HasDotActive(val4))
						{
							num++;
						}
					}
				}
				if (Object.op_Implicit((Object)(object)self) && num >= 6)
				{
					num = 0;
					((BaseServerAchievement)this).Grant();
				}
			}

			public override void OnUninstall()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				CharacterBody.FixedUpdate -= new hook_FixedUpdate(CheckDebuffsOnCharacter);
				((BaseServerAchievement)this).OnUninstall();
			}
		}

		public override void OnInstall()
		{
			((BaseAchievement)this).OnInstall();
			((BaseAchievement)this).SetServerTracked(true);
		}

		public override void OnUninstall()
		{
			((BaseAchievement)this).OnUninstall();
		}
	}
	[RegisterAchievement("EXPEDITION_COMPASS", "ACHIEVEMENT_EXPEDITION_COMPASS", null, 2u, null)]
	public class CompassAchievement : BaseAchievement
	{
		public override void OnInstall()
		{
			((BaseAchievement)this).OnInstall();
			SceneExitController.onBeginExit += OnSceneBeginExit;
		}

		private void OnSceneBeginExit(SceneExitController controller)
		{
			Check();
		}

		private void Check()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Invalid comparison between Unknown and I4
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Invalid comparison between Unknown and I4
			if (!Object.op_Implicit((Object)(object)SceneCatalog.currentSceneDef.destinationsGroup))
			{
				return;
			}
			List<PurchaseInteraction> instancesList = InstanceTracker.GetInstancesList<PurchaseInteraction>();
			List<BarrelInteraction> instancesList2 = InstanceTracker.GetInstancesList<BarrelInteraction>();
			short num = 0;
			for (int i = 0; i < instancesList.Count; i++)
			{
				if (instancesList[i].available && (int)instancesList[i].costType != 4 && (int)instancesList[i].costType != 5 && (int)instancesList[i].costType != 6 && (int)instancesList[i].costType != 10)
				{
					return;
				}
				num++;
			}
			short num2 = 0;
			for (int j = 0; j < instancesList2.Count; j++)
			{
				if (!instancesList2[j].opened)
				{
					return;
				}
				num2++;
			}
			if (num == instancesList.Count && num2 == instancesList2.Count)
			{
				instancesList = null;
				num = 0;
				instancesList2 = null;
				num2 = 0;
				((BaseAchievement)this).Grant();
			}
		}

		public override void OnUninstall()
		{
			SceneExitController.onBeginExit -= OnSceneBeginExit;
			((BaseAchievement)this).OnUninstall();
		}
	}
	[RegisterAchievement("EXPEDITION_CYCLE", "ACHIEVEMENT_EXPEDITION_CYCLE", null, 2u, typeof(CycleAchievementTracker))]
	public class CycleAchievement : BaseAchievement
	{
		public class CycleAchievementTracker : BaseServerAchievement
		{
			public override void OnInstall()
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Expected O, but got Unknown
				((BaseServerAchievement)this).OnInstall();
				CharacterBody.FixedUpdate += new hook_FixedUpdate(CheckHoursToGrant);
			}

			private void CheckHoursToGrant(orig_FixedUpdate orig, CharacterBody self)
			{
				orig.Invoke(self);
				if (Object.op_Implicit((Object)(object)self) && ((BaseServerAchievement)this).IsCurrentBody(self) && LocalUserManager.localUsersList[((NetworkBehaviour)self).playerControllerId + 1].userProfile.totalLoginSeconds >= 360000)
				{
					((BaseServerAchievement)this).Grant();
				}
			}

			public override void OnUninstall()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				CharacterBody.FixedUpdate -= new hook_FixedUpdate(CheckHoursToGrant);
				((BaseServerAchievement)this).OnUninstall();
			}
		}

		public override void OnInstall()
		{
			((BaseAchievement)this).OnInstall();
			((BaseAchievement)this).SetServerTracked(true);
		}

		public override void OnUninstall()
		{
			((BaseAchievement)this).OnUninstall();
		}
	}
	[RegisterAchievement("EXPEDITION_HEATCORE", "ACHIEVEMENT_EXPEDITION_HEATCORE", null, 5u, typeof(HeatcoreAchievementTracker))]
	public class HeatcoreAchievement : BaseAchievement
	{
		public class HeatcoreAchievementTracker : BaseServerAchievement
		{
			private bool flag;

			public override void OnInstall()
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Expected O, but got Unknown
				((BaseServerAchievement)this).OnInstall();
				CharacterBody.FixedUpdate += new hook_FixedUpdate(CheckCharacterEquip);
				Run.onServerGameOver += Run_onServerGameOver;
			}

			private void CheckCharacterEquip(orig_FixedUpdate orig, CharacterBody self)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				if (Object.op_Implicit((Object)(object)self) && ((BaseServerAchievement)this).IsCurrentBody(self))
				{
					if (self.equipmentSlot.equipmentIndex == Equipment.QuestVolatileBattery.equipmentIndex)
					{
						flag = true;
					}
					else
					{
						flag = false;
					}
				}
			}

			private void Run_onServerGameOver(Run run, GameEndingDef gameEndingDef)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				CharacterBody.FixedUpdate -= new hook_FixedUpdate(CheckCharacterEquip);
				if (flag && (Object)(object)gameEndingDef == (Object)(object)GameEndings.MainEnding)
				{
					flag = false;
					((BaseServerAchievement)this).Grant();
				}
			}

			public override void OnUninstall()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				CharacterBody.FixedUpdate -= new hook_FixedUpdate(CheckCharacterEquip);
				Run.onServerGameOver -= Run_onServerGameOver;
				((BaseServerAchievement)this).OnUninstall();
			}
		}

		public override void OnInstall()
		{
			((BaseAchievement)this).OnInstall();
			((BaseAchievement)this).SetServerTracked(true);
		}

		public override void OnUninstall()
		{
			((BaseAchievement)this).OnUninstall();
		}
	}
	[RegisterAchievement("EXPEDITION_SHITTYCAPE", "ACHIEVEMENT_EXPEDITION_SHITTYCAPE", null, 1u, typeof(ShittyCapeAchievementTracker))]
	public class ShittyCapeAchievement : BaseAchievement
	{
		public class ShittyCapeAchievementTracker : BaseServerAchievement
		{
			private float timer = 2f;

			private bool isTimerActive;

			private int amountOfStrikes = 1;

			public override void OnInstall()
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Expected O, but got Unknown
				((BaseServerAchievement)this).OnInstall();
				CharacterBody.FixedUpdate += new hook_FixedUpdate(FixedUpdate);
				GlobalEventManager.onServerDamageDealt += onServerDamageDealt;
			}

			private void onServerDamageDealt(DamageReport report)
			{
				if (((BaseServerAchievement)this).IsCurrentBody(report.victimBody) && !report.isFallDamage && (Object)(object)report.attackerBody != (Object)(object)report.victimBody)
				{
					if (isTimerActive)
					{
						amountOfStrikes++;
					}
					else
					{
						isTimerActive = true;
					}
				}
			}

			private void FixedUpdate(orig_FixedUpdate orig, CharacterBody self)
			{
				orig.Invoke(self);
				if (!((BaseServerAchievement)this).IsCurrentBody(self))
				{
					return;
				}
				if (timer > 0f)
				{
					if (isTimerActive)
					{
						timer -= Time.fixedDeltaTime;
						if (amountOfStrikes >= 20)
						{
							isTimerActive = false;
							timer = 0f;
							amountOfStrikes = 0;
							((BaseServerAchievement)this).Grant();
						}
					}
				}
				else
				{
					isTimerActive = false;
					timer = 2f;
					amountOfStrikes = 1;
				}
			}

			public override void OnUninstall()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				CharacterBody.FixedUpdate -= new hook_FixedUpdate(FixedUpdate);
				GlobalEventManager.onServerDamageDealt -= onServerDamageDealt;
				((BaseServerAchievement)this).OnUninstall();
			}
		}

		public override void OnInstall()
		{
			((BaseAchievement)this).OnInstall();
			((BaseAchievement)this).SetServerTracked(true);
		}

		public override void OnUninstall()
		{
			((BaseAchievement)this).OnUninstall();
		}
	}
	public abstract class ArtifactBase
	{
		public ArtifactDef artifactDef;

		public abstract string ArtifactName { get; }

		public abstract string ArtifactLangTokenName { get; }

		public abstract string ArtifactDescription { get; }

		public abstract Sprite ArtifactEnabledIcon { get; }

		public abstract Sprite ArtifactDisabledIcon { get; }

		public abstract Sprite ArtifactUnlockIcon { get; }

		public abstract GameObject ArtifactModelPrefab { get; }

		public bool ArtifactEnabled => RunArtifactManager.instance.IsArtifactEnabled(artifactDef);

		public virtual string AchievementName { get; } = string.Empty;


		public virtual string AchievementDesc { get; } = string.Empty;


		public virtual Func<string> GetHowToUnlock => () => AchievementName + "\n<style=cStack>" + AchievementDesc + "</style>";

		public virtual Func<string> GetUnlocked => () => AchievementName + "\n<style=cStack>" + AchievementDesc + "</style>";

		public abstract void Init(ConfigFile config);

		protected void CreateLang()
		{
			LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_NAME", ArtifactName);
			LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION", ArtifactDescription);
		}

		protected void CreateArtifact()
		{
			artifactDef = ScriptableObject.CreateInstance<ArtifactDef>();
			artifactDef.cachedName = "ARTIFACT_" + ArtifactLangTokenName;
			artifactDef.nameToken = "ARTIFACT_" + ArtifactLangTokenName + "_NAME";
			artifactDef.descriptionToken = "ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION";
			artifactDef.smallIconSelectedSprite = ArtifactEnabledIcon;
			artifactDef.smallIconDeselectedSprite = ArtifactDisabledIcon;
			artifactDef.pickupModelPrefab = ArtifactModelPrefab;
			if (AchievementName != string.Empty && AchievementDesc != string.Empty)
			{
				artifactDef.unlockableDef = CreateUnlock();
			}
			ContentAddition.AddArtifactDef(artifactDef);
		}

		protected UnlockableDef CreateUnlock()
		{
			artifactDef.unlockableDef = ScriptableObject.CreateInstance<UnlockableDef>();
			((Object)artifactDef.unlockableDef).name = "ACHIEVEMENT_EXPEDITION_" + ArtifactLangTokenName;
			artifactDef.unlockableDef.cachedName = "ACHIEVEMENT_EXPEDITION_" + ArtifactLangTokenName;
			artifactDef.unlockableDef.nameToken = "ACHIEVEMENT_EXPEDITION_" + ArtifactLangTokenName + "_NAME";
			artifactDef.unlockableDef.getHowToUnlockString = GetHowToUnlock;
			artifactDef.unlockableDef.getUnlockedString = GetUnlocked;
			artifactDef.unlockableDef.achievementIcon = ArtifactUnlockIcon;
			UnlockableDef unlockableDef = artifactDef.unlockableDef;
			ContentAddition.AddUnlockableDef(unlockableDef);
			return unlockableDef;
		}

		public abstract void Hooks();
	}
	internal class Destination : ArtifactBase
	{
		public static ConfigEntry<int> TimesToPrintMessageOnStart;

		public static GameObject expeditionStagePickerPrefab;

		public static SceneDef pickedSceneDef;

		public static ArtifactCode artifactCode;

		public static GameObject panelPrefab;

		public static SceneDef seerStationStaff;

		public static SceneDef infiniteTowerStaff;

		public static bool stopSpawningPortalsPlease;

		internal static Destination Instance { get; private set; }

		public override string ArtifactName => "Artifact of Destination";

		public override string ArtifactLangTokenName => "DESTINATION";

		public override string ArtifactDescription => "Choose your destination.";

		public override Sprite ArtifactEnabledIcon => Assets.mainAssetBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Artifacts/Destination/destinationIconEnabled.png");

		public override Sprite ArtifactDisabledIcon => Assets.mainAssetBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Artifacts/Destination/destinationIconDisabled.png");

		public override Sprite ArtifactUnlockIcon => Assets.mainAssetBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Artifacts/Destination/destinationIconUnlock.png");

		public override GameObject ArtifactModelPrefab => Assets.mainAssetBundle.LoadAsset<GameObject>("Assets/Artifacts/PickupDestination.prefab");

		public static DestinationStagePicker destinationStagePicker { get; private set; }

		public override string AchievementName => "Trial of Destination";

		public override string AchievementDesc => "Complete the Trial of Destination";

		public override void Init(ConfigFile config)
		{
			//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_0057: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			CreateConfig(config);
			CreateLang();
			CreateArtifact();
			Hooks();
			Instance = this;
			expeditionStagePickerPrefab = Assets.mainAssetBundle.LoadAsset<GameObject>("Assets/Artifacts/ExpeditionStagePicker.prefab");
			artifactCode = ScriptableObject.CreateInstance<ArtifactCode>();
			artifactCode.topRow = new Vector3Int(5, 3, 5);
			artifactCode.middleRow = new Vector3Int(3, 1, 3);
			artifactCode.bottomRow = new Vector3Int(5, 3, 5);
			ArtifactCodeAPI.AddCode(artifactDef, artifactCode);
		}

		private void CreateConfig(ConfigFile config)
		{
			TimesToPrintMessageOnStart = config.Bind<int>("Artifact: " + ArtifactName, "Times to Print Message in Chat", 5, "How many times should a message be printed to the chat on run start?");
		}

		public override void Hooks()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			SceneExitController.SetState += new Manipulator(SceneExitController_SetState);
			SceneExitController.UpdateServer += new Manipulator(SceneExitController_UpdateServer);
			ChargedState.OnEnter += new Manipulator(ChargedState_OnEnter);
			SeerStationController.SetRunNextStageToTarget += new hook_SetRunNextStageToTarget(SetRunNextStageToTarget);
			Run.AdvanceStage += new hook_AdvanceStage(AdvanceStage);
			Stage.onStageStartGlobal += StageStartGlobal;
		}

		private void StageStartGlobal(Stage obj)
		{
			if (Run.instance is InfiniteTowerRun)
			{
				infiniteTowerStaff = obj.sceneDef;
			}
		}

		private void ChargedState_OnEnter(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction val2 = val.Instrs[val.Instrs.Count - 1];
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<ChargeIndicatorController>(x, "isCharged")
			}))
			{
				_ = val.Next;
				val.EmitDelegate<Func<bool>>((Func<bool>)Check);
				val.Emit(OpCodes.Brtrue_S, val2);
			}
			else
			{
				Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
			}
			static bool Check()
			{
				if (stopSpawningPortalsPlease)
				{
					stopSpawningPortalsPlease = false;
					return true;
				}
				return false;
			}
		}

		private void SetRunNextStageToTarget(orig_SetRunNextStageToTarget orig, SeerStationController self)
		{
			orig.Invoke(self);
			if (NetworkServer.active && base.ArtifactEnabled)
			{
				seerStationStaff = SceneCatalog.GetSceneDef((SceneIndex)self.targetSceneDefIndex);
			}
		}

		private void AdvanceStage(orig_AdvanceStage orig, Run self, SceneDef nextScene)
		{
			orig.Invoke(self, nextScene);
			if (NetworkServer.active && base.ArtifactEnabled)
			{
				seerStationStaff = null;
			}
		}

		private void SceneExitController_UpdateServer(ILContext il)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel iLLabel = null;
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<SceneExitController>(x, "experienceCollector"),
				(Instruction x) => ILPatternMatchingExt.MatchCall<Object>(x, "op_Implicit"),
				(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref iLLabel)
			}))
			{
				val.EmitDelegate<Func<bool>>((Func<bool>)Check);
				val.Emit(OpCodes.Brtrue_S, (object)iLLabel);
			}
			else
			{
				Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
			}
			bool Check()
			{
				if (NetworkServer.active && base.ArtifactEnabled)
				{
					if (Object.op_Implicit((Object)(object)pickedSceneDef))
					{
						return false;
					}
					return true;
				}
				return false;
			}
		}

		private void SceneExitController_SetState(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchCall<SceneExitController>(x, "set_isRunning")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<SceneExitController>>((Action<SceneExitController>)Check);
			}
			else
			{
				Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
			}
			void Check(SceneExitController sceneExitController)
			{
				pickedSceneDef = null;
				if (NetworkServer.active && base.ArtifactEnabled)
				{
					PullUp(sceneExitController);
				}
			}
		}

		public static void PullUp(SceneExitController sceneExitController)
		{
			CreatePicker();
			destinationStagePicker.Init(sceneExitController);
			((Component)destinationStagePicker).gameObject.SetActive(true);
		}

		public static void CreatePicker()
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)Destination.destinationStagePicker))
			{
				panelPrefab = Object.Instantiate<GameObject>(expeditionStagePickerPrefab, HUD.instancesList[0].mainContainer.transform);
				panelPrefab.AddComponent<StagePickerSizeAdjuster>();
				DestinationStagePicker destinationStagePicker = panelPrefab.AddComponent<DestinationStagePicker>();
				DestinationCancelExit destinationCancelExit = ((Component)panelPrefab.transform.Find("body/BeetleJuice/cancelbutton")).gameObject.AddComponent<DestinationCancelExit>();
				destinationStagePicker.childLocator = panelPrefab.GetComponent<ChildLocator>();
				destinationStagePicker.destinationCancelExit = destinationCancelExit;
				destinationCancelExit.hGButton = ((Component)destinationCancelExit).gameObject.GetComponent<HGButton>();
				destinationCancelExit.destinationStagePicker = destinationStagePicker;
				((UnityEvent)((Button)destinationCancelExit.hGButton).onClick).AddListener(new UnityAction(destinationCancelExit.Cancel));
				destinationCancelExit.hGButton.imageOnHover = ((Component)((Component)destinationCancelExit.hGButton).gameObject.transform.Find("cancelbutton, outline")).gameObject.GetComponent<Image>();
				destinationCancelExit.hGButton.showImageOnHover = true;
				destinationCancelExit.hGButton.uiClickSoundOverride = "Play_UI_menuBack";
				Destination.destinationStagePicker = destinationStagePicker;
				((Behaviour)((Component)HUD.instancesList[0].mainContainer.transform.Find("MainUIArea")).GetComponent<Canvas>()).enabled = false;
				stopSpawningPortalsPlease = true;
			}
		}
	}
	public class DestinationCancelExit : MonoBehaviour
	{
		public HGButton hGButton;

		public SceneExitController sceneExitController;

		public DestinationStagePicker destinationStagePicker;

		public void OnDisable()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((UnityEvent)((Button)hGButton).onClick).RemoveListener(new UnityAction(Cancel));
		}

		public void Cancel()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)((Component)sceneExitController).GetComponent<TeleporterInteraction>()))
			{
				EntityStateMachine component = ((Component)sceneExitController).GetComponent<EntityStateMachine>();
				if ((Object)(object)component == (Object)null)
				{
					return;
				}
				component.SetNextState((EntityState)new ChargedState());
				sceneExitController.SetState((ExitState)0);
				((Component)destinationStagePicker).gameObject.SetActive(false);
				Object.Destroy((Object)(object)Destination.panelPrefab);
				((Behaviour)((Component)HUD.instancesList[0].mainContainer.transform.Find("MainUIArea")).GetComponent<Canvas>()).enabled = true;
			}
			if (Object.op_Implicit((Object)(object)((Component)sceneExitController).GetComponent<GenericInteraction>()))
			{
				sceneExitController.SetState((ExitState)0);
				((Component)destinationStagePicker).gameObject.SetActive(false);
				Object.Destroy((Object)(object)Destination.panelPrefab);
				((Behaviour)((Component)HUD.instancesList[0].mainContainer.transform.Find("MainUIArea")).GetComponent<Canvas>()).enabled = true;
				((Component)sceneExitController).GetComponent<GenericInteraction>().SetInteractabilityAvailable();
			}
		}
	}
	public class DestinationStagePicker : MonoBehaviour
	{
		public ChildLocator childLocator;

		public DestinationCancelExit destinationCancelExit;

		public void Init(SceneExitController sceneExitController)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Invalid comparison between Unknown and I4
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Invalid comparison between Unknown and I4
			//IL_0bb6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc0: Expected O, but got Unknown
			//IL_0942: Unknown result type (might be due to invalid IL or missing references)
			//IL_0951: Unknown result type (might be due to invalid IL or missing references)
			destinationCancelExit.sceneExitController = sceneExitController;
			GameObject gameObject = ((Component)childLocator.FindChild("Button")).gameObject;
			Transform val = childLocator.FindChild("Content");
			SceneDef nextStageScene = Run.instance.nextStageScene;
			bool flag = !Object.op_Implicit((Object)(object)nextStageScene) || (int)nextStageScene.sceneType == 1;
			((UnityEvent)((Button)((Component)this).gameObject.GetComponent<MPButton>()).onClick).AddListener(new UnityAction(destinationCancelExit.Cancel));
			int num = (Object.op_Implicit((Object)(object)nextStageScene) ? nextStageScene.stageOrder : (-1));
			List<SceneDef> list = (Object.op_Implicit((Object)(object)nextStageScene) ? ((IEnumerable<SceneDef>)(object)SceneCatalog.allSceneDefs).ToList() : new List<SceneDef> { Stage.instance.sceneDef });
			if (Object.op_Implicit((Object)(object)sceneExitController.destinationScene) && (!Object.op_Implicit((Object)(object)sceneExitController.destinationScene.destinationsGroup) || !Object.op_Implicit((Object)(object)sceneExitController.destinationScene.loopedDestinationsGroup)) && !Object.op_Implicit((Object)(object)((Component)sceneExitController).GetComponent<TeleporterInteraction>()) && (Object)(object)sceneExitController.destinationScene != (Object)(object)Destination.seerStationStaff)
			{
				list.Clear();
				list.Add(sceneExitController.destinationScene);
			}
			if (Object.op_Implicit((Object)(object)sceneExitController.destinationScene) && sceneExitController.destinationScene.cachedName == "moon2" && !sceneExitController.useRunNextStageScene)
			{
				list.Clear();
				list.Add(SceneCatalog.FindSceneDef("moon2"));
			}
			if (sceneExitController.isColossusPortal)
			{
				int stageOrder = Stage.instance.sceneDef.stageOrder;
				int num2 = Run.instance.nextStageScene.stageOrder;
				if (num2 != stageOrder + 1 && stageOrder <= 5)
				{
					num2 = stageOrder + 1;
				}
				switch (num2)
				{
				case 2:
					list.Clear();
					list.Add(SceneCatalog.FindSceneDef("lemuriantemple"));
					break;
				case 3:
					list.Clear();
					if (Run.instance.stageClearCount <= 4)
					{
						list.Add(SceneCatalog.FindSceneDef("habitat"));
					}
					else
					{
						list.Add(SceneCatalog.FindSceneDef("habitatfall"));
					}
					break;
				case 4:
					list.Clear();
					list.Add(SceneCatalog.FindSceneDef("meridian"));
					break;
				}
			}
			if (!flag)
			{
				list.Clear();
				list.Add(nextStageScene);
			}
			if (Object.op_Implicit((Object)(object)sceneExitController.destinationScene))
			{
				if (sceneExitController.destinationScene.cachedName == "conduitcanyon")
				{
					list.Clear();
					list.Add(SceneCatalog.FindSceneDef("conduitcanyon"));
				}
				if (sceneExitController.destinationScene.cachedName == "solutionalhaunt")
				{
					list.Clear();
					list.Add(SceneCatalog.FindSceneDef("solutionalhaunt"));
				}
			}
			if (Object.op_Implicit((Object)(object)sceneExitController.destinationScene) && (sceneExitController.destinationScene.cachedName == "artifactworld" || sceneExitController.destinationScene.cachedName == "artifactworld01" || sceneExitController.destinationScene.cachedName == "artifactworld02" || sceneExitController.destinationScene.cachedName == "artifactworld03"))
			{
				list.Remove(SceneCatalog.FindSceneDef(sceneExitController.destinationScene.cachedName));
				list.Add(SceneCatalog.FindSceneDef("artifactworld"));
				list.Add(SceneCatalog.FindSceneDef("artifactworld01"));
				list.Add(SceneCatalog.FindSceneDef("artifactworld02"));
				list.Add(SceneCatalog.FindSceneDef("artifactworld03"));
			}
			if (Run.instance is InfiniteTowerRun)
			{
				list.Clear();
				list.Add(SceneCatalog.FindSceneDef("itancientloft"));
				list.Add(SceneCatalog.FindSceneDef("itdampcave"));
				list.Add(SceneCatalog.FindSceneDef("itfrozenwall"));
				list.Add(SceneCatalog.FindSceneDef("itgolemplains"));
				list.Add(SceneCatalog.FindSceneDef("itgoolake"));
				list.Add(SceneCatalog.FindSceneDef("itskymeadow"));
				list.Add(SceneCatalog.FindSceneDef("itmoon"));
				list.Remove(SceneCatalog.FindSceneDef(Destination.infiniteTowerStaff.cachedName));
			}
			foreach (SceneDef item in list)
			{
				SceneDef sceneDef = item;
				if (((!flag || (Object.op_Implicit((Object)(object)sceneDef.requiredExpansion) && !Run.instance.IsExpansionEnabled(sceneDef.requiredExpansion)) || (Object.op_Implicit((Object)(object)nextStageScene) && (!Object.op_Implicit((Object)(object)sceneExitController.destinationScene) || (Object)(object)sceneDef != (Object)(object)sceneExitController.destinationScene) && (sceneDef.stageOrder != num || (int)sceneDef.sceneType != 1))) && sceneDef.cachedName != "artifactworld" && sceneDef.cachedName != "artifactworld01" && sceneDef.cachedName != "artifactworld02" && sceneDef.cachedName != "artifactworld03") || (Object.op_Implicit((Object)(object)sceneExitController.destinationScene) && sceneExitController.destinationScene.cachedName != "conduitcanyon" && sceneDef.cachedName == "conduitcanyon") || (Object.op_Implicit((Object)(object)sceneExitController.destinationScene) && sceneExitController.destinationScene.cachedName != "artifactworld" && sceneExitController.destinationScene.cachedName != "artifactworld01" && sceneExitController.destinationScene.cachedName != "artifactworld02" && sceneExitController.destinationScene.cachedName != "artifactworld03" && (sceneDef.cachedName == "artifactworld" || sceneDef.cachedName == "artifactworld01" || sceneDef.cachedName == "artifactworld02" || sceneDef.cachedName == "artifactworld03")) || (Run.instance.stageClearCount < 4 && sceneDef.isLockedBeforeLooping && ((Object)(object)Destination.seerStationStaff == (Object)null || Destination.seerStationStaff.cachedName != sceneDef.cachedName)) || (Run.instance.stageClearCount >= 4 && Object.op_Implicit((Object)(object)sceneDef.loopedSceneDef) && ((Object)(object)Destination.seerStationStaff == (Object)null || Destination.seerStationStaff.cachedName != sceneDef.cachedName)) || sceneDef.cachedName == "golemplains2" || sceneDef.cachedName == "blackbeach2" || (!sceneExitController.isColossusPortal && ((Object)(object)Destination.seerStationStaff == (Object)null || Destination.seerStationStaff.cachedName != sceneDef.cachedName) && (sceneDef.cachedName == "habitat" || sceneDef.cachedName == "habitatfall" || sceneDef.cachedName == "lemuriantemple" || sceneDef.cachedName == "meridian")) || (sceneDef.cachedName == "moon2" && sceneExitController.useRunNextStageScene))
				{
					continue;
				}
				HGButton component = Object.Instantiate<GameObject>(gameObject, val).GetComponent<HGButton>();
				((Component)component).gameObject.SetActive(true);
				if (Object.op_Implicit((Object)(object)((Selectable)component).image) && Object.op_Implicit((Object)(object)sceneDef.previewTexture))
				{
					Texture previewTexture = sceneDef.previewTexture;
					Texture2D val2 = (Texture2D)(object)((previewTexture is Texture2D) ? previewTexture : null);
					Sprite sprite = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0f, 0f));
					((Selectable)component).image.sprite = sprite;
					if (sceneDef.cachedName == "nest")
					{
						((Selectable)component).image.sprite = Assets.mainAssetBundle.LoadAsset<Sprite>("Assets/Artifacts/GearboxAreStupid/texNest_GearboxAreStupid.png");
					}
					if (sceneDef.cachedName == "villagenight")
					{
						((Selectable)component).image.sprite = Assets.mainAssetBundle.LoadAsset<Sprite>("Assets/Artifacts/GearboxAreStupid/texVillageNight_GearboxAreStupid.png");
					}
					if (sceneDef.cachedName == "solusweb")
					{
						((Selectable)component).image.sprite = Assets.mainAssetBundle.LoadAsset<Sprite>("Assets/Artifacts/GearboxAreStupid/texSolusWeb_GearboxAreStupid.png");
					}
					if (Run.instance is InfiniteTowerRun)
					{
						if (sceneDef.cachedName == "itancientloft")
						{
							((Selectable)component).image.sprite = Assets.mainAssetBundle.LoadAsset<Sprite>("Assets/Artifacts/ForSimulacrum/itAncientLoft.png");
						}
						if (sceneDef.cachedName == "itdampcave")
						{
							((Selectable)component).image.sprite = Assets.mainAssetBundle.LoadAsset<Sprite>("Assets/Artifacts/ForSimulacrum/itDampCave.png");
						}
						if (sceneDef.cachedName == "itfrozenwall")
						{
							((Selectable)component).image.sprite = Assets.mainAssetBundle.LoadAsset<Sprite>("Assets/Artifacts/ForSimulacrum/itFrozenWall.png");
						}
						if (sceneDef.cachedName == "itgolemplains")
						{
							((Selectable)component).image.sprite = Assets.mainAssetBundle.LoadAsset<Sprite>("Assets/Artifacts/ForSimulacrum/itGolemPlains.png");
						}
						if (sceneDef.cachedName == "itgoolake")
						{
							((Selectable)component).image.sprite = Assets.mainAssetBundle.LoadAsset<Sprite>("Assets/Artifacts/ForSimulacrum/itGooLake.png");
						}
						if (sceneDef.cachedName == "itmoon")
						{
							((Selectable)component).image.sprite = Assets.mainAssetBundle.LoadAsset<Sprite>("Assets/Artifacts/ForSimulacrum/itMoon.png");
						}
						if (sceneDef.cachedName == "itskymeadow")
						{
							((Selectable)component).image.sprite = Assets.mainAssetBundle.LoadAsset<Sprite>("Assets/Artifacts/ForSimulacrum/itSkyMeadow.png");
						}
					}
				}
				component.imageOnHover = ((Component)((Component)component).gameObject.transform.Find("button, outline")).gameObject.GetComponent<Image>();
				component.showImageOnHover = true;
				((UnityEvent)((Button)component).onClick).AddListener(new UnityAction(sus));
				void sus()
				{
					string cachedName = sceneDef.cachedName;
					if (!(cachedName == "golemplains"))
					{
						if (cachedName == "blackbeach")
						{
							float num3 = Mathf.Round(Random.Range(0f, 1f));
							if (num3 == 0f)
							{
								Destination.pickedSceneDef = sceneDef;
								sceneExitController.destinationScene = sceneDef;
							}
							if (num3 == 1f)
							{
								Destination.pickedSceneDef = SceneCatalog.FindSceneDef("blackbeach2");
								sceneExitController.destinationScene = SceneCatalog.FindSceneDef("blackbeach2");
							}
						}
						else
						{
							Destination.pickedSceneDef = sceneDef;
							sceneExitController.destinationScene = sceneDef;
						}
					}
					else
					{
						float num4 = Mathf.Round(Random.Range(0f, 1f));
						if (num4 == 0f)
						{
							Destination.pickedSceneDef = sceneDef;
							sceneExitController.destinationScene = sceneDef;
						}
						if (num4 == 1f)
						{
							Destination.pickedSceneDef = SceneCatalog.FindSceneDef("golemplains2");
							sceneExitController.destinationScene = SceneCatalog.FindSceneDef("golemplains2");
						}
					}
					((Component)this).gameObject.SetActive(false);
					Object.Destroy((Object)(object)Destination.panelPrefab);
					((Behaviour)((Component)HUD.instancesList[0].mainContainer.transform.Find("MainUIArea")).GetComponent<Canvas>()).enabled = true;
					Destination.stopSpawningPortalsPlease = false;
					if (Util.HasEffectiveAuthority(HUD.instancesList[0].oldTarget.GetComponent<CharacterBody>().networkIdentity))
					{
						AkSoundEngine.PostEvent(3652871718u, HUD.instancesList[0].oldTarget);
					}
				}
			}
			if (Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponent<StagePickerSizeAdjuster>()))
			{
				((Component)this).gameObject.GetComponent<StagePickerSizeAdjuster>().MikeRebuildMyPanel();
			}
		}

		private void FixedUpdate()
		{
			if ((Object)(object)HUD.instancesList[0].mainContainer.GetComponentInChildren<ScoreboardController>() != (Object)null)
			{
				destinationCancelExit.Cancel();
			}
		}
	}
	public class StagePickerSizeAdjuster : MonoBehaviour
	{
		private int buttonCount;

		private float normalSizeX;

		private float normalSizeY;

		private void MikeFindVariables()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			normalSizeX = ((Component)((Component)this).gameObject.transform.Find("body")).gameObject.GetComponent<RectTransform>().sizeDelta.x;
			normalSizeY = ((Component)((Component)this).gameObject.transform.Find("body")).gameObject.GetComponent<RectTransform>().sizeDelta.y;
		}

		public void MikeRebuildMyPanel()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			MikeFindVariables();
			for (buttonCount = ((Component)((Component)this).gameObject.transform.Find("body/BeetleJuice/content")).gameObject.transform.childCount; buttonCount > 7; buttonCount -= 3)
			{
				((Component)((Component)this).gameObject.transform.Find("body")).gameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(normalSizeX + 300f, normalSizeY);
				normalSizeX = ((Component)((Component)this).gameObject.transform.Find("body")).gameObject.GetComponent<RectTransform>().sizeDelta.x;
			}
		}
	}
	public class Feathers2Behaviour : ItemBehavior
	{
		public float maxTimerNumber;

		private float realTimerNumber;

		public CharacterBody playerBody;

		public static FireProjectileInfo fireProjectileInfo;

		public GameObject wingusDingus;

		private void Awake()
		{
			((Behaviour)this).enabled = false;
		}

		private void Start()
		{
			//IL_0011: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			wingusDingus = Object.Instantiate<GameObject>(Feathers2.Feather2WingsEffectPrefab, playerBody.coreTransform.position, playerBody.coreTransform.rotation);
			float radius = playerBody.radius;
			wingusDingus.transform.localScale = new Vector3(1.5f * radius, 1.5f * radius, 1.5f * radius);
			wingusDingus.transform.SetParent(playerBody.coreTransform);
		}

		private void OnEnable()
		{
		}

		private void OnDisable()
		{
		}

		private void OnDestroy()
		{
			Object.Destroy((Object)(object)wingusDingus);
		}

		private void FixedUpdate()
		{
			CharacterMotor val = default(CharacterMotor);
			CharacterMotor val2 = default(CharacterMotor);
			if (((((Component)playerBody).TryGetComponent<CharacterMotor>(ref val) && !val.isGrounded) || !((Component)playerBody).TryGetComponent<CharacterMotor>(ref val2)) && playerBody.inputBank.skill1.down)
			{
				realTimerNumber -= Time.deltaTime;
				if (realTimerNumber <= 0f)
				{
					FireProjectile(playerBody);
					AkSoundEngine.PostEvent(623304158u, ((Component)playerBody).gameObject);
					realTimerNumber = maxTimerNumber;
				}
				if (!wingusDingus.activeSelf)
				{
					wingusDingus.SetActive(true);
				}
			}
			else
			{
				realTimerNumber = maxTimerNumber;
				if (wingusDingus.activeSelf)
				{
					wingusDingus.SetActive(false);
				}
			}
		}

		private void FireProjectile(CharacterBody characterBody)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			FireProjectileInfo val = default(FireProjectileInfo);
			val.owner = ((Component)characterBody).gameObject;
			val.damage = 0.8f * characterBody.damage;
			val.force = 10f;
			val.position = characterBody.corePosition;
			val.rotation = Util.QuaternionSafeLookRotation(characterBody.inputBank.aimDirection);
			val.projectilePrefab = Feathers2.Projectile;
			fireProjectileInfo = val;
			ProjectileManager.instance.FireProjectile(fireProjectileInfo);
		}
	}
	public class georevealer : NetworkBehaviour
	{
		private struct PendingReveal : IComparable<PendingReveal>
		{
			public GameObject gameObject;

			public FixedTimeStamp time;

			public float duration;

			public int CompareTo(PendingReveal other)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				return ((FixedTimeStamp)(ref time)).CompareTo(other.time);
			}
		}

		private class RevealedObject : MonoBehaviour
		{
			private float lifetime;

			private static readonly Dictionary<GameObject, RevealedObject> currentlyRevealedObjects = new Dictionary<GameObject, RevealedObject>();

			private PositionIndicator positionIndicator;

			public static void RevealObject(GameObject gameObject, float duration)
			{
				if (!currentlyRevealedObjects.TryGetValue(gameObject, out var value))
				{
					if ((Object)(object)gameObject.GetComponent<ShrineBloodBehavior>() != (Object)null)
					{
						value = gameObject.AddComponent<RevealedObject>();
					}
					else if ((Object)(object)gameObject.GetComponent<ShrineBossBehavior>() != (Object)null)
					{
						value = gameObject.AddComponent<RevealedObject>();
					}
					else if ((Object)(object)gameObject.GetComponent<ShrineChanceBehavior>() != (Object)null)
					{
						value = gameObject.AddComponent<RevealedObject>();
					}
					else if ((Object)(object)gameObject.GetComponent<ShrineCleanseBehavior>() != (Object)null)
					{
						value = gameObject.AddComponent<RevealedObject>();
					}
					else if ((Object)(object)gameObject.GetComponent<ShrineCombatBehavior>() != (Object)null)
					{
						value = gameObject.AddComponent<RevealedObject>();
					}
					else if ((Object)(object)gameObject.GetComponent<ShrineHealingBehavior>() != (Object)null)
					{
						value = gameObject.AddComponent<RevealedObject>();
					}
					else if ((Object)(object)gameObject.GetComponent<ShrineRestackBehavior>() != (Object)null)
					{
						value = gameObject.AddComponent<RevealedObject>();
					}
					else if ((Object)(object)gameObject.GetComponent<TeleporterInteraction>() != (Object)null)
					{
						value = gameObject.AddComponent<RevealedObject>();
					}
					else if ((Object)(object)gameObject.GetComponent<PortalStatueBehavior>() != (Object)null)
					{
						value = gameObject.AddComponent<RevealedObject>();
					}
					else if ((Object)(object)gameObject.GetComponent<PressurePlateController>() != (Object)null)
					{
						value = gameObject.AddComponent<RevealedObject>();
					}
					else if ((Object)(object)gameObject.GetComponent<ShrineRebirthController>() != (Object)null)
					{
						value = gameObject.AddComponent<RevealedObject>();
					}
					else if ((Object)(object)gameObject.GetComponent<HalcyoniteShrineInteractable>() != (Object)null)
					{
						value = gameObject.AddComponent<RevealedObject>();
					}
					else if ((Object)(object)gameObject.GetComponent<ShrineColossusAccessBehavior>() != (Object)null)
					{
						value = gameObject.AddComponent<RevealedObject>();
					}
					else if ((Object)(object)gameObject.GetComponent<ShrineCombatTroopBehavior>() != (Object)null)
					{
						value = gameObject.AddComponent<RevealedObject>();
					}
					else
					{
						if (!((Object)(object)gameObject.GetComponent<ShrinePlanetManager>() != (Object)null))
						{
							return;
						}
						value = gameObject.AddComponent<RevealedObject>();
					}
				}
				if (value.lifetime < duration)
				{
					value.lifetime = duration;
				}
			}

			private void OnEnable()
			{
				//IL_0069: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				NetworkIdentity component = ((Component)this).gameObject.GetComponent<NetworkIdentity>();
				if (Object.op_Implicit((Object)(object)component))
				{
					foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
					{
						if (!((Object)(object)instance == (Object)null) && instance.isPingTheSameNetworkObject(component))
						{
							Object.Destroy((Object)(object)this);
							return;
						}
					}
				}
				GameObject val = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/PositionIndicators/PoiPositionIndicator"), ((Component)this).transform.position, ((Component)this).transform.rotation);
				positionIndicator = val.GetComponent<PositionIndicator>();
				positionIndicator.insideViewObject.GetComponent<SpriteRenderer>().sprite = GetInteractableIcon(((Component)this).gameObject);
				positionIndicator.insideViewObject.GetComponent<SpriteRenderer>().color = new Color(0.63f, 0.87f, 1f, 1f);
				positionIndicator.outsideViewObject.GetComponentInChildren<SpriteRenderer>().color = new Color(0.63f, 0.87f, 1f, 1f);
				positionIndicator.targetTransform = ((Component)this).transform;
				currentlyRevealedObjects[((Component)this).gameObject] = this;
			}

			private void OnDisable()
			{
				currentlyRevealedObjects.Remove(((Component)this).gameObject);
				if (Object.op_Implicit((Object)(object)positionIndicator))
				{
					Object.Destroy((Object)(object)((Component)positionIndicator).gameObject);
				}
				positionIndicator = null;
			}

			private void FixedUpdate()
			{
				lifetime -= Time.fixedDeltaTime;
				if (lifetime <= 0f)
				{
					Object.Destroy((Object)(object)this);
				}
			}
		}

		[SyncVar]
		public float radius;

		public float pulseTravelSpeed;

		public float revealDuration;

		public float pulseInterval;

		private FixedTimeStamp nextPulse = FixedTimeStamp.negativeInfinity;

		public GameObject pulseEffectPrefab;

		public float pulseEffectScale;

		private static readonly List<PendingReveal> pendingReveals = new List<PendingReveal>();

		private static Type[] typesToCheck;

		private Vector3 spawn;

		public float Networkradius
		{
			get
			{
				return radius;
			}
			[param: In]
			set
			{
				((NetworkBehaviour)this).SetSyncVar<float>(value, ref radius, 1u);
			}
		}

		public static Sprite GetInteractableIcon(GameObject gameObject)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Invalid comparison between Unknown and I4
			PingInfoProvider component = gameObject.GetComponent<PingInfoProvider>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.pingIconOverride))
			{
				return component.pingIconOverride;
			}
			string text = "Assets/Models/Prefabs/VFX/geolocator/texGeoIndicatorMystery.png";
			if (((Object)gameObject).name.Contains("Shrine"))
			{
				text = "Assets/Models/Prefabs/VFX/geolocator/texGeoIndicatorShrine.png";
			}
			else if (Object.op_Implicit((Object)(object)gameObject.GetComponent<TeleporterInteraction>()))
			{
				text = "Assets/Models/Prefabs/VFX/geolocator/texGeoIndicatorTeleporter.png";
			}
			else
			{
				PortalStatueBehavior component2 = gameObject.GetComponent<PortalStatueBehavior>();
				if (Object.op_Implicit((Object)(object)component2) && (int)component2.portalType == 0)
				{
					text = "Assets/Models/Prefabs/VFX/geolocator/texGeoIndicatorMystery.png";
				}
				else
				{
					PurchaseInteraction component3 = gameObject.GetComponent<PurchaseInteraction>();
					if (Object.op_Implicit((Object)(object)component3) && (int)component3.costType == 3)
					{
						text = "Assets/Models/Prefabs/VFX/geolocator/texGeoIndicatorShrine.png";
					}
				}
			}
			return Assets.mainAssetBundle.LoadAsset<Sprite>(text);
		}

		[InitDuringStartupPhase(/*Could not decode attribute arguments.*/)]
		private static void Init()
		{
			RoR2Application.onFixedUpdate += StaticFixedUpdate;
			typesToCheck = (from t in typeof(ChestRevealer).Assembly.GetTypes()
				where typeof(IInteractable).IsAssignableFrom(t)
				select t).ToArray();
		}

		private static void StaticFixedUpdate()
		{
			pendingReveals.Sort();
			while (pendingReveals.Count > 0)
			{
				PendingReveal pendingReveal = pendingReveals[0];
				if (((FixedTimeStamp)(ref pendingReveal.time)).hasPassed)
				{
					if (Object.op_Implicit((Object)(object)pendingReveal.gameObject))
					{
						RevealedObject.RevealObject(pendingReveal.gameObject, pendingReveal.duration);
					}
					pendingReveals.RemoveAt(0);
					continue;
				}
				break;
			}
		}

		public void Pulse()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			Vector3 origin = ((Component)this).transform.position;
			float radiusSqr = radius * radius;
			float invPulseTravelSpeed = 1f / pulseTravelSpeed;
			Type[] array = typesToCheck;
			for (int i = 0; i < array.Length; i++)
			{
				foreach (MonoBehaviour item2 in InstanceTracker.FindInstancesEnumerable(array[i]))
				{
					if (((IInteractable)item2).ShouldShowOnScanner())
					{
						TryAddRevealable(((Component)item2).transform);
					}
				}
			}
			spawn = origin;
			((MonoBehaviour)this).Invoke("SpawnEffect", 0.5f);
			void TryAddRevealable(Transform revealableTransform)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: 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)
				Vector3 val = revealableTransform.position - origin;
				float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
				if (!(sqrMagnitude > radiusSqr) && (!((Object)(object)((Component)revealableTransform).gameObject.GetComponent<TeleporterInteraction>() != (Object)null) || !((Component)revealableTransform).gameObject.GetComponent<TeleporterInteraction>().TrySetTeleporterIndicatorDiscovered(true)))
				{
					foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
					{
						if (!((Object)(object)instance == (Object)null) && instance.isPingTheSameNetworkObject(((Component)revealableTransform).gameObject.GetComponent<NetworkIdentity>()))
						{
							return;
						}
					}
					float num = Mathf.Sqrt(sqrMagnitude) * invPulseTravelSpeed;
					PendingReveal pendingReveal = default(PendingReveal);
					pendingReveal.gameObject = ((Component)revealableTransform).gameObject;
					pendingReveal.time = FixedTimeStamp.now + num;
					pendingReveal.duration = revealDuration;
					PendingReveal item = pendingReveal;
					pendingReveals.Add(item);
				}
			}
		}

		private void SpawnEffect()
		{
			//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_000d: 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_0030: Expected O, but got Unknown
			EffectManager.SpawnEffect(pulseEffectPrefab, new EffectData
			{
				origin = spawn,
				scale = radius * pulseEffectScale
			}, false);
		}

		private void FixedUpdate()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (((FixedTimeStamp)(ref nextPulse)).hasPassed)
			{
				Pulse();
				nextPulse = FixedTimeStamp.now + pulseInterval;
			}
		}

		private void UNetVersion()
		{
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			if (forceAll)
			{
				writer.Write(radius);
				return true;
			}
			bool flag = false;
			if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
			{
				if (!flag)
				{
					writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
					flag = true;
				}
				writer.Write(radius);
			}
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
			}
			return flag;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
			if (initialState)
			{
				radius = reader.ReadSingle();
				return;
			}
			int num = (int)reader.ReadPackedUInt32();
			if (((uint)num & (true ? 1u : 0u)) != 0)
			{
				radius = reader.ReadSingle();
			}
		}
	}
	public class HandleHeatcore : MonoBehaviour
	{
		public GameObject theresholdInstance;

		public float theEndIsNear;

		private bool playBuildUpSound;

		private float segmentMoveX;

		private float theresholdMoveX;

		private float theresholdCurrentPositionX;

		private float heatcoreTimer = 360f;

		public GameObject theDifficultyBar;

		public CharacterBody heatHolder;

		private int stopSearching;

		private void OnEnable()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			try
			{
				if (heatHolder.isPlayerControlled)
				{
					FindСorrespondingDificultyBar();
					DifficultyBarController.SetSegmentScroll += new hook_SetSegmentScroll(MoveThereshold);
				}
				theEndIsNear = heatcoreTimer;
				playBuildUpSound = true;
			}
			catch (Exception)
			{
				((Behaviour)this).enabled = false;
			}
		}

		private void OnDisable()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			try
			{
				if (Object.op_Implicit((Object)(object)theDifficultyBar))
				{
					DifficultyBarController.SetSegmentScroll -= new hook_SetSegmentScroll(MoveThereshold);
				}
			}
			catch (Exception)
			{
			}
		}

		private void OnDestroy()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			try
			{
				if (Object.op_Implicit((Object)(object)theDifficultyBar))
				{
					AkSoundEngine.PostEvent(199676870u, ((Component)heatHolder).gameObject);
					Object.Destroy((Object)(object)theresholdInstance.gameObject);
					DifficultyBarController.SetSegmentScroll -= new hook_SetSegmentScroll(MoveThereshold);
				}
			}
			catch (Exception)
			{
			}
		}

		private void FixedUpdate()
		{
			if (!Run.instance.isRunStopwatchPaused)
			{
				theEndIsNear -= Time.deltaTime;
				if (theEndIsNear <= 30f && playBuildUpSound)
				{
					AkSoundEngine.PostEvent(3779037176u, ((Component)heatHolder).gameObject);
					playBuildUpSound = false;
				}
			}
		}

		private void MoveThereshold(orig_SetSegmentScroll orig, DifficultyBarController self, float segmentScroll)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, segmentScroll);
			if (!Object.op_Implicit((Object)(object)theresholdInstance))
			{
				return;
			}
			segmentMoveX = self.segmentContainer.offsetMin.x;
			if (theresholdMoveX != segmentMoveX)
			{
				float num = theresholdMoveX - segmentMoveX;
				if (num >= 9f || num <= -9f)
				{
					num = 1f;
				}
				if (theresholdCurrentPositionX - num <= 72f)
				{
					theresholdInstance.GetComponent<RectTransform>().anchoredPosition = new Vector2(theresholdCurrentPositionX - num, 0f);
				}
				else
				{
					theresholdInstance.GetComponent<RectTransform>().anchoredPosition = new Vector2(72f, 0f);
				}
				theresholdMoveX = segmentMoveX;
				theresholdCurrentPositionX -= num;
			}
		}

		private void SetupThereshold()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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_00f0: 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_017a: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)theDifficultyBar))
			{
				if ((Object)(object)theresholdInstance != (Object)null)
				{
					Object.Destroy((Object)(object)theresholdInstance.gameObject);
				}
				theresholdInstance = Object.Instantiate<GameObject>(Heatcore.HeatcoreThereshold, theDifficultyBar.transform);
				if (23f * (0.85f + (float)Run.instance.participatingPlayerCount * 0.15f) * DifficultyCatalog.GetDifficultyDef(Run.instance.selectedDifficulty).scalingValue * Mathf.Pow(1.15f, (float)Run.instance.stageClearCount) <= 72f)
				{
					theresholdInstance.GetComponent<RectTransform>().anchoredPosition = new Vector2(23f * (0.85f + (float)Run.instance.participatingPlayerCount * 0.15f) * DifficultyCatalog.GetDifficultyDef(Run.instance.selectedDifficulty).scalingValue * Mathf.Pow(1.15f, (float)Run.instance.stageClearCount), 0f);
				}
				else
				{
					theresholdInstance.GetComponent<RectTransform>().anchoredPosition = new Vector2(72f, 0f);
				}
				theresholdCurrentPositionX = 23f * (0.85f + (float)Run.instance.participatingPlayerCount * 0.15f) * DifficultyCatalog.GetDifficultyDef(Run.instance.selectedDifficulty).scalingValue * Mathf.Pow(1.15f, (float)Run.instance.stageClearCount);
				segmentMoveX = theDifficultyBar.GetComponent<DifficultyBarController>().segmentContainer.offsetMin.x;
				theresholdMoveX = segmentMoveX;
			}
		}

		private void FindСorrespondingDificultyBar()
		{
			using List<HUD>.Enumerator enumerator = HUD.instancesList.GetEnumerator();
			if (enumerator.MoveNext())
			{
				HUD current = enumerator.Current;
				if ((Object)(object)current.oldTarget == (Object)(object)((Component)heatHolder).gameObject)
				{
					theDifficultyBar = ((Component)((Component)current).gameObject.GetComponentInChildren<DifficultyBarController>()).gameObject;
					SetupThereshold();
				}
				else
				{
					((MonoBehaviour)this).Invoke("FindСorrespondingDificultyBar", 0.1f);
					stopSearching++;
				}
			}
		}
	}
	public class HandleTalisman : MonoBehaviour
	{
		public CharacterBody self;

		private float healingTimer;

		public float healingInterval = 1f;

		public int timesHealed;

		private void OnEnable()
		{
			try
			{
				self.onSkillActivatedServer += OnSkillActivatedServer;
				timesHealed = 0;
				if (Util.HasEffectiveAuthority(self.networkIdentity))
				{
					AkSoundEngine.PostEvent(2303086811u, ((Component)self).gameObject);
				}
			}
			catch (Exception)
			{
				((Behaviour)this).enabled = false;
			}
		}

		private void OnDisable()
		{
			try
			{
				self.onSkillActivatedServer -= OnSkillActivatedServer;
			}
			catch (Exception)
			{
			}
		}

		private void OnDestroy()
		{
			try
			{
				self.onSkillActivatedServer -= OnSkillActivatedServer;
				self.RemoveBuff(Buffs.Cloak);
				self.RemoveBuff(Talisman.TalismanRegen);
				if (Util.HasEffectiveAuthority(self.networkIdentity))
				{
					AkSoundEngine.PostEvent(1911342449u, ((Component)self).gameObject);
				}
			}
			catch (Exception)
			{
			}
		}

		private void FixedUpdate()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			if (self.HasBuff(Talisman.TalismanRegen))
			{
				healingTimer -= Time.fixedDeltaTime;
				if (healingTimer <= 0f)
				{
					healingTimer = healingInterval;
					self.healthComponent.HealFraction(0.01f, default(ProcChainMask));
					timesHealed++;
				}
			}
			if (timesHealed == 11)
			{
				Object.Destroy((Object)(object)this);
			}
		}

		private void OnSkillActivatedServer(GenericSkill genericSkill)
		{
			if (self.HasBuff(Talisman.TalismanRegen))
			{
				Object.Destroy((Object)(object)this);
			}
		}
	}
	public class InstinctController : MonoBehaviour
	{
		private CharacterBody _characterBody;

		public bool isSucker;

		public bool isAbsoluteSucker;

		private void Awake()
		{
			_characterBody = ((Component)this).GetComponent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)((Component)_characterBody.healthComponent).GetComponent<SetStateOnHurt>()))
			{
				isSucker = ((Component)_characterBody.healthComponent).GetComponent<SetStateOnHurt>().canBeStunned;
				isAbsoluteSucker = ((Component)_characterBody.healthComponent).GetComponent<SetStateOnHurt>().canBeHitStunned;
			}
		}

		private void OnDestroy()
		{
			if (_characterBody.HasBuff(Instinct.RageInstinct))
			{
				_characterBody.RemoveBuff(Instinct.RageInstinct);
			}
		}

		private void FixedUpdate()
		{
			if (_characterBody.healthComponent.combinedHealth <= _characterBody.healthComponent.fullCombinedHealth / 2f && _characterBody.healthComponent.combinedHealth > 0f)
			{
				if (!_characterBody.HasBuff(Instinct.RageInstinct))
				{
					_characterBody.AddBuff(Instinct.RageInstinct);
				}
			}
			else if (_characterBody.HasBuff(Instinct.RageInstinct))
			{
				_characterBody.RemoveBuff(Instinct.RageInstinct);
			}
		}
	}
	public class MortICantMoveItMoveItAnymore : MonoBehaviour
	{
		private CharacterBody body;

		private TemporaryOverlayInstance injuredOverlayInstance;

		private void Awake()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
			if (!body.HasBuff(Instinct.Injured))
			{
				Object.Destroy((Object)(object)this);
			}
			injuredOverlayInstance = TemporaryOverlayManager.AddOverlay(((Component)body.modelLocator.modelTransform).gameObject);
			injuredOverlayInstance.duration = 1000f;
			injuredOverlayInstance.animateShaderAlpha = true;
			injuredOverlayInstance.alphaCurve = AnimationCurve.EaseInOut(1f, 1f, 1f, 0f);
			injuredOverlayInstance.destroyComponentOnEnd = true;
			injuredOverlayInstance.originalMaterial = Instinct.InjuredMaterial;
			injuredOverlayInstance.AddToCharacterModel(((Component)body.modelLocator.modelTransform).gameObject.GetComponent<CharacterModel>());
		}

		private void OnDestroy()
		{
			injuredOverlayInstance.Destroy();
		}

		private void FixedUpdate()
		{
			if (body.HasBuff(Instinct.Injured))
			{
				body.isSprinting = false;
			}
			else
			{
				Object.Destroy((Object)(object)this);
			}
		}
	}
	public class PaperdogBehaviour : ItemBehavior
	{
		private bool playSound;

		private bool inPeace;

		private bool providingBuff;

		public float outOfCombatStopwatch2;

		public float outOfDangerStopwatch2;

		private void OnEnable()
		{
		}

		private void OnDisable()
		{
			try
			{
				((Component)this).gameObject.GetComponent<CharacterBody>().RemoveBuff(Paperdog.Continuity);
			}
			catch (Exception)
			{
			}
		}

		private void OnDestroy()
		{
			try
			{
				((Component)this).gameObject.GetComponent<CharacterBody>().RemoveBuff(Paperdog.Continuity);
			}
			catch (Exception)
			{
			}
		}

		private void SetProvidingBuff(bool shouldProvideBuff, CharacterBody body)
		{
			if (shouldProvideBuff != providingBuff)
			{
				providingBuff = shouldProvideBuff;
				if (providingBuff)
				{
					body.AddBuff(Paperdog.Continuity);
				}
				else
				{
					body.RemoveBuff(Paperdog.Continuity);
				}
			}
		}

		private void FixedUpdate()
		{
			outOfCombatStopwatch2 += Time.fixedDeltaTime;
			outOfDangerStopwatch2 += Time.fixedDeltaTime;
			if (outOfDangerStopwatch2 >= 3f && outOfCombatStopwatch2 >= 3f)
			{
				inPeace = true;
				if (playSound)
				{
					AkSoundEngine.PostEvent(1179956560u, ((Component)this).gameObject);
					playSound = false;
				}
			}
			else
			{
				inPeace = false;
				playSound = true;
			}
			SetProvidingBuff(inPeace, ((Component)this).gameObject.GetComponent<CharacterBody>());
		}
	}
	public class RedGuitarBehaviour : ItemBehavior
	{
		private CharacterBody Chris;

		public int itemCount;

		private void OnEnable()
		{
			try
			{
				BossGroup.onBossGroupStartServer += OnBossGroupStartServer;
				Chris = ((Component)this).gameObject.GetComponent<CharacterBody>();
			}
			catch (Exception)
			{
				((Behaviour)this).enabled = false;
			}
		}

		private void OnDisable()
		{
			try
			{
				BossGroup.onBossGroupStartServer -= OnBossGroupStartServer;
			}
			catch (Exception)
			{
			}
		}

		private void OnDestroy()
		{
			try
			{
				BossGroup.onBossGroupStartServer -= OnBossGroupStartServer;
			}
			catch (Exception)
			{
			}
		}

		private void OnBossGroupStartServer(BossGroup bossGroup)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			AkSoundEngine.PostEvent(3245283788u, ((Component)Chris).gameObject);
			foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(Chris.teamComponent.teamIndex))
			{
				if (teamMember.teamIndex == Chris.teamComponent.teamIndex)
				{
					((Component)teamMember).GetComponent<CharacterBody>().AddTimedBuff(RedGuitar.Jamming, (float)(5 + 5 * itemCount), 1);
					Transform modelTransform = teamMember.body.modelLocator.modelTransform;
					if (Object.op_Implicit((Object)(object)modelTransform))
					{
						TemporaryOverlayInstance obj = TemporaryOverlayManager.AddOverlay(((Component)modelTransform).gameObject);
						obj.duration = 5f + 5f * (float)itemCount;
						obj.animateShaderAlpha = true;
						obj.alphaCurve = AnimationCurve.EaseInOut(1f, 1f, 1f, 0f);
						obj.destroyComponentOnEnd = true;
						obj.originalMaterial = Assets.mainAssetBundle.LoadAsset<Material>("Jamming_material.mat");
						obj.AddToCharacterModel(((Component)modelTransform).gameObject.GetComponent<CharacterModel>());
					}
				}
			}
		}
	}
	public class RepairStationManager : NetworkBehaviour
	{
		public NewPickupPickerController PickupPickerController;

		public NetworkUIPromptController NetworkUIPromptController;

		public Animator animator;

		public EntityStateMachine esm;

		public NetworkStateMachine esm2;

		public int maxItemsToScrapAtATime = 1;

		public Interactor interactor;

		public UniquePickup pickupPrint;

		public void Start()
		{
			esm2 = ((Component)this).gameObject.GetComponent<NetworkStateMachine>();
			PickupPickerController = ((Component)this).gameObject.GetComponent<NewPickupPickerController>();
			animator = ((Component)this).gameObject.GetComponentInChildren<Animator>();
			((UnityEvent<Interactor>)(object)((PickupPickerController)((Component)this).gameObject.GetComponent<NewPickupPickerController>()).onServerInteractionBegin).AddListener((UnityAction<Interactor>)AssignPotentialInteractor);
			((UnityEvent<Interactor>)(object)((PickupPickerController)((Component)this).gameObject.GetComponent<NewPickupPickerController>()).onServerInteractionBegin).AddListener((UnityAction<Interactor>)((PickupPickerController)((Component)this).gameObject.GetComponent<NewPickupPickerController>()).SetOptionsFromInteractor);
			((UnityEvent<UniquePickup>)(object)((PickupPickerController)((Component)this).gameObject.GetComponent<NewPickupPickerController>()).onUniquePickupSelected).AddListener((UnityAction<UniquePickup>)BeginRepair);
			((UnityEvent<UniquePickup>)(object)((PickupPickerController)((Component)this).gameObject.GetComponent<NewPickupPickerController>()).onUniquePickupSelected).AddListener((UnityAction<UniquePickup>)ClearParticipant);
			void ClearParticipant(UniquePickup arg0)
			{
				((Component)this).gameObject.GetComponent<NetworkUIPromptController>().ClearParticipant();
			}
		}

		private void FixedUpdate()
		{
			((PickupPickerController)PickupPickerController).multiOptionsAvailable = false;
		}

		[Server]
		public void AssignPotentialInteractor(Interactor potentialInteractor)
		{
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void ExpeditionDemo.RepairStationManager::AssignPotentialInteractor(RoR2.Interactor)' called on client");
			}
			else if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"UwU");
			}
			else
			{
				interactor = potentialInteractor;
			}
		}

		[Server]
		public void BeginRepair(UniquePickup pickupToTake)
		{
			//IL_01b7: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: 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_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void ExpeditionDemo.RepairStationManager::BeginRepair(RoR2.UniquePickup)' called on client");
				return;
			}
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'BeginRepair' called on client");
				return;
			}
			PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupToTake.pickupIndex);
			if (pickupDef == null)
			{
				return;
			}
			ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex)));
			if (!Object.op_Implicit((Object)(object)itemDef))
			{
				return;
			}
			string name = itemDef.nameToken.Replace("CONSUMED", "");
			ItemIndex itemIndex = ((IEnumerable<ItemDef>)(object)ItemCatalog.allItemDefs).Where((ItemDef x) => x.nameToken == name).FirstOrDefault().itemIndex;
			CharacterBody val = default(CharacterBody);
			if (!((Component)interactor).TryGetComponent<CharacterBody>(ref val))
			{
				return;
			}
			Inventory inventory = val.inventory;
			if (!Object.op_Implicit((Object)(object)inventory))
			{
				return;
			}
			ItemTransformation val2 = default(ItemTransformation);
			((ItemTransformation)(ref val2)).allowWhenDisabled = false;
			((ItemTransformation)(ref val2)).forbidPermanentItems = ((UniquePickup)(ref pickupToTake)).isTempItem;
			((ItemTransformation)(ref val2)).forbidTempItems = !((UniquePickup)(ref pickupToTake)).isTempItem;
			((ItemTransformation)(ref val2)).minToTransform = 1;
			((ItemTransformation)(ref val2)).maxToTransform = 1;
			((ItemTransformation)(ref val2)).originalItemIndex = itemDef.itemIndex;
			((ItemTransformation)(ref val2)).newItemIndex = (ItemIndex)(-1);
			val2.transformationType = (ItemTransformationTypeIndex)(-1);
			ItemTransformation val3 = val2;
			bool flag = false;
			TryTransformResult val4 = default(TryTransformResult);
			if (((ItemTransformation)(ref val3)).TryTransform(inventory, ref val4) && Object.op_Implicit((Object)(object)val))
			{
				for (int i = 0; i < ((TryTransformResult)(ref val4)).totalTransformed; i++)
				{
					GameObject gameObject = ((Component)((Component)this).gameObject.transform.FindChild("DropPivot")).gameObject;
					try
					{
						PickupIndex pickupIndex = PickupCatalog.FindPickupIndex(itemIndex);
						pickupPrint = new UniquePickup
						{
							pickupIndex = pickupIndex
						};
						ExpeditionHelpfulUtils.CreateItemTakenOrb(val.corePosition, gameObject, GetAdditionalRandomItem(inventory, itemIndex));
						ExpeditionHelpfulUtils.CreateItemTakenOrb(val.corePosition, gameObject, val4.takenItem.itemIndex);
					}
					catch (ArgumentOutOfRangeException)
					{
						inventory.GiveItemPermanent(itemDef.itemIndex, 1);
						Debug.LogError((object)"You have not items to repair!");
						Debug.LogError((object)"Have not? What?");
						break;
					}
					flag = true;
				}
			}
			if (Object.op_Implicit((Object)(object)esm) && flag)
			{
				esm.SetNextState((EntityState)(object)new RSWaitToBeginRepair());
			}
		}

		public bool IsRewardPickupEmpty()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			_ = pickupPrint;
			return false;
		}

		public UniquePickup PopRewardPickup()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return pickupPrint;
		}

		public ItemIndex GetAdditionalRandomItem(Inventory inventory, ItemIndex itemIndex)
		{
			//IL_0000: 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_0010: Invalid comparison between Unknown and I4
			//IL_0035: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: 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_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected O, but got Unknown
			ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex);
			bool flag = false;
			ItemIndex val;
			if ((int)itemDef.tier == 1 && inventory.GetItemCountPermanent(Items.RegeneratingScrap.itemIndex) > 0)
			{
				val = Items.RegeneratingScrap.itemIndex;
				flag = true;
			}
			else
			{
				PickupDef pickupDef = PickupCatalog.GetPickupDef(PickupCatalog.FindScrapIndexForItemTier(itemDef.tier));
				val = (ItemIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex));
				flag = false;
			}
			if (inventory.GetItemCountPermanent(val) > 0)
			{
				inventory.RemoveItemPermanent(val, 1);
				if (flag)
				{
					EntitySoundManager.EmitSoundServer(NetworkSoundEventCatalog.FindNetworkSoundEventIndex("Play_item_proc_regenScrap_consume"), ((Component)inventory.characterBody).gameObject);
					ModelLocator component = ((Component)inventory.characterBody).GetComponent<ModelLocator>();
					if (Object.op_Implicit((Object)(object)component))
					{
						Transform modelTransform = component.modelTransform;
						if (Object.op_Implicit((Object)(object)modelTransform))
						{
							CharacterModel component2 = ((Component)modelTransform).GetComponent<CharacterModel>();
							if (Object.op_Implicit((Object)(object)component2))
							{
								List<GameObject> itemDisplayObjects = component2.GetItemDisplayObjects(Items.RegeneratingScrap.itemIndex);
								if (itemDisplayObjects.Count > 0)
								{
									GameObject val2 = itemDisplayObjects[0];
									GameObject obj = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/RegeneratingScrap/RegeneratingScrapExplosionDisplay.prefab").WaitForCompletion();
									EffectData val3 = new EffectData
									{
										origin = val2.transform.position,
										rotation = val2.transform.rotation
									};
									EffectManager.SpawnEffect(obj, val3, true);
								}
							}
						}
					}
					EffectManager.SimpleMuzzleFlash(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/RegeneratingScrap/RegeneratingScrapExplosionInPrinter.prefab").WaitForCompletion(), ((Component)this).gameObject, "DropPivot", true);
					CharacterMasterNotificationQueue.SendTransformNotification(inventory.characterBody.master, Items.RegeneratingScrap.itemIndex, Items.RegeneratingScrapConsumed.itemIndex, (TransformationType)0);
				}
				return val;
			}
			List<ItemIndex> itemAcquisitionOrder = inventory.itemAcquisitionOrder;
			List<ItemIndex> list = new List<ItemIndex>();
			foreach (ItemIndex item in itemAcquisitionOrder)
			{
				if (ItemCatalog.GetItemDef(item).tier == itemDef.tier)
				{
					list.Add(item);
				}
			}
			ItemIndex val4 = list[Random.Range(0, list.Count)];
			inventory.RemoveItemPermanent(val4, 1);
			return val4;
		}

		private void UNetVersion()
		{
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			return false;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
		}

		public override void PreStartClient()
		{
		}
	}
	public class ShrinePlanetManager : ShrineBehavior
	{
		public ShrinePlanetPPC pickupPickerController;

		public Interactor interactor;

		public ItemIndex[] selectedItemsList;

		public bool isActive;

		public bool isOfferingButtonClicked;

		private const float delayConst = 0.45f;

		private float delay;

		public int repeats;

		public GameObject[] droplets;

		public GameObject spawnPoint;

		public GameObject center;

		public GameObject symbol;

		public GameObject ThrownObjectProjectile;

		private static int kRpcRpcDisableSymbol;

		private void Start()
		{
			pickupPickerController = ((Component)this).GetComponent<ShrinePlanetPPC>();
			ChildLocator component = ((Component)this).GetComponent<ChildLocator>();
			spawnPoint = ((Component)component.transformPairs[0].transform).gameObject;
			center = ((Component)component.transformPairs[1].transform).gameObject;
			symbol = ((Component)((Component)((Component)this).gameObject.transform.FindChild("Base")).transform.FindChild("Symbol")).gameObject;
			ExpeditionHelpfulUtils.TryAddNetworkidentity(symbol);
			ItemIndex[] array = new ItemIndex[5];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			selectedItemsList = (ItemIndex[])(object)array;
			((UnityEvent<Interactor>)(object)((PickupPickerController)pickupPickerController).onServerInteractionBegin).AddListener((UnityAction<Interactor>)AssignPotentialInteractor);
			((UnityEvent<Interactor>)(object)((PickupPickerController)pickupPickerController).onServerInteractionBegin).AddListener((UnityAction<Interactor>)Prepair);
			((UnityEvent<Interactor>)(object)((PickupPickerController)pickupPickerController).onServerInteractionBegin).AddListener((UnityAction<Interactor>)pickupPickerController.SetOptionsFromInteractor);
			((UnityEvent<UniquePickup>)(object)((PickupPickerController)pickupPickerController).onUniquePickupSelected).AddListener((UnityAction<UniquePickup>)AddItemToList);
		}

		[ClientRpc]
		public void RpcDisableSymbol()
		{
			symbol.SetActive(false);
		}

		public void ClearParticipant()
		{
			((Component)this).gameObject.GetComponent<NetworkUIPromptController>().ClearParticipant();
		}

		[Server]
		private void OnDisable()
		{
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void ExpeditionDemo.ShrinePlanetManager::OnDisable()' called on client");
				return;
			}
			ThrownObjectProjectile = null;
			isActive = false;
			GameObject[] array = droplets;
			foreach (GameObject val in array)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					val.GetComponent<DropletShrinePlanetBehaviour>().DestroyDropletBehaviourByTakeObject();
				}
			}
		}

		[Server]
		private void Prepair(Interactor arg0)
		{
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void ExpeditionDemo.ShrinePlanetManager::Prepair(RoR2.Interactor)' called on client");
				return;
			}
			ThrownObjectProjectile = null;
			delay = 0.45f;
			repeats = 0;
			isActive = false;
			ItemIndex[] array = new ItemIndex[5];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			selectedItemsList = (ItemIndex[])(object)array;
			droplets = (GameObject[])(object)new GameObject[5];
		}

		[Server]
		public void AssignPotentialInteractor(Interactor potentialInteractor)
		{
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void ExpeditionDemo.ShrinePlanetManager::AssignPotentialInteractor(RoR2.Interactor)' called on client");
			}
			else
			{
				interactor = potentialInteractor;
			}
		}

		[Server]
		private void AddItemToList(UniquePickup pickupToTake)
		{
			//IL_0078: 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_008f: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Invalid comparison between I4 and Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: 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_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Expected I4, but got Unknown
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void ExpeditionDemo.ShrinePlanetManager::AddItemToList(RoR2.UniquePickup)' called on client");
				return;
			}
			int num = 0;
			ItemIndex[] array = selectedItemsList;
			for (int i = 0; i < array.Length; i++)
			{
				if ((int)array[i] != -1)
				{
					num++;
				}
			}
			if (num >= 5 || !NetworkServer.active)
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)interactor))
			{
				interactor = ((Component)((Component)this).GetComponent<NetworkUIPromptController>()._currentParticipantMaster.GetBody()).gameObject.GetComponent<Interactor>();
			}
			PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupToTake.pickupIndex);
			if (pickupDef == null)
			{
				return;
			}
			ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex)));
			if (!Object.op_Implicit((Object)(object)itemDef))
			{
				return;
			}
			ItemIndex itemIndex = itemDef.itemIndex;
			CharacterBody val = default(CharacterBody);
			if (!((Component)interactor).TryGetComponent<CharacterBody>(ref val))
			{
				return;
			}
			Inventory inventory = val.inventory;
			if (!Object.op_Implicit((Object)(object)inventory) || isActive)
			{
				return;
			}
			int itemCountPermanent = inventory.GetItemCountPermanent(itemIndex);
			int num2 = 0;
			array = selectedItemsList;
			for (int i = 0; i < array.Length; i++)
			{
				if ((int)array[i] == (int)itemIndex)
				{
					num2++;
				}
			}
			if (num2 < itemCountPermanent)
			{
				FindItemButton(pickupToTake, out var button);
				if ((Object)(object)button != (Object)null)
				{
					TextMeshProUGUI component = ((Component)button.transform.FindChild("Quantity")).gameObject.GetComponent<TextMeshProUGUI>();
					int num3 = int.Parse(((TMP_Text)component).text);
					num3--;
					((TMP_Text)component).text = num3.ToString();
					((Graphic)component).color = new Color(255f, 128f, 128f);
					if (num3 <= 0)
					{
						((TMP_Text)component).text = "empty";
						((Component)button.GetComponent<ChildLocator>().transformPairs[0].transform).gameObject.GetComponent<Image>().sprite = Addressables.LoadAssetAsync<Sprite>((object)RoR2_Base_Common_MiscIcons.texUnlockIcon_png).WaitForCompletion();
						((Selectable)button.GetComponent<HGButton>()).interactable = false;
						((Component)component).gameObject.SetActive(false);
					}
					if (!((Component)component).gameObject.activeSelf)
					{
						((Component)button.GetComponent<ChildLocator>().transformPairs[0].transform).gameObject.GetComponent<Image>().sprite = Addressables.LoadAssetAsync<Sprite>((object)RoR2_Base_Common_MiscIcons.texUnlockIcon_png).WaitForCompletion();
						((Selectable)button.GetComponent<HGButton>()).interactable = false;
					}
				}
				for (int j = 0; j < selectedItemsList.Length; j++)
				{
					if ((int)selectedItemsList[j] == -1)
					{
						selectedItemsList[j] = (ItemIndex)(int)itemIndex;
						break;
					}
				}
			}
			((Component)this).gameObject.GetComponent<NetworkUIPromptController>()._currentLocalParticipant.cameraRigController.hud.mainContainer.gameObject.GetComponentInChildren<PlanetPickerPanelHelper>().SynchronizeLists();
		}

		public void FindItemButton(UniquePickup pickup, out GameObject button)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			if (((PickupPickerController)pickupPickerController).options.Length != 0)
			{
				for (int i = 0; i < ((PickupPickerController)pickupPickerController).options.Length; i++)
				{
					if (((PickupPickerController)pickupPickerController).options[i].pickup == pickup)
					{
						num = i;
						break;
					}
				}
			}
			button = ((Component)((Component)((Component)this).gameObject.GetComponent<NetworkUIPromptController>()._currentLocalParticipant.cameraRigController.hud.mainContainer.gameObject.GetComponentInChildren<PickupPickerPanel>().buttonContainer).gameObject.transform.GetChild(num + 1)).gameObject;
		}

		public void FixedUpdate()
		{
			((PickupPickerController)pickupPickerController).multiOptionsAvailable = false;