Decompiled source of CiarencesUnbelievableModifications v1.10.0

CiarencesUnbelievableModifications/CiarenceUnbelievableModifications.dll

Decompiled a year ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using ImGuiNET;
using Receiver2;
using Receiver2ModdingKit;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
using VLB;
using Wolfire;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace CiarenceUnbelievableModifications;

[BepInPlugin("Ciarencew.CiarencesUnbelievableModifications", "CiarencesUnbelievableModifications", "1.7.0")]
public class MainPlugin : BaseUnityPlugin
{
	internal static ConfigFile config;

	internal const string InventoryGlintColourRandomizerHID = "IGCR-HID";

	internal const string SpawnCompatibleMagsHID = "SCM-HID";

	private void Awake()
	{
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Expected O, but got Unknown
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Expected O, but got Unknown
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Expected O, but got Unknown
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Expected O, but got Unknown
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Expected O, but got Unknown
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Expected O, but got Unknown
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Expected O, but got Unknown
		//IL_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin CiarencesUnbelievableModifications is loaded!");
		config = ((BaseUnityPlugin)this).Config;
		SettingsManager.InitializeAndBindSettings();
		if (SettingsManager.configTurretAmmoBoxBoom.Value)
		{
			TurretAmmoBoxBoom.Enable();
		}
		if (SettingsManager.configDropGunEverywhere.Value)
		{
			DropGunEverywhere.Enable();
		}
		if (SettingsManager.configGunTweaks.Value)
		{
			Harmony.CreateAndPatchAll(typeof(GunTweaks), (string)null);
		}
		if (SettingsManager.configRobotTweaks.Value)
		{
			Harmony.CreateAndPatchAll(typeof(RobotTweaks), (string)null);
		}
		if (SettingsManager.configSpawnCompatibleMags.Value)
		{
			Harmony.CreateAndPatchAll(typeof(rtlgTweaks.SpawnCompatibleMagsTweak), "SCM-HID");
		}
		Harmony.CreateAndPatchAll(typeof(lahTweaks), (string)null);
		Harmony.CreateAndPatchAll(typeof(DropGunEverywhere.DropButtonTimeOffsetTranspiler), (string)null);
		Harmony.CreateAndPatchAll(typeof(RobotTweaks.TurretLightUpdateTranspiler), (string)null);
		Harmony.CreateAndPatchAll(typeof(RobotTweaks.TripmineUpdateTranspiler), (string)null);
		Harmony.CreateAndPatchAll(typeof(MenuManagerTweaks), (string)null);
		Harmony.CreateAndPatchAll(typeof(TapeLocatron3000), (string)null);
		Harmony.CreateAndPatchAll(typeof(TurretAmmoBoxBoom), (string)null);
		Harmony.CreateAndPatchAll(typeof(SpecialEventsTweaks.HalloweenTweaks), (string)null);
		if (SettingsManager.configInventoryGlintColourEnabled.Value)
		{
			Harmony.CreateAndPatchAll(typeof(InventoryGlintColourRandomizer), "IGCR-HID");
		}
		ReceiverEvents.StartListening((ReceiverEventTypeVoid)26, (UnityAction<ReceiverEventTypeVoid>)OnInitialize);
		ReceiverEvents.StartListening((ReceiverEventTypeVoid)26, (UnityAction<ReceiverEventTypeVoid>)PostProcessTweaks.OnPlayerInitialize);
		ReceiverEvents.StartListening((ReceiverEventTypeVoid)26, (UnityAction<ReceiverEventTypeVoid>)RobotTweaks.OnPlayerInitialize);
		ReceiverEvents.StartListening((ReceiverEventTypeVoid)26, (UnityAction<ReceiverEventTypeVoid>)rtlgTweaks.OnInitialize);
		AddTasksAtCoreStartup(RobotTweaks.PatchBombBotPrefab, RobotTweaks.PatchPowerLeechPrefab, GunTweaks.PatchDeaglesSpring, GunTweaks.PatchHiPointCatchMagSlideAmount, PostProcessTweaks.AddSettingsToStandardProfile, FPSLimiterTweaks.Initialize, Leaning.Initialize, RobotTweaks.SetUpLightPartFieldReflections);
	}

	private void AddTasksAtCoreStartup(params StartupAction[] startupActions)
	{
		for (int i = 0; i < startupActions.Length; i++)
		{
			ModdingKitEvents.AddTaskAtCoreStartup(startupActions[i]);
		}
	}

	private void OnInitialize(ReceiverEventTypeVoid ev)
	{
		if (SettingsManager.configDropGunEverywhere.Value)
		{
			DropGunEverywhere.Enable();
		}
	}

	public GameObject InstantiateMagazine(Vector3 position, Quaternion rotation, Transform parent, MagazineClass magazine_class)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		ReceiverCoreScript obj = ReceiverCoreScript.Instance();
		GunScript val = default(GunScript);
		obj.player.lah.TryGetGun(ref val);
		MagazineScript val2 = default(MagazineScript);
		obj.TryGetMagazinePrefabFromRoot(val.magazine_root_types[Random.Range(0, val.magazine_root_types.Length)], magazine_class, ref val2);
		return RuntimeTileLevelGenerator.instance.InstantiateMagazine(position, rotation, parent, val2);
	}

	private void OnApplicationFocus(bool focused)
	{
		FPSLimiterTweaks.ToggleFocusLostLimiter(focused);
	}

	private void Update()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		if (SettingsManager.configDiscoFlashlight.Value)
		{
			FlashlightTweaks.Discolights();
		}
		if (SettingsManager.configEnableTurretDiscoLights.Value)
		{
			RobotTweaks.Discolights();
		}
		if (SettingsManager.configFlashlightTweaks.Value)
		{
			FlashlightTweaks.UpdateFlashlight(SettingsManager.configFlashlightToggleKey.Value);
		}
	}
}
internal static class DropGunEverywhere
{
	[HarmonyPatch(typeof(LocalAimHandler), "Update")]
	public static class DropButtonTimeOffsetTranspiler
	{
		public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, generator).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(LocalAimHandler), "allow_gun_drop"), (string)null)
			});
			if (!val.ReportFailure(__originalMethod, (Action<string>)Debug.LogError))
			{
				val.Advance(6).SetInstruction(new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(DropGunEverywhere), "time_to_drop")));
			}
			return val.InstructionEnumeration();
		}
	}

	private static LocalAimHandler lah;

	public static float time_to_drop = 1f;

	public static void Enable()
	{
		if (LocalAimHandler.TryGetInstance(ref lah))
		{
			lah.allow_gun_drop = true;
		}
	}

	public static void Disable()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected O, but got Unknown
		LevelObject val = (LevelObject)typeof(ReceiverCoreScript).GetField("level_object", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ReceiverCoreScript.Instance());
		lah.allow_gun_drop = val.allow_gun_drop;
	}
}
internal static class FPSLimiterTweaks
{
	private static bool isLoading;

	internal static void Initialize()
	{
		SceneManager.sceneLoaded += OnSceneLoaded;
		SceneManager.sceneUnloaded += OnSceneUnloaded;
	}

	internal static void CreateSettingsMenuEntries()
	{
		SettingsMenuManager.CreateSettingsMenuOption<bool>("Focus Lost FPS Limiter", SettingsManager.configLimitFPSFocusLostEnabled, 23);
		SettingsMenuManager.CreateSettingsMenuOption<float>("Focus Lost FPS Limit", SettingsManager.configLimitFPSFocusLostCount, 24);
	}

	internal static void ToggleFocusLostLimiter(bool focused)
	{
		if (SettingsManager.configLimitFPSFocusLostEnabled.Value)
		{
			if (isLoading)
			{
				Application.targetFrameRate = -1;
			}
			else
			{
				Application.targetFrameRate = (int)(focused ? ((float)(ConfigFiles.global.fps_limiter_active ? ConfigFiles.global.fps_limit : (-1))) : SettingsManager.configLimitFPSFocusLostCount.Value);
			}
		}
	}

	private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		isLoading = false;
	}

	private static void OnSceneUnloaded(Scene scene)
	{
		isLoading = true;
	}
}
internal static class FlashlightTweaks
{
	private static LocalAimHandler lah;

	private static float drop_button_released_time;

	private static float battery_life_remaining = float.MaxValue;

	private static float max_battery_life = 19800f;

	private static VolumetricLightBeam vlb;

	public static bool verbose;

	public static float time_to_drop;

	public static Color flashlight_color;

	private static float colour_a = 0f;

	private static float colour_b = 0.5f;

	private static float colour_c = 1f;

	private static float random_a;

	private static float random_b;

	private static float random_c;

	public static int disco_timescale;

