using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using ExitGames.Client.Photon;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Quick Restart")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Quick Restart")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("89a2838d-6516-48d0-bfaf-bda1077942b6")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("tony4twentys.quickrestart", "Quick Restart", "1.4.1")]
public class QuickRestartPlugin : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <AutoClickMainMenuButton>d__40 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public QuickRestartPlugin <>4__this;
private Button <targetButton>5__1;
private Exception <ex>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <AutoClickMainMenuButton>d__40(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<targetButton>5__1 = null;
<ex>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Quick Restart: Waiting {<>4__this.mainMenuClickDelay.Value} seconds before clicking {<>4__this.mainMenuButtonChoice.Value}");
<>2__current = (object)new WaitForSeconds(<>4__this.mainMenuClickDelay.Value);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
try
{
GameObject obj = GameObject.Find(<>4__this.mainMenuButtonChoice.Value);
<targetButton>5__1 = ((obj != null) ? obj.GetComponent<Button>() : null);
if ((Object)(object)<targetButton>5__1 != (Object)null)
{
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)("Quick Restart: Found " + <>4__this.mainMenuButtonChoice.Value + ", clicking it"));
((UnityEvent)<targetButton>5__1.onClick).Invoke();
}
else
{
((BaseUnityPlugin)<>4__this).Logger.LogWarning((object)("Quick Restart: " + <>4__this.mainMenuButtonChoice.Value + " not found"));
}
<targetButton>5__1 = null;
}
catch (Exception ex)
{
<ex>5__2 = ex;
((BaseUnityPlugin)<>4__this).Logger.LogError((object)("Quick Restart: Error auto-clicking " + <>4__this.mainMenuButtonChoice.Value + ": " + <ex>5__2.Message));
}
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <DelayedRestart>d__32 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public QuickRestartPlugin <>4__this;
private bool <isSolo>5__1;
private float <charWait>5__2;
private float <charMaxWait>5__3;
private AirportCheckInKiosk <kiosk>5__4;
private float <maxWait>5__5;
private float <timer>5__6;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DelayedRestart>d__32(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<kiosk>5__4 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Expected O, but got Unknown
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Expected O, but got Unknown
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Expected O, but got Unknown
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<isSolo>5__1 = PhotonNetwork.OfflineMode || PhotonNetwork.CurrentRoom == null || PhotonNetwork.CurrentRoom.PlayerCount <= 1;
if (!<isSolo>5__1)
{
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Quick Restart: Countdown starting");
<>2__current = (object)new WaitForSeconds(<>4__this.restartDelaySeconds.Value);
<>1__state = 1;
return true;
}
goto IL_0173;
case 1:
<>1__state = -1;
<maxWait>5__5 = 10f;
<timer>5__6 = 0f;
goto IL_0147;
case 2:
<>1__state = -1;
<timer>5__6 += 0.5f;
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Quick Restart: Waiting for players ({PhotonNetwork.PlayerList.Length}/{PhotonNetwork.CurrentRoom.PlayerCount})");
goto IL_0147;
case 3:
<>1__state = -1;
<charWait>5__2 += 0.5f;
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Quick Restart: Waiting for Character to load");
goto IL_01d5;
case 4:
<>1__state = -1;
<kiosk>5__4 = Object.FindFirstObjectByType<AirportCheckInKiosk>();
if ((Object)(object)<kiosk>5__4 != (Object)null)
{
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Quick Restart: Starting next run from Airport");
<>4__this.TrySetRandomSeed();
if (<>4__this.useDailySeed)
{
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.WaitAndStartGame(<kiosk>5__4));
<>1__state = 5;
return true;
}
<kiosk>5__4.StartGame(Ascents.currentAscent);
}
else
{
((BaseUnityPlugin)<>4__this).Logger.LogWarning((object)"Quick Restart: Kiosk not found after delay");
}
break;
case 5:
{
<>1__state = -1;
break;
}
IL_01d5:
if (Character.AllCharacters.Count <= 0 && <charWait>5__2 < <charMaxWait>5__3)
{
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 3;
return true;
}
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 4;
return true;
IL_0173:
<charWait>5__2 = 0f;
<charMaxWait>5__3 = 10f;
goto IL_01d5;
IL_0147:
if (PhotonNetwork.PlayerList.Length < PhotonNetwork.CurrentRoom.PlayerCount && <timer>5__6 < <maxWait>5__5)
{
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 2;
return true;
}
goto IL_0173;
}
<>4__this.shouldAutoRestart = false;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <ForceLoadTitleScene>d__23 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public QuickRestartPlugin <>4__this;
private string <currentScene>5__1;
private Exception <ex>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ForceLoadTitleScene>d__23(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<currentScene>5__1 = null;
<ex>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
try
{
Scene activeScene = SceneManager.GetActiveScene();
<currentScene>5__1 = ((Scene)(ref activeScene)).name;
if (<currentScene>5__1 != "Title")
{
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Quick Restart: Force loading Title scene to skip startup screens.");
SceneManager.LoadScene("Title", (LoadSceneMode)0);
}
else
{
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Quick Restart: Already in Title scene.");
}
<currentScene>5__1 = null;
}
catch (Exception ex)
{
<ex>5__2 = ex;
((BaseUnityPlugin)<>4__this).Logger.LogError((object)("Quick Restart: Error force loading Title scene: " + <ex>5__2.Message));
}
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SkipSplashScreenCoroutine>d__22 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public QuickRestartPlugin <>4__this;
private Exception <ex>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SkipSplashScreenCoroutine>d__22(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<ex>5__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
try
{
SplashScreen.Stop((StopBehavior)0);
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Quick Restart: Splash screen skipped successfully.");
}
catch (Exception ex)
{
<ex>5__1 = ex;
((BaseUnityPlugin)<>4__this).Logger.LogWarning((object)("Quick Restart: Could not skip splash screen: " + <ex>5__1.Message));
}
((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.ForceLoadTitleScene());
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <WaitAndStartGame>d__34 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public AirportCheckInKiosk kiosk;
public QuickRestartPlugin <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WaitAndStartGame>d__34(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Quick Restart: Starting game after property sync");
kiosk.StartGame(Ascents.currentAscent);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <WaitAndStartGameFromAirport>d__35 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public QuickRestartPlugin <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WaitAndStartGameFromAirport>d__35(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.TryStartGameFromAirport();
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();
}
}
private string previousScene = "";
private bool shouldAutoRestart = false;
private bool useRandomSeed = false;
private bool useDailySeed = false;
private bool hasAutoClickedMainMenuButton = false;
private ConfigEntry<KeyCode> menuKey;
private ConfigEntry<float> restartDelaySeconds;
private ConfigEntry<bool> skipSplashScreen;
private ConfigEntry<float> mainMenuClickDelay;
private ConfigEntry<bool> enableMainMenuAutoClick;
private ConfigEntry<string> mainMenuButtonChoice;
private ConfigEntry<float> menuX;
private ConfigEntry<float> menuY;
private ConfigEntry<bool> enableHotkeys;
private ConfigEntry<KeyCode> hotkeyAscentKiosk;
private ConfigEntry<KeyCode> hotkeyQuickRestart;
private ConfigEntry<KeyCode> hotkeyDailySeed;
private ConfigEntry<KeyCode> hotkeyReturnToAirport;
private ConfigEntry<KeyCode> hotkeyRandomSeed;
private bool showMenu = false;
private Rect menuRect;
private void Awake()
{
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
menuKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "MenuKey", (KeyCode)291, "Key to open the Quick Restart menu.");
restartDelaySeconds = ((BaseUnityPlugin)this).Config.Bind<float>("General", "RestartDelaySeconds", 5f, "Delay before restarting after returning to the Airport. Best around 5 seconds for multiplayer syncing");
skipSplashScreen = ((BaseUnityPlugin)this).Config.Bind<bool>("MainMenu", "SkipSplashScreen", true, "Skip the splash screen when the game starts.");
enableMainMenuAutoClick = ((BaseUnityPlugin)this).Config.Bind<bool>("MainMenu", "EnableAutoClick", true, "Automatically click a button when reaching the main menu.");
mainMenuButtonChoice = ((BaseUnityPlugin)this).Config.Bind<string>("MainMenu", "ButtonChoice", "Button_PlayWithFriends", "Which button to automatically click: 'Button_PlayWithFriends' or 'Button_PlaySolo'.");
mainMenuClickDelay = ((BaseUnityPlugin)this).Config.Bind<float>("MainMenu", "MainMenuClickDelay", 1f, "Delay before clicking button when reaching main menu (seconds).");
menuX = ((BaseUnityPlugin)this).Config.Bind<float>("Menu", "PositionX", 50f, "X position of the menu window.");
menuY = ((BaseUnityPlugin)this).Config.Bind<float>("Menu", "PositionY", 50f, "Y position of the menu window.");
enableHotkeys = ((BaseUnityPlugin)this).Config.Bind<bool>("Hotkeys", "EnableHotkeys", false, "Enable hotkey functionality for quick actions.");
hotkeyAscentKiosk = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "AscentKioskKey", (KeyCode)282, "Hotkey for Ascent Kiosk interaction.");
hotkeyQuickRestart = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "QuickRestartKey", (KeyCode)283, "Hotkey for Quick Restart.");
hotkeyDailySeed = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "DailySeedKey", (KeyCode)284, "Hotkey for Daily Seed Start.");
hotkeyReturnToAirport = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "ReturnToAirportKey", (KeyCode)285, "Hotkey for Return to Airport.");
hotkeyRandomSeed = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "RandomSeedKey", (KeyCode)286, "Hotkey for Random Seed Start.");
menuRect = new Rect(menuX.Value, menuY.Value, 300f, 400f);
SceneManager.sceneLoaded += OnSceneLoaded;
if (skipSplashScreen.Value)
{
((MonoBehaviour)this).StartCoroutine(SkipSplashScreenCoroutine());
}
}
[IteratorStateMachine(typeof(<SkipSplashScreenCoroutine>d__22))]
private IEnumerator SkipSplashScreenCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SkipSplashScreenCoroutine>d__22(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<ForceLoadTitleScene>d__23))]
private IEnumerator ForceLoadTitleScene()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ForceLoadTitleScene>d__23(0)
{
<>4__this = this
};
}
private void OnDestroy()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
}
private void Update()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if (!PhotonNetwork.InRoom || !PhotonNetwork.IsMasterClient)
{
return;
}
if (Input.GetKeyDown(menuKey.Value))
{
showMenu = !showMenu;
((BaseUnityPlugin)this).Logger.LogInfo((object)("Quick Restart: Menu " + (showMenu ? "opened" : "closed")));
if (!showMenu)
{
Cursor.lockState = (CursorLockMode)1;
Cursor.visible = false;
}
}
if (enableHotkeys.Value)
{
HandleHotkeys();
}
}
private void HandleHotkeys()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: 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_010f: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: 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)
if (Input.GetKeyDown(hotkeyAscentKiosk.Value))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Ascent Kiosk hotkey pressed");
CallInteractCastFinished();
}
Scene activeScene;
if (Input.GetKeyDown(hotkeyQuickRestart.Value))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Quick Restart hotkey pressed");
useRandomSeed = false;
useDailySeed = false;
activeScene = SceneManager.GetActiveScene();
string name = ((Scene)(ref activeScene)).name;
if (name == "Airport")
{
TryStartGameFromAirport();
}
else
{
TriggerReturnToAirport();
}
}
if (Input.GetKeyDown(hotkeyDailySeed.Value))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Daily Seed Start hotkey pressed");
useRandomSeed = false;
useDailySeed = true;
SetShouldRandomise(value: false);
activeScene = SceneManager.GetActiveScene();
string name2 = ((Scene)(ref activeScene)).name;
if (name2 == "Airport")
{
((MonoBehaviour)this).StartCoroutine(WaitAndStartGameFromAirport());
}
else
{
TriggerReturnToAirport();
}
}
if (Input.GetKeyDown(hotkeyReturnToAirport.Value))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Return to Airport hotkey pressed");
shouldAutoRestart = false;
GameOverHandler val = Object.FindFirstObjectByType<GameOverHandler>();
if ((Object)(object)val != (Object)null)
{
val.ForceEveryPlayerDoneWithEndScreen();
}
}
if (Input.GetKeyDown(hotkeyRandomSeed.Value))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Random Seed Start hotkey pressed");
useRandomSeed = true;
useDailySeed = false;
SetShouldRandomise(value: true);
SetNewRandomSeed();
activeScene = SceneManager.GetActiveScene();
string name3 = ((Scene)(ref activeScene)).name;
if (name3 == "Airport")
{
TryStartGameFromAirport();
}
else
{
TriggerReturnToAirport();
}
}
}
private void OnGUI()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
if (showMenu)
{
menuRect = new Rect(menuX.Value, menuY.Value, 300f, 400f);
menuRect = GUI.Window(0, menuRect, new WindowFunction(DrawMenuWindow), "Quick Restart Menu");
HandleMenuInput();
}
}
private void HandleMenuInput()
{
//IL_001a: 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)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
Cursor.lockState = (CursorLockMode)0;
Cursor.visible = true;
if (Input.GetMouseButtonDown(0))
{
Vector2 val = Vector2.op_Implicit(Input.mousePosition);
val.y = (float)Screen.height - val.y;
if (((Rect)(ref menuRect)).Contains(val))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Menu clicked");
}
}
}
private void DrawMenuWindow(int windowID)
{
//IL_0176: 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_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_037f: Unknown result type (might be due to invalid IL or missing references)
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
GUILayout.BeginVertical(GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[2]
{
GUILayout.ExpandWidth(true),
GUILayout.ExpandHeight(true)
});
GUILayout.Label("Quick Restart Options", GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
if (enableHotkeys.Value)
{
GUILayout.Label("Hotkeys: F1-F5 (Enabled)", GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
}
else
{
GUILayout.Label("Hotkeys: Disabled", GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
}
GUILayout.Space(10f);
string text = "\ud83c\udfaf Ascent Kiosk";
if (enableHotkeys.Value)
{
text += " (F1)";
}
if (GUILayout.Button(text, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Ascent Kiosk requested");
CallInteractCastFinished();
showMenu = false;
}
GUILayout.Space(5f);
string text2 = "\ud83d\udd04 Quick Restart";
if (enableHotkeys.Value)
{
text2 += " (F2)";
}
Scene activeScene;
if (GUILayout.Button(text2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }))
{
useRandomSeed = false;
useDailySeed = false;
activeScene = SceneManager.GetActiveScene();
string name = ((Scene)(ref activeScene)).name;
if (name == "Airport")
{
TryStartGameFromAirport();
}
else
{
TriggerReturnToAirport();
}
showMenu = false;
}
GUILayout.Space(5f);
string text3 = "\ud83d\udcc5 Daily Seed Start";
if (enableHotkeys.Value)
{
text3 += " (F3)";
}
if (GUILayout.Button(text3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }))
{
useRandomSeed = false;
useDailySeed = true;
SetShouldRandomise(value: false);
activeScene = SceneManager.GetActiveScene();
string name2 = ((Scene)(ref activeScene)).name;
if (name2 == "Airport")
{
((MonoBehaviour)this).StartCoroutine(WaitAndStartGameFromAirport());
}
else
{
TriggerReturnToAirport();
}
showMenu = false;
}
GUILayout.Space(5f);
string text4 = "✈\ufe0f Return to Airport";
if (enableHotkeys.Value)
{
text4 += " (F4)";
}
if (GUILayout.Button(text4, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Return to airport requested");
shouldAutoRestart = false;
GameOverHandler val = Object.FindFirstObjectByType<GameOverHandler>();
if ((Object)(object)val != (Object)null)
{
val.ForceEveryPlayerDoneWithEndScreen();
}
showMenu = false;
}
GUILayout.Space(10f);
GUILayout.Label("Terrain Randomizer", GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
GUILayout.Space(5f);
string text5 = "\ud83c\udfb2 Random Seed Start";
if (enableHotkeys.Value)
{
text5 += " (F5)";
}
if (GUILayout.Button(text5, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }))
{
useRandomSeed = true;
useDailySeed = false;
SetShouldRandomise(value: true);
SetNewRandomSeed();
activeScene = SceneManager.GetActiveScene();
string name3 = ((Scene)(ref activeScene)).name;
if (name3 == "Airport")
{
TryStartGameFromAirport();
}
else
{
TriggerReturnToAirport();
}
showMenu = false;
}
GUILayout.Space(10f);
if (GUILayout.Button("❌ Close Menu", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
{
showMenu = false;
}
GUILayout.EndVertical();
GUI.DragWindow();
}
private void TriggerReturnToAirport()
{
GameOverHandler val = Object.FindFirstObjectByType<GameOverHandler>();
if ((Object)(object)val != (Object)null)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Forcing all players to close end screen...");
val.ForceEveryPlayerDoneWithEndScreen();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Returning to airport, will auto-restart.");
shouldAutoRestart = true;
}
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
string name = ((Scene)(ref scene)).name;
if (name == "Airport" && shouldAutoRestart)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Airport scene loaded, starting countdown");
((MonoBehaviour)this).StartCoroutine(DelayedRestart());
}
else if (name == "Title")
{
if (enableMainMenuAutoClick.Value && !hasAutoClickedMainMenuButton)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Main menu detected, auto-clicking configured button");
hasAutoClickedMainMenuButton = true;
((MonoBehaviour)this).StartCoroutine(AutoClickMainMenuButton());
}
else if (enableMainMenuAutoClick.Value && hasAutoClickedMainMenuButton)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Main menu detected but auto-click already performed, skipping");
}
else
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Main menu detected but auto-click is disabled");
}
}
previousScene = name;
}
[IteratorStateMachine(typeof(<DelayedRestart>d__32))]
private IEnumerator DelayedRestart()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DelayedRestart>d__32(0)
{
<>4__this = this
};
}
private void TryStartGameFromAirport()
{
AirportCheckInKiosk val = Object.FindFirstObjectByType<AirportCheckInKiosk>();
if ((Object)(object)val == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Quick Restart: No AirportCheckInKiosk found!");
return;
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Manually starting game from Airport");
TrySetRandomSeed();
if (useDailySeed)
{
((MonoBehaviour)this).StartCoroutine(WaitAndStartGame(val));
}
else
{
val.StartGame(Ascents.currentAscent);
}
}
[IteratorStateMachine(typeof(<WaitAndStartGame>d__34))]
private IEnumerator WaitAndStartGame(AirportCheckInKiosk kiosk)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WaitAndStartGame>d__34(0)
{
<>4__this = this,
kiosk = kiosk
};
}
[IteratorStateMachine(typeof(<WaitAndStartGameFromAirport>d__35))]
private IEnumerator WaitAndStartGameFromAirport()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WaitAndStartGameFromAirport>d__35(0)
{
<>4__this = this
};
}
private void SetShouldRandomise(bool value)
{
Hashtable customProperties = ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties;
customProperties[(object)"shouldRandomise"] = value;
PhotonNetwork.CurrentRoom.SetCustomProperties(customProperties, (Hashtable)null, (WebFlags)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Quick Restart: Set shouldRandomise = {value}");
}
private void SetNewRandomSeed()
{
int num = Random.Range(1, 10001);
Hashtable customProperties = ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties;
customProperties[(object)"seed"] = num;
PhotonNetwork.CurrentRoom.SetCustomProperties(customProperties, (Hashtable)null, (WebFlags)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Quick Restart: Set new random seed = {num}");
}
private void TrySetRandomSeed()
{
if (useRandomSeed)
{
SetShouldRandomise(value: true);
SetNewRandomSeed();
}
}
private void CallInteractCastFinished()
{
Character val = null;
if (Character.AllCharacters != null && Character.AllCharacters.Count > 0)
{
val = ((IEnumerable<Character>)Character.AllCharacters).FirstOrDefault((Func<Character, bool>)((Character c) => (Object)(object)c.refs?.view != (Object)null && c.refs.view.OwnerActorNr == PhotonNetwork.LocalPlayer.ActorNumber));
}
if ((Object)(object)val == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Quick Restart: No local character found for Interact_CastFinished call.");
return;
}
AirportCheckInKiosk val2 = Object.FindFirstObjectByType<AirportCheckInKiosk>();
if ((Object)(object)val2 == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Quick Restart: No AirportCheckInKiosk found for Interact_CastFinished call.");
return;
}
try
{
val2.Interact_CastFinished(val);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Restart: Successfully called Interact_CastFinished on kiosk");
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Quick Restart: Error calling Interact_CastFinished: " + ex.Message));
}
}
[IteratorStateMachine(typeof(<AutoClickMainMenuButton>d__40))]
private IEnumerator AutoClickMainMenuButton()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <AutoClickMainMenuButton>d__40(0)
{
<>4__this = this
};
}
}