Decompiled source of ShipColors v0.1.0

ShipColors.dll

Decompiled 2 months ago
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using OpenLib.Common;
using OpenLib.ConfigManager;
using OpenLib.Events;
using ShipColors.Compat;
using ShipColors.ConfigManager;
using ShipColors.Customizer;
using ShipColors.Events;
using UnityEngine;
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("ShipColors")]
[assembly: AssemblyDescription("https://github.com/darmuh/ShipColors")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShipColors")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("16e2d4eb-0360-4fa3-9b4b-908c5717ef6c")]
[assembly: AssemblyFileVersion("0.1.0")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[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;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace ShipColors
{
	[BepInPlugin("darmuh.ShipColors", "ShipColors", "0.1.0")]
	[BepInDependency("darmuh.OpenLib", "0.1.6")]
	public class Plugin : BaseUnityPlugin
	{
		public static class PluginInfo
		{
			public const string PLUGIN_GUID = "darmuh.ShipColors";

			public const string PLUGIN_NAME = "ShipColors";

			public const string PLUGIN_VERSION = "0.1.0";
		}

		public static Plugin instance;

		internal static ManualLogSource Log;

		public bool LobbyCompat = false;

		public bool darmuhsTerminalStuff = false;

		public Terminal Terminal;

		private void Awake()
		{
			instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"ShipColors is loading with version 0.1.0!");
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			ConfigSettings.BindConfigSettings();
			((BaseUnityPlugin)this).Config.SettingChanged += OnSettingChanged;
			Subscribers.Subscribe();
			Log.LogInfo((object)"ShipColors load complete!");
		}

		internal void OnSettingChanged(object sender, SettingChangedEventArgs settingChangedArg)
		{
			Spam("CONFIG SETTING CHANGE EVENT");
			if (settingChangedArg.ChangedSetting != null && (Object)(object)StartOfRound.Instance != (Object)null)
			{
				Subscribers.StartCustomizer();
			}
		}

		internal static void MoreLogs(string message)
		{
			if (ConfigSettings.ExtensiveLogging.Value)
			{
				Log.LogInfo((object)message);
			}
		}

		internal static void Spam(string message)
		{
			if (ConfigSettings.DeveloperLogging.Value)
			{
				Log.LogDebug((object)message);
			}
		}

		internal static void ERROR(string message)
		{
			Log.LogError((object)message);
		}

		internal static void WARNING(string message)
		{
			Log.LogWarning((object)message);
		}
	}
}
namespace ShipColors.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("ShipColors.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal Resources()
		{
		}
	}
}
namespace ShipColors.ConfigManager
{
	public static class ConfigSettings
	{
		public static ConfigEntry<bool> ExtensiveLogging { get; internal set; }

		public static ConfigEntry<bool> DeveloperLogging { get; internal set; }

		public static ConfigEntry<bool> SetShipLights { get; internal set; }

		public static ConfigEntry<string> ShipLight_1 { get; internal set; }

		public static ConfigEntry<string> ShipLight_2 { get; internal set; }

		public static ConfigEntry<string> ShipLight_3 { get; internal set; }

		public static ConfigEntry<bool> UseSharedMaterials { get; internal set; }

		public static ConfigEntry<string> Mat_TerminalTex { get; internal set; }

		public static ConfigEntry<string> Mat_ScreenOff { get; internal set; }

		public static ConfigEntry<string> Mat_Charger { get; internal set; }

		public static ConfigEntry<string> Mat_DarkSteel { get; internal set; }

		public static ConfigEntry<string> Mat_ElevatorSteel { get; internal set; }

		public static ConfigEntry<string> Mat_BlackRubber { get; internal set; }

		public static ConfigEntry<string> Mat_DeskBottom { get; internal set; }

		public static ConfigEntry<string> Mat_ControlPanel { get; internal set; }

		public static ConfigEntry<string> Mat_ShipHull { get; internal set; }

		public static ConfigEntry<string> Mat_ShipRoomMetal { get; internal set; }

		public static ConfigEntry<string> Mat_ShipFloor { get; internal set; }

		public static ConfigEntry<string> Mat_BunkBeds { get; internal set; }

		public static ConfigEntry<string> Mat_LockerCabinet { get; internal set; }

		public static ConfigEntry<string> Mat_DoorGenerator { get; internal set; }

		public static ConfigEntry<string> Mat_DoorControlPanel { get; internal set; }

		public static ConfigEntry<string> Mat_ShipDoors { get; internal set; }

		public static ConfigEntry<string> Mat_ShipDoors2 { get; internal set; }

		public static ConfigEntry<bool> TerminalCustomization { get; internal set; }

		public static ConfigEntry<string> TerminalColor { get; internal set; }

		public static ConfigEntry<string> TerminalButtonsColor { get; internal set; }

		public static ConfigEntry<string> TerminalKeyboardColor { get; internal set; }

		public static ConfigEntry<string> TerminalTextColor { get; internal set; }

		public static ConfigEntry<string> TerminalMoneyColor { get; internal set; }

		public static ConfigEntry<string> TerminalMoneyBGColor { get; internal set; }

		public static ConfigEntry<float> TerminalMoneyBGAlpha { get; internal set; }

		public static ConfigEntry<string> TerminalCaretColor { get; internal set; }

		public static ConfigEntry<string> TerminalScrollbarColor { get; internal set; }

		public static ConfigEntry<string> TerminalScrollBGColor { get; internal set; }

		public static ConfigEntry<string> TerminalLightColor { get; internal set; }

		public static ConfigEntry<bool> TerminalCustomBG { get; internal set; }

		public static ConfigEntry<string> TerminalCustomBGColor { get; internal set; }

		public static ConfigEntry<float> TerminalCustomBGAlpha { get; internal set; }

		public static void BindConfigSettings()
		{
			Plugin.Log.LogInfo((object)"Binding configuration settings");
			ExtensiveLogging = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Debug", "ExtensiveLogging", false, "Enable or Disable extensive logging for this mod.");
			DeveloperLogging = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Debug", "DeveloperLogging", false, "Enable or Disable developer logging for this mod. (this will fill your log file FAST)");
			SetShipLights = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Ship Lights", "SetShipLights", true, "Enable or Disable changing ship light colors section");
			ShipLight_1 = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Ship Lights", "ShipLight_1", "#FFFFFF", "This changes the color of the first ship light");
			ShipLight_2 = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Ship Lights", "ShipLight_2", "#FFFFFF", "This changes the color of the first ship light");
			ShipLight_3 = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Ship Lights", "ShipLight_3", "#FFFFFF", "This changes the color of the first ship light");
			UseSharedMaterials = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "UseSharedMaterials", true, "Enable or Disable modifying global shared textures section");
			Mat_TerminalTex = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_TerminalTex", "#CFCFCF", "This changes the color of the physical terminal texture (re-used by other electronics)");
			Mat_Charger = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_Charger", "#5C5840", "This changes the color of the main texture of the charging station");
			Mat_DarkSteel = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_DarkSteel", "#494949", "This changes the color of the DarkSteel material that is used throughout the game");
			Mat_ElevatorSteel = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ElevatorSteel", "#FFFFFF", "This changes the color of the ElevatorSteel material that is used throughout the game");
			Mat_BlackRubber = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_BlackRubber", "#2E2E2E", "This changes the color of the BlackRubber material that is used throughout the game");
			Mat_ScreenOff = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ScreenOff", "#000000", "This changes the color of the ScreenOff material that is used throughout the game");
			Mat_DeskBottom = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_DeskBottom", "#545250", "This changes the color of the Desk Bottom texture by the ship monitors and everywhere else it is re-used");
			Mat_ControlPanel = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ControlPanel", "#6C6862", "This changes the color of the ControlPanel shared material that is used throughout the game");
			Mat_ShipFloor = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ShipFloor", "#C8BDB8", "This changes the color of the ShipFloor shared material that is used throughout the game");
			Mat_ShipHull = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ShipHull", "#FFFFFF", "This changes the color of the ShipHull shared material that is used throughout the game");
			Mat_ShipRoomMetal = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ShipRoomMetal", "#D6C9B5", "This changes the color of the ShipRoomMetal shared material that is used throughout the game");
			Mat_BunkBeds = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_BunkBeds", "#CFCFCF", "This changes the color of the BunkBeds shared material that is used throughout the game");
			Mat_LockerCabinet = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_LockerCabinet", "#7D2426", "This changes the color of the LockerCabinet shared material that is used throughout the game");
			Mat_ShipDoors = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ShipDoors", "#71665E", "This changes the color of the ShipDoors shared material that is used throughout the game");
			Mat_ShipDoors2 = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ShipDoors2", "#6F645D", "This changes the color of the ShipDoors2 shared material that is used throughout the game");
			Mat_DoorGenerator = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_DoorGenerator", "#FFECD0", "This changes the color of the DoorGenerator shared material that is used throughout the game");
			Mat_DoorControlPanel = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_DoorControlPanel", "#373732", "This changes the color of the DoorControlPanel shared material that is used throughout the game");
			ConfigSetup.RemoveOrphanedEntries(((BaseUnityPlugin)Plugin.instance).Config);
		}
	}
}
namespace ShipColors.Events
{
	public class Subscribers
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static ParameterEvent<Terminal> <0>__OnTerminalAwake;