	public static void UpdateFlashlight(KeyCode toggleKey)
	{
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		if (!LocalAimHandler.TryGetInstance(ref lah) || !lah.IsHoldingFlashlight || lah.IsHoldingMagazine)
		{
			return;
		}
		if (battery_life_remaining == float.MaxValue)
		{
			battery_life_remaining = (float)typeof(FlashlightScript).GetField("battery_life_remaining", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(LocalAimHandler.Flashlight);
		}
		if (Input.GetKeyDown(toggleKey))
		{
			if (verbose)
			{
				Debug.LogFormat("{0} pressed", new object[1] { toggleKey });
			}
			LocalAimHandler.Flashlight.TogglePower();
		}
		vlb = ((Component)((Component)LocalAimHandler.Flashlight.spot_light).transform).GetComponent<VolumetricLightBeam>();
		vlb.colorFromLight = false;
		vlb.color = new Color(vlb.color.r, vlb.color.g, vlb.color.b, 1f * (battery_life_remaining / max_battery_life));
		if (!lah.IsHoldingGun)
		{
			if (lah.character_input.GetButtonDown(68))
			{
				drop_button_released_time = Time.time + time_to_drop;
			}
			if (lah.character_input.GetButtonUp(68))
			{
				drop_button_released_time = float.MaxValue;
			}
			if (Time.time >= drop_button_released_time && drop_button_released_time != float.MaxValue && lah.character_input.GetButton(68))
			{
				int handWithState = lah.GetHandWithState((State)4);
				lah.MoveInventoryItem(lah.hands[handWithState].slot.contents[0], (InventorySlot)null);
				drop_button_released_time = float.MaxValue;
			}
		}
		UpdateFlashlightColours();
	}

	public static void UpdateFlashlightColours()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: 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)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)LocalAimHandler.Flashlight != (Object)null)
		{
			LocalAimHandler.Flashlight.spot_light.color = flashlight_color;
			LocalAimHandler.Flashlight.point_light.color = flashlight_color;
			LocalAimHandler.Flashlight.point_light2.color = flashlight_color;
			((Component)((Component)LocalAimHandler.Flashlight.spot_light).transform).GetComponent<VolumetricLightBeam>().color = new Color(flashlight_color.r, flashlight_color.g, flashlight_color.b);
		}
	}

	public static void Discolights()
	{
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)LocalAimHandler.Flashlight != (Object)null && LocalAimHandler.Flashlight.switch_on)
		{
			if (colour_a == random_a)
			{
				random_a = Random.Range(0f, 1f);
			}
			if (colour_b == random_b)
			{
				random_b = Random.Range(0f, 1f);
			}
			if (colour_c == random_c)
			{
				random_c = Random.Range(0f, 1f);
			}
			colour_a = Mathf.MoveTowards(colour_a, random_a, Time.deltaTime / (float)disco_timescale);
			colour_b = Mathf.MoveTowards(colour_b, random_b, Time.deltaTime / (float)disco_timescale);
			colour_c = Mathf.MoveTowards(colour_c, random_c, Time.deltaTime / (float)disco_timescale);
			flashlight_color = new Color(colour_a, colour_b, colour_c);
			UpdateFlashlightColours();
		}
	}
}
internal static class GunTweaks
{
	public static void PatchDeaglesSpring()
	{
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: 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_0083: Unknown result type (might be due to invalid IL or missing references)
		foreach (GameObject item in ReceiverCoreScript.Instance().gun_prefabs.Where((GameObject e) => e.GetComponent<GunScript>().weapon_group_name == "desert_eagle"))
		{
			if ((Object)(object)item != (Object)null)
			{
				Transform val = item.transform.Find("main_spring");
				if ((Object)(object)val != (Object)null)
				{
					Quaternion localRotation = val.localRotation;
					((Quaternion)(ref localRotation)).eulerAngles = new Vector3(5f, 0f, 20f);
					val.localRotation = localRotation;
				}
				else
				{
					Debug.LogError((object)"hey, guess what, the mainspring is null.... oops");
				}
			}
			else
			{
				Debug.LogError((object)"fucking deagle is null, can you believe it? fucking fuck.");
			}
		}
	}

	public static void PatchHiPointCatchMagSlideAmount()
	{
		foreach (GunScript item in from e in ReceiverCoreScript.Instance().gun_prefabs
			where (int)e.GetComponent<GunScript>().gun_model == 5
			select e.GetComponent<GunScript>())
		{
			if ((Object)(object)item != (Object)null)
			{
				item.magazine_catch_mag_slide_animation = "";
				item.magazine_catch_mag_slide_amount = 0.8025f;
			}
		}
	}
}
public static class InventoryGlintColourRandomizer
{
	internal static readonly Color BaseGlintColour = new Color(1f, 0.9266f, 0.5047f);

	[HarmonyPatch(typeof(InventoryItem), "Awake")]
	[HarmonyPostfix]
	private static void PatchInventoryItemAwake(ref InventoryItem __instance)
	{
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		if (SettingsManager.configInventoryGlintColourEnabled.Value && (Object)(object)__instance.glint_renderer != (Object)null && (Object)(object)__instance.glint_renderer.material != (Object)null)
		{
			Color val = Random.ColorHSV(0f, 1f, 0f, 1f, 0.7f, 1f);
			if (SettingsManager.Verbose)
			{
				Debug.Log((object)(__instance.InternalName + "'s new Random Colour: " + val));
			}
			__instance.glint_renderer.material.SetColor("_GlintColor", val);
		}
	}
}
public static class Leaning
{
	private enum LeaningDirection
	{
		None,
		Left,
		Right,
		Forward
	}

	private static bool leaning;

	private static LeaningDirection leaningDirection;

	private static float leaningRotation = 30f;

	private static Transform lean_pivot;

	public static void Initialize()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		lean_pivot = Object.Instantiate<GameObject>(new GameObject("lean_pivot"), ReceiverCoreScript.Instance().player_prefab.transform).transform;
		lean_pivot.localPosition = Vector3.zero;
		lean_pivot.localRotation = Quaternion.identity;
	}

	[HarmonyPatch(typeof(LocalAimHandler), "SetUpCamera")]
	[HarmonyPostfix]
	private static void PatchSetupCamera()
	{
		((Component)LocalAimHandler.player_instance.main_camera).transform.parent = lean_pivot;
		lean_pivot.parent = ((Component)LocalAimHandler.player_instance).transform;
	}

	[HarmonyPatch(typeof(LocalAimHandler), "UpdateCameraAndPlayerTransformation")]
	[HarmonyPostfix]
	private static void PatchUpdateCamera()
	{
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		if (leaningDirection == LeaningDirection.Forward)
		{
			leaning = false;
		}
		if (Input.GetKey((KeyCode)97) && Input.GetKey((KeyCode)101))
		{
			if (!leaning)
			{
				leaning = true;
			}
			leaningDirection = LeaningDirection.Forward;
		}
		else if (Input.GetKeyDown((KeyCode)97))
		{
			if (!leaning)
			{
				leaning = true;
				leaningDirection = LeaningDirection.Left;
			}
			else if (leaningDirection == LeaningDirection.Left)
			{
				leaning = false;
				leaningDirection = LeaningDirection.None;
			}
		}
		else if (Input.GetKeyDown((KeyCode)101))
		{
			if (!leaning)
			{
				leaning = true;
				leaningDirection = LeaningDirection.Right;
			}
			else if (leaningDirection == LeaningDirection.Right)
			{
				leaning = false;
				leaningDirection = LeaningDirection.None;
			}
		}
		float num = 0f;
		float num2 = 0f;
		if (leaning)
		{
			switch (leaningDirection)
			{
			case LeaningDirection.Left:
				num = leaningRotation;
				break;
			case LeaningDirection.Right:
				num = 0f - leaningRotation;
				break;
			case LeaningDirection.Forward:
				num2 = 0f - leaningRotation;
				break;
			}
		}
		lean_pivot.eulerAngles = new Vector3(Mathf.MoveTowardsAngle(lean_pivot.eulerAngles.x, num, Time.deltaTime * 200f), 0f, Mathf.MoveTowardsAngle(lean_pivot.eulerAngles.z, num2, Time.deltaTime * 200f));
	}
}
internal static class MenuManagerTweaks
{
	internal static void TriggerEventLoadLevelSections()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		if (ImGui.BeginMenu("Trigger event"))
		{
			foreach (ReceiverEventType value in Enum.GetValues(typeof(ReceiverEventType)))
			{
				ReceiverEventType val = value;
				if (ImGui.MenuItem(((object)(ReceiverEventType)(ref val)).ToString()))
				{
					ReceiverEventManager.Instance.TriggerEvent(val);
				}
			}
			ImGui.EndMenu();
		}
		if (!ImGui.BeginMenu("Load Level"))
		{
			return;
		}
		string[] array = LevelManagerScript.Instance.level_list.GetSceneNames().ToArray();
		for (int i = 0; i < array.Length; i++)
		{
			if (ImGui.MenuItem(array[i]))
			{
				ReceiverCoreScript.Instance().StartGameMode((GameMode)0);
				ReceiverCoreScript.Instance().FadeAndLoad(LevelManagerScript.Instance.level_list.GetIDs()[i]);
				ReceiverCoreScript.Instance().menu_manager.CloseMenu();
			}
		}
		ImGui.EndMenu();
	}

	[HarmonyPatch(typeof(MenuManagerScript), "UpdateDeveloperMenu")]
	[HarmonyTranspiler]
	private static IEnumerable<CodeInstruction> UpdateDeveloperMenuTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Expected O, but got Unknown
		CodeMatcher val = new CodeMatcher(instructions, generator).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
		{
			new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"Special Events", (string)null)
		});
		if (!val.ReportFailure(__originalMethod, (Action<string>)Debug.LogError))
		{
			val.SetAndAdvance(OpCodes.Call, (object)AccessTools.Method(typeof(MenuManagerTweaks), "TriggerEventLoadLevelSections", (Type[])null, (Type[])null)).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Ldstr, (object)"Special Events")
			});
		}
		return val.InstructionEnumeration();
	}
}
internal static class PostProcessTweaks
{
	private static LocalAimHandler lah;

