Decompiled source of MelanieMelicious fAnCy ShIp v0.1.0

MelanieFancyShip.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("WiderShipMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WiderShipMod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3b42a851-dbf6-428d-a7f2-0af1d6039c22")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class HarmonyPatches
{
	public static bool enabledWiderShip;

	public static bool enabledShipWindow;

	public static bool enabledCelestialTint;

	[HarmonyPostfix]
	[HarmonyPatch(typeof(StartOfRound), "firstDayAnimation")]
	private static void NewSavePatch()
	{
		if (enabledShipWindow)
		{
			((MonoBehaviour)StartOfRound.Instance).StartCoroutine(Setup.ShipWindowSetup());
		}
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(StartOfRound), "Start")]
	[HarmonyAfter(new string[] { "mborsh.WiderShipMod", "TestAccount666.ShipWindows" })]
	private static void StartRoundPatch()
	{
		Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
		Assembly[] array = assemblies;
		foreach (Assembly assembly in array)
		{
			if (assembly.FullName.StartsWith("WiderShipMod"))
			{
				enabledWiderShip = true;
			}
			else if (assembly.FullName.StartsWith("TestAccount666.ShipWindows"))
			{
				enabledShipWindow = true;
			}
			else if (assembly.FullName.StartsWith("CelestialTint"))
			{
				enabledCelestialTint = true;
			}
		}
		Setup.ShipSetup();
	}

	[HarmonyAfter(new string[] { "mborsh.WiderShipMod" })]
	[HarmonyPrefix]
	[HarmonyPatch(typeof(RoundManager), "FinishGeneratingLevel")]
	private static void StartLevelPatch()
	{
		Setup.NavSetup();
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(StartOfRound), "BuyShipUnlockableClientRpc")]
	private static void SyncUnlockPatch()
	{
		if (enabledShipWindow)
		{
			((MonoBehaviour)StartOfRound.Instance).StartCoroutine(Setup.ShipWindowSetup());
		}
	}
}
public class Setup : MonoBehaviour
{
	public static void ShipSetup()
	{
		//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0602: Unknown result type (might be due to invalid IL or missing references)
		//IL_063a: Unknown result type (might be due to invalid IL or missing references)
		//IL_065e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0682: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0725: Unknown result type (might be due to invalid IL or missing references)
		//IL_0744: Unknown result type (might be due to invalid IL or missing references)
		//IL_0763: Unknown result type (might be due to invalid IL or missing references)
		//IL_0782: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_07df: Unknown result type (might be due to invalid IL or missing references)
		//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_081d: Unknown result type (might be due to invalid IL or missing references)
		//IL_083c: Unknown result type (might be due to invalid IL or missing references)
		//IL_085b: Unknown result type (might be due to invalid IL or missing references)
		//IL_087a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0899: Unknown result type (might be due to invalid IL or missing references)
		//IL_08b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_08d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_08f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0915: Unknown result type (might be due to invalid IL or missing references)
		//IL_0934: Unknown result type (might be due to invalid IL or missing references)
		//IL_0953: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: 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_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_0296: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0312: Unknown result type (might be due to invalid IL or missing references)
		//IL_0331: Unknown result type (might be due to invalid IL or missing references)
		//IL_0350: Unknown result type (might be due to invalid IL or missing references)
		//IL_036f: Unknown result type (might be due to invalid IL or missing references)
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_040a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0429: Unknown result type (might be due to invalid IL or missing references)
		//IL_0448: Unknown result type (might be due to invalid IL or missing references)
		//IL_0467: Unknown result type (might be due to invalid IL or missing references)
		//IL_0486: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a9d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0abc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0adb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0afa: Unknown result type (might be due to invalid IL or missing references)
		//IL_09fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a1d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a3c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a5b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a7a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b1a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e9f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ea6: Expected O, but got Unknown
		//IL_0b52: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b59: Expected O, but got Unknown
		//IL_0cd5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cf4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d13: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d32: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d51: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d70: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d8f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dae: Unknown result type (might be due to invalid IL or missing references)
		//IL_0efe: Unknown result type (might be due to invalid IL or missing references)
		GameObject val;
		if (HarmonyPatches.enabledWiderShip)
		{
			val = Object.Instantiate<GameObject>(Plugin.bundle.LoadAsset<GameObject>("Assets/MelanieFancyShip/Prefab/ShipInsideWider.prefab"), GameObject.Find("Environment/HangarShip/ShipInside").transform.position, GameObject.Find("Environment/HangarShip/ShipInside").transform.rotation, GameObject.Find("Environment/HangarShip/ShipInside").transform.parent);
			Create("OutsideShipRoom", "OutsideShipRoom0", new Vector3(0f, 5f, 2f));
			Active("ShipInsideBoth", state: false);
			Active("Right wall", state: false);
			Active("FloorBoth", state: false);
			Active("ShipRailsBoth", state: false);
			Active("ShipRailPostsBoth", state: false);
			Active("CatwalkBoth", state: false);
			Active("CatwalkRLBBoth", state: false);
			Active("CatwalkRLBoth", state: false);
			Active("Cube.005 (1)", state: false);
			Move("ScavengerModelSuitParts/Circle.002", new Vector3(5f, -2.7f, 15.8f));
			Move("ScavengerModelSuitParts/OxyCharger(Clone)", new Vector3(5f, -2.7f, 15.5f));
			Move("AirFilterThing", new Vector3(5.5f, 2.6f, 1.7f));
			Move("Area Light (4)(Clone)_left", new Vector3(850f, 0f, 433f));
			Move("Area Light (5)(Clone)_left", new Vector3(-600f, 0f, 433f));
			Move("Area Light (7)(Clone)_left", new Vector3(850f, 0f, 433f));
			Move("Area Light (8)(Clone)_left", new Vector3(-600f, 0f, 433f));
			Move("Area Light (4)(Clone)_right", new Vector3(850f, -720f, -77f));
			Move("Area Light (5)(Clone)_right", new Vector3(-600f, -720f, -77f));
			Move("Area Light (7)(Clone)_right", new Vector3(850f, -720f, -77f));
			Move("Area Light (8)(Clone)_right", new Vector3(-600f, -720f, -77f));
			Move("Cube.005 (2)", new Vector3(-5f, 3f, -5f));
			Move("ChargeStation", new Vector3(4.7f, 1f, -5f));
			Move("GiantCylinderMagnet", new Vector3(1f, 2.5f, -14.7f));
			Move("HangarDoorButtonPanel", new Vector3(-4.8f, 4f, -4.3f));
			Move("HangingLamp (3)(Clone)_left", new Vector3(850f, 0f, 500f));
			Move("HangingLamp (4)(Clone)_left", new Vector3(-600f, 0f, 500f));
			Move("HangingLamp (3)(Clone)_right", new Vector3(850f, -720f, 0f));
			Move("HangingLamp (4)(Clone)_right", new Vector3(-600f, -720f, 0f));
			Move("LadderShort", new Vector3(9.4f, -2.6f, 4.4f));
			Move("MagnetLever", new Vector3(-7.5f, 1.5f, -14f));
			Move("OutsideShip (3)", new Vector3(14.1f, 3.2f, 9f));
			Move("SideMachineryLeft", new Vector3(8.3f, 1.6f, 2.4f));
			Move("SingleScreen", new Vector3(-7.5f, -1.5f, 0.45f));
			Move("Environment/HangarShip/ThrusterBackRight", new Vector3(7.4f, -0.2f, 0.4f));
			Move("Environment/HangarShip/ThrusterBackLeft", new Vector3(7.4f, -0.2f, -13.9f));
			Move("Environment/HangarShip/ThrusterFrontRight", new Vector3(-2.1f, -0.2f, 0.4f));
			Move("Environment/HangarShip/ThrusterFrontLeft", new Vector3(-2.1f, -0.2f, -13.9f));
			Rotate("ChargeStation", new Vector3(-90f, 0f, 0f));
			Rotate("LadderShort", new Vector3(0f, 90f, 0f));
			Rotate("MagnetLever", new Vector3(90f, 0f, 180f));
			Brighten("Area Light (4)(Clone)_left", 4f);
			Brighten("Area Light (5)(Clone)_left", 4f);
			Brighten("Area Light (7)(Clone)_left", 4f);
			Brighten("Area Light (8)(Clone)_left", 4f);
			try
			{
				GameObject.Find("Area Light (4)(Clone)_left").GetComponent<Light>().colorTemperature = 4000f;
				GameObject.Find("Area Light (5)(Clone)_left").GetComponent<Light>().colorTemperature = 4000f;
				GameObject.Find("Area Light (7)(Clone)_left").GetComponent<Light>().colorTemperature = 4000f;
				GameObject.Find("Area Light (8)(Clone)_left").GetComponent<Light>().colorTemperature = 4000f;
				GameObject.Find("Area Light (4)(Clone)_right").GetComponent<Light>().colorTemperature = 4000f;
				GameObject.Find("Area Light (5)(Clone)_right").GetComponent<Light>().colorTemperature = 4000f;
				GameObject.Find("Area Light (7)(Clone)_right").GetComponent<Light>().colorTemperature = 4000f;
				GameObject.Find("Area Light (8)(Clone)_right").GetComponent<Light>().colorTemperature = 4000f;
			}
			catch
			{
			}
		}
		else
		{
			val = Object.Instantiate<GameObject>(Plugin.bundle.LoadAsset<GameObject>("Assets/MelanieFancyShip/Prefab/ShipInside.prefab"), GameObject.Find("Environment/HangarShip/ShipInside").transform.position, GameObject.Find("Environment/HangarShip/ShipInside").transform.rotation, GameObject.Find("Environment/HangarShip/ShipInside").transform.parent);
			Create("Area Light (3)", "2StoryLight0", new Vector3(800f, 0f, 500f));
			Create("Area Light (3)", "2StoryLight1", new Vector3(-600f, 0f, 500f));
			Create("Area Light (7)", "2StorySpotlight0", new Vector3(800f, 0f, 315f));
			Create("Area Light (7)", "2StorySpotlight1", new Vector3(-600f, 0f, 315f));
			Create("HangingLamp (2)", "2StoryLamp0", new Vector3(800f, 0f, 500f));
			Create("HangingLamp (2)", "2StoryLamp1", new Vector3(-600f, 0f, 500f));
			Active("WallInsulator", state: false);
			Active("WallInsulator2", state: false);
			Move("ScavengerModelSuitParts/Circle.002", new Vector3(7f, -2.7f, 10.5f));
			Move("ScavengerModelSuitParts/OxyCharger(Clone)", new Vector3(7f, -2.7f, 10.2f));
			Move("GiantCylinderMagnet", new Vector3(1f, 2.5f, -9.7f));
			Move("LadderShort", new Vector3(9.4f, -2.6f, 1.4f));
			Move("LadderShort (1)", new Vector3(-9f, -2.6f, -11.7f));
			Move("LeavingShip (1)", new Vector3(0.8f, 3.3f, 11.3f));
			Move("LeavingShip (3)", new Vector3(-2.8f, 3.3f, -5.8f));
			Move("LeavingShip (4)", new Vector3(13.7f, 3.3f, 13f));
			Move("MeterBoxDevice.001", new Vector3(-4f, 1.9f, -2f));
			Move("OutsideShip (1)", new Vector3(-2.5f, 0f, -3.8f));
			Move("OutsideShip (2)", new Vector3(2.3f, 3.2f, 11f));
			Move("OutsideShip (3)", new Vector3(14.1f, 3.2f, 6.1f));
			Move("OutsideShipRoom", new Vector3(0f, 0f, 2f));
			Move("SideMachineryRight", new Vector3(-4f, 1.9f, -2f));
			Move("Environment/HangarShip/ThrusterBackRight", new Vector3(7.4f, -0.2f, -2.6f));
			Move("Environment/HangarShip/ThrusterFrontRight", new Vector3(-2.1f, -0.2f, -2.6f));
			Size("LeavingShip (3)", new Vector3(3f, 12.2f, 0.8f));
			Size("OutsideShip (1)", new Vector3(2.4f, 1.8f, 1.1f));
			Size("OutsideShipRoom", new Vector3(1f, 2f, 1f));
			try
			{
				GameObject.Find("2StoryLight0").GetComponent<Light>().colorTemperature = 4000f;
				GameObject.Find("2StoryLight1").GetComponent<Light>().colorTemperature = 4000f;
				GameObject.Find("2StorySpotlight0").GetComponent<Light>().colorTemperature = 4000f;
				GameObject.Find("2StorySpotlight1").GetComponent<Light>().colorTemperature = 4000f;
			}
			catch
			{
			}
		}
		if (HarmonyPatches.enabledCelestialTint)
		{
			if (HarmonyPatches.enabledWiderShip)
			{
				Move("MeterBoxDevice.001_copy", new Vector3(-3.1f, 1.2f, -6.1f));
				Move("OutsideShipRoom_copy", new Vector3(1.3f, 0.3f, -2.5f));
				Move("SideMachineryLeft_copy", new Vector3(-0.6f, 1.7f, -22.3f));
				Move("SideMachineryRight_copy", new Vector3(-2.7f, 2.2f, -6.3f));
				Rotate("SideMachineryLeft_copy", new Vector3(0f, 90f, 90f));
			}
			else
			{
				Move("MeterBoxDevice.001_copy", new Vector3(-3.1f, 1.2f, -8.1f));
				Move("OutsideShipRoom_copy", new Vector3(1.3f, 0.3f, -5.5f));
				Move("SideMachineryRight_copy", new Vector3(-2.7f, 2.2f, -9.3f));
				Size("OutsideShipRoom_copy", new Vector3(1f, 2f, 1f));
			}
			Move("ShipLightsPost_copy", new Vector3(7.6f, 6.2f, -16.8f));
		}
		((Object)val).name = "MelanieShip";
		foreach (Transform item in GameObject.Find("Environment/HangarShip").transform)
		{
			Transform val2 = item;
			if (((Object)val2).name == "ShipInside" || ((Object)val2).name == "ShipInside.001" || ((Object)val2).name == "Plane.001")
			{
				Active(((Object)((Component)val2).gameObject).name, state: false);
			}
		}
		Active("CatwalkShip", state: false);
		Active("CatwalkRailLining", state: false);
		Active("CatwalkRailLiningB", state: false);
		Active("CatwalkUnderneathSupports", state: false);
		Active("ShipRails", state: false);
		Active("ShipRailPosts", state: false);
		Active("Environment/HangarShip/Railing/Cube", state: false);
		Active("Environment/HangarShip/Railing/Cube (1)", state: false);
		Active("Environment/HangarShip/Railing/Cube (2)", state: false);
		Active("Environment/HangarShip/Railing/Cube (3)", state: false);
		Active("Environment/HangarShip/Railing/Cube (4)", state: false);
		Active("Environment/HangarShip/Railing/Cube (5)", state: false);
		Active("Environment/HangarShip/Railing/Cube (6)", state: false);
		Active("Environment/HangarShip/Railing/Cube (7)", state: false);
		Active("Environment/HangarShip/Railing/Cube (8)", state: false);
		Active("Environment/HangarShip/Railing/Cube (9)", state: false);
		Active("Environment/HangarShip/Railing/Cube (10)", state: false);
		Active("LeavingShip (6)", state: false);
		Active("Light", state: false);
		Active("Light (3)", state: false);
		Move("ScavengerModelSuitParts/Circle.002", new Vector3(-1f, -2.7f, 5.3f));
		Move("Cube.005", new Vector3(0f, 3f, -4f));
		Move("Cube.006", new Vector3(0.5f, 3f, -4f));
		Move("ShipLightsPost", new Vector3(0f, 5f, 0f));
		Move("ShipBoundsTrigger", new Vector3(1.5f, 6.7f, -6.7f));
		Move("ShipInnerRoomBoundsTrigger", new Vector3(1.4f, 4.3f, -6.6f));
		Size("ShipBoundsTrigger", new Vector3(24f, 15.1f, 22f));
		Size("ShipInnerRoomBoundsTrigger", new Vector3(18f, 11f, 16f));
		try
		{
			GameObject.Find("Area Light (3)").GetComponent<Light>().colorTemperature = 4000f;
			GameObject.Find("Area Light (4)").GetComponent<Light>().colorTemperature = 4000f;
			GameObject.Find("Area Light (5)").GetComponent<Light>().colorTemperature = 4000f;
			GameObject.Find("Area Light (7)").GetComponent<Light>().colorTemperature = 4000f;
			GameObject.Find("Area Light (8)").GetComponent<Light>().colorTemperature = 4000f;
			GameObject.Find("Area Light (9)").GetComponent<Light>().colorTemperature = 4000f;
		}
		catch
		{
		}
		if (HarmonyPatches.enabledShipWindow)
		{
			((MonoBehaviour)StartOfRound.Instance).StartCoroutine(ShipWindowSetup());
			return;
		}
		foreach (Transform item2 in GameObject.Find("Environment/HangarShip").transform)
		{
			Transform val3 = item2;
			if (((Object)val3).name == "ShipInside")
			{
				Active(((Object)((Component)val3).gameObject).name, state: false);
			}
			else if (((Object)val3).name == "Plane.001")
			{
				val3.localScale = new Vector3(0f, 0f, 0f);
			}
		}
	}

