using System;
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 BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Peak;
using Photon.Pun;
using UnityEngine;
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("Limbo")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Limbo")]
[assembly: AssemblyTitle("Limbo")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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]
[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]
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace Limbo
{
[BepInPlugin("Limbo", "Limbo", "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 Limbo is loaded!");
Harmony val = new Harmony("limbo");
val.PatchAll();
}
}
}
namespace TheWall
{
[HarmonyPatch(typeof(PeakGatePortal), "Interact_CastFinished")]
internal static class Restart
{
internal static bool Prefix()
{
if (!PhotonNetwork.IsMasterClient)
{
OkIJustRunCoroutines.Instance.localChar.view.RPC("AskForGen", (RpcTarget)2, Array.Empty<object>());
return false;
}
OkIJustRunCoroutines.Instance.RunGen();
return false;
}
}
public class OkIJustRunCoroutines : MonoBehaviour
{
public static OkIJustRunCoroutines Instance;
public Character localChar;
public void Awake()
{
Instance = this;
}
[PunRPC]
public void AskForGen()
{
RunGen();
}
public void RunGen()
{
Limbo.addToSeed++;
Limbo.lardnessMult += 0.33333f;
Instance.localChar.view.RPC("RestartAndLardUp", (RpcTarget)0, new object[2]
{
Limbo.addToSeed,
Limbo.lardnessMult
});
}
[PunRPC]
public void RestartAndLardUp(int addToSeed, float lardnessMult)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
Random.InitState(((Component)Singleton<MapHandler>.Instance).GetComponent<LevelGeneration>().seed + addToSeed);
foreach (Character allCharacter in Character.AllCharacters)
{
Vector3 val = HelperFunctions.GetGroundPos(new Vector3(2.1947f, 2000.7744f, 164.0367f), (LayerType)1, 0f) + new Vector3(0f, 3f, 0f);
if (!allCharacter.data.dead)
{
allCharacter.WarpPlayer(val, false);
}
else
{
allCharacter.view.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[3] { val, false, 6 });
}
allCharacter.refs.items.SpawnItemInHand("Glizzy");
}
PropSpawner[] componentsInChildren = Limbo.LeVoid.GetComponentsInChildren<PropSpawner>();
componentsInChildren = Limbo.BubbleSort(componentsInChildren);
List<PropSpawner> list = new List<PropSpawner>();
PropSpawner[] array = componentsInChildren;
foreach (PropSpawner val2 in array)
{
if (((Object)val2).name.StartsWith("Ladders") || ((Object)val2).name.StartsWith("Stairs") || ((Object)val2).name.StartsWith("Bridges"))
{
list.Add(val2);
continue;
}
val2.nrOfSpawns += (int)(((float)val2.nrOfSpawns * 0.1f > 1f) ? ((float)val2.nrOfSpawns * 0.1f) : 1f);
((LevelGenStep)val2).ExecuteImmediately();
}
LavaRising componentInChildren = Limbo.LeVoid.GetComponentInChildren<LavaRising>();
componentInChildren.timeTraveled = 0f;
componentInChildren.topTransform.position = new Vector3(componentInChildren.topTransform.position.x, 939.3f * lardnessMult, componentInChildren.topTransform.position.z);
componentInChildren.travelTime = 620f * lardnessMult * 0.98f;
componentInChildren.started = true;
Limbo.LeVoid.transform.parent.localScale = new Vector3(1f, lardnessMult, 1f);
foreach (PropSpawner item in list)
{
item.nrOfSpawns += (int)(((float)item.nrOfSpawns * 0.1f > 1f) ? ((float)item.nrOfSpawns * 0.1f) : 1f);
((LevelGenStep)item).ExecuteImmediately();
}
}
public IEnumerator<WaitForSeconds> WaitToWarp()
{
yield return new WaitForSeconds(10f);
Limbo.addToSeed = 0;
Limbo.lardnessMult = 1f;
((Component)Singleton<OrbFogHandler>.Instance).gameObject.SetActive(false);
MapSegment[] segments = Singleton<MapHandler>.Instance.segments;
foreach (MapSegment g in segments)
{
if ((int)g.biome != 17)
{
g.segmentParent.SetActive(false);
if ((Object)(object)g.wallNext != (Object)null)
{
g.wallNext.SetActive(false);
}
if ((Object)(object)g.wallPrevious != (Object)null)
{
g.wallPrevious.SetActive(false);
}
continue;
}
g.segmentParent.SetActive(true);
Limbo.LeVoid = g.segmentParent;
if ((Object)(object)g.wallNext != (Object)null)
{
g.wallNext.SetActive(false);
}
if ((Object)(object)g.wallPrevious != (Object)null)
{
g.wallPrevious.SetActive(false);
}
}
Vector3 pos = HelperFunctions.GetGroundPos(new Vector3(2.1947f, 2000.7744f, 164.0367f), (LayerType)1, 0f) + new Vector3(0f, 5f, 0f);
localChar.WarpPlayer(pos, false);
}
}
[HarmonyPatch(typeof(Character), "Start")]
internal static class Limbo
{
public static float lardnessMult = 1f;
public static GameObject LeVoid;
public static int addToSeed = 0;
public static PropSpawner[] BubbleSort(PropSpawner[] arr)
{
int num = arr.Length;
for (int i = 0; i < num - 1; i++)
{
for (int j = 0; j < num - i - 1; j++)
{
if (arr[j].nrOfSpawns > arr[j + 1].nrOfSpawns)
{
PropSpawner val = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = val;
}
}
}
return arr;
}
internal static void Postfix(Character __instance)
{
if (!__instance.inAirport && __instance.IsLocal)
{
OkIJustRunCoroutines okIJustRunCoroutines = ((Component)__instance).gameObject.AddComponent<OkIJustRunCoroutines>();
okIJustRunCoroutines.localChar = __instance;
((MonoBehaviour)okIJustRunCoroutines).StartCoroutine((IEnumerator)okIJustRunCoroutines.WaitToWarp());
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}