	private static ReceiverFog receiver_fog;

	public static bool verbose;

	internal static SettingsMenuEntry<float> motionBlurSlider;

	internal static SettingsMenuEntry<string> ssrDropDown;

	internal static MotionBlur motionBlur;

	internal static ScreenSpaceReflections ssr;

	public static Color east_beginner_colour = new Color(0.5f, 0.2f, 1f);

	public static Color west_beginner_colour = new Color(0.5f, 1f, 0.2f);

	public static Color east_sleeper_colour = new Color(0.1751f, 0.0753f, 0.3396f);

	public static Color west_sleeper_colour = new Color(0.1178f, 0.2453f, 0.0405f);

	public static Color east_sleepwalker_colour = new Color(0.1751f, 0.0753f, 0.3396f);

	public static Color west_sleepwalker_colour = new Color(0.1178f, 0.2453f, 0.0405f);

	public static Color east_fire_colour = new Color(1f, 0.5408f, 0f);

	public static Color west_fire_colour = new Color(1f, 0.398f, 0f);

	public static Color east_awake_colour = new Color(0.5f, 0.2f, 1f);

	public static Color west_awake_colour = new Color(0.5f, 1f, 0.2f);

	public static Color east_other_colour = new Color(0.5f, 0.2f, 1f);

	public static Color west_other_colour = new Color(0.5f, 1f, 0.2f);

	internal static void AddSettingsToStandardProfile()
	{
		CreateSettingsMenuEntries();
	}