	public static IEnumerator ShipWindowSetup()
	{
		yield return (object)new WaitForSeconds(1f * Time.deltaTime);
		Material invis = Plugin.bundle.LoadAsset<Material>("Assets/MelanieFancyShip/Material/Invis.mat");
		if ((Object)(object)GameObject.Find("MelanieShip/CeilingWindow") == (Object)null && (Object)(object)GameObject.Find("CeilingWindow") != (Object)null)
		{
			Parent("CeilingWindow", "MelanieShip");
			Move("CeilingWindow", new Vector3(7.2f, 1.3f, 10.7f));
			Material[] matRef = ((Renderer)GameObject.Find("Roof0").GetComponent<MeshRenderer>()).materials;
			((Renderer)GameObject.Find("Roof0").GetComponent<MeshRenderer>()).materials = (Material[])(object)new Material[4]
			{
				matRef[0],
				matRef[1],
				invis,
				invis
			};
		}
		else if ((Object)(object)GameObject.Find("CeilingWindow") == (Object)null)
		{
			Material[] matRef = ((Renderer)GameObject.Find("Roof0").GetComponent<MeshRenderer>()).materials;
			((Renderer)GameObject.Find("Roof0").GetComponent<MeshRenderer>()).materials = (Material[])(object)new Material[4]
			{
				matRef[0],
				matRef[1],
				matRef[0],
				matRef[1]
			};
		}
		if ((Object)(object)GameObject.Find("MelanieShip/Window1") == (Object)null && (Object)(object)GameObject.Find("Window1") != (Object)null)
		{
			Parent("Window1", "MelanieShip");
			Rotate("Window1", new Vector3(0f, 0f, 21f));
			Active("Windows/MelWinFrame0", state: true);
			Active("Windows/MelWinFrame1", state: true);
			Active("Windows/MelWinFrame2", state: true);
			if (HarmonyPatches.enabledWiderShip)
			{
				Create("Window1", "2StoryWindow0", new Vector3(-7.3f, 2.9f, 6.5f));
				Create("Window1", "2StoryWindow1", new Vector3(3.4f, 9.55f, 6.4f));
				Move("Window1", new Vector3(3.4f, 9.55f, 1.4f));
				Size("2StoryWindow0", new Vector3(5.2f, 0.5f, 1.3f));
			}
			else
			{
				Create("Window1", "2StoryWindow0", new Vector3(-7.3f, 0.4f, 6.5f));
				Create("Window1", "2StoryWindow1", new Vector3(3.4f, 4.55f, 6.4f));
				Move("Window1", new Vector3(3.4f, 4.55f, 1.4f));
				Size("2StoryWindow0", new Vector3(2.9f, 0.5f, 1.2f));
			}
			Rotate("2StoryWindow0", new Vector3(0f, 0f, -90f));
			Material[] matRef = ((Renderer)GameObject.Find("Wall0").GetComponent<MeshRenderer>()).materials;
			((Renderer)GameObject.Find("Wall0").GetComponent<MeshRenderer>()).materials = (Material[])(object)new Material[4]
			{
				matRef[0],
				matRef[1],
				invis,
				invis
			};
			matRef = ((Renderer)GameObject.Find("Wall1").GetComponent<MeshRenderer>()).materials;
			((Renderer)GameObject.Find("Wall1").GetComponent<MeshRenderer>()).materials = (Material[])(object)new Material[4]
			{
				matRef[0],
				matRef[1],
				invis,
				invis
			};
		}
		else if ((Object)(object)GameObject.Find("Window1") == (Object)null)
		{
			Material[] matRef = ((Renderer)GameObject.Find("Wall0").GetComponent<MeshRenderer>()).materials;
			((Renderer)GameObject.Find("Wall0").GetComponent<MeshRenderer>()).materials = (Material[])(object)new Material[4]
			{
				matRef[0],
				matRef[1],
				matRef[0],
				matRef[1]
			};
			matRef = ((Renderer)GameObject.Find("Wall1").GetComponent<MeshRenderer>()).materials;
			((Renderer)GameObject.Find("Wall1").GetComponent<MeshRenderer>()).materials = (Material[])(object)new Material[4]
			{
				matRef[0],
				matRef[1],
				matRef[0],
				matRef[1]
			};
			Active("Windows/MelWinFrame0", state: false);
			Active("Windows/MelWinFrame1", state: false);
			Active("Windows/MelWinFrame2", state: false);
		}
		if ((Object)(object)GameObject.Find("MelanieShip/Window2") == (Object)null && (Object)(object)GameObject.Find("Window2") != (Object)null)
		{
			Parent("Window2", "MelanieShip");
			Rotate("Window2", new Vector3(0f, 0f, 0f));
			Create("Window2", "2StoryWindow2", new Vector3(5.9f, -4.15f, 6.4f));
			Active("Windows/MelWinFrame3", state: true);
			Active("Windows/MelWinFrame4", state: true);
			if (HarmonyPatches.enabledWiderShip)
			{
				Move("Window2", new Vector3(5.9f, -7.15f, 1.4f));
			}
			else
			{
				Move("Window2", new Vector3(5.9f, -4.15f, 1.4f));
			}
			Material[] matRef = ((Renderer)GameObject.Find("Wall2").GetComponent<MeshRenderer>()).materials;
			((Renderer)GameObject.Find("Wall2").GetComponent<MeshRenderer>()).materials = (Material[])(object)new Material[4]
			{
				matRef[0],
				matRef[1],
				invis,
				invis
			};
		}
		else if ((Object)(object)GameObject.Find("Window2") == (Object)null)
		{
			Material[] matRef = ((Renderer)GameObject.Find("Wall2").GetComponent<MeshRenderer>()).materials;
			((Renderer)GameObject.Find("Wall2").GetComponent<MeshRenderer>()).materials = (Material[])(object)new Material[4]
			{
				matRef[0],
				matRef[1],
				matRef[0],
				matRef[1]
			};
			Active("Windows/MelWinFrame3", state: false);
			Active("Windows/MelWinFrame4", state: false);
		}
		if ((Object)(object)GameObject.Find("MelanieShip/Window3") == (Object)null && (Object)(object)GameObject.Find("Window3") != (Object)null)
		{
			Parent("Window3", "MelanieShip");
			Material[] matRef = ((Renderer)GameObject.Find("Floor0").GetComponent<MeshRenderer>()).materials;
			((Renderer)GameObject.Find("Floor0").GetComponent<MeshRenderer>()).materials = (Material[])(object)new Material[4]
			{
				matRef[0],
				matRef[1],
				invis,
				invis
			};
		}
		else if ((Object)(object)GameObject.Find("Window3") == (Object)null)
		{
			Material[] matRef = ((Renderer)GameObject.Find("Floor0").GetComponent<MeshRenderer>()).materials;
			((Renderer)GameObject.Find("Floor0").GetComponent<MeshRenderer>()).materials = (Material[])(object)new Material[4]
			{
				matRef[0],
				matRef[1],
				matRef[0],
				matRef[1]
			};
		}
		foreach (Transform item in GameObject.Find("Environment/HangarShip").transform)
		{
			Transform child = item;
			if (((Object)child).name == "ShipInside")
			{
				Active(((Object)((Component)child).gameObject).name, state: false);
			}
			else if (((Object)child).name == "Plane.001")
			{
				child.localScale = new Vector3(0f, 0f, 0f);
			}
		}
	}

