using System;
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.Logging;
using FireExitLadders.Plugin;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FireExitLadders")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FireExitLadders")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bd78aa7e-f834-4e2f-85c3-9e9a7069c8c6")]
[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 FireExitLadders
{
[BepInPlugin("cobster.exitdoor", "exitdoor", "1.0.0.0")]
public class MainInitialiser : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("cobster.exitdoor");
private static MainInitialiser Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("cobster.exitdoor");
mls.LogInfo((object)"cobster.exitdoor ONLINE");
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
harmony.PatchAll(typeof(MainInitialiser));
harmony.PatchAll(typeof(MainPatch2));
}
}
}
namespace FireExitLadders.Plugin
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class MainPatch2
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void updateObject()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
if (!Object.op_Implicit((Object)(object)GameObject.Find("exitDoorLadderCreator")))
{
GameObject val = new GameObject("exitDoorLadderCreator");
val.AddComponent<ladderMonoBehavior>();
}
}
}
public class ladderMonoBehavior : MonoBehaviour
{
private GameObject MainTrigger;
private int LoadedScene = 0;
private List<GameObject> AddedLadders = new List<GameObject>();
private List<LadderDetails> LadderQueue = new List<LadderDetails>();
public bool FoundALevelScene = false;
private void FixedUpdate()
{
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
int sceneCount = SceneManager.sceneCount;
FoundALevelScene = false;
for (int i = 0; i < LadderQueue.Count; i++)
{
if (CreateNewLadder(LadderQueue[i], LadderQueue[i].index))
{
LadderQueue.Remove(LadderQueue[i]);
}
}
GameObject val = GameObject.Find("PARENT LADDER");
if ((Object)(object)val != (Object)null)
{
for (int j = 0; j < val.transform.childCount; j++)
{
GameObject gameObject = ((Component)val.transform.GetChild(j)).gameObject;
if (!(((Object)gameObject).name == "MAIN LADDER TRIGGER") && gameObject.transform.childCount != 0)
{
Object.Destroy((Object)(object)((Component)gameObject.transform.GetChild(0)).gameObject);
}
}
}
for (int k = 0; k < sceneCount; k++)
{
Scene sceneAt = SceneManager.GetSceneAt(k);
if (((Scene)(ref sceneAt)).isLoaded)
{
switch (((Scene)(ref sceneAt)).name)
{
case "Level1Experimentation":
CheckForLoad(1);
FoundALevelScene = true;
break;
case "Level2Assurance":
CheckForLoad(2);
FoundALevelScene = true;
break;
case "Level3Vow":
CheckForLoad(3);
FoundALevelScene = true;
break;
case "Level4March":
CheckForLoad(4);
FoundALevelScene = true;
break;
case "Level5Rend":
CheckForLoad(5);
FoundALevelScene = true;
break;
case "Level6Dine":
CheckForLoad(6);
FoundALevelScene = true;
break;
case "Level7Offense":
CheckForLoad(7);
FoundALevelScene = true;
break;
case "Level8Titan":
CheckForLoad(8);
FoundALevelScene = true;
break;
}
}
}
if (!FoundALevelScene)
{
CheckForUnload();
}
}
public bool CreateNewLadder(LadderDetails det, int index)
{
//IL_00e0: 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_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
det.index = index;
if ((Object)(object)GameObject.Find("OutsideShipRoom") == (Object)null)
{
if (!LadderQueue.Contains(det))
{
LadderQueue.Add(det);
}
return false;
}
GameObject val = Object.Instantiate<GameObject>(((Component)GameObject.Find("OutsideShipRoom").transform.Find("Ladder")).gameObject);
det.Created = true;
det.ladderObj = val;
if (index > 0)
{
val.transform.SetParent(MainTrigger.transform.parent);
val.transform.localPosition = det.position;
val.transform.localEulerAngles = Vector3.zero;
}
else
{
((Object)val).name = "PARENT LADDER";
val.transform.position = det.position;
val.transform.eulerAngles = det.rotation;
MainTrigger = ((Component)val.transform.Find("LadderTrigger")).gameObject;
((Object)MainTrigger).name = "MAIN LADDER TRIGGER";
MainTrigger.transform.localPosition = det.trigPos;
MainTrigger.transform.localScale = det.trigSca;
}
AddedLadders.Add(val);
return true;
}
public void CreateNewWalkway(Vector3 pos, Vector3 rot, Vector3 scale)
{
//IL_0017: 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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: 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)
GameObject val = Object.Instantiate<GameObject>(GameObject.Find("CatwalkShip"));
val.transform.position = pos;
val.transform.eulerAngles = rot;
val.transform.localScale = scale;
GameObject val2 = Object.Instantiate<GameObject>(GameObject.Find("CatwalkRailLiningB"));
val2.transform.position = pos;
val2.transform.eulerAngles = rot;
val2.transform.localScale = scale;
AddedLadders.Add(val2);
AddedLadders.Add(val);
}
public void CreateLights(LightDetails[] lighttrail)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < lighttrail.Length; i++)
{
LightDetails lightDetails = lighttrail[i];
GameObject val = new GameObject("cobster.exitdoor LIGHT OBJECT");
Light val2 = val.AddComponent<Light>();
val2.intensity = lightDetails.intensity;
val2.color = Color.op_Implicit(lightDetails.Color);
val.transform.position = lightDetails.Position;
AddedLadders.Add(val);
}
}
public void LoadLevelAdditives(int sceneid)
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
LadderDetails[] array = new LadderDetails[0];
switch (sceneid)
{
case 1:
Debug.Log((object)"Loaded Experimentation Exit Door Ladders : (cobster.exitdoor)");
array = FireExitMapDetails.ExperimentationExitLadders;
break;
case 2:
Debug.Log((object)"Loaded Asssurance Exit Door Ladders : (cobster.exitdoor)");
CreateNewWalkway(new Vector3(109.2948f, 14.3255f, -61.5236f), new Vector3(270f, 32.7873f, 0f), new Vector3(1f, 1f, 0.0878f));
array = FireExitMapDetails.AssuranceExitLadders;
break;
case 3:
Debug.Log((object)"Loaded Vow Exit Door Ladders : (cobster.exitdoor)");
array = FireExitMapDetails.VowExitLadders;
break;
case 4:
Debug.Log((object)"Loaded March Exit Door Ladders : (cobster.exitdoor)");
array = FireExitMapDetails.MarchExitLadders;
break;
case 5:
Debug.Log((object)"Loaded Rend Exit Door Ladders : (cobster.exitdoor)");
CreateNewWalkway(new Vector3(-73.6975f, -13.194f, -121.1399f), new Vector3(270f, 339.8019f, 0f), new Vector3(2f, 2f, 0.1678f));
CreateLights(FireExitMapDetails.RendLightTrail);
array = FireExitMapDetails.RendExitLadders;
break;
case 6:
Debug.Log((object)"Loaded Dine Exit Door Ladders : (cobster.exitdoor)");
CreateNewWalkway(new Vector3(-46.0223f, 4.4286f, -83.1384f), new Vector3(90f, 126.7368f, 0f), new Vector3(2f, 2f, 0.1678f));
array = FireExitMapDetails.DineExitLadders;
break;
case 7:
Debug.Log((object)"Loaded Offense Exit Door Ladders : (cobster.exitdoor)");
array = FireExitMapDetails.OffenseExitLadders;
break;
case 8:
Debug.Log((object)"Loaded Titan Exit Door Ladders : (cobster.exitdoor)");
array = FireExitMapDetails.TitanExitLadders;
break;
}
for (int i = 0; i < array.Length; i++)
{
CreateNewLadder(array[i], i);
}
}
public void CheckForLoad(int sceneid)
{
if (LoadedScene == 0)
{
LoadedScene = sceneid;
LoadLevelAdditives(sceneid);
}
}
public void CheckForUnload()
{
if (LoadedScene != 0)
{
ResetLadderDetails(ActiveSceneDetails());
LoadedScene = 0;
for (int i = 0; i < AddedLadders.Count; i++)
{
GameObject val = AddedLadders[i];
Object.Destroy((Object)(object)val);
}
MainTrigger = null;
AddedLadders = new List<GameObject>();
}
}
public LadderDetails[] ActiveSceneDetails()
{
return LoadedScene switch
{
1 => FireExitMapDetails.ExperimentationExitLadders,
2 => FireExitMapDetails.AssuranceExitLadders,
3 => FireExitMapDetails.VowExitLadders,
4 => FireExitMapDetails.MarchExitLadders,
5 => FireExitMapDetails.RendExitLadders,
6 => FireExitMapDetails.DineExitLadders,
7 => FireExitMapDetails.OffenseExitLadders,
8 => FireExitMapDetails.TitanExitLadders,
_ => new LadderDetails[0],
};
}
public void ResetLadderDetails(LadderDetails[] dets)
{
for (int i = 0; i < dets.Length; i++)
{
dets[i].Created = false;
}
}
}
public static class FireExitMapDetails
{
public static LadderDetails[] ExperimentationExitLadders = new LadderDetails[4]
{
new LadderDetails(new Vector3(-121.2548f, 3f, -52.7786f), new Vector3(0f, 180f, 0f), new Vector3(-0.2758f, 19.1444f, -0.6996f), new Vector3(1.5025f, 40f, 0.5839f)),
new LadderDetails(new Vector3(0f, 9.0227f, 0f), Vector3.zero, Vector3.zero, Vector3.zero),
new LadderDetails(new Vector3(0f, 18.18f, 0f), Vector3.zero, Vector3.zero, Vector3.zero),
new LadderDetails(new Vector3(0f, 26.9448f, 0f), Vector3.zero, Vector3.zero, Vector3.zero)
};
public static LadderDetails[] AssuranceExitLadders = new LadderDetails[2]
{
new LadderDetails(new Vector3(108.7475f, 4.36f, -58.9745f), new Vector3(0f, 31.6f, 0f), new Vector3(-0.2758f, 10.8932f, -0.6995f), new Vector3(1.5025f, 16f, 0.5839f)),
new LadderDetails(new Vector3(0f, 8.9076f, 0f), Vector3.zero, Vector3.zero, Vector3.zero)
};
public static LadderDetails[] VowExitLadders = new LadderDetails[0];
public static LadderDetails[] OffenseExitLadders = new LadderDetails[3]
{
new LadderDetails(new Vector3(22.4995f, 6.1249f, -43.5538f), new Vector3(0f, 3f, 0f), new Vector3(-0.2758f, 4.95f, -0.6995f), new Vector3(1.5025f, 22.5f, 0.5839f)),
new LadderDetails(new Vector3(0.0163f, 6.6811f, 0f), Vector3.zero, Vector3.zero, Vector3.zero),
new LadderDetails(new Vector3(0.0163f, -8.9989f, 0f), Vector3.zero, Vector3.zero, Vector3.zero)
};
public static LadderDetails[] MarchExitLadders = new LadderDetails[0];
public static LadderDetails[] RendExitLadders = new LadderDetails[4]
{
new LadderDetails(new Vector3(-76.9147f, -33.5369f, -122.6359f), new Vector3(0f, 339.5443f, 0f), new Vector3(-0.2758f, 19.1059f, -0.6995f), new Vector3(1.5025f, 40f, 0.5839f)),
new LadderDetails(new Vector3(0.0163f, 9.0048f, 0f), Vector3.zero, Vector3.zero, Vector3.zero),
new LadderDetails(new Vector3(0.0163f, 17.9971f, 0f), Vector3.zero, Vector3.zero, Vector3.zero),
new LadderDetails(new Vector3(0.0163f, 26.9281f, 0f), Vector3.zero, Vector3.zero, Vector3.zero)
};
public static LadderDetails[] DineExitLadders = new LadderDetails[2]
{
new LadderDetails(new Vector3(-40.1984f, -5.9383f, -83.0799f), new Vector3(0f, 126.516f, 0f), new Vector3(-0.1009f, 12.1365f, -0.6995f), new Vector3(1.5025f, 10.1765f, 0.5839f)),
new LadderDetails(new Vector3(0.0163f, 9.0048f, 0f), Vector3.zero, Vector3.zero, Vector3.zero)
};
public static LadderDetails[] TitanExitLadders = new LadderDetails[0];
public static LightDetails[] RendLightTrail = new LightDetails[9]
{
new LightDetails(new Vector3(-68.4192f, -9.2144f, -120.6189f), 100f, new Vector4(1f, 1f, 0.88f, 1f)),
new LightDetails(new Vector3(-57.2119f, -9.0689f, -118.179f), 100f, new Vector4(1f, 1f, 0.88f, 1f)),
new LightDetails(new Vector3(-42.9938f, -9.4325f, -116.7244f), 100f, new Vector4(1f, 1f, 0.88f, 1f)),
new LightDetails(new Vector3(-33.0301f, -11.6325f, -120.6862f), 100f, new Vector4(1f, 1f, 0.88f, 1f)),
new LightDetails(new Vector3(-26.0119f, -14.1598f, -124.559f), 100f, new Vector4(1f, 1f, 0.88f, 1f)),
new LightDetails(new Vector3(-15.1756f, -15.378f, -125.8862f), 100f, new Vector4(1f, 1f, 0.88f, 1f)),
new LightDetails(new Vector3(-7.5574f, -15.6544f, -125.8862f), 100f, new Vector4(1f, 1f, 0.88f, 1f)),
new LightDetails(new Vector3(-75.6192f, -12.7598f, -122.5788f), 100f, new Vector4(1f, 1f, 0.88f, 1f)),
new LightDetails(new Vector3(-77.6011f, -31.8144f, -123.128f), 20f, new Vector4(1f, 1f, 0.88f, 1f))
};
public static Vector3[] ExperimentationExitScans = (Vector3[])(object)new Vector3[1]
{
new Vector3(0f, 0f, 0f)
};
public static Vector3[] AssuranceExitScans = (Vector3[])(object)new Vector3[1]
{
new Vector3(0f, 0f, 0f)
};
public static Vector3[] VowExitScans = (Vector3[])(object)new Vector3[1]
{
new Vector3(0f, 0f, 0f)
};
public static Vector3[] OffenseExitScans = (Vector3[])(object)new Vector3[1]
{
new Vector3(0f, 0f, 0f)
};
public static Vector3[] MarchExitScans = (Vector3[])(object)new Vector3[3]
{
new Vector3(0f, 0f, 0f),
new Vector3(0f, 0f, 0f),
new Vector3(0f, 0f, 0f)
};
public static Vector3[] RendExitScans = (Vector3[])(object)new Vector3[1]
{
new Vector3(0f, 0f, 0f)
};
public static Vector3[] DineExitScans = (Vector3[])(object)new Vector3[1]
{
new Vector3(0f, 0f, 0f)
};
public static Vector3[] TitanExitScans = (Vector3[])(object)new Vector3[1]
{
new Vector3(0f, 0f, 0f)
};
}
public struct LadderDetails
{
public Vector3 position;
public Vector3 rotation;
public Vector3 trigPos;
public Vector3 trigSca;
public int index;
public bool Created;
public GameObject ladderObj;
public LadderDetails(Vector3 pos, Vector3 rot, Vector3 trPos, Vector3 trSca)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
position = pos;
rotation = rot;
trigPos = trPos;
trigSca = trSca;
index = 0;
Created = false;
ladderObj = null;
}
}
public struct LightDetails
{
public Vector3 Position;
public float intensity;
public Vector4 Color;
public LightDetails(Vector3 pos, float tense, Vector4 col)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
Position = pos;
intensity = tense;
Color = col;
}
}
}