	public static Color GetCurrentColourEast()
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Invalid comparison between Unknown and I4
		//IL_0012: 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_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		if ((int)ReceiverCoreScript.Instance().game_mode.GetGameMode() != 2)
		{
			return east_other_colour;
		}
		switch (ReceiverCoreScript.Instance().WorldGenerationConfiguration.level_name)
		{
		case "introduction":
		case "beginner":
			return east_beginner_colour;
		case "sleeper":
			return east_sleeper_colour;
		case "sleepwalker":
			return east_sleepwalker_colour;
		case "dawned":
			return east_fire_colour;
		case "awake":
			return east_awake_colour;
		default:
			return east_other_colour;
		}
	}

	public static Color GetCurrentColourWest()
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Invalid comparison between Unknown and I4
		//IL_0012: 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_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		if ((int)ReceiverCoreScript.Instance().game_mode.GetGameMode() != 2)
		{
			return west_other_colour;
		}
		switch (ReceiverCoreScript.Instance().WorldGenerationConfiguration.level_name)
		{
		case "introduction":
		case "beginner":
			return west_beginner_colour;
		case "sleeper":
			return west_sleeper_colour;
		case "sleepwalker":
			return west_sleepwalker_colour;
		case "dawned":
			return west_fire_colour;
		case "awake":
			return west_awake_colour;
		default:
			return west_other_colour;
		}
	}

	public static void OnPlayerInitialize(ReceiverEventTypeVoid ev)
	{
		receiver_fog = null;
		List<PostProcessVolume> list = new List<PostProcessVolume>();
		PostProcessManager.instance.GetActiveVolumes(((Component)ReceiverCoreScript.Instance().player.lah.main_camera).GetComponent<PostProcessLayer>(), list, true, true);
		IEnumerable<ReceiverFog> source = from e in list
			where e.profile.HasSettings<ReceiverFog>()
			select e.profile.GetSetting<ReceiverFog>();
		if (source.Count() > 0)
		{
			receiver_fog = source.Last();
		}
		if ((Object)(object)receiver_fog != (Object)null)
		{
			((ParameterOverride)receiver_fog.eastColor).overrideState = true;
			((ParameterOverride)receiver_fog.westColor).overrideState = true;
		}
		UpdateFogColour();
	}

	private static void CreateSettingsMenuEntries()
	{
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		SettingsMenuManager.CreateSettingsMenuOption<bool>("Enable Screen Space Reflections", SettingsManager.configSSREnabled, 14).control.GetComponent(Type.GetType("Receiver2.ToggleComponent, Wolfire.Receiver2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"));
		ssrDropDown = SettingsMenuManager.CreateSettingsMenuOption<string>("Screen Space Reflections Quality", SettingsManager.configSSRQuality, 15);
		DropdownComponent ssrDropDownComp = ssrDropDown.control.GetComponent<DropdownComponent>();
		((UnityEvent<int>)(object)ssrDropDownComp.OnChange).AddListener((UnityAction<int>)delegate
		{
			ChangeSSRQualitySetting(ssrDropDownComp.SelectedIndex);
		});
		ssrDropDown.control.SetActive(SettingsManager.configSSREnabled.Value);
		ssrDropDown.label.SetActive(SettingsManager.configSSREnabled.Value);
		if (!GlobalPostProcess.instance.default_standard_profile.HasSettings<ScreenSpaceReflections>())
		{
			ssr = GlobalPostProcess.instance.default_standard_profile.AddSettings<ScreenSpaceReflections>();
		}
		((PostProcessEffectSettings)ssr).active = SettingsManager.configSSREnabled.Value;
		((ParameterOverride<float>)(object)ssr.distanceFade).value = 1f;
		((ParameterOverride)ssr.distanceFade).overrideState = true;
		((ParameterOverride<ScreenSpaceReflectionResolution>)(object)ssr.resolution).value = (ScreenSpaceReflectionResolution)2;
		((ParameterOverride)ssr.resolution).overrideState = true;
		((ParameterOverride<float>)(object)ssr.thickness).value = 20f;
		((ParameterOverride)ssr.thickness).overrideState = true;
		((ParameterOverride<int>)(object)ssr.maximumIterationCount).value = 256;
		((ParameterOverride)ssr.maximumIterationCount).overrideState = true;
		((ParameterOverride<float>)(object)ssr.maximumMarchDistance).value = 100f;
		((ParameterOverride)ssr.maximumMarchDistance).overrideState = true;
		((ParameterOverride<float>)(object)ssr.vignette).value = 0.2f;
		((ParameterOverride)ssr.vignette).overrideState = true;
		((ParameterOverride<ScreenSpaceReflectionPreset>)(object)ssr.preset).value = (ScreenSpaceReflectionPreset)((AcceptableValueList<string>)(object)((ConfigEntryBase)SettingsManager.configSSRQuality).Description.AcceptableValues).AcceptableValues.ToList().FindIndex((string value) => value == SettingsManager.configSSRQuality.Value);
		((ParameterOverride)ssr.preset).overrideState = true;
		Component component = SettingsMenuManager.CreateSettingsMenuOption<bool>("Enable Motion Blur", SettingsManager.configMotionBlurEnabled, 17).control.GetComponent(Type.GetType("Receiver2.ToggleComponent, Wolfire.Receiver2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"));
		_ = (UnityEvent<bool>)((object)component).GetType().GetField("OnChange").GetValue(component);
		motionBlurSlider = SettingsMenuManager.CreateSettingsMenuOption<float>("Motion Blur Intensity", SettingsManager.configMotionBlurIntensity, 18);
		SliderComponent motionBlurSliderComp = motionBlurSlider.control.GetComponent<SliderComponent>();
		((UnityEvent<float>)(object)motionBlurSliderComp.OnChange).AddListener((UnityAction<float>)delegate
		{
			ChangeMotionBlurIntensity(motionBlurSliderComp.Value);
		});
		motionBlurSlider.control.SetActive(SettingsManager.configMotionBlurEnabled.Value);
		motionBlurSlider.label.SetActive(SettingsManager.configMotionBlurEnabled.Value);
		if (!GlobalPostProcess.instance.default_standard_profile.HasSettings<MotionBlur>())
		{
			motionBlur = GlobalPostProcess.instance.default_standard_profile.AddSettings<MotionBlur>();
		}
		((PostProcessEffectSettings)motionBlur).active = SettingsManager.configMotionBlurEnabled.Value;
		((ParameterOverride<int>)(object)motionBlur.sampleCount).value = 100;
		((ParameterOverride)motionBlur.sampleCount).overrideState = true;
		((ParameterOverride<float>)(object)motionBlur.shutterAngle).value = SettingsManager.configMotionBlurIntensity.Value;
		((ParameterOverride)motionBlur.shutterAngle).overrideState = true;
	}

	internal static void ToggleMotionBlur()
	{
		((PostProcessEffectSettings)GlobalPostProcess.instance.default_standard_profile.GetSetting<MotionBlur>()).active = SettingsManager.configMotionBlurEnabled.Value;
		if (motionBlurSlider != null)
		{
			motionBlurSlider.control.SetActive(SettingsManager.configMotionBlurEnabled.Value);
			motionBlurSlider.label.SetActive(SettingsManager.configMotionBlurEnabled.Value);
		}
	}

	internal static void ToggleSSR()
	{
		((PostProcessEffectSettings)GlobalPostProcess.instance.default_standard_profile.GetSetting<ScreenSpaceReflections>()).active = SettingsManager.configSSREnabled.Value;
		if (ssrDropDown != null)
		{
			ssrDropDown.control.SetActive(SettingsManager.configSSREnabled.Value);
			ssrDropDown.label.SetActive(SettingsManager.configSSREnabled.Value);
		}
	}

	private static void ChangeSSRQualitySetting(int value)
	{
		//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)
		((ParameterOverride<ScreenSpaceReflectionPreset>)(object)GlobalPostProcess.instance.default_standard_profile.GetSetting<ScreenSpaceReflections>().preset).value = ParameterOverride<ScreenSpaceReflectionPreset>.op_Implicit(new ParameterOverride<ScreenSpaceReflectionPreset>((ScreenSpaceReflectionPreset)value));
	}

	private static void ChangeMotionBlurIntensity(float value)
	{
		((ParameterOverride<float>)(object)GlobalPostProcess.instance.default_standard_profile.GetSetting<MotionBlur>().shutterAngle).value = value;
	}

	public static void UpdateFogColour()
	{
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: 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)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: 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_0139: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)receiver_fog != (Object)null)
		{
			if (verbose)
			{
				Debug.Log((object)"Updating fog colours");
			}
			if (verbose)
			{
				Debug.LogFormat("Current east fog color is {0}", new object[1] { ((ParameterOverride<Color>)(object)receiver_fog.eastColor).value });
			}
			if (verbose)
			{
				Debug.LogFormat("Current west fog color is {0}", new object[1] { ((ParameterOverride<Color>)(object)receiver_fog.westColor).value });
			}
			if (verbose)
			{
				Debug.LogFormat("Current custom east fog color is {0}", new object[1] { GetCurrentColourEast() });
			}
			if (verbose)
			{
				Debug.LogFormat("Current custom west fog color is {0}", new object[1] { GetCurrentColourWest() });
			}
			((ParameterOverride<Color>)(object)receiver_fog.eastColor).value = GetCurrentColourEast();
			((ParameterOverride<Color>)(object)receiver_fog.westColor).value = GetCurrentColourWest();
			if (verbose)
			{
				Debug.LogFormat("Current east fog color is {0}", new object[1] { ((ParameterOverride<Color>)(object)receiver_fog.eastColor).value });
			}
			if (verbose)
			{
				Debug.LogFormat("Current west fog color is {0}", new object[1] { ((ParameterOverride<Color>)(object)receiver_fog.westColor).value });
			}
		}
	}
}
public static class RobotTweaks
{
	[HarmonyPatch(typeof(TurretScript), "UpdateLight")]
	public static class TurretLightUpdateTranspiler
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
		{
			//IL_0002: 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_0037: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, generator).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(Light), "set_color", (Type[])null, (Type[])null), (string)null)
			});
			if (!val.ReportFailure(__originalMethod, (Action<string>)Debug.LogError))
			{
				val.SetAndAdvance(OpCodes.Ldfld, (object)AccessTools.Field(typeof(RobotTweaks), "colour_normal")).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(Light), "set_color", new Type[1] { typeof(Color) }, (Type[])null))
				});
			}
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(Light), "set_color", (Type[])null, (Type[])null), (string)null)
			});
			if (!val.ReportFailure(__originalMethod, (Action<string>)Debug.LogError))
			{
				val.SetAndAdvance(OpCodes.Ldfld, (object)AccessTools.Field(typeof(RobotTweaks), "colour_alert_shooting")).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(Light), "set_color", new Type[1] { typeof(Color) }, (Type[])null))
				});
			}
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(Light), "set_color", (Type[])null, (Type[])null), (string)null)
			});
			if (!val.ReportFailure(__originalMethod, (Action<string>)Debug.LogError))
			{
				val.SetAndAdvance(OpCodes.Ldfld, (object)AccessTools.Field(typeof(RobotTweaks), "colour_alert")).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(Light), "set_color", new Type[1] { typeof(Color) }, (Type[])null))
				});
			}
			return val.InstructionEnumeration();
		}
	}

	[HarmonyPatch(typeof(TripMineBot), "Update")]
	public static class TripmineUpdateTranspiler
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Expected O, but got Unknown
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Expected O, but got Unknown
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Expected O, but got Unknown
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Expected O, but got Unknown
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Expected O, but got Unknown
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Expected O, but got Unknown
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, generator).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LocalAimHandler), "player_instance"), (string)null)
			});
			if (!val.ReportFailure(__originalMethod, (Action<string>)Debug.LogError))
			{
				val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Ldarg_0, (object)null)
				}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(TripMineBot), "light_beam"))
				}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(RobotTweaks), "tripmine_beam_colour"))
				})
					.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(VolumetricLightBeam), "color"))
					})
					.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Ldarg_0, (object)null)
					})
					.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(TripMineBot), "triggered"))
					})
					.InsertBranchAndAdvance(OpCodes.Brfalse_S, val.Pos)
					.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Ldarg_0, (object)null)
					})
					.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(TripMineBot), "light_beam"))
					})
					.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(RobotTweaks), "tripmine_beam_colour_triggered"))
					})
					.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(VolumetricLightBeam), "color"))
					})
					.Advance(2)
					.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Ldarg_0, (object)null)
					})
					.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(TripMineBot), "light_beam"))
					})
					.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(VolumetricLightBeam), "UpdateAfterManualPropertyChange", (Type[])null, (Type[])null))
					});
			}
			return val.InstructionEnumeration();
		}
	}

	public static Color tripmine_beam_colour;

	public static Color tripmine_beam_colour_triggered;

	public static Color tripmine_beam_colour_normal;

	public static Color tripmine_beam_colour_triggered_normal;

	public static Color colour_normal;

	public static Color colour_alert;

	public static Color colour_alert_shooting;

	public static Color colour_idle_turret;

	public static Color colour_alert_turret;

	public static Color colour_attacking_turret;

	public static Color colour_idle_drone;

	public static Color colour_alert_drone;

	public static Color colour_attacking_drone;

	public static Color colour_idle_camera;

	public static Color colour_alert_camera;

	public static Color colour_alarming_camera;

	public static Color tc_tripmine_beam_colour = Color.blue;

	public static Color tc_tripmine_beam_colour_triggered = Color.red;

	public static readonly Color tc_colour_idle = Color.red;

	public static readonly Color tc_colour_alert = Color.white;

	public static readonly Color tc_colour_attack = new Color(1f, 0.25f, 0f);

	public static Color colour_override_idle;

	public static Color colour_override_alert;

	public static Color colour_override_attack;

	private static float colour_a = 0f;

	private static float colour_b = 0.5f;

	private static float colour_c = 1f;

	private static float random_a;

	private static float random_b;

	private static float random_c;

	public static int disco_timescale;

	public static bool verbose;

	public static bool campaign_has_override;

	private static FieldInfo current_light_mode;

	private static FieldInfo part;

	private static FieldInfo light_color;

	private static FieldInfo light_intensity;

	private static MethodInfo SetLightMode;

	public static bool ShouldOverrideColour
	{
		get
		{
			if (campaign_has_override)
			{
				return SettingsManager.configKilldroneColourOverride.Value;
			}
			return false;
		}
	}

	internal static void SetUpLightPartFieldReflections()
	{
		current_light_mode = typeof(LightPart).GetField("current_light_mode", BindingFlags.Instance | BindingFlags.NonPublic);
		part = typeof(LightPart).GetField("part", BindingFlags.Instance | BindingFlags.NonPublic);
		light_color = typeof(LightPart).GetField("light_color", BindingFlags.Instance | BindingFlags.NonPublic);
		SetLightMode = typeof(LightPart).GetMethod("SetLightMode", BindingFlags.Instance | BindingFlags.NonPublic);
		light_intensity = typeof(LightPart).GetField("light_intensity", BindingFlags.Instance | BindingFlags.NonPublic);
	}

	public static void PatchBombBotPrefab()
	{
		ReceiverCoreScript.Instance().enemy_prefabs.bomb_bot.GetComponent<BombBotScript>().voice_filter = "event:/TextToSpeech/TextToSpeech - bomb bot";
	}

	internal static void PatchPowerLeechPrefab()
	{
		((RobotScript)ReceiverCoreScript.Instance().enemy_prefabs.power_leech_bot.GetComponent<PowerLeechBot>()).occlusion_component = ((RobotScript)ReceiverCoreScript.Instance().enemy_prefabs.turret.GetComponent<TurretScript>()).occlusion_component;
	}

	internal static void OnChangeKilldroneLightColour()
	{
		UpdateColourPartLight();
	}

	[HarmonyPatch(typeof(LightPart), "SetLightMode")]
	[HarmonyTranspiler]
	private static IEnumerable<CodeInstruction> TranspileSetLightMode(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Expected O, but got Unknown
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Expected O, but got Unknown
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Expected O, but got Unknown
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Expected O, but got Unknown
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f4: Expected O, but got Unknown
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Expected O, but got Unknown
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0254: Expected O, but got Unknown
		CodeMatcher val = new CodeMatcher(instructions, generator).MatchForward(true, (CodeMatch[])(object)new CodeMatch[1]
		{
			new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(LightPart), "passive_color"), (string)null)
		});
		if (!val.ReportFailure(__originalMethod, (Action<string>)Debug.LogError))
		{
			val.SetOperandAndAdvance((object)AccessTools.Field(typeof(LightPart), "part"));
			val.Insert((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(RobotTweaks), "GetPassiveColour", (Type[])null, (Type[])null))
			});
		}
		val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1]
		{
			new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(LightPart), "alert_color"), (string)null)
		});
		if (!val.ReportFailure(__originalMethod, (Action<string>)Debug.LogError))
		{
			val.SetOperandAndAdvance((object)AccessTools.Field(typeof(LightPart), "part"));
			val.Insert((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(RobotTweaks), "GetAlertColour", (Type[])null, (Type[])null))
			});
		}
		val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1]
		{
			new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(LightPart), "aggressive_color"), (string)null)
		});
		if (!val.ReportFailure(__originalMethod, (Action<string>)Debug.LogError))
		{
			val.SetOperandAndAdvance((object)AccessTools.Field(typeof(LightPart), "part"));
			val.Insert((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(RobotTweaks), "GetAggressiveColour", (Type[])null, (Type[])null))
			});
		}
		val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1]
		{
			new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(LightPart), "passive_color"), (string)null)
		});
		if (!val.ReportFailure(__originalMethod, (Action<string>)Debug.LogError))
		{
			val.SetOperandAndAdvance((object)AccessTools.Field(typeof(LightPart), "part"));
			val.Insert((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(RobotTweaks), "GetPassiveColour", (Type[])null, (Type[])null))
			});
		}
		return val.InstructionEnumeration();
	}

	[HarmonyPatch(typeof(SecurityCamera), "Start")]
	[HarmonyPostfix]
	private static void PatchSecurityCameraStart(ref SecurityCamera __instance)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		light_color.SetValue(__instance.light_part, ShouldOverrideColour ? colour_override_idle : colour_idle_camera);
	}

	[HarmonyPatch(typeof(ShockDrone), "Start")]
	[HarmonyPostfix]
	private static void PatchShockDroneStart(ref ShockDrone __instance)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		light_color.SetValue(__instance.light_part, ShouldOverrideColour ? colour_override_idle : colour_idle_drone);
	}

	[HarmonyPatch(typeof(LightPart), "Start")]
	[HarmonyPostfix]
	private static void PatchLightPartStart(ref LightPart __instance)
	{
		__instance.SetTargetLightMode((LightMode)0, true);
		((Component)__instance).SendMessage("UpdateLightMode", (object)true);
		((Component)__instance).SendMessage("UpdateLights");
	}

	internal static void UpdateColourPartLight(LightPart instance = null)
	{
		if ((Object)(object)instance != (Object)null)
		{
			SetLightMode.Invoke(instance, new object[1] { current_light_mode.GetValue(instance) });
			return;
		}
		LightPart[] array = Object.FindObjectsOfType<LightPart>();
		for (int i = 0; i < array.Length; i++)
		{
			SetLightMode.Invoke(array[i], new object[1] { current_light_mode.GetValue(array[i]) });
		}
	}

	[HarmonyPatch(typeof(LightPart), "UpdateLightMode")]
	[HarmonyPrefix]
	private static void PatchLightPartUpdate(ref LightPart __instance)
	{
		if (SettingsManager.configEnableTurretDiscoLights.Value && ShouldOverrideColour)
		{
			UpdateColourPartLight(__instance);
		}
	}

	internal static void UpdateLightPartDefaultColour(Color lightColour, ReceiverEntityType entityType = 0)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Invalid comparison between Unknown and I4
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Invalid comparison between Unknown and I4
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		EnemyPrefabsList enemy_prefabs = ReceiverCoreScript.Instance().enemy_prefabs;
		if ((int)entityType == 0)
		{
			light_color.SetValue(enemy_prefabs.shock_drone.GetComponent<ShockDrone>().light_part, lightColour);
			light_color.SetValue(enemy_prefabs.security_camera.GetComponent<SecurityCamera>().light_part, lightColour);
			return;
		}
		GameObject prefab = enemy_prefabs.GetPrefab(entityType);
		if ((int)entityType == 2)
		{
			light_color.SetValue(prefab.GetComponent<ShockDrone>().light_part, lightColour);
		}
		if ((int)entityType == 6)
		{
			light_color.SetValue(prefab.GetComponent<SecurityCamera>().light_part, lightColour);
		}
	}

	public static Color GetPassiveColour(RobotPart part)
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		if (campaign_has_override && SettingsManager.configKilldroneColourOverride.Value)
		{
			return colour_override_idle;
		}
		if (part.robot is ShockDrone)
		{
			return colour_idle_drone;
		}
		return colour_idle_camera;
	}

	public static Color GetAlertColour(RobotPart part)
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		if (campaign_has_override && SettingsManager.configKilldroneColourOverride.Value)
		{
			return colour_override_alert;
		}
		if (part.robot is ShockDrone)
		{
			return colour_alert_drone;
		}
		return colour_alert_camera;
	}

	public static Color GetAggressiveColour(RobotPart part)
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		if (campaign_has_override && SettingsManager.configKilldroneColourOverride.Value)
		{
			return colour_override_attack;
		}
		if (part.robot is ShockDrone)
		{
			return colour_attacking_drone;
		}
		return colour_alarming_camera;
	}

	public static void OnPlayerInitialize(ReceiverEventTypeVoid ev)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Invalid comparison between Unknown and I4
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: 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_007d: 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_0087: 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_0091: 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_00cc: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: 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)
		if ((int)ReceiverCoreScript.Instance().game_mode.GetGameMode() != 2)
		{
			return;
		}
		FieldInfo field = typeof(RankingProgressionGameMode).GetField("campaign_name", BindingFlags.Instance | BindingFlags.NonPublic);
		RankingProgressionGameMode component = ((Component)ReceiverCoreScript.Instance().game_mode).GetComponent<RankingProgressionGameMode>();
		if (SettingsManager.Verbose)
		{
			Debug.Log(field.GetValue(component));
		}
		if ((string)field.GetValue(component) != "bozo_torture_campaign")
		{
			campaign_has_override = false;
			colour_normal = colour_idle_turret;
			colour_alert = colour_alert_turret;
			colour_alert_shooting = colour_attacking_turret;
			tripmine_beam_colour = tripmine_beam_colour_normal;
			if (SettingsManager.Verbose)
			{
				Debug.LogFormat("{0} <- {1}", new object[2] { tripmine_beam_colour, tripmine_beam_colour_normal });
			}
			tripmine_beam_colour_triggered = tripmine_beam_colour_triggered_normal;
			if (SettingsManager.Verbose)
			{
				Debug.LogFormat("{0} <- {1}", new object[2] { tripmine_beam_colour_triggered, tripmine_beam_colour_triggered_normal });
			}
		}
		else
		{
			campaign_has_override = true;
			SetOverrideColours(enable: true);
			if (SettingsManager.Verbose)
			{
				Debug.Log((object)"player is bozo");
			}
		}
	}

	internal static void SetOverrideColours(bool enable)
	{
		//IL_0073: 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_007d: 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_0087: 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_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//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_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_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: 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_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		if (enable && campaign_has_override && SettingsManager.configKilldroneColourOverride.Value)
		{
			colour_override_idle = tc_colour_idle;
			colour_override_alert = tc_colour_alert;
			colour_override_attack = tc_colour_attack;
			colour_normal = colour_override_idle;
			colour_alert = colour_override_alert;
			colour_alert_shooting = colour_override_attack;
			tripmine_beam_colour = tc_tripmine_beam_colour;
			tripmine_beam_colour_triggered = tc_tripmine_beam_colour_triggered;
			UpdateLightPartDefaultColour(colour_override_idle, (ReceiverEntityType)0);
		}
		else
		{
			colour_normal = colour_idle_turret;
			colour_alert = colour_alert_turret;
			colour_alert_shooting = colour_attacking_turret;
			tripmine_beam_colour = tripmine_beam_colour_normal;
			tripmine_beam_colour_triggered = tripmine_beam_colour_triggered_normal;
			UpdateLightPartDefaultColour(SettingsManager.configDroneColourIdle.Value, (ReceiverEntityType)2);
			UpdateLightPartDefaultColour(SettingsManager.configCameraColourIdle.Value, (ReceiverEntityType)6);
		}
		UpdateColourPartLight();
	}

	public static void Discolights()
	{
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: 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)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		if (!campaign_has_override || (campaign_has_override && !SettingsManager.configKilldroneColourOverride.Value))
		{
			if (colour_a == random_a)
			{
				random_a = Random.Range(0f, 1f);
			}
			if (colour_b == random_b)
			{
				random_b = Random.Range(0f, 1f);
			}
			if (colour_c == random_c)
			{
				random_c = Random.Range(0f, 1f);
			}
			colour_a = Mathf.MoveTowards(colour_a, random_a, Time.deltaTime / (float)disco_timescale);
			colour_b = Mathf.MoveTowards(colour_b, random_b, Time.deltaTime / (float)disco_timescale);
			colour_c = Mathf.MoveTowards(colour_c, random_c, Time.deltaTime / (float)disco_timescale);
			UpdateLightPartDefaultColour(colour_idle_camera = (colour_idle_drone = (colour_normal = new Color(colour_a, colour_b, colour_c))), (ReceiverEntityType)0);
		}
	}
}
internal class SpecialEventsTweaks
{
	internal static class HalloweenTweaks
	{
		[HarmonyPatch(typeof(Pumpkin), "Start")]
		[HarmonyPrefix]
		private static void PatchPumpkinAwake(ref Pumpkin __instance)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			if (RobotTweaks.campaign_has_override)
			{
				__instance.intact_object.GetComponentInChildren<Light>().color = Color.red;
				Material material = ((Renderer)__instance.intact_object.GetComponentInChildren<MeshRenderer>()).material;
				material.color = (Probability.Chance(0.2f) ? Color.black : material.color);
				material.SetColor("_EmissionColor", Color.red);
			}
		}
	}
}
internal static class TapeLocatron3000
{
	internal static float light_distance = 10f;