			public static Event <1>__OnStart;

			public static Event <2>__OnTerminalDisable;

			public static Event <3>__OnGameLoad;
		}

		public static void Subscribe()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			EventManager.TerminalAwake.AddListener((ParameterEvent<Terminal>)OnTerminalAwake);
			CustomEvent startOfRoundAwake = EventManager.StartOfRoundAwake;
			object obj = <>O.<1>__OnStart;
			if (obj == null)
			{
				Event val = OnStart;
				<>O.<1>__OnStart = val;
				obj = (object)val;
			}
			startOfRoundAwake.AddListener((Event)obj);
			CustomEvent terminalDisable = EventManager.TerminalDisable;
			object obj2 = <>O.<2>__OnTerminalDisable;
			if (obj2 == null)
			{
				Event val2 = OnTerminalDisable;
				<>O.<2>__OnTerminalDisable = val2;
				obj2 = (object)val2;
			}
			terminalDisable.AddListener((Event)obj2);
			CustomEvent gameNetworkManagerStart = EventManager.GameNetworkManagerStart;
			object obj3 = <>O.<3>__OnGameLoad;
			if (obj3 == null)
			{
				Event val3 = OnGameLoad;
				<>O.<3>__OnGameLoad = val3;
				obj3 = (object)val3;
			}
			gameNetworkManagerStart.AddListener((Event)obj3);
		}

		public static void OnGameLoad()
		{
			if (StartGame.SoftCompatibility("darmuh.TerminalStuff", ref Plugin.instance.darmuhsTerminalStuff))
			{
				Plugin.MoreLogs("leaving terminal customization to darmuhsTerminalStuff");
			}
			if (StartGame.SoftCompatibility("BMX.LobbyCompatibility", ref Plugin.instance.LobbyCompat))
			{
				BMX_LobbyCompat.SetCompat(isNetworked: false);
			}
		}

		public static void OnTerminalAwake(Terminal instance)
		{
			Plugin.instance.Terminal = instance;
			Plugin.MoreLogs("Setting Plugin.instance.Terminal");
		}

		internal static void StartCustomizer()
		{
			if (ConfigSettings.SetShipLights.Value)
			{
				CustomShipLights.SetShipLights();
			}
			if (ConfigSettings.UseSharedMaterials.Value)
			{
				GlobalSharedCustomization.UseSharedTextures();
				Plugin.Spam("Only setting shared texture values");
			}
		}

		public static void OnTerminalDisable()
		{
		}

		public static void OnStart()
		{
			Plugin.Log.LogInfo((object)"patching customizations now!");
			StartCustomizer();
		}
	}
}
namespace ShipColors.Customizer
{
	internal class GlobalSharedCustomization
	{
		internal static void UseSharedTextures()
		{
			//IL_0010: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			Misc.LogColorBeforeChange(StartOfRound.Instance.mapScreen.offScreenMat.color, ConfigSettings.Mat_ScreenOff);
			Misc.LogColorBeforeChange(((Renderer)StartOfRound.Instance.mapScreen.mesh).sharedMaterial.color, ConfigSettings.Mat_TerminalTex);
			StartOfRound.Instance.mapScreen.offScreenMat.color = Misc.HexToColor(ConfigSettings.Mat_ScreenOff.Value);
			Plugin.Spam("Mat_ScreenOff set");
			((Renderer)StartOfRound.Instance.mapScreen.mesh).sharedMaterial.color = Misc.HexToColor(ConfigSettings.Mat_TerminalTex.Value);
			Plugin.Spam("Mat_TerminalTex set");
			ChargingStation();
			ControlPanels();
			ShipInside();
			Bunkbeds();
			LockerCabinet();
			HangarDoorStuff();
		}

