using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Photon.Pun;
using UnityEngine;
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("Board Flight")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Board Flight")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("088bdbe1-e2f4-43bb-9b89-3fa225dca6ff")]
[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")]
namespace WalkOnBoarding;
[BepInPlugin("tony4twenty.Walk_On_Boarding", "Walk On Boarding", "1.1.0")]
public class WalkOnBoardPlugin : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <CheckLoop>d__14 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public WalkOnBoardPlugin <>4__this;
private Button <startButton>5__1;
private Character[] <characters>5__2;
private Character[] <>s__3;
private int <>s__4;
private Character <character>5__5;
private CharacterData <data>5__6;
private Vector3 <groundPos>5__7;
private AirportCheckInKiosk <kiosk>5__8;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CheckLoop>d__14(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<startButton>5__1 = null;
<characters>5__2 = null;
<>s__3 = null;
<character>5__5 = null;
<data>5__6 = null;
<kiosk>5__8 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Expected O, but got Unknown
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "Airport")
{
if (PhotonNetwork.IsMasterClient && !<>4__this.gameStarted)
{
GameObject obj = GameObject.Find("StartGameButton");
<startButton>5__1 = ((obj != null) ? obj.GetComponent<Button>() : null);
if ((Object)(object)<startButton>5__1 != (Object)null && !((Selectable)<startButton>5__1).interactable)
{
<>4__this.gameStarted = true;
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Start game button is disabled, game likely started. Preventing kiosk reopen.");
}
else
{
<characters>5__2 = Object.FindObjectsByType<Character>((FindObjectsSortMode)0);
<>s__3 = <characters>5__2;
for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++)
{
<character>5__5 = <>s__3[<>s__4];
if (((MonoBehaviourPun)<character>5__5).photonView.IsMine)
{
<data>5__6 = ((Component)<character>5__5).GetComponent<CharacterData>();
if ((Object)(object)<data>5__6 == (Object)null)
{
continue;
}
<groundPos>5__7 = <data>5__6.groundPos;
if (<>4__this.IsInsideTriggerBox(<groundPos>5__7))
{
if (!<>4__this.triggeredBoarding)
{
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Host is inside trigger zone. Triggering Interact_CastFinished...");
<kiosk>5__8 = Object.FindFirstObjectByType<AirportCheckInKiosk>();
if ((Object)(object)<kiosk>5__8 != (Object)null)
{
<kiosk>5__8.Interact_CastFinished(<character>5__5);
<>4__this.triggeredBoarding = true;
}
else
{
((BaseUnityPlugin)<>4__this).Logger.LogWarning((object)"Could not find AirportCheckInKiosk to trigger interaction.");
}
<kiosk>5__8 = null;
}
}
else
{
<>4__this.triggeredBoarding = false;
}
<data>5__6 = null;
}
<character>5__5 = null;
}
<>s__3 = null;
<characters>5__2 = null;
}
<startButton>5__1 = null;
}
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
}
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 GameObject boardingPanel;
private bool triggeredBoarding = false;
private bool gameStarted = false;
private Coroutine checkLoop;
private Vector3 boxMin = new Vector3(30f, 0f, 90f);
private Vector3 boxMax = new Vector3(43f, 2f, 97f);
private static readonly Vector3 beginCornerA = new Vector3(2.3922f, 0.5546f, 107.3045f);
private static readonly Vector3 beginCornerB = new Vector3(22.0822f, 0.568f, 99.7617f);
private ConfigEntry<bool> useBeginningCfg;
private void Awake()
{
useBeginningCfg = ((BaseUnityPlugin)this).Config.Bind<bool>("Trigger", "Use beginning of hallway?", false, "If true, uses beginning-of-hallway trigger box; otherwise uses end-of-hallway.");
ApplyBoxFromConfig();
}
private void ApplyBoxFromConfig()
{
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: 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)
if (useBeginningCfg != null && useBeginningCfg.Value)
{
float num = Mathf.Min(beginCornerA.x, beginCornerB.x);
float num2 = Mathf.Min(beginCornerA.y, beginCornerB.y);
float num3 = Mathf.Min(beginCornerA.z, beginCornerB.z);
float num4 = Mathf.Max(beginCornerA.x, beginCornerB.x);
float num5 = Mathf.Max(beginCornerA.y, beginCornerB.y);
float num6 = Mathf.Max(beginCornerA.z, beginCornerB.z);
boxMin = new Vector3(num, num2, num3);
boxMax = new Vector3(num4, num5, num6);
}
else
{
boxMin = new Vector3(30f, 0f, 90f);
boxMax = new Vector3(43f, 2f, 97f);
}
}
private void OnEnable()
{
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnDisable()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (((Scene)(ref scene)).name == "Airport")
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Airport scene loaded. Attempting to remove sliding doors and kiosk visuals...");
RemoveSlidingDoors();
RemoveCheckInKiosk();
triggeredBoarding = false;
gameStarted = false;
if (checkLoop != null)
{
((MonoBehaviour)this).StopCoroutine(checkLoop);
}
checkLoop = ((MonoBehaviour)this).StartCoroutine(CheckLoop());
}
else if (checkLoop != null)
{
((MonoBehaviour)this).StopCoroutine(checkLoop);
checkLoop = null;
}
}
[IteratorStateMachine(typeof(<CheckLoop>d__14))]
private IEnumerator CheckLoop()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CheckLoop>d__14(0)
{
<>4__this = this
};
}
private bool IsInsideTriggerBox(Vector3 pos)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: 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_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
return pos.x >= boxMin.x && pos.x <= boxMax.x && pos.y >= boxMin.y && pos.y <= boxMax.y && pos.z >= boxMin.z && pos.z <= boxMax.z;
}
private void RemoveSlidingDoors()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
GameObject[] array = rootGameObjects;
foreach (GameObject val in array)
{
Transform val2 = FindDeepChild(val.transform, "Sliding Doors");
if ((Object)(object)val2 != (Object)null)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Found 'Sliding Doors' GameObject. Removing MeshRenderer, MeshFilter, and Collider...");
Object.DestroyImmediate((Object)(object)((Component)val2).GetComponent<MeshRenderer>());
Object.DestroyImmediate((Object)(object)((Component)val2).GetComponent<MeshFilter>());
Object.DestroyImmediate((Object)(object)((Component)val2).GetComponent<Collider>());
return;
}
}
((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find 'Sliding Doors' GameObject in Airport scene.");
}
private void RemoveCheckInKiosk()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
GameObject[] array = rootGameObjects;
foreach (GameObject val in array)
{
Transform val2 = FindDeepChild(val.transform, "AirportGateKiosk");
if ((Object)(object)val2 != (Object)null)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Found 'AirportGateKiosk'. Removing MeshRenderer, MeshFilter, and Collider...");
Object.DestroyImmediate((Object)(object)((Component)val2).GetComponent<MeshRenderer>());
Object.DestroyImmediate((Object)(object)((Component)val2).GetComponent<MeshFilter>());
Object.DestroyImmediate((Object)(object)((Component)val2).GetComponent<Collider>());
return;
}
}
((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find 'AirportGateKiosk' GameObject in Airport scene.");
}
private Transform FindDeepChild(Transform parent, string name)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
foreach (Transform item in parent)
{
Transform val = item;
if (((Object)val).name == name)
{
return val;
}
Transform val2 = FindDeepChild(val, name);
if ((Object)(object)val2 != (Object)null)
{
return val2;
}
}
return null;
}
}