	internal static float time_occluded = 0f;

	[HarmonyPatch(typeof(RuntimeTileLevelGenerator), "Update")]
	[HarmonyPostfix]
	private static void PatchRuntimeTileGenUpdate(ref RuntimeTileLevelGenerator __instance)
	{
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: 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_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)LocalAimHandler.player_instance != (Object)null) || !SettingsManager.configTapeLocatron3000Enabled.Value)
		{
			return;
		}
		foreach (var item2 in AccessTools.Field(typeof(RuntimeTileLevelGenerator), "tapes_closest_to_player").GetValue(__instance) as List<(int, ActiveItem)>)
		{
			ActiveItem item = item2.Item2;
			if ((Object)(object)LocalAimHandler.player_instance.main_camera != (Object)null)
			{
				Vector3 position = item.position;
				Vector3 val = LocalAimHandler.player_instance.GetCameraPos() - item.position;
				ApplyIndividualDroneLightNoRayCast(position, ((Vector3)(ref val)).normalized, SettingsManager.configTapeLocatron3000ColourLos.Value, SettingsManager.configTapeLocatron3000ColourOccluded.Value, light_distance);
			}
		}
	}

	public static void ApplyIndividualDroneLightNoRayCast(Vector3 origin, Vector3 light_direction, Color color_los, Color color_occluded, float light_range)
	{
		//IL_000f: 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_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = ((Component)LocalAimHandler.player_instance.main_camera).transform.position - origin;
		float num = Vector3.Magnitude(val);
		if (num > light_range)
		{
			return;
		}
		Vector3 val2 = Vector3.Normalize(val);
		float num2 = Vector3.Dot(val2, light_direction);
		float num3 = Mathf.Lerp(0f, 1f, (num2 - 0.7f) / 0.3f);
		num3 *= 1f - num / light_range;
		if (num3 > 0f)
		{
			Color val3 = color_los;
			RaycastHit val4 = default(RaycastHit);
			if (Physics.Raycast(origin, val2, ref val4, num, LayerMask.op_Implicit(ReceiverCoreScript.Instance().layer_mask_vision)) && !StochasticVision.CheckHitPlayer(val4, LocalAimHandler.player_instance))
			{
				val3 = color_occluded;
			}
			val3 *= ((Component)AudioManager.Instance()).GetComponent<MusicScript>().Mystical;
			float num4 = 4f;
			num3 = Mathf.Pow(num3, 4f);
			num3 *= num4;
			float num5 = Vector3.Dot(-val2, ((Component)LocalAimHandler.player_instance.main_camera).transform.right);
			float num6 = Vector3.Dot(-val2, ((Component)LocalAimHandler.player_instance.main_camera).transform.up);
			if (num5 > 0f)
			{
				ScreenEffect.Flash((Type)4, new Color(val3.r, val3.g, val3.b, num3 * num5), 0f, 0f, (Dir)1);
			}
			if (num5 < 0f)
			{
				ScreenEffect.Flash((Type)4, new Color(val3.r, val3.g, val3.b, num3 * (0f - num5)), 0f, 0f, (Dir)0);
			}
			if (num6 > 0f)
			{
				ScreenEffect.Flash((Type)4, new Color(val3.r, val3.g, val3.b, num3 * num6), 0f, 0f, (Dir)2);
			}
			if (num6 < 0f)
			{
				ScreenEffect.Flash((Type)4, new Color(val3.r, val3.g, val3.b, num3 * (0f - num6)), 0f, 0f, (Dir)3);
			}
		}
	}
}
public static class TurretAmmoBoxBoom
{
	public static bool verbose;

