Decompiled source of HandheldMap v1.6.2

LC_HandHeldDevice.dll

Decompiled 4 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LC_HandHeldDevice.Patches;
using LethalLib.Modules;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LC_HandHeldDevice")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LC_HandHeldDevice")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2e45d23a-326c-4621-879f-642402b89ccd")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LC_HandHeldDevice
{
	[BepInPlugin("Mellowdy.HandHeldMapMod", "HandHeldMapMod", "1.6.0")]
	public class HandHeldMapMod : BaseUnityPlugin
	{
		private const string modGUID = "Mellowdy.HandHeldMapMod";

		private const string modName = "HandHeldMapMod";

		private const string modVersion = "1.6.0";

		private const string assetName = "map.device";

		private const string gameObjectName = "HandHeldMapDevice.prefab";

		private readonly Harmony harmony = new Harmony("Mellowdy.HandHeldMapMod");

		public static ManualLogSource mls;

		private static HandHeldMapMod instance;

		private static string Name = "Hand-held Map";

		public static ConfigEntry<int> Price;

		public static ConfigEntry<float> BatteryUsage;

		public static ConfigEntry<float> TurnOnBatteryUsage;

		public static ConfigEntry<bool> BatteryFail;

		public static ConfigEntry<float> FailureBreakPoint;

		public static ConfigEntry<float> BaseChance;

		public static ConfigEntry<bool> PocketTurnOff;

		public static ConfigEntry<float> Size;

		public static ConfigEntry<bool> Light;

		public static ConfigEntry<bool> ShowEnemiesConfig;

		public static ConfigEntry<bool> ShowScrapConfig;

		public static ConfigEntry<bool> ShowPlayersConfig;

		public static ConfigEntry<bool> ShowDeadPlayersConfig;

		public static ConfigEntry<bool> ShowDoorsConfig;

		public static ConfigEntry<bool> ShowMinesConfig;

		public static ConfigEntry<bool> ShowTurretsConfig;

		public static ConfigEntry<float> UpdateRate;

		public static GameObject cameraPrefab;

		public static Material backUpMaterialOff;

		public static Material backUpMaterialOn;

		private void Awake()
		{
			//IL_046f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			mls = Logger.CreateLogSource("Mellowdy.HandHeldMapMod");
			harmony.PatchAll();
			Price = ((BaseUnityPlugin)this).Config.Bind<int>("Price", "MapPrice", 45, "Credits needed to buy the hand-held map");
			BatteryUsage = ((BaseUnityPlugin)this).Config.Bind<float>("Battery", "Battery Charge", 120f, "The amount of time in seconds the map can be active");
			TurnOnBatteryUsage = ((BaseUnityPlugin)this).Config.Bind<float>("Battery", "Turn on requirement", 0.05f, "The percent of battery that gets drained when the map gets turned on (0.1 = 10% drain each time its turned on)");
			BatteryFail = ((BaseUnityPlugin)this).Config.Bind<bool>("Battery", "Battery Failure", true, "decription");
			FailureBreakPoint = ((BaseUnityPlugin)this).Config.Bind<float>("Battery", "Battery Failure Break Point", 0.5f, "The charge breakpoint where the map will begin to glitch and fail to update as often (0.5 = map will start failing at 50% charge)");
			BaseChance = ((BaseUnityPlugin)this).Config.Bind<float>("Battery", "Base Chance", 2f, "The base chance for the map to update every second after battery failure");
			PocketTurnOff = ((BaseUnityPlugin)this).Config.Bind<bool>("Battery", "Turn off when pocketed", true, "Should the map turn off when pocketed or dropped");
			Size = ((BaseUnityPlugin)this).Config.Bind<float>("Map Properties", "Size", 0.75f, "The size of the map compared to the monitor map in the ship");
			Light = ((BaseUnityPlugin)this).Config.Bind<bool>("Map Properties", "Light", false, "If the map should have nightvision like the map in the ship or not");
			ShowEnemiesConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Visibility", "Show Enemies", true, "Should Enemies be shown");
			ShowScrapConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Visibility", "Show Scrap", true, "Should Scrap be shown");
			ShowPlayersConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Visibility", "Show Players", true, "Should Players be shown");
			ShowDeadPlayersConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Visibility", "Show Dead Players", true, "Should Dead Players be shown");
			ShowDoorsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Visibility", "Show Doors", true, "Should Doors be shown");
			ShowMinesConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Visibility", "Show Mines", true, "Should Landmines be shown");
			ShowTurretsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Visibility", "Show Turrets", true, "Should Turrets be shown");
			UpdateRate = ((BaseUnityPlugin)this).Config.Bind<float>("Preformance", "Update Rate", 2.5f, "How often the map should update the visibility settings");
			BatteryUsage.SettingChanged += HandHeldMap.UpdateSettings;
			TurnOnBatteryUsage.SettingChanged += HandHeldMap.UpdateSettings;
			BatteryFail.SettingChanged += HandHeldMap.UpdateSettings;
			FailureBreakPoint.SettingChanged += HandHeldMap.UpdateSettings;
			BaseChance.SettingChanged += HandHeldMap.UpdateSettings;
			PocketTurnOff.SettingChanged += HandHeldMap.UpdateSettings;
			Size.SettingChanged += HandHeldMap.UpdateSettings;
			Light.SettingChanged += HandHeldMap.UpdateSettings;
			ShowEnemiesConfig.SettingChanged += HandHeldMap.UpdateSettings;
			ShowScrapConfig.SettingChanged += HandHeldMap.UpdateSettings;
			ShowPlayersConfig.SettingChanged += HandHeldMap.UpdateSettings;
			ShowDeadPlayersConfig.SettingChanged += HandHeldMap.UpdateSettings;
			ShowDoorsConfig.SettingChanged += HandHeldMap.UpdateSettings;
			ShowMinesConfig.SettingChanged += HandHeldMap.UpdateSettings;
			ShowTurretsConfig.SettingChanged += HandHeldMap.UpdateSettings;
			UpdateRate.SettingChanged += HandHeldMap.UpdateSettings;
			HandHeldMap.UpdateSettings();
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string text = Path.Combine(directoryName, "map.device").Replace("\\", "/");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Item val2 = val.LoadAsset<Item>("Map.asset");
			GameObject val3 = val.LoadAsset<GameObject>("HandHeldMapDevice.prefab");
			cameraPrefab = val.LoadAsset<GameObject>("Camera.prefab");
			HandHeldMap.turnOn = val.LoadAsset<AudioClip>("On.wav");
			HandHeldMap.turnOff = val.LoadAsset<AudioClip>("Off.wav");
			HandHeldMap handHeldMap = val3.AddComponent<HandHeldMap>();
			((GrabbableObject)handHeldMap).originalScale = val3.transform.localScale;
			((GrabbableObject)handHeldMap).grabbable = true;
			((GrabbableObject)handHeldMap).itemProperties = val2;
			((GrabbableObject)handHeldMap).floorYRot = -1;
			val2.spawnPrefab = val3;
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterItem(val2);
			Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, CreateInfoNode("Hand-heldMapDevice", "Allows easy viewing of the map from anywhere."), Price.Value);
			mls.LogInfo((object)"HandHeldMap mod is active");
		}

		private TerminalNode CreateInfoNode(string name, string description)
		{
			TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
			val.clearPreviousText = true;
			((Object)val).name = name + "InfoNode";
			val.displayText = description + "\n\n";
			return val;
		}

		public static GameObject[] FindAndRemap(int layer)
		{
			GameObject[] array = Object.FindObjectsOfType<GameObject>();
			List<GameObject> list = new List<GameObject>();
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].layer == layer)
				{
					list.Add(array[i]);
				}
			}
			if (list.Count == 0)
			{
				return null;
			}
			return list.ToArray();
		}
	}
}
namespace LC_HandHeldDevice.Patches
{
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class GrabbableObjectPatch
	{
		[HarmonyPatch("LateUpdate")]
		[HarmonyPostfix]
		private static void LootVisibilityOnMapPatch(GrabbableObject __instance)
		{
			if (!HandHeldMap.ShowScrap && (Object)(object)__instance != (Object)null && !__instance.deactivated && ((Component)__instance).gameObject.activeInHierarchy && (Object)(object)__instance.radarIcon != (Object)null && (Object)(object)((Component)__instance.radarIcon).gameObject != (Object)null && HandHeldMap.currentlyShowScrap != ((Component)__instance.radarIcon).gameObject.activeSelf)
			{
				((Component)__instance.radarIcon).gameObject.SetActive(HandHeldMap.currentlyShowScrap);
			}
		}
	}
	public class HandHeldMap : GrabbableObject
	{
		private ManualCameraRenderer mcr;

