Decompiled source of RockBottom v0.0.5

RockBottom.dll

Decompiled 21 hours ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Agents;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using CellMenu;
using GTFO.API;
using GameData;
using GameEvent;
using Globals;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Localization;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("RockBottom")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RockBottom")]
[assembly: AssemblyTitle("RockBottom")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace RockBottom
{
	[BepInPlugin("com.hirnukuono.RockBottom", "RockBottom", "0.0.5")]
	public class Plugin : BasePlugin
	{
		private class functions
		{
			[CompilerGenerated]
			private sealed class <inlevel2>d__1 : IEnumerator<object>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private object <>2__current;

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

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

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

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

				private bool MoveNext()
				{
					//IL_0028: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Expected O, but got Unknown
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>2__current = (object)new WaitForSeconds(2f);
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -1;
						GameStateManager.Current.DoChangeState((eGameStateName)10);
						<>2__current = null;
						<>1__state = 2;
						return true;
					case 2:
						<>1__state = -1;
						return false;
					}
				}

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

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

			public static void inlevel()
			{
				CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(inlevel2()), (Action)null);
			}

			[IteratorStateMachine(typeof(<inlevel2>d__1))]
			public static IEnumerator inlevel2()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <inlevel2>d__1(0);
			}
		}

		[HarmonyPatch]
		private class rbpatches
		{
			[HarmonyPatch(typeof(ElevatorSeat), "Awake")]
			[HarmonyPrefix]
			private static void Button(ElevatorSeat __instance)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Invalid comparison between Unknown and I4
				if ((int)GameStateManager.CurrentStateName == 6)
				{
					return;
				}
				foreach (TextMeshPro componentsInChild in ((Component)__instance.m_HSUDecompressText.transform.parent).GetComponentsInChildren<TextMeshPro>())
				{
					if (((Object)componentsInChild.transform).name == "HSU_TEXT")
					{
						((TMP_Text)componentsInChild).m_text = "<color=red>POWER FAILURE</color>";
						((TMP_Text)componentsInChild).ForceMeshUpdate(true, true);
					}
				}
				TextMeshPro componentInChildren = __instance.m_HSUDecompressText.GetComponentInChildren<TextMeshPro>();
				((TMP_Text)componentInChildren).m_text = "EJECTION IMMINENT";
				((TMP_Text)componentInChildren).ForceMeshUpdate(true, true);
			}

			[HarmonyPatch(typeof(GS_StopElevatorRide), "Enter")]
			[HarmonyPostfix]
			internal static void readytostart(GS_StopElevatorRide __instance)
			{
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Expected O, but got Unknown
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0116: Unknown result type (might be due to invalid IL or missing references)
				//IL_0128: Unknown result type (might be due to invalid IL or missing references)
				//IL_013a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: 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_0070: 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_0302: Unknown result type (might be due to invalid IL or missing references)
				if (m_cargoCageInUse)
				{
					ElevatorCargoCage componentInChildren = ((Component)ElevatorRide.Current).GetComponentInChildren<ElevatorCargoCage>();
					Vector3 position = default(Vector3);
					((Vector3)(ref position))..ctor(0f, 0f, 0f);
					((Component)componentInChildren).transform.SetParent((Transform)null);
					if ((Object)(object)ElevatorShaftLanding.CargoAlign == (Object)null)
					{
						((Vector3)(ref position))..ctor(0f, 1f, 16f);
					}
					if ((Object)(object)ElevatorShaftLanding.CargoAlign != (Object)null)
					{
						position = ElevatorShaftLanding.CargoAlign.position;
					}
					((Component)componentInChildren).transform.position = position;
					((Component)componentInChildren).transform.localEulerAngles = new Vector3(0f, 180f, 0f);
					componentInChildren.MoveObjectiveItemsToCargo();
					componentInChildren.Open();
				}
				Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
				while (enumerator.MoveNext())
				{
					PlayerAgent current = enumerator.Current;
					ElevatorSeat componentInParent = ((Component)current).GetComponentInParent<ElevatorSeat>();
					GameObject val = new GameObject();
					val.transform.position = new Vector3(0f, 1f, 12f);
					((Component)current).gameObject.transform.parent = val.transform;
					((Component)current).gameObject.transform.position = val.transform.position;
					((Agent)current).Position = val.transform.position;
					current.LastKnownMainDimensionPosition = val.transform.position;
					if ((Object)(object)componentInParent != (Object)null)
					{
						((Component)componentInParent).transform.parent = null;
						((Component)componentInParent).transform.position = ((Component)current).gameObject.transform.position;
					}
				}
				PlayerAgent.TrySetFirstNodeToAllPlayers();
				FocusStateManager.ChangeState((eFocusState)4, false);
				GameStateManager.Current.DoChangeState((eGameStateName)10);
				GameStateManager.Current.m_currentStateName = (eGameStateName)10;
				enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
				while (enumerator.MoveNext())
				{
					enumerator.Current.Locomotion.ChangeState((PLOC_State)0, true);
				}
				GameEventManager.PostEvent((eGameEvent)76, (PlayerAgent)null, 0f, "", (Dictionary<string, string>)null);
				m_cargoCageInUse = false;
				PlayerBackpackManager.ResetLocalAmmoStorage(false);
				PlayerBackpackManager.LocalBackpack.AmmoStorage.FillAllClips();
				if (SNet.IsMaster)
				{
					Enumerator<SNet_Player> enumerator2 = SNet.Slots.SlottedPlayers.GetEnumerator();
					while (enumerator2.MoveNext())
					{
						SNet_Player current2 = enumerator2.Current;
						if (current2.IsBot)
						{
							PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(current2);
							backpack.AmmoStorage.Reset(false);
							backpack.AmmoStorage.FillAllClips();
						}
					}
				}
				WardenObjectiveDataBlock val2 = default(WardenObjectiveDataBlock);
				WardenObjectiveManager.TryGetWardenObjectiveDataForLayer((LG_LayerType)0, 0, ref val2);
				if (WardenObjectiveManager.HasValidWaveSettings(val2.WavesOnElevatorLand))
				{
					WardenObjectiveManager.TriggerEnemyWaves(val2.WavesOnElevatorLand, Builder.GetElevatorArea().m_courseNode, (SurvivalWaveSpawnType)0, 0f, (PlayerAgent)null);
				}
				if (val2.EventsOnElevatorLand.Count > 0)
				{
					WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(val2.EventsOnElevatorLand, (eWardenObjectiveEventTrigger)0, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null);
				}
				if (SNet.IsMaster)
				{
					if (val2.FogTransitionDataOnElevatorLand != 0)
					{
						EnvironmentStateManager.AttemptStartFogTransition(val2.FogTransitionDataOnElevatorLand, val2.FogTransitionDurationOnElevatorLand, (eDimensionIndex)0);
					}
					for (int i = 0; i < Builder.CurrentFloor.m_dimensions.Count; i++)
					{
						Dimension val3 = Builder.CurrentFloor.m_dimensions[i];
						uint num = val3.DimensionData.DimensionFogData;
						if (num == 0)
						{
							num = val2.FogTransitionDataOnElevatorLand;
						}
						if (num != 0)
						{
							EnvironmentStateManager.AttemptStartFogTransition(num, 1f, val3.DimensionIndex);
						}
					}
				}
				((Component)ElevatorRide.Current.m_elevatorCage).gameObject.SetActive(false);
				((Component)ElevatorRide.Current.m_shaftTop).gameObject.SetActive(false);
				ElevatorRide.Current.HideAllSegments();
			}

			[HarmonyPatch(typeof(GS_Generating), "Enter")]
			[HarmonyPrefix]
			internal static bool Enter(GS_Generating __instance)
			{
				//IL_025e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0263: Unknown result type (might be due to invalid IL or missing references)
				//IL_0272: Unknown result type (might be due to invalid IL or missing references)
				//IL_0274: Invalid comparison between Unknown and I4
				//IL_0276: Unknown result type (might be due to invalid IL or missing references)
				//IL_0279: Invalid comparison between Unknown and I4
				CM_PageBase.s_sound.Stop();
				foreach (ElevatorSeat item in Object.FindObjectsOfType<ElevatorSeat>())
				{
					item.m_preReleaseSequence = null;
				}
				m_cargoCageInUse = false;
				((Component)ElevatorRide.Current.m_elevatorCage).gameObject.SetActive(true);
				((Component)ElevatorRide.Current.m_shaftTop).gameObject.SetActive(true);
				if (PlayerAgent.USE_NEW_PLAYER_RIG)
				{
					Enumerator<PlayerAgent> enumerator2 = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
					while (enumerator2.MoveNext())
					{
						PlayerAgent current = enumerator2.Current;
						PlayerBackpackManager.Current.EquipVanityItemsFromBackpack(current.Owner, current.Owner.PlayerSlotIndex(), current.RigSwitch, current.PlayerSyncModel, true, true);
					}
				}
				RundownManager.Current.NewGameSession();
				EnvironmentStateManager.ResetFogSettingsLocal();
				FocusStateManager.MapToggleAllowed = true;
				FocusStateManager.MenuToggleAllowed = true;
				GameEventManager.PostEvent((eGameEvent)72, (PlayerAgent)null, 0f, "", (Dictionary<string, string>)null);
				SNet.Core.SetFriendsData((FriendsDataType)5, "Generating");
				Global.IsGenerating = true;
				FocusStateManager.ExitMenu(true);
				if (Global.UseStaticLevel)
				{
					Builder.Current.Build();
				}
				else
				{
					FocusStateManager.ChangeState((eFocusState)7, false);
					Builder.Current.Build();
					GuiManager.PlayerLayer.ShowWardenIntel(LocalizedText.op_Implicit(RundownManager.ActiveExpedition.Descriptive.RoleplayedWardenIntel), 4f, 6f);
					string text = "<color=orange>";
					float num = RundownManager.Current.ArtifactHeatForActiveExpedition();
					text = ((num < 0.25f) ? (text + Text.Get(803u)) : ((num < 0.4f) ? (text + Text.Get(804u)) : ((num < 0.7f) ? (text + Text.Get(805u)) : ((!(num < 0.9f)) ? (text + Text.Get(807u)) : (text + Text.Get(806u))))));
					text += "</color>";
					string text2 = "<color=orange>" + (num * 100f).ToString("N0") + "%</color>";
					_ = "<size=200%><color=white>" + Text.Format(802u, (Object[])(object)new Object[2]
					{
						Object.op_Implicit(text2),
						Object.op_Implicit(text)
					}) + "</color></size>";
				}
				WardenObjectiveDataBlock val = default(WardenObjectiveDataBlock);
				WardenObjectiveManager.TryGetWardenObjectiveDataForLayer((LG_LayerType)0, 0, ref val);
				eWardenObjectiveType type = val.Type;
				if (val.GenericItemFromStart != 0)
				{
					m_cargoCageInUse = true;
				}
				if ((int)type == 7 || (int)type == 10)
				{
					m_cargoCageInUse = true;
				}
				IWardenObjective val2 = default(IWardenObjective);
				if (WardenObjectiveManager.TryGetWardenObjective((LG_LayerType)0, 0, ref val2))
				{
					val2.OnElevatorStart();
				}
				ElevatorRide.Current.DisableLights();
				return false;
			}
		}

		public static ManualLogSource L;

		public static bool m_cargoCageInUse;

		public override void Load()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			L = ((BasePlugin)this).Log;
			new Harmony("RockBottom").PatchAll();
			EventAPI.OnExpeditionStarted += functions.inlevel;
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "RockBottom";

		public const string Version = "1.0.0";

		public const string VersionPrerelease = null;

		public const string VersionMetadata = null;

		public const string SemVer = "1.0.0";

		public const string GitRevShort = null;

		public const string GitRevLong = null;

		public const string GitBranch = null;

		public const string GitTag = null;

		public const bool GitIsDirty = false;
	}
}