	internal static bool enabled;

	[HarmonyPatch(typeof(TurretScript), "Damage")]
	[HarmonyTranspiler]
	private static IEnumerable<CodeInstruction> TranspileDamageTurretScript(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Expected O, but got Unknown
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Expected O, but got Unknown
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Expected O, but got Unknown
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Expected O, but got Unknown
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Expected O, but got Unknown
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Expected O, but got Unknown
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Expected O, but got Unknown
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Expected O, but got Unknown
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Expected O, but got Unknown
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Expected O, but got Unknown
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Expected O, but got Unknown
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Expected O, but got Unknown
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Expected O, but got Unknown
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Expected O, but got Unknown
		//IL_025c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0262: Expected O, but got Unknown
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_027f: Expected O, but got Unknown
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Expected O, but got Unknown
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02eb: Expected O, but got Unknown
		//IL_034c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0352: Expected O, but got Unknown
		CodeMatcher val = new CodeMatcher(instructions, generator).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
		{
			new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(TurretScript), "ammo_alive"), (string)null),
			new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null)
		});
		if (!val.ReportFailure(__originalMethod, (Action<string>)Debug.LogError))
		{
			val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(TurretAmmoBoxBoom), "enabled"))
			}).InsertBranchAndAdvance(OpCodes.Brfalse_S, val.Pos + 1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null)
			})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Component), "get_transform", (Type[])null, (Type[])null))
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Ldarg_0, (object)null)
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(TurretScript), "bullets_per_belt"))
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Ldarg_0, (object)null)
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(TurretScript), "ammo_belts"))
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Ldc_I4_1, (object)null)
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Sub, (object)null)
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Mul, (object)null)
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Ldarg_0, (object)null)
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(TurretScript), "bullets"))
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Add, (object)null)
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Ldarg_0, (object)null)
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Component), "get_transform", (Type[])null, (Type[])null))
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Ldstr, (object)"point_pivot/gun_pivot/gun_assembly/ammo_destroy")
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(Transform), "Find", new Type[1] { typeof(string) }, (Type[])null))
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(TurretScript), "cartridge_spec"))
				})
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(TurretAmmoBoxBoom), "FireShrapnel", new Type[4]
					{
						typeof(Transform),
						typeof(int),
						typeof(Transform),
						typeof(CartridgeSpec)
					}, (Type[])null))
				});
		}
		return val.InstructionEnumeration();
	}

	public static void Enable()
	{
		enabled = true;
	}

	public static void Disable()
	{
		enabled = false;
	}

	private static void OnHitRobot(ReceiverEventTypeGameObject ev, GameObject robot)
	{
	}

	public static void FireShrapnel(TurretScript turret)
	{
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: 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_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: 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_0146: 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)
		//IL_014d: 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_0156: 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_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		int num = turret.bullets_per_belt * turret.ammo_belts;
		Transform val = ((Component)turret).transform.Find("point_pivot/gun_pivot/gun_assembly/ammo_destroy");
		if (SettingsManager.Verbose)
		{
			Debug.LogFormat("shrapnel_source is at {0}, transform parent is {1}", new object[2]
			{
				val.localPosition,
				((Object)val.parent).name
			});
		}
		CartridgeSpec val2 = (CartridgeSpec)typeof(TurretScript).GetField("cartridge_spec", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic).GetValue(turret);
		if (SettingsManager.Verbose)
		{
			Debug.LogFormat("cartridge is: {0}", new object[1] { val2.diameter });
		}
		if (SettingsManager.Verbose)
		{
			Debug.LogFormat("bullet count is: {0}", new object[1] { num });
		}
		for (int i = 0; i < num; i++)
		{
			Vector3 val3 = LocalAimHandler.player_instance.RandomPointInCollider(1f) - ((Component)val).transform.position;
			Vector3 normalized;
			if (i == 0 && (((Vector3)(ref val3)).magnitude < 5f || Probability.Chance(0.05f) || RobotTweaks.campaign_has_override))
			{
				if (SettingsManager.Verbose)
				{
					Debug.Log((object)"Targeting player");
				}
				normalized = ((Vector3)(ref val3)).normalized;
			}
			else
			{
				Vector3 onUnitSphere = Random.onUnitSphere;
				onUnitSphere.z = Mathf.Abs(onUnitSphere.z);
				Vector3 val4 = ((Component)val).transform.rotation * onUnitSphere;
				normalized = ((Vector3)(ref val4)).normalized;
			}
			BulletTrajectory val5 = BulletTrajectoryManager.PlanTrajectory(((Component)val).transform.position + ((Component)val).transform.forward * 0.05f, val2, normalized * Random.Range(0.1f, 1f), true);
			if (BulletTrajectoryManager.draw_debug_trajectory_path)
			{
				val5.draw_path = (DrawType)1;
			}
			else
			{
				val5.draw_path = (DrawType)2;
			}
			val5.bullet_source = ((Component)turret).gameObject;
			val5.bullet_source_entity_type = (ReceiverEntityType)1;
			BulletTrajectoryManager.ExecuteTrajectory(val5);
		}
	}

	public static void FireShrapnel(Transform turret_transform, int bullet_count, Transform shrapnel_source, CartridgeSpec cartridge)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: 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_0112: 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_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: 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_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		if (!SettingsManager.configTurretAmmoBoxBoom.Value)
		{
			return;
		}
		if (SettingsManager.Verbose)
		{
			Debug.LogFormat("shrapnel_source is at {0}, transform parent is {1}", new object[2]
			{
				shrapnel_source.localPosition,
				((Object)shrapnel_source.parent).name
			});
		}
		if (SettingsManager.Verbose)
		{
			Debug.LogFormat("cartridge is: {0}", new object[1] { cartridge.diameter });
		}
		if (SettingsManager.Verbose)
		{
			Debug.LogFormat("bullet count is: {0}", new object[1] { bullet_count });
		}
		for (int i = 0; i < bullet_count; i++)
		{
			Vector3 val = LocalAimHandler.player_instance.RandomPointInCollider(1f) - ((Component)shrapnel_source).transform.position;
			Vector3 normalized;
			if (i == 0 && (((Vector3)(ref val)).magnitude < 5f || Probability.Chance(0.05f) || RobotTweaks.campaign_has_override))
			{
				if (SettingsManager.Verbose)
				{
					Debug.Log((object)"Targeting player");
				}
				normalized = ((Vector3)(ref val)).normalized;
			}
			else
			{
				Vector3 onUnitSphere = Random.onUnitSphere;
				onUnitSphere.z = Mathf.Abs(onUnitSphere.z);
				Vector3 val2 = ((Component)shrapnel_source).transform.rotation * onUnitSphere;
				normalized = ((Vector3)(ref val2)).normalized;
			}
			BulletTrajectory val3 = BulletTrajectoryManager.PlanTrajectory(((Component)shrapnel_source).transform.position + ((Component)shrapnel_source).transform.forward * 0.05f, cartridge, normalized * Random.Range(0.1f, 1f), true);
			if (BulletTrajectoryManager.draw_debug_trajectory_path)
			{
				val3.draw_path = (DrawType)1;
			}
			else
			{
				val3.draw_path = (DrawType)2;
			}
			val3.bullet_source = ((Component)turret_transform).gameObject;
			val3.bullet_source_entity_type = (ReceiverEntityType)1;
			BulletTrajectoryManager.ExecuteTrajectory(val3);
		}
	}
}
internal static class lahTweaks
{
	[HarmonyPatch(typeof(LocalAimHandler), "IsTerminalFall", new Type[] { typeof(Vector3) })]
	[HarmonyPrefix]
	public static bool PatchIsTerminalFall(ref bool __result)
	{
		if (ConfigFiles.global.god)
		{
			__result = false;
			return false;
		}
		return true;
	}
}
internal static class rtlgTweaks
{
	internal static class TileFix
	{
		private static TileScript victorian;