	public static void NavSetup()
	{
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Expected O, but got Unknown
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			Transform transform = GameObject.Find("Environment/NavMeshColliders/PlayerShipNavmesh").transform;
			try
			{
				GameObject.Find("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (6)").isStatic = false;
				GameObject.Find("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (7)").isStatic = false;
				GameObject.Find("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (8)").isStatic = false;
				GameObject.Find("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (10)").isStatic = false;
				GameObject.Find("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (11)").isStatic = false;
				GameObject.Find("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (12)").isStatic = false;
				GameObject.Find("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (13)").isStatic = false;
				GameObject.Find("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (14)").isStatic = false;
			}
			catch
			{
			}
			foreach (Transform item in transform)
			{
				Transform val = item;
				try
				{
					((Component)val).gameObject.SetActive(false);
				}
				catch
				{
				}
			}
			Active("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (6)", state: true);
			Active("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (7)", state: true);
			Active("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (8)", state: true);
			GameObject val2;
			if (HarmonyPatches.enabledWiderShip)
			{
				val2 = Object.Instantiate<GameObject>(Plugin.bundle.LoadAsset<GameObject>("Assets/Melanie2StoryShip/Prefab/ShipWiderNav.prefab"), transform.parent);
				Move("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (10)", new Vector3(19.6f, -3.8f, 10.1f));
				Move("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (11)", new Vector3(19.6f, -3.8f, -5.1f));
				Move("ShipLadder", new Vector3(24.9f, -4.8f, 12.7f));
				Size("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (13)", new Vector3(0.8f, 5.7f, 16.5f));
			}
			else
			{
				val2 = Object.Instantiate<GameObject>(Plugin.bundle.LoadAsset<GameObject>("Assets/Melanie2StoryShip/Prefab/ShipNav.prefab"), transform.parent);
				Move("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (10)", new Vector3(19.6f, -3.8f, 7.1f));
				Move("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (13)", new Vector3(28.1f, -3.8f, 3.2f));
				Move("ShipLadder", new Vector3(24.9f, -4.8f, 9.7f));
				Size("Environment/NavMeshColliders/PlayerShipNavmesh/Cube (13)", new Vector3(0.8f, 5.7f, 8.5f));
			}
			val2.transform.position = transform.position;
			GameObject.Find("MelanieLadder0").GetComponent<OffMeshLink>().UpdatePositions();
			GameObject.Find("MelanieLadder1").GetComponent<OffMeshLink>().UpdatePositions();
			GameObject.Find("MelanieLadder2").GetComponent<OffMeshLink>().UpdatePositions();
			try
			{
				GameObject.Find("MelanieLadder3").GetComponent<OffMeshLink>().UpdatePositions();
			}
			catch
			{
			}
		}
		catch
		{
		}
	}

	private static void Move(string obj, Vector3 pos)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			GameObject.Find(obj).transform.localPosition = pos;
		}
		catch
		{
		}
	}

	private static void Rotate(string obj, Vector3 rot)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			GameObject.Find(obj).transform.localEulerAngles = rot;
		}
		catch
		{
		}
	}

	private static void Size(string obj, Vector3 scale)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			GameObject.Find(obj).transform.localScale = scale;
		}
		catch
		{
		}
	}

	private static void Create(string obj, string name, Vector3 pos)
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			GameObject val = Object.Instantiate<GameObject>(GameObject.Find(obj), GameObject.Find(obj).transform.parent);
			((Object)val).name = name;
			Move(((Object)val).name, pos);
		}
		catch
		{
		}
	}

	private static void Active(string obj, bool state)
	{
		try
		{
			GameObject.Find(obj).SetActive(state);
		}
		catch
		{
		}
	}

	private static void Brighten(string obj, float intensity)
	{
		try
		{
			Light component = GameObject.Find(obj).GetComponent<Light>();
			component.range *= intensity;
		}
		catch
		{
		}
	}

	private static void Parent(string obj, string parent)
	{
		try
		{
			GameObject.Find(obj).transform.parent = GameObject.Find(parent).transform;
		}
		catch
		{
		}
	}
}
[BepInPlugin("MelanieMelicious.fancyShip", "Melanie Melicious - fAnCy ShIp", "0.1.0")]
public class Plugin : BaseUnityPlugin
{
	private const string GUID = "MelanieMelicious.fancyShip";

	private const string NAME = "Melanie Melicious - fAnCy ShIp";

	private const string VERSION = "0.1.0";

	private readonly Harmony harmony = new Harmony("MelanieMelicious.fancyShip");

	public static ManualLogSource mls;

	public static AssetBundle bundle;

	private static Plugin instance;

	private void Awake()
	{
		instance = this;
		mls = Logger.CreateLogSource("fAnCy ShiP");
		mls = ((BaseUnityPlugin)this).Logger;
		harmony.PatchAll(typeof(HarmonyPatches));
		string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "melanieshipfancy");
		bundle = AssetBundle.LoadFromFile(text);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"fAnCy Ship Mod loading wowow");
	}
}