Decompiled source of Ascent 67 v1.0.1

BepInEx/plugins/Ascent_67.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Ascent_67")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Ascent_67")]
[assembly: AssemblyTitle("Ascent 67")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.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;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ascent67
{
	[HarmonyPatch(typeof(BoardingPass), "UpdateAscent")]
	internal static class ascent67
	{
		internal static int cachedAscentIncrease;

		internal static void Prefix(BoardingPass __instance, int ___maxAscent)
		{
			if (__instance.ascentIndex > ___maxAscent && ___maxAscent < 67)
			{
				cachedAscentIncrease = 67 - ___maxAscent;
				___maxAscent = 67;
				__instance.ascentIndex = 67;
				Singleton<AchievementManager>.Instance.SetSteamStat((STEAMSTATTYPE)13, 67);
				Debug.Log((object)(Singleton<AchievementManager>.Instance.GetMaxAscent() + "  " + ___maxAscent + "   " + __instance.ascentIndex));
				__instance.ascentTitle.text = "Ascent 67";
				__instance.ascentDesc.text = "You have to bring the 24 karat gold bing bong whilst covered in mustard";
			}
			if (__instance.ascentIndex == 66)
			{
				__instance.ascentIndex = ___maxAscent - cachedAscentIncrease;
				cachedAscentIncrease = 0;
			}
		}

		internal static void Postfix(BoardingPass __instance, int ___maxAscent)
		{
			if (__instance.ascentIndex < 67 && !((Selectable)__instance.incrementAscentButton).interactable)
			{
				((Selectable)__instance.incrementAscentButton).interactable = true;
			}
		}
	}
	[HarmonyPatch(typeof(RunManager), "StartRun")]
	internal static class ascent67SummonLabubu
	{
		internal static void Prefix(RunManager __instance)
		{
			if (Ascents.currentAscent < 67)
			{
				return;
			}
			foreach (Character allCharacter in Character.AllCharacters)
			{
				allCharacter.refs.items.SpawnItemInHand("AncientIdol");
				CharacterCustomization.SetCharacterSkinColor(2);
			}
		}
	}
	[HarmonyPatch(typeof(Character), "Update")]
	internal class ascent67Effect
	{
		internal static void Postfix(Character __instance)
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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_0110: 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)
			int num = Random.Range(1, 11001);
			if (Ascents.currentAscent >= 67 && num >= 10999 && __instance.data.fallSeconds < 0.1f && !__instance.data.passedOut)
			{
				__instance.RPCA_Fall(1f);
				__instance.refs.items.DropAllItems(false);
				Rigidbody bodypartRig = __instance.GetBodypartRig((BodypartType)16);
				Rigidbody bodypartRig2 = __instance.GetBodypartRig((BodypartType)13);
				Rigidbody bodypartRig3 = __instance.GetBodypartRig((BodypartType)0);
				Rigidbody bodypartRig4 = __instance.GetBodypartRig((BodypartType)4);
				bodypartRig.AddForce((__instance.data.lookDirection_Flat + Vector3.up) * 200f, (ForceMode)1);
				bodypartRig2.AddForce((__instance.data.lookDirection_Flat + Vector3.up) * 200f, (ForceMode)1);
				bodypartRig3.AddForce(Vector3.up * 1500f * 1.5f, (ForceMode)1);
				bodypartRig4.AddForce(__instance.data.lookDirection_Flat * -300f, (ForceMode)1);
			}
		}
	}
	[HarmonyPatch(typeof(Bodypart), "Drag")]
	internal class ascent67Drag
	{
		internal static bool Prefix(Bodypart __instance, float drag, bool ignoreRagdoll = false)
		{
			//IL_0062: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: 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_0188: Unknown result type (might be due to invalid IL or missing references)
			if (!ignoreRagdoll)
			{
				drag = Mathf.Lerp(1f, drag, __instance.character.data.currentRagdollControll);
			}
			if (__instance.rig.isKinematic && Ascents.currentAscent < 67)
			{
				return false;
			}
			if (Ascents.currentAscent < 67)
			{
				Rigidbody rig = __instance.rig;
				rig.linearVelocity *= drag;
				Rigidbody rig2 = __instance.rig;
				rig2.angularVelocity *= drag;
			}
			else
			{
				if (__instance.character.data.isClimbing)
				{
					Rigidbody rig3 = __instance.rig;
					rig3.linearVelocity *= drag;
				}
				else
				{
					__instance.rig.linearVelocity = new Vector3(__instance.rig.linearVelocity.x, drag * __instance.rig.linearVelocity.y, __instance.rig.linearVelocity.z);
				}
				if (Math.Abs(__instance.rig.linearVelocity.x) + Math.Abs(__instance.rig.linearVelocity.z) > 4f)
				{
					__instance.character.refs.movement.movementForce = 5f;
				}
				else
				{
					__instance.character.refs.movement.movementForce = 25f;
				}
				Rigidbody rig4 = __instance.rig;
				rig4.angularVelocity *= drag;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(AscentUI), "Update")]
	internal static class AscentUiFixFor67
	{
		internal static bool Prefix(TextMeshProUGUI ___text)
		{
			int currentAscent = Ascents._currentAscent;
			((TMP_Text)___text).text = "Ascent " + currentAscent;
			if (currentAscent == 0)
			{
				((TMP_Text)___text).text = "";
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(Flare), "Update")]
	internal class ascent67WinCondition
	{
		internal static bool Prefix(Flare __instance)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			bool value = ((ItemComponent)__instance).GetData<BoolItemData>((DataEntryKey)3).Value;
			((ItemComponent)__instance).item.UIData.canPocket = !value;
			((ItemComponent)__instance).item.UIData.canBackpack = !value;
			if (value && !__instance.trackable.hasTracker)
			{
				__instance.EnableFlareVisuals();
			}
			if (value && Object.op_Implicit((Object)(object)((ItemComponent)__instance).item.holderCharacter) && Singleton<MountainProgressHandler>.Instance.IsAtPeak(((ItemComponent)__instance).item.holderCharacter.Center) && !Singleton<PeakHandler>.Instance.summonedHelicopter)
			{
				if (Ascents.currentAscent < 67)
				{
					((Component)__instance).GetComponent<PhotonView>().RPC("TriggerHelicopter", (RpcTarget)3, Array.Empty<object>());
				}
				else
				{
					BackpackData val2 = default(BackpackData);
					foreach (Character allCharacter in Character.AllCharacters)
					{
						bool flag = false;
						if (Object.op_Implicit((Object)(object)allCharacter.data.currentItem) && ((Enum)allCharacter.data.currentItem.itemTags).HasFlag((Enum)(object)(ItemTags)64))
						{
							flag = true;
						}
						ItemSlot[] itemSlots = allCharacter.player.itemSlots;
						foreach (ItemSlot val in itemSlots)
						{
							if (val != null && (Object)(object)val.prefab != (Object)null && ((Enum)val.prefab.itemTags).HasFlag((Enum)(object)(ItemTags)64))
							{
								flag = true;
							}
						}
						if (!((ItemSlot)allCharacter.player.backpackSlot).IsEmpty() && ((ItemSlot)allCharacter.player.backpackSlot).data.TryGetDataEntry<BackpackData>((DataEntryKey)7, ref val2))
						{
							ItemSlot[] itemSlots2 = val2.itemSlots;
							foreach (ItemSlot val3 in itemSlots2)
							{
								if (val3 != null && (Object)(object)val3.prefab != (Object)null && ((Enum)val3.prefab.itemTags).HasFlag((Enum)(object)(ItemTags)64))
								{
									flag = true;
								}
							}
						}
						if (flag)
						{
							((Component)__instance).GetComponent<PhotonView>().RPC("TriggerHelicopter", (RpcTarget)3, Array.Empty<object>());
						}
					}
				}
			}
			return false;
		}
	}
	[BepInPlugin("helloitsmesixseven", "Ascent_67", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log { get; private set; }

		private void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Plugin ascent 67 is loaded!");
			Harmony val = new Harmony("676767");
			val.PatchAll();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}