		private static TileScript twoTowers;

		internal static void ChangeVictorianTopFloorCollision()
		{
			//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_0043: Unknown result type (might be due to invalid IL or missing references)
			victorian = GetTilePrefab((ReceiverTileType)210);
			if ((Object)(object)victorian != (Object)null)
			{
				Transform obj = ((Component)victorian).transform.Find("physical/Base/VictorianModule_Model/Collision/LoftFloorCollision_WithHatch");
				Vector3 localPosition = obj.localPosition;
				localPosition.y = 8.37f;
				obj.localPosition = localPosition;
				if (verbose)
				{
					Debug.Log((object)"Changed victorian top floor collider position");
				}
			}
			else
			{
				Debug.LogError((object)"SHIT FUCKING VICTRORIAN IS NULLLLLLLL!!!!!!!!!!!!!!!!!!!!!!!");
			}
		}

		internal static void ChangeTwoTowersWalkwayLayer()
		{
			twoTowers = GetTilePrefab((ReceiverTileType)209);
			((Component)((Component)twoTowers).transform.Find("physical/Base/Architecture/10_tower_walkramp")).gameObject.layer = 0;
		}
	}

	internal static class SpawnCompatibleMagsTweak
	{
		[HarmonyPatch(typeof(RuntimeTileLevelGenerator), "InstantiateMagazine", new Type[]
		{
			typeof(Vector3),
			typeof(Quaternion),
			typeof(Transform),
			typeof(MagazineClass)
		})]
		[HarmonyPrefix]
		private static bool InstantiateMagazine(ref GameObject __result, ref Vector3 position, ref Quaternion rotation, ref Transform parent, ref MagazineClass magazine_class)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			ReceiverCoreScript obj = ReceiverCoreScript.Instance();
			GunScript gunPrefab = obj.GetGunPrefab(obj.CurrentLoadout.gun_internal_name);
			MagazineScript val = default(MagazineScript);
			obj.TryGetMagazinePrefabFromRoot(gunPrefab.magazine_root_types[Random.Range(0, gunPrefab.magazine_root_types.Length)], magazine_class, ref val);
			__result = RuntimeTileLevelGenerator.instance.InstantiateMagazine(position, rotation, parent, val);
			return false;
		}
	}

	private static bool patched;

	public static bool verbose;

	public static TileScript GetTilePrefab(ReceiverTileType tileType)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		return RuntimeTileLevelGenerator.instance.tile_prefabs.Where((TileScript e) => e.tile_type == tileType).FirstOrDefault();
	}

	internal static void OnInitialize(ReceiverEventTypeVoid ev)
	{
		if ((Object)(object)RuntimeTileLevelGenerator.instance != (Object)null && SettingsManager.configVictorianFix.Value && !patched)
		{
			TileFix.ChangeTwoTowersWalkwayLayer();
			TileFix.ChangeVictorianTopFloorCollision();
			patched = true;
		}
	}
}
internal static class SettingsManager
{
	internal static ConfigFile config;