		private GameObject cameraObject;

		private RenderTexture renderTexture;

		public static AudioClip turnOn;

		public static AudioClip turnOff;

		public static float BatteryUsage;

		public static float TurnOnBatteryUsage;

		public static bool BatteryFail;

		public static float FailureBreakPoint;

		public static float BaseChance;

		public static float Size = 1f;

		private float originalSize;

		public static bool LightOn = true;

		public static bool pocketTurnOff = true;

		public AudioSource audioSource;

		public float MaxCharge = 0f;

		private bool isOn = false;

		public static bool ShowEnemies;

		public static bool ShowScrap;

		public static bool currentlyShowScrap;

		public static bool ShowPlayers;

		public static bool ShowDeadPlayers;

		public static bool ShowDoors;

		public static bool ShowTurrets;

		public static bool ShowMines;

		public bool culled = false;

		public float cullTimer;

		public static float resetTime = 2.5f;

		public static int MaxMaps;

		public static bool ShouldUpdateOutsideLocalPlayer;

		public static int MinUpdateDistance;

		private bool lightWait = false;

		public static int activeMaps;

		private static ManualCameraRenderer originalMCR = null;

		public bool isInHand;

		public override void Start()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Expected O, but got Unknown
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Expected O, but got Unknown
			((GrabbableObject)this).Start();
			activeMaps++;
			base.insertedBattery = new Battery(false, 1f);
			MaxCharge = base.insertedBattery.charge;
			base.itemProperties.batteryUsage = BatteryUsage;
			try
			{
				if ((Object)(object)((Component)this).transform.parent == (Object)null && base.isInShipRoom && base.isInElevator && (Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.elevatorTransform != (Object)null)
				{
					((Component)this).transform.SetParent(StartOfRound.Instance.elevatorTransform, false);
					base.targetFloorPosition = ((Component)this).transform.localPosition - ((Component)this).transform.parent.position;
				}
				base.mainObjectRenderer = ((Component)this).GetComponent<MeshRenderer>();
				audioSource = ((Component)this).GetComponent<AudioSource>();
				GameObject val = GameObject.Find("CameraMonitorScript");
				if ((Object)(object)originalMCR == (Object)null && (Object)(object)val != (Object)null)
				{
					originalMCR = val.GetComponent<ManualCameraRenderer>();
				}
				if ((Object)(object)originalMCR == (Object)null)
				{
					originalMCR = Object.FindObjectOfType<ManualCameraRenderer>();
				}
				GameObject val2;
				if ((Object)(object)originalMCR != (Object)null && (Object)(object)originalMCR.cam != (Object)null)
				{
					val2 = ((Component)originalMCR.cam).gameObject;
				}
				else
				{
					val2 = HandHeldMapMod.cameraPrefab;
					HUDManager.Instance.DisplayTip("HandheldMap", "Failed to load proper camera for the map. Deploying safe guard. If you get this error contact the mod developer to get it fixed.", true, false, "LC_Tip1");
				}
				mcr = ((Component)this).gameObject.AddComponent<ManualCameraRenderer>();
				mcr.mesh = base.mainObjectRenderer;
				GameObject val3 = (cameraObject = Object.Instantiate<GameObject>(val2));
				Camera component = val3.GetComponent<Camera>();
				renderTexture = new RenderTexture(((Texture)component.targetTexture).width, ((Texture)component.targetTexture).height, component.targetTexture.depth);
				mcr.mapCameraLight = val3.GetComponentInChildren<Light>();
				mcr.mapCameraAnimator = val3.GetComponentInChildren<Animator>();
				mcr.cam = component;
				mcr.mapCamera = component;
				component.targetTexture = renderTexture;
				originalSize = component.orthographicSize;
				component.orthographicSize = originalSize * Size;
				mcr.materialIndex = 0;
				if ((Object)(object)originalMCR != (Object)null)
				{
					mcr.onScreenMat = Object.Instantiate<Material>(originalMCR.onScreenMat);
					mcr.offScreenMat = originalMCR.offScreenMat;
					mcr.shipArrowUI = originalMCR.shipArrowUI;
					mcr.shipArrowPointer = originalMCR.shipArrowPointer;
				}
				else
				{
					mcr.onScreenMat = Object.Instantiate<Material>(HandHeldMapMod.backUpMaterialOn);
					mcr.offScreenMat = HandHeldMapMod.backUpMaterialOff;
					mcr.shipArrowPointer = ((Component)this).transform;
					mcr.shipArrowUI = new GameObject();
				}
				mcr.onScreenMat.mainTexture = (Texture)(object)renderTexture;
				TurnOn(on: false);
				mcr.radarTargets.Clear();
				mcr.AddTransformAsTargetToRadar(((Component)this).transform, "You are here", true);
			}
			catch (Exception ex)
			{
				HUDManager.Instance.DisplayTip("HandheldMap", "Failed to load. " + ex, true, false, "LC_Tip1");
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		public override void Update()
		{
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			if (!base.isHeld || !isInHand || !((Object)(object)base.playerHeldBy != (Object)null) || !((Object)(object)mcr != (Object)null) || !UpdateOtherMaps())
			{
				return;
			}
			if ((Object)(object)mcr.mapCameraLight != (Object)null && !((Behaviour)mcr.mapCameraLight).enabled && LightOn && !lightWait)
			{
				((Behaviour)mcr.mapCameraLight).enabled = LightOn;
			}
			if ((Object)(object)mcr.cam != (Object)null)
			{
				((Behaviour)mcr.cam).enabled = true;
				if (base.insertedBattery.charge / MaxCharge < FailureBreakPoint && BatteryFail)
				{
					float num = (BaseChance + base.insertedBattery.charge / MaxCharge) * Time.deltaTime;
					float num2 = Random.Range(0f, 1f);
					if (num2 <= num)
					{
						mcr.cam.Render();
					}
				}
				else
				{
					mcr.cam.Render();
				}
				if ((Object)(object)mcr.targetedPlayer != (Object)(object)base.playerHeldBy)
				{
					mcr.targetedPlayer = base.playerHeldBy;
				}
			}
			if (cullTimer <= 0f)
			{
				cullTimer = resetTime;
				bool flag = culled;
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				if (localPlayerController.isInElevator || localPlayerController.isInHangarShipRoom || Vector3.Distance(((Component)localPlayerController).transform.position, StartOfRound.Instance.elevatorTransform.position) < 10f)
				{
					culled = false;
				}
				else
				{
					culled = true;
				}
				CullRelevantGameObjects(!culled);
			}
			else
			{
				cullTimer -= Time.deltaTime;
			}
		}

		public bool UpdateOtherMaps()
		{
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			return (Object)(object)localPlayerController == (Object)(object)base.playerHeldBy;
		}

		public void TurnOn(bool on)
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			bool flag = isOn != on;
			isOn = on;
			base.isBeingUsed = on;
			mcr.SwitchScreenOn(on);
			if (!flag)
			{
				return;
			}
			if (on)
			{
				audioSource.PlayOneShot(turnOn);
				if (base.insertedBattery.charge != 1f)
				{
					((MonoBehaviour)this).StartCoroutine(Drain(1f));
				}
			}
			else
			{
				audioSource.PlayOneShot(turnOff);
			}
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 10f, 0.65f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			TurnOn(used);
		}

		public override void UseUpBatteries()
		{
			((GrabbableObject)this).UseUpBatteries();
			TurnOn(on: false);
		}

		public override void GrabItem()
		{
			mcr.targetedPlayer = base.playerHeldBy;
			((GrabbableObject)this).GrabItem();
			isInHand = true;
			((MonoBehaviour)this).StartCoroutine(TurnOnLightDelay());
			((Behaviour)mcr).enabled = true;
		}

		public IEnumerator TurnOnLightDelay()
		{
			cameraObject.SetActive(false);
			yield return (object)new WaitForSeconds(0.1f);
			cameraObject.SetActive(true);
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			isInHand = true;
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			if (pocketTurnOff)
			{
				TurnOn(on: false);
			}
			isInHand = false;
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			if (pocketTurnOff)
			{
				TurnOn(on: false);
			}
			isInHand = false;
			((Behaviour)mcr).enabled = false;
			cameraObject.SetActive(false);
		}

		public override void ChargeBatteries()
		{
			((GrabbableObject)this).ChargeBatteries();
			MaxCharge = base.insertedBattery.charge;
		}

		public IEnumerator Drain(float Duration)
		{
			float t = 0f;
			while (t < Duration)
			{
				base.insertedBattery.charge = Mathf.Max(base.insertedBattery.charge - MaxCharge * TurnOnBatteryUsage * Time.deltaTime / Duration, 0f);
				t += Time.deltaTime;
				yield return (object)new WaitForEndOfFrame();
			}
		}

		public override void OnDestroy()
		{
			((NetworkBehaviour)this).OnDestroy();
			renderTexture.Release();
			Object.Destroy((Object)(object)((Component)mcr.cam).gameObject);
			activeMaps--;
		}

		public static void CullRelevantGameObjects(bool cull)
		{
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			if (!ShowEnemies)
			{
				EnemyAI[] array = Object.FindObjectsOfType<EnemyAI>(true);
				EnemyAI[] array2 = array;
				foreach (EnemyAI val in array2)
				{
					GameObject val2 = ((!((Object)(object)((Component)val).transform.parent != (Object)null)) ? FindMapDot(((Component)val).gameObject) : FindMapDot(((Component)((Component)val).transform.parent).gameObject));
					if ((Object)(object)val2 != (Object)null)
					{
						val2.SetActive(cull);
					}
				}
			}
			if (!ShowScrap)
			{
				currentlyShowScrap = cull;
			}
			if (!ShowPlayers)
			{
				PlayerControllerB[] array3 = Object.FindObjectsOfType<PlayerControllerB>(true);
				PlayerControllerB[] array4 = array3;
				foreach (PlayerControllerB val3 in array4)
				{
					Animator mapRadarDotAnimator = val3.mapRadarDotAnimator;
					if ((Object)(object)mapRadarDotAnimator != (Object)null)
					{
						((Component)mapRadarDotAnimator).gameObject.SetActive(cull);
					}
				}
			}
			if (!ShowDeadPlayers)
			{
				DeadBodyInfo[] array5 = Object.FindObjectsOfType<DeadBodyInfo>(true);
				DeadBodyInfo[] array6 = array5;
				foreach (DeadBodyInfo val4 in array6)
				{
					((Component)val4.radarDot).gameObject.SetActive(cull);
				}
			}
			if (!ShowDoors)
			{
				GameObject val5 = GameObject.Find("Systems/GameSystems/ItemSystems/MapScreenUIWorldSpace");
				if ((Object)(object)val5 != (Object)null)
				{
					foreach (Transform item in val5.transform)
					{
						Transform val6 = item;
						((Component)val6).gameObject.SetActive(cull);
					}
				}
			}
			if (!ShowMines)
			{
				Landmine[] array7 = Object.FindObjectsOfType<Landmine>(true);
				Landmine[] array8 = array7;
				foreach (Landmine val7 in array8)
				{
					Transform val8 = ((Component)val7).transform.parent.Find("ScanSphere");
					if ((Object)(object)val8 != (Object)null)
					{
						((Component)val8).gameObject.SetActive(cull);
					}
				}
			}
			if (ShowTurrets)
			{
				return;
			}
			Turret[] array9 = Object.FindObjectsOfType<Turret>(true);
			Turret[] array10 = array9;
			foreach (Turret val9 in array10)
			{
				foreach (Transform item2 in ((Component)val9).transform.parent.Find("MeshContainer").Find("RotatingRodContainer"))
				{
					Transform val10 = item2;
					if (((Object)val10).name.StartsWith("Plane"))
					{
						((Component)val10).gameObject.SetActive(cull);
					}
				}
			}
		}

		private static GameObject FindMapDot(GameObject enemyObject, bool isModel = false)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			foreach (Transform item in enemyObject.transform)
			{
				Transform val = item;
				if (((Object)val).name.StartsWith("MapDot"))
				{
					return ((Component)val).gameObject;
				}
				if ((!isModel && ((Object)val).name.EndsWith("Model")) || ((Object)val).name.EndsWith("ModelContainer"))
				{
					GameObject val2 = FindMapDot(((Component)val).gameObject);
					if ((Object)(object)val2 != (Object)null)
					{
						return val2;
					}
				}
			}
			return null;
		}