		private static void ShipInside()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			if (TryGetMeshRenderer("Environment/HangarShip/ShipInside", out var mesh))
			{
				Plugin.Spam($"This should be 5 - {((Renderer)mesh).sharedMaterials.Length}");
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[0].color, ConfigSettings.Mat_ShipHull);
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[1].color, ConfigSettings.Mat_ShipRoomMetal);
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[2].color, ConfigSettings.Mat_ShipFloor);
				((Renderer)mesh).sharedMaterials[0].color = Misc.HexToColor(ConfigSettings.Mat_ShipHull.Value);
				((Renderer)mesh).sharedMaterials[1].color = Misc.HexToColor(ConfigSettings.Mat_ShipRoomMetal.Value);
				((Renderer)mesh).sharedMaterials[2].color = Misc.HexToColor(ConfigSettings.Mat_ShipFloor.Value);
			}
		}

		private static void Bunkbeds()
		{
			SetSharedMaterial("Environment/HangarShip/Bunkbeds", ConfigSettings.Mat_BunkBeds);
		}

		private static void LockerCabinet()
		{
			SetSharedMaterial("Environment/HangarShip/StorageCloset", ConfigSettings.Mat_LockerCabinet);
			SetSharedMaterial("Environment/HangarShip/StorageCloset/Cube.000", ConfigSettings.Mat_LockerCabinet);
		}

		private static void HangarDoorStuff()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			SetSharedMaterial("Environment/HangarShip/DoorGenerator", ConfigSettings.Mat_DoorGenerator);
			SetSharedMaterial("Environment/HangarShip/AnimatedShipDoor/HangarDoorButtonPanel", ConfigSettings.Mat_DoorControlPanel);
			if (TryGetMeshRenderer("Environment/HangarShip/AnimatedShipDoor/HangarDoorLeft (1)", out var mesh))
			{
				Plugin.Spam($"This should be 2 - {((Renderer)mesh).sharedMaterials.Length}");
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[0].color, ConfigSettings.Mat_ShipDoors);
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[1].color, ConfigSettings.Mat_ShipDoors2);
				((Renderer)mesh).sharedMaterials[0].color = Misc.HexToColor(ConfigSettings.Mat_ShipDoors.Value);
				((Renderer)mesh).sharedMaterials[1].color = Misc.HexToColor(ConfigSettings.Mat_ShipDoors2.Value);
			}
		}

		private static void SetSharedMaterial(string FindObject, ConfigEntry<string> setting)
		{
			//IL_0014: 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)
			if (TryGetMeshRenderer(FindObject, out var mesh))
			{
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterial.color, setting);
				((Renderer)mesh).sharedMaterial.color = Misc.HexToColor(setting.Value);
				Plugin.Spam(((ConfigEntryBase)setting).Definition.Key + " has been set");
			}
		}

		private static void ControlPanels()
		{
			SetSharedMaterial("Environment/HangarShip/ControlDesk", ConfigSettings.Mat_DeskBottom);
			SetSharedMaterial("Environment/HangarShip/ControlPanelWTexture", ConfigSettings.Mat_ControlPanel);
		}

		private static void ChargingStation()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			if (TryGetMeshRenderer("Environment/HangarShip/ShipModels2b/ChargeStation", out var mesh))
			{
				Plugin.Spam($"This should be 7 - {((Renderer)mesh).sharedMaterials.Length}");
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[0].color, ConfigSettings.Mat_Charger);
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[1].color, ConfigSettings.Mat_DarkSteel);
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[2].color, ConfigSettings.Mat_ElevatorSteel);
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[3].color, ConfigSettings.Mat_BlackRubber);
				((Renderer)mesh).sharedMaterials[0].color = Misc.HexToColor(ConfigSettings.Mat_Charger.Value);
				((Renderer)mesh).sharedMaterials[1].color = Misc.HexToColor(ConfigSettings.Mat_DarkSteel.Value);
				((Renderer)mesh).sharedMaterials[2].color = Misc.HexToColor(ConfigSettings.Mat_ElevatorSteel.Value);
				((Renderer)mesh).sharedMaterials[3].color = Misc.HexToColor(ConfigSettings.Mat_BlackRubber.Value);
				Plugin.Spam("Charger, Darksteel, ElevatorSteel, and BlackRubber materials set.");
			}
		}

		private static bool TryGetMeshRenderer(string GameObjectFind, out MeshRenderer mesh)
		{
			if ((Object)(object)GameObject.Find(GameObjectFind) == (Object)null)
			{
				mesh = null;
				Plugin.WARNING("Unable to find object at path " + GameObjectFind);
				return false;
			}
			mesh = GameObject.Find(GameObjectFind).GetComponent<MeshRenderer>();
			if ((Object)(object)mesh == (Object)null)
			{
				return false;
			}
			return true;
		}
	}
	internal class CustomShipLights
	{
		internal static void SetShipLights()
		{
			SetLightColor("Environment/HangarShip/ShipElectricLights/Area Light (3)", ConfigSettings.ShipLight_1);
			SetLightColor("Environment/HangarShip/ShipElectricLights/Area Light (9)", ConfigSettings.ShipLight_1);
			SetLightColor("Environment/HangarShip/ShipElectricLights/Area Light (4)", ConfigSettings.ShipLight_2);
			SetLightColor("Environment/HangarShip/ShipElectricLights/Area Light (8)", ConfigSettings.ShipLight_2);
			SetLightColor("Environment/HangarShip/ShipElectricLights/Area Light (5)", ConfigSettings.ShipLight_3);
			SetLightColor("Environment/HangarShip/ShipElectricLights/Area Light (7)", ConfigSettings.ShipLight_3);
		}

		internal static void SetLightColor(string GameObjectFind, ConfigEntry<string> setting)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)GameObject.Find(GameObjectFind) != (Object)null && (Object)(object)GameObject.Find(GameObjectFind).GetComponent<Light>() != (Object)null)
			{
				GameObject.Find(GameObjectFind).GetComponent<Light>().color = Misc.HexToColor(setting.Value);
				Plugin.Spam(((ConfigEntryBase)setting).Definition.Key + " has been set for light at path " + GameObjectFind);
			}
		}
	}
	internal class ShipMonitors
	{
		internal static void ShipMonitorStuff()
		{
		}
	}
	internal class TerminalCustomizations
	{
		internal static void TerminalStuff()
		{
			if (!Plugin.instance.darmuhsTerminalStuff && ConfigSettings.TerminalCustomization.Value)
			{
				if ((Object)(object)Plugin.instance.Terminal == (Object)null)
				{
					Plugin.ERROR("FATAL ERROR: Terminal is NULL");
				}
				else
				{
					TerminalCustomization();
				}
			}
		}

		private static void TerminalBodyColors()
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			if (!ConfigSettings.TerminalCustomization.Value || Plugin.instance.darmuhsTerminalStuff)
			{
				return;
			}
			MeshRenderer component = GameObject.Find("Environment/HangarShip/Terminal").GetComponent<MeshRenderer>();
			if ((Object)(object)component != (Object)null)
			{
				if (((Renderer)component).materials.Length <= 3)
				{
					((Renderer)component).materials[0].color = Misc.HexToColor(ConfigSettings.TerminalColor.Value);
					((Renderer)component).materials[1].color = Misc.HexToColor(ConfigSettings.TerminalButtonsColor.Value);
				}
				else
				{
					Plugin.WARNING("termMesh does not have expected number of materials, only setting terminal body color");
					((Renderer)component).material.color = Misc.HexToColor(ConfigSettings.TerminalColor.Value);
				}
			}
			else
			{
				Plugin.WARNING("customization failure: termMesh is null");
			}
		}

		private static void TerminalKeyboardColors()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (ConfigSettings.TerminalCustomization.Value && !Plugin.instance.darmuhsTerminalStuff)
			{
				MeshRenderer component = GameObject.Find("Environment/HangarShip/Terminal/Terminal.003").GetComponent<MeshRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					((Renderer)component).material.color = Misc.HexToColor(ConfigSettings.TerminalKeyboardColor.Value);
				}
				else
				{
					Plugin.WARNING("customization failure: kbMesh is null");
				}
			}
		}

		internal static void TerminalCustomization()
		{
			//IL_0039: 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_006e: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			if (ConfigSettings.TerminalCustomization.Value && !Plugin.instance.darmuhsTerminalStuff)
			{
				TerminalBodyColors();
				TerminalKeyboardColors();
				Color color = Misc.HexToColor(ConfigSettings.TerminalMoneyBGColor.Value);
				color.a = ConfigSettings.TerminalMoneyBGAlpha.Value;
				((Graphic)Plugin.instance.Terminal.screenText.textComponent).color = Misc.HexToColor(ConfigSettings.TerminalTextColor.Value);
				((Graphic)Plugin.instance.Terminal.topRightText).color = Misc.HexToColor(ConfigSettings.TerminalMoneyColor.Value);
				((Graphic)((Component)((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.transform.GetChild(0).GetChild(5)).gameObject.GetComponent<Image>()).color = color;
				Plugin.instance.Terminal.screenText.caretColor = Misc.HexToColor(ConfigSettings.TerminalCaretColor.Value);
				((Graphic)((Selectable)Plugin.instance.Terminal.scrollBarVertical).image).color = Misc.HexToColor(ConfigSettings.TerminalScrollbarColor.Value);
				((Graphic)((Component)Plugin.instance.Terminal.scrollBarVertical).gameObject.GetComponent<Image>()).color = Misc.HexToColor(ConfigSettings.TerminalScrollBGColor.Value);
				Plugin.instance.Terminal.terminalLight.color = Misc.HexToColor(ConfigSettings.TerminalLightColor.Value);
				Image component = GameObject.Find("Environment/HangarShip/Terminal/Canvas/MainContainer/Scroll View/Viewport/InputField (TMP)").GetComponent<Image>();
				if ((Object)(object)component != (Object)null)
				{
					((Behaviour)component).enabled = ConfigSettings.TerminalCustomBG.Value;
					Color color2 = Misc.HexToColor(ConfigSettings.TerminalCustomBGColor.Value);
					color2.a = ConfigSettings.TerminalCustomBGAlpha.Value;
					((Graphic)component).color = color2;
				}
			}
		}
	}
}
namespace ShipColors.Compat
{
	internal class BMX_LobbyCompat
	{
		public static void SetCompat(bool isNetworked)
		{
			Version version = Assembly.GetExecutingAssembly().GetName().Version;
			if (isNetworked)
			{
				PluginHelper.RegisterPlugin("darmuh.ShipColors", version, (CompatibilityLevel)2, (VersionStrictness)3);
			}
			else
			{
				PluginHelper.RegisterPlugin("darmuh.ShipColors", version, (CompatibilityLevel)0, (VersionStrictness)3);
			}
		}
	}
}