	private const string debugCatName = "Debug";

	private const string generalCatName = "General";

	private const string fogCatName = "Fog";

	private const string flashlightCatName = "Flashlight";

	private const string killdroneCatName = "Killdrone Colour";

	private const string tripmineColCatName = "Killdrone Colour | Tripmines";

	private const string turretColCatName = "Killdrone Colour | Turrets";

	private const string shockdroneColCatName = "Killdrone Colour | Shock Drones";

	private const string cameraColCatName = "Killdrone Colour | Cameras";

	private const string dropGunEverywhereCatName = "Drop gun everywhere";

	private const string funStuffCatName = "Fun stuff";

	private const string tapeLocatron3000CatName = "Tape Locatron 3000";

	private const string itemGlintColourCatName = "Item Glint Colour";

	internal static ConfigEntry<bool> configSSREnabled;

	internal static ConfigEntry<string> configSSRQuality;

	internal static ConfigEntry<bool> configMotionBlurEnabled;

	internal static ConfigEntry<float> configMotionBlurIntensity;

	internal static ConfigEntry<bool> configVerboseDebugEnabled;

	internal static ConfigEntry<bool> configKilldroneColourOverride;

	internal static ConfigEntry<Color> configFogColourBeginnerEast;

	internal static ConfigEntry<Color> configFogColourBeginnerWest;

	internal static ConfigEntry<Color> configFogColourSleeperEast;

	internal static ConfigEntry<Color> configFogColourSleeperWest;

	internal static ConfigEntry<Color> configFogColourSleepwalkerEast;

	internal static ConfigEntry<Color> configFogColourSleepwalkerWest;

	internal static ConfigEntry<Color> configFogColourFireEast;

	internal static ConfigEntry<Color> configFogColourFireWest;

	internal static ConfigEntry<Color> configFogColourAwakeEast;

	internal static ConfigEntry<Color> configFogColourAwakeWest;

	internal static ConfigEntry<Color> configFogColourOtherEast;

	internal static ConfigEntry<Color> configFogColourOtherWest;

	internal static ConfigEntry<Color> configTripmineBeamColour;

	internal static ConfigEntry<Color> configTripmineBeamTriggeredColour;

	internal static ConfigEntry<bool> configFlashlightTweaks;

	internal static ConfigEntry<bool> configDiscoFlashlight;

	internal static ConfigEntry<float> configTimeToDropFlashlight;

	internal static ConfigEntry<Color> configFlashlightColour;

	internal static ConfigEntry<KeyCode> configFlashlightToggleKey;

	internal static ConfigEntry<bool> configDropGunEverywhere;

	internal static ConfigEntry<float> configTimeToDropGun;

	internal static ConfigEntry<KeyCode> configForceXrayKey;

	internal static ConfigEntry<bool> configEnableTurretDiscoLights;

	internal static ConfigEntry<Color> configTurretColourNormal;

	internal static ConfigEntry<Color> configTurretColourAlert;

	internal static ConfigEntry<Color> configTurretColourAlertShooting;

	internal static ConfigEntry<Color> configDroneColourIdle;

	internal static ConfigEntry<Color> configDroneColourAlert;

	internal static ConfigEntry<Color> configDroneColourAttacking;

	internal static ConfigEntry<Color> configCameraColourIdle;

	internal static ConfigEntry<Color> configCameraColourAlert;

	internal static ConfigEntry<Color> configCameraColourAlarming;

	internal static ConfigEntry<int> configDiscoTimescale;

	internal static ConfigEntry<bool> configTurretAmmoBoxBoom;

	internal static ConfigEntry<bool> configGunTweaks;

	internal static ConfigEntry<bool> configRobotTweaks;

	internal static ConfigEntry<bool> configVictorianFix;

	internal static ConfigEntry<bool> configSpawnCompatibleMags;

	internal static ConfigEntry<bool> configLimitFPSFocusLostEnabled;

	internal static ConfigEntry<float> configLimitFPSFocusLostCount;

	internal static ConfigEntry<bool> configTapeLocatron3000Enabled;

	internal static ConfigEntry<Color> configTapeLocatron3000ColourOccluded;

	internal static ConfigEntry<Color> configTapeLocatron3000ColourLos;

	internal static ConfigEntry<bool> configInventoryGlintColourEnabled;

	public static bool Verbose => configVerboseDebugEnabled.Value;

	internal static void InitializeAndBindSettings()
	{
		//IL_009f: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: 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_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_0262: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Expected O, but got Unknown
		//IL_031e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0328: Expected O, but got Unknown
		//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fe: Expected O, but got Unknown
		//IL_0412: Unknown result type (might be due to invalid IL or missing references)
		//IL_0435: Unknown result type (might be due to invalid IL or missing references)
		//IL_0458: Unknown result type (might be due to invalid IL or missing references)
		//IL_047b: Unknown result type (might be due to invalid IL or missing references)
		//IL_049e: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0507: Unknown result type (might be due to invalid IL or missing references)
		//IL_052a: Unknown result type (might be due to invalid IL or missing references)
		//IL_054d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0570: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f9: Expected O, but got Unknown
		//IL_0686: Unknown result type (might be due to invalid IL or missing references)
		//IL_0690: Expected O, but got Unknown
		//IL_0729: Unknown result type (might be due to invalid IL or missing references)
		//IL_0733: Expected O, but got Unknown
		//IL_0766: Unknown result type (might be due to invalid IL or missing references)
		//IL_0789: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d33: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d38: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d42: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d47: 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_0d56: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d60: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d65: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d6f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d74: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d7e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d83: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d8d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d92: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d9c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0da1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dab: Unknown result type (might be due to invalid IL or missing references)
		//IL_0db0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dbf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dc9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dce: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dd8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ddd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e05: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e0a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e19: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e1e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e28: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e2d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e37: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e3c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e46: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e4b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e55: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e5a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e64: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e69: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e73: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e78: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e82: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e87: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e91: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e96: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ea0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ea5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0eaf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0eb4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ebe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ec3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ecd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ed2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0edc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ee1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0eeb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ef0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0efa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0eff: Unknown result type (might be due to invalid IL or missing references)
		config = MainPlugin.config;
		configVerboseDebugEnabled = config.Bind<bool>("Debug", "VerboseEnabled", false, "Turns on a bunch of Debug.Log() to help with debugging");
		configFlashlightTweaks = config.Bind<bool>("General", "FlashlightTweaks", true, "Enable the flashlight tweaks");
		configKilldroneColourOverride = config.Bind<bool>("Killdrone Colour", "KilldroneColourOverride", true, "Enables custom colour for the killdrones on specific campaigns");
		configKilldroneColourOverride.SettingChanged += delegate
		{
			RobotTweaks.SetOverrideColours(configKilldroneColourOverride.Value);
		};
		configFogColourBeginnerEast = config.Bind<Color>("Fog", "FogColourBeginnerEast", PostProcessTweaks.east_beginner_colour, "The color of the fog on the east side for beginner and intro");
		configFogColourBeginnerWest = config.Bind<Color>("Fog", "FogColourBeginnerWest", PostProcessTweaks.west_beginner_colour, "The color of the fog on the west side for beginner and intro");
		configFogColourSleeperEast = config.Bind<Color>("Fog", "FogColourSleeperEast", PostProcessTweaks.east_sleeper_colour, "The color of the fog on the east side for sleeper");
		configFogColourSleeperWest = config.Bind<Color>("Fog", "FogColourSleeperWest", PostProcessTweaks.west_sleeper_colour, "The color of the fog on the west side for sleeper");
		configFogColourSleepwalkerEast = config.Bind<Color>("Fog", "FogColourSleepwalkerEast", PostProcessTweaks.east_sleepwalker_colour, "The color of the fog on the east side for sleepwalker");
		configFogColourSleepwalkerWest = config.Bind<Color>("Fog", "FogColourSleepwalkerWest", PostProcessTweaks.west_sleepwalker_colour, "The color of the fog on the west side for sleepwalker");
		configFogColourFireEast = config.Bind<Color>("Fog", "FogColourFireEast", PostProcessTweaks.east_fire_colour, "The color of the fog on the east side for liminal");
		configFogColourFireWest = c