		public static void UpdateSettings(object sender, EventArgs e)
		{
			UpdateSettings();
		}

		public static void UpdateSettings()
		{
			BatteryUsage = HandHeldMapMod.BatteryUsage.Value;
			TurnOnBatteryUsage = HandHeldMapMod.TurnOnBatteryUsage.Value;
			BatteryFail = HandHeldMapMod.BatteryFail.Value;
			FailureBreakPoint = HandHeldMapMod.FailureBreakPoint.Value;
			BaseChance = HandHeldMapMod.BaseChance.Value;
			Size = HandHeldMapMod.Size.Value;
			LightOn = HandHeldMapMod.Light.Value;
			pocketTurnOff = HandHeldMapMod.PocketTurnOff.Value;
			ShowEnemies = HandHeldMapMod.ShowEnemiesConfig.Value;
			ShowScrap = HandHeldMapMod.ShowScrapConfig.Value;
			ShowPlayers = HandHeldMapMod.ShowPlayersConfig.Value;
			ShowDeadPlayers = HandHeldMapMod.ShowDeadPlayersConfig.Value;
			ShowDoors = HandHeldMapMod.ShowDoorsConfig.Value;
			ShowMines = HandHeldMapMod.ShowMinesConfig.Value;
			ShowTurrets = HandHeldMapMod.ShowTurretsConfig.Value;
			resetTime = HandHeldMapMod.UpdateRate.Value;
			HandHeldMap[] array = Object.FindObjectsOfType<HandHeldMap>();
			foreach (HandHeldMap handHeldMap in array)
			{
				((GrabbableObject)handHeldMap).itemProperties.batteryUsage = BatteryUsage;
				handHeldMap.mcr.cam.orthographicSize = handHeldMap.originalSize * Size;
			}
		}
	}
}