Decompiled source of Extra Snap Points Made Easy v1.2.4

ExtraSnapPointsMadeEasy.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExtraSnapPointsMadeEasy.Configs;
using ExtraSnapPointsMadeEasy.Extensions;
using ExtraSnapPointsMadeEasy.Helpers;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ExtraSnapPointsMadeEasy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExtraSnapPointsMadeEasy")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b2e20761-66b2-4727-a49f-fc11433a2125")]
[assembly: AssemblyFileVersion("1.2.4")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.4.0")]
[module: UnverifiableCode]
namespace ExtraSnapPointsMadeEasy
{
	[BepInPlugin("Searica.Valheim.ExtraSnapPointsMadeEasy", "ExtraSnapPointsMadeEasy", "1.2.4")]
	internal sealed class ExtraSnapPointsMadeEasy : BaseUnityPlugin
	{
		public const string PluginName = "ExtraSnapPointsMadeEasy";

		public const string Author = "Searica";

		public const string PluginGUID = "Searica.Valheim.ExtraSnapPointsMadeEasy";

		public const string PluginVersion = "1.2.4";

		internal static ExtraSnapPointsMadeEasy Instance;

		private static readonly string MainSection = ConfigManager.SetStringPriority("Global", 3);

		private static readonly string SnapModeSection = ConfigManager.SetStringPriority("ManualSnapping", 2);

		private static readonly string ExtraSnapsSection = ConfigManager.SetStringPriority("\u200bExtraSnapPoints", 1);

		private static readonly string PrefabSnapSettings = "Individual Snap Point Settings";

		internal static readonly Dictionary<string, ConfigEntry<bool>> SnapPointSettings = new Dictionary<string, ConfigEntry<bool>>();

		public static ConfigEntry<KeyCode> EnableManualSnap { get; private set; }

		public static ConfigEntry<KeyCode> EnableManualClosestSnap { get; private set; }

		public static ConfigEntry<KeyCode> EnableGridSnap { get; private set; }

		public static ConfigEntry<KeyCode> CycleGridPrecision { get; private set; }

		public static ConfigEntry<KeyCode> IterateSourceSnapPoints { get; private set; }

		public static ConfigEntry<KeyCode> IterateTargetSnapPoints { get; private set; }

		public static ConfigEntry<bool> ResetSnapsOnNewPiece { get; private set; }

		public static ConfigEntry<bool> EnableExtraSnapPoints { get; private set; }

		public static ConfigEntry<bool> EnableLineSnapPoints { get; private set; }

		public static ConfigEntry<bool> EnableTriangleSnapPoints { get; private set; }

		public static ConfigEntry<bool> EnableRect2DSnapPoints { get; private set; }

		public static ConfigEntry<bool> EnableRoofTopSnapPoints { get; private set; }

		public static ConfigEntry<bool> EnableTerrainOpSnapPoints { get; private set; }

		internal static ConfigEntry<MessageType> NotificationType { get; private set; }

		internal static bool UpdateExtraSnapPoints { get; set; } = false;


		private void Awake()
		{
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			ConfigManager.Init("Searica.Valheim.ExtraSnapPointsMadeEasy", ((BaseUnityPlugin)this).Config);
			Initialize();
			ConfigManager.Save();
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Searica.Valheim.ExtraSnapPointsMadeEasy");
			Game.isModded = true;
			ConfigManager.SetupWatcher();
			ConfigManager.CheckForConfigManager();
			ConfigManager.OnConfigWindowClosed += delegate
			{
				ExtraSnapsManager.AddExtraSnapPoints("Config settings changed, re-initializing");
			};
			ConfigManager.OnConfigFileReloaded += delegate
			{
				ExtraSnapsManager.AddExtraSnapPoints("Config settings changed after reloading config file, re-initializing");
			};
		}

		private void OnDestroy()
		{
			ConfigManager.Save();
		}

		public static void Initialize()
		{
			Log.Verbosity = ConfigManager.BindConfig(MainSection, "Verbosity", LogLevel.Low, "Low will log basic information about the mod. Medium will log information that is useful for troubleshooting. High will log a lot of information, do not set it to this without good reason as it will slow down your game.");
			EnableManualSnap = ConfigManager.BindConfig<KeyCode>(SnapModeSection, "ToggleManualSnapMode", (KeyCode)308, "This key will enable or disable manual snapping mode.");
			EnableManualClosestSnap = ConfigManager.BindConfig<KeyCode>(SnapModeSection, "ToggleManualClosestMode", (KeyCode)301, "This key will enable or disable manual closest snapping mode.");
			EnableGridSnap = ConfigManager.BindConfig<KeyCode>(SnapModeSection, "ToggleSnapToGridMode", (KeyCode)284, "This key will enable or disable snap to grid mode.");
			CycleGridPrecision = ConfigManager.BindConfig<KeyCode>(SnapModeSection, "CycleGridPrecision", (KeyCode)285, "This key will change the precision of the grid in when in grid mode.");
			IterateSourceSnapPoints = ConfigManager.BindConfig<KeyCode>(SnapModeSection, "IterateSourceSnapPoints", (KeyCode)306, "This key will cycle through the snap points on the piece you are placing.");
			IterateTargetSnapPoints = ConfigManager.BindConfig<KeyCode>(SnapModeSection, "IterateTargetSnapPoints", (KeyCode)304, "This key will cycle through the snap points on the piece you are attaching to.");
			ResetSnapsOnNewPiece = ConfigManager.BindConfig(SnapModeSection, "ResetSnapsOnNewPiece", value: false, "Controls if the selected snap point is reset for each placement, defaults to not reset.This means your selections carry over between placements.");
			NotificationType = ConfigManager.BindConfig<MessageType>(SnapModeSection, "NotificationType", (MessageType)2, "Set the type of notification for when manual snapping mode is changed or selected snap points are changed. \"Center\" will display in the center of the screen in large yellow text. \"TopLeft\" will display under the hotkey bar in small white text.");
			EnableExtraSnapPoints = ConfigManager.BindConfig(ExtraSnapsSection, "ExtraSnapPoints", value: true, "Globally enable/disable all extra snap points.");
			EnableExtraSnapPoints.SettingChanged += SnapSettingChanged;
			EnableLineSnapPoints = ConfigManager.BindConfig(ExtraSnapsSection, "LineSnapPoints", value: true, "Enabled adds extra snap points for all \"Line\" pieces. Disabled will prevent extra snap points being added to any \"Line\" pieces.");
			EnableLineSnapPoints.SettingChanged += SnapSettingChanged;
			EnableTriangleSnapPoints = ConfigManager.BindConfig(ExtraSnapsSection, "TriangleSnapPoints", value: true, "Enabled adds extra snap points for all \"Triangle\" pieces. Disabled will prevent extra snap points being added to any \"Triangle\" pieces.");
			EnableTriangleSnapPoints.SettingChanged += SnapSettingChanged;
			EnableRect2DSnapPoints = ConfigManager.BindConfig(ExtraSnapsSection, "Rect2DSnapPoints", value: true, "Enabled adds extra snap points for all \"Rect2D\" pieces. Disabled will prevent extra snap points being added to any \"Rect2D\" pieces.");
			EnableRect2DSnapPoints.SettingChanged += SnapSettingChanged;
			EnableRoofTopSnapPoints = ConfigManager.BindConfig(ExtraSnapsSection, "RoofTopSnapPoints", value: true, "Enabled adds extra snap points for all \"RoofTop\" pieces. Disabled will prevent extra snap points being added to any \"RoofTop\" pieces.");
			EnableRoofTopSnapPoints.SettingChanged += SnapSettingChanged;
			EnableTerrainOpSnapPoints = ConfigManager.BindConfig(ExtraSnapsSection, "TerrainOpSnapPoints", value: false, "Enabled adds extra snap points for all \"TerrainOp\" pieces like the level ground tool in the Hoe. Disabled will prevent extra snap points being added to any \"TerrainOp\" pieces.");
			EnableTerrainOpSnapPoints.SettingChanged += SnapSettingChanged;
		}

		internal static ConfigEntry<bool> LoadConfig(GameObject gameObject)
		{
			ConfigEntry<bool> val = ConfigManager.BindConfig(PrefabSnapSettings, ((Object)gameObject).name, value: true, "Set to true/enabled to enable snap points for this prefab and false/disabled to disable them.");
			val.SettingChanged += SnapSettingChanged;
			SnapPointSettings[((Object)gameObject).name] = val;
			return val;
		}

		private static void SnapSettingChanged(object o, EventArgs e)
		{
			if (!UpdateExtraSnapPoints)
			{
				UpdateExtraSnapPoints = true;
			}
		}

		public static void ReInitExtraSnapPoints()
		{
			ExtraSnapsManager.AddExtraSnapPoints("External mod triggered a re-initialization, adding extra snap points", forceUpdate: true);
		}
	}
	internal enum LogLevel
	{
		Low,
		Medium,
		High
	}
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		private const BindingFlags AllBindings = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty;

		internal static ConfigEntry<LogLevel> Verbosity { get; set; }

		internal static LogLevel VerbosityLevel => Verbosity.Value;

		internal static bool IsVerbosityLow => Verbosity.Value >= LogLevel.Low;

		internal static bool IsVerbosityMedium => Verbosity.Value >= LogLevel.Medium;

		internal static bool IsVerbosityHigh => Verbosity.Value >= LogLevel.High;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void LogDebug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void LogError(object data)
		{
			_logSource.LogError(data);
		}

		internal static void LogFatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void LogInfo(object data, LogLevel level = LogLevel.Low)
		{
			if (Verbosity == null || VerbosityLevel >= level)
			{
				_logSource.LogInfo(data);
			}
		}

		internal static void LogMessage(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void LogWarning(object data)
		{
			_logSource.LogWarning(data);
		}

		internal static void LogGameObject(GameObject prefab, bool includeChildren = false)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			LogInfo("***** " + ((Object)prefab).name + " *****");
			Component[] components = prefab.GetComponents<Component>();
			for (int i = 0; i < components.Length; i++)
			{
				LogComponent(components[i]);
			}
			if (!includeChildren)
			{
				return;
			}
			LogInfo("***** " + ((Object)prefab).name + " (children) *****");
			foreach (Transform item in prefab.transform)
			{
				Transform val = item;
				LogInfo(" - " + ((Object)((Component)val).gameObject).name);
				components = ((Component)val).gameObject.GetComponents<Component>();
				for (int i = 0; i < components.Length; i++)
				{
					LogComponent(components[i]);
				}
			}
		}

		internal static void LogComponent(Component compo)
		{
			LogInfo("--- " + ((object)compo).GetType().Name + ": " + ((Object)compo).name + " ---");
			PropertyInfo[] properties = ((object)compo).GetType().GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty);
			foreach (PropertyInfo propertyInfo in properties)
			{
				LogInfo($" - {propertyInfo.Name} = {propertyInfo.GetValue(compo)}");
			}
			FieldInfo[] fields = ((object)compo).GetType().GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty);
			foreach (FieldInfo fieldInfo in fields)
			{
				LogInfo($" - {fieldInfo.Name} = {fieldInfo.GetValue(compo)}");
			}
		}
	}
}
namespace ExtraSnapPointsMadeEasy.Utils
{
	internal class BepInExUtils
	{
		private static Dictionary<PluginInfo, string> PluginInfoTypeNameCache { get; } = new Dictionary<PluginInfo, string>();


		private static Dictionary<Assembly, PluginInfo> AssemblyToPluginInfoCache { get; } = new Dictionary<Assembly, PluginInfo>();


		private static Dictionary<Type, PluginInfo> TypeToPluginInfoCache { get; } = new Dictionary<Type, PluginInfo>();


		internal static BepInPlugin GetSourceModMetadata()
		{
			Type callingType = ReflectionUtils.GetCallingType();
			PluginInfo pluginInfoFromType = GetPluginInfoFromType(callingType);
			object obj = ((pluginInfoFromType != null) ? pluginInfoFromType.Metadata : null);
			if (obj == null)
			{
				PluginInfo pluginInfoFromAssembly = GetPluginInfoFromAssembly(callingType.Assembly);
				obj = ((pluginInfoFromAssembly != null) ? pluginInfoFromAssembly.Metadata : null) ?? ((BaseUnityPlugin)ExtraSnapPointsMadeEasy.Instance).Info.Metadata;
			}
			return (BepInPlugin)obj;
		}

		private static PluginInfo GetPluginInfoFromType(Type type)
		{
			if (TypeToPluginInfoCache.TryGetValue(type, out var value))
			{
				return value;
			}
			foreach (PluginInfo value2 in Chainloader.PluginInfos.Values)
			{
				if (ReflectionUtils.GetPrivateProperty<string>(value2, "TypeName").Equals(type.FullName))
				{
					TypeToPluginInfoCache[type] = value2;
					return value2;
				}
			}
			return null;
		}

		private static PluginInfo GetPluginInfoFromAssembly(Assembly assembly)
		{
			if (AssemblyToPluginInfoCache.TryGetValue(assembly, out var value))
			{
				return value;
			}
			foreach (PluginInfo value2 in Chainloader.PluginInfos.Values)
			{
				if (assembly.GetType(GetPluginInfoTypeName(value2)) != null)
				{
					AssemblyToPluginInfoCache[assembly] = value2;
					return value2;
				}
			}
			AssemblyToPluginInfoCache[assembly] = null;
			return null;
		}

		private static string GetPluginInfoTypeName(PluginInfo info)
		{
			if (PluginInfoTypeNameCache.TryGetValue(info, out var value))
			{
				return value;
			}
			value = ReflectionUtils.GetPrivateProperty<string>(info, "TypeName");
			PluginInfoTypeNameCache.Add(info, value);
			return value;
		}
	}
	internal class ReflectionUtils
	{
		internal static Type GetCallingType()
		{
			return (new StackTrace().GetFrames() ?? Array.Empty<StackFrame>()).First((StackFrame x) => x.GetMethod().ReflectedType?.Assembly != typeof(ExtraSnapPointsMadeEasy).Assembly).GetMethod().ReflectedType;
		}

		internal static T GetPrivateProperty<T>(object instance, string name)
		{
			PropertyInfo property = instance.GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.NonPublic);
			if (property == null)
			{
				Log.LogError("Property " + name + " does not exist on type: " + instance.GetType());
				return default(T);
			}
			return (T)property.GetValue(instance);
		}
	}
}
namespace ExtraSnapPointsMadeEasy.Patches
{
	[HarmonyPatch(typeof(Player))]
	internal class PlayerPatch
	{
		internal enum SnapMode
		{
			Auto,
			Manual,
			ManualClosest,
			Grid
		}

		internal enum GridPrecision
		{
			Low,
			High
		}

		private static readonly int TerrainRayMask = LayerMask.GetMask(new string[1] { "terrain" });

		private static int currentSourceSnap = 0;

		private static int currentTargetSnap = 0;

		private static Transform currentTargetParent;

		private static Transform currentSourceParent;

		private static readonly Dictionary<SnapMode, string> SnapModeMsg = new Dictionary<SnapMode, string>
		{
			{
				SnapMode.Auto,
				"Snap Mode: Auto"
			},
			{
				SnapMode.Manual,
				"Snap Mode: Manual"
			},
			{
				SnapMode.ManualClosest,
				"Snap Mode: Manual (Closest)"
			},
			{
				SnapMode.Grid,
				"SnapMode: Grid"
			}
		};

		internal static SnapMode snapMode;

		internal static Dictionary<GridPrecision, float> GridPrecisionMap = new Dictionary<GridPrecision, float>
		{
			{
				GridPrecision.High,
				0.5f
			},
			{
				GridPrecision.Low,
				1f
			}
		};

		internal static GridPrecision gridPrecision;

		private static float currentGridPrecision = GridPrecisionMap[GridPrecision.Low];

		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch("PieceRayTest")]
		public static bool Call_PieceRayTest(object instance, out Vector3 point, out Vector3 normal, out Piece piece, out Heightmap heightmap, out Collider waterSurface, bool water)
		{
			throw new NotImplementedException();
		}

		[HarmonyPostfix]
		[HarmonyPatch("UpdatePlacementGhost")]
		private static void UpdatePlacementGhostPostfix(Player __instance)
		{
			//IL_0024: 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_0076: 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)
			if (!Object.op_Implicit((Object)(object)__instance) || !((Character)__instance).InPlaceMode() || ((Character)__instance).IsDead())
			{
				return;
			}
			SnapMode snapMode = PlayerPatch.snapMode;
			if (Input.GetKeyDown(ExtraSnapPointsMadeEasy.EnableManualSnap.Value))
			{
				if (PlayerPatch.snapMode == SnapMode.Manual)
				{
					PlayerPatch.snapMode = SnapMode.Auto;
				}
				else
				{
					PlayerPatch.snapMode = SnapMode.Manual;
				}
			}
			else if (Input.GetKeyDown(ExtraSnapPointsMadeEasy.EnableManualClosestSnap.Value))
			{
				if (PlayerPatch.snapMode == SnapMode.ManualClosest)
				{
					PlayerPatch.snapMode = SnapMode.Auto;
				}
				else
				{
					PlayerPatch.snapMode = SnapMode.ManualClosest;
				}
			}
			else if (Input.GetKeyDown(ExtraSnapPointsMadeEasy.EnableGridSnap.Value))
			{
				if (PlayerPatch.snapMode == SnapMode.Grid)
				{
					PlayerPatch.snapMode = SnapMode.Auto;
				}
				else
				{
					PlayerPatch.snapMode = SnapMode.Grid;
				}
			}
			if (PlayerPatch.snapMode != snapMode)
			{
				((Character)__instance).Message(ExtraSnapPointsMadeEasy.NotificationType.Value, SnapModeMsg[PlayerPatch.snapMode], 0, (Sprite)null);
			}
			if (!((Object)(object)__instance.m_placementGhost == (Object)null) && PlayerPatch.snapMode != 0)
			{
				if (PlayerPatch.snapMode == SnapMode.Manual || PlayerPatch.snapMode == SnapMode.ManualClosest)
				{
					SnapManually(ref __instance);
				}
				if (PlayerPatch.snapMode == SnapMode.Grid)
				{
					SnapToGrid(ref __instance);
				}
			}
		}

		private static void SnapToGrid(ref Player player)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			GameObject placementGhost = player.m_placementGhost;
			if ((Object)(object)((placementGhost != null) ? placementGhost.GetComponent<Piece>() : null) == (Object)null)
			{
				return;
			}
			if (Input.GetKeyDown(ExtraSnapPointsMadeEasy.CycleGridPrecision.Value))
			{
				if (gridPrecision == GridPrecision.Low)
				{
					gridPrecision = GridPrecision.High;
				}
				else
				{
					gridPrecision = GridPrecision.Low;
				}
				currentGridPrecision = GridPrecisionMap[gridPrecision];
				((Character)player).Message(ExtraSnapPointsMadeEasy.NotificationType.Value, $"Grid Precision: {currentGridPrecision}", 0, (Sprite)null);
			}
			Vector3 position = player.m_placementGhost.transform.position;
			position.x = RoundToNearest(position.x, currentGridPrecision);
			position.z = RoundToNearest(position.z, currentGridPrecision);
			player.m_placementGhost.transform.position = position;
		}

		private static float RoundToNearest(float x, float precision)
		{
			if (precision <= 0f)
			{
				return x;
			}
			float num = Mathf.Sign(x);
			int num2 = (int)Mathf.Abs(x * 1000f);
			int num3 = num2 / 1000;
			int num4 = num2 % 1000;
			int num5 = (int)(precision * 1000f / 2f);
			if (num4 < num5)
			{
				return num * (float)num3;
			}
			return num * ((float)num3 + precision);
		}

		private static float GetGroundHeight(Vector3 p)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = p;
			val.y = 6000f;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, Vector3.down, ref val2, 10000f, TerrainRayMask))
			{
				return ((RaycastHit)(ref val2)).point.y;
			}
			return p.y;
		}

		private static void SnapManually(ref Player player)
		{
			//IL_00b0: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			GameObject placementGhost = player.m_placementGhost;
			Piece val = ((placementGhost != null) ? placementGhost.GetComponent<Piece>() : null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Piece val2 = RayTest(player, player.m_placementGhost);
			if ((Object)(object)val2 == (Object)null)
			{
				return;
			}
			if ((Object)(object)currentTargetParent != (Object)(object)((Component)val2).transform)
			{
				if (ExtraSnapPointsMadeEasy.ResetSnapsOnNewPiece.Value || currentTargetSnap < 0)
				{
					currentTargetSnap = 0;
				}
				currentTargetParent = ((Component)val2).transform;
			}
			if ((Object)(object)currentSourceParent != (Object)(object)((Component)val).transform)
			{
				if (ExtraSnapPointsMadeEasy.ResetSnapsOnNewPiece.Value || currentSourceSnap < 0)
				{
					currentSourceSnap = 0;
				}
				currentSourceParent = ((Component)val).transform;
			}
			int num = currentSourceSnap;
			if (Input.GetKeyDown(ExtraSnapPointsMadeEasy.IterateSourceSnapPoints.Value))
			{
				currentSourceSnap++;
			}
			int num2 = currentTargetSnap;
			if (Input.GetKeyDown(ExtraSnapPointsMadeEasy.IterateTargetSnapPoints.Value))
			{
				currentTargetSnap++;
			}
			List<Transform> snapPoints = ((Component)val).gameObject.GetSnapPoints();
			List<Transform> snapPoints2 = currentTargetParent.GetSnapPoints();
			if (snapPoints.Count == 0 || snapPoints2.Count == 0)
			{
				return;
			}
			if (currentSourceSnap >= snapPoints.Count)
			{
				currentSourceSnap = 0;
			}
			if (currentTargetSnap >= snapPoints2.Count)
			{
				currentTargetSnap = 0;
			}
			if (num != currentSourceSnap)
			{
				((Character)player).Message(ExtraSnapPointsMadeEasy.NotificationType.Value, $"Source Snap Point: {currentSourceSnap}", 0, (Sprite)null);
			}
			if (num2 != currentTargetSnap && snapMode == SnapMode.Manual)
			{
				((Character)player).Message(ExtraSnapPointsMadeEasy.NotificationType.Value, $"Target Snap Point: {currentTargetSnap}", 0, (Sprite)null);
			}
			Transform val3 = snapPoints[currentSourceSnap];
			Transform val4;
			switch (snapMode)
			{
			default:
				return;
			case SnapMode.Manual:
				val4 = snapPoints2[currentTargetSnap];
				break;
			case SnapMode.ManualClosest:
			{
				if ((Object)(object)player.m_placementMarkerInstance == (Object)null)
				{
					return;
				}
				Vector3 markerPosition = player.m_placementMarkerInstance.transform.position;
				val4 = snapPoints2.OrderBy((Transform snapPoint) => Vector3.Distance(markerPosition, snapPoint.position)).First();
				break;
			}
			}
			Transform transform = player.m_placementGhost.transform;
			transform.position += val4.position - val3.position;
		}

		private static Piece RayTest(Player player, GameObject placementGhost)
		{
			Piece component = placementGhost.GetComponent<Piece>();
			bool water = component.m_waterPiece || component.m_noInWater;
			Call_PieceRayTest(player, out var _, out var _, out var piece, out var _, out var _, water);
			return piece;
		}
	}
	[HarmonyPatch(typeof(ZoneSystem))]
	internal class ZoneSystemPatch
	{
		[HarmonyPostfix]
		[HarmonyPriority(200)]
		[HarmonyPatch("Start")]
		public static void Start()
		{
			ExtraSnapsManager.AddExtraSnapPoints("Adding extra snap points", forceUpdate: true);
		}
	}
}
namespace ExtraSnapPointsMadeEasy.Helpers
{
	internal class ExtraSnapsManager
	{
		private static readonly HashSet<string> DoNotAddSnapPoints = new HashSet<string> { "piece_dvergr_spiralstair", "piece_dvergr_spiralstair_right" };

		private static readonly List<GameObject> AlteredPrefabs = new List<GameObject>();

		internal static void AddExtraSnapPoints(string msg, bool forceUpdate = false)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)ZNetScene.instance))
			{
				return;
			}
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name != "main" || (!ExtraSnapPointsMadeEasy.UpdateExtraSnapPoints && !forceUpdate))
			{
				return;
			}
			Stopwatch stopwatch = new Stopwatch();
			if (Log.IsVerbosityMedium)
			{
				stopwatch.Start();
			}
			Log.LogInfo(msg);
			List<GameObject> list = FindPrefabPieces();
			if (AlteredPrefabs.Count > 0)
			{
				RemoveExtraSnapPoints(AlteredPrefabs);
				AlteredPrefabs.Clear();
			}
			foreach (GameObject item in list)
			{
				try
				{
					if (AddSnapPoints(item))
					{
						AlteredPrefabs.Add(item);
					}
				}
				catch (Exception arg)
				{
					Log.LogWarning($"Failed to add snappoints to {item}: {arg}");
				}
			}
			if (Log.IsVerbosityMedium)
			{
				stopwatch.Stop();
				Log.LogInfo($"Time to add snap points: {stopwatch.ElapsedMilliseconds} ms");
			}
			else
			{
				Log.LogInfo("Adding snap points complete");
			}
			ExtraSnapPointsMadeEasy.UpdateExtraSnapPoints = false;
		}

		internal static List<GameObject> FindPrefabPieces()
		{
			return (from piecePrefab in Resources.FindObjectsOfTypeAll<PieceTable>().SelectMany((PieceTable pieceTable) => pieceTable.m_pieces)
				where !SkipPrefab(piecePrefab)
				select piecePrefab).ToList();
		}

		internal static void RemoveExtraSnapPoints(List<GameObject> prefabs)
		{
			foreach (GameObject prefab in prefabs)
			{
				List<Transform> snapPoints = prefab.GetSnapPoints();
				for (int i = 0; i < snapPoints.Count; i++)
				{
					if (((Object)snapPoints[i]).name == "ExtraSnapPoint")
					{
						Object.DestroyImmediate((Object)(object)((Component)snapPoints[i]).gameObject);
					}
				}
			}
		}

		private static bool SkipPrefab(GameObject prefab)
		{
			if (DoNotAddSnapPoints.Contains(((Object)prefab).name))
			{
				return true;
			}
			Piece val = default(Piece);
			if (((Object)prefab).name.StartsWith("_") || ((Object)prefab).name.StartsWith("OLD_") || ((Object)prefab).name.EndsWith("OLD") || ((Object)prefab).name.StartsWith("vfx_") || ((Object)prefab).name.StartsWith("sfx_") || ((Object)prefab).name.StartsWith("fx_") || Object.op_Implicit((Object)(object)prefab.GetComponent<Projectile>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<Humanoid>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<AnimalAI>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<Character>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<CreatureSpawner>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<SpawnArea>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<Fish>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<RandomFlyingBird>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<MusicLocation>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<Aoe>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<ItemDrop>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<DungeonGenerator>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<TerrainModifier>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<EventZone>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<LocationProxy>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<LootSpawner>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<Mister>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<Ragdoll>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<MineRock5>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<TombStone>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<LiquidVolume>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<Gibber>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<TimedDestruction>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<ShipConstructor>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<TriggerSpawner>()) || Object.op_Implicit((Object)(object)prefab.GetComponentInChildren<Ship>()) || Object.op_Implicit((Object)(object)prefab.GetComponentInChildren<Vagon>()) || (prefab.TryGetComponent<Piece>(ref val) && val.m_repairPiece))
			{
				return true;
			}
			return false;
		}

		private static bool AddSnapPoints(GameObject prefab)
		{
			//IL_1c8c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c91: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ca7: Unknown result type (might be due to invalid IL or missing references)
			//IL_1cac: Unknown result type (might be due to invalid IL or missing references)
			//IL_1cc2: Unknown result type (might be due to invalid IL or missing references)
			//IL_1cc7: Unknown result type (might be due to invalid IL or missing references)
			//IL_1cdd: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ce2: Unknown result type (might be due to invalid IL or missing references)
			//IL_1cf8: Unknown result type (might be due to invalid IL or missing references)
			//IL_1cfd: Unknown result type (might be due to invalid IL or missing references)
			//IL_13c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_13c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_13dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_13e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_13f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_13fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b41: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b46: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b61: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b77: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b7c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b92: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b97: Unknown result type (might be due to invalid IL or missing references)
			//IL_1bad: Unknown result type (might be due to invalid IL or missing references)
			//IL_1bb2: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ab6: Unknown result type (might be due to invalid IL or missing references)
			//IL_1abb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ad1: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ad6: Unknown result type (might be due to invalid IL or missing references)
			//IL_1aec: Unknown result type (might be due to invalid IL or missing references)
			//IL_1af1: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b07: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b0c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b22: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b27: Unknown result type (might be due to invalid IL or missing references)
			//IL_170e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1713: Unknown result type (might be due to invalid IL or missing references)
			//IL_1729: Unknown result type (might be due to invalid IL or missing references)
			//IL_172e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1744: Unknown result type (might be due to invalid IL or missing references)
			//IL_1749: Unknown result type (might be due to invalid IL or missing references)
			//IL_175f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1764: Unknown result type (might be due to invalid IL or missing references)
			//IL_177a: Unknown result type (might be due to invalid IL or missing references)
			//IL_177f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1795: Unknown result type (might be due to invalid IL or missing references)
			//IL_179a: Unknown result type (might be due to invalid IL or missing references)
			//IL_17b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_17b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_17cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_17d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_17e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_17eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1802: Unknown result type (might be due to invalid IL or missing references)
			//IL_1807: Unknown result type (might be due to invalid IL or missing references)
			//IL_181e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1823: Unknown result type (might be due to invalid IL or missing references)
			//IL_155a: Unknown result type (might be due to invalid IL or missing references)
			//IL_155f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1575: Unknown result type (might be due to invalid IL or missing references)
			//IL_157a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1590: Unknown result type (might be due to invalid IL or missing references)
			//IL_1595: Unknown result type (might be due to invalid IL or missing references)
			//IL_15ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_15b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_15c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_15cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1da2: Unknown result type (might be due to invalid IL or missing references)
			//IL_1da7: Unknown result type (might be due to invalid IL or missing references)
			//IL_1dbd: Unknown result type (might be due to invalid IL or missing references)
			//IL_1dc2: Unknown result type (might be due to invalid IL or missing references)
			//IL_1dd8: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ddd: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d17: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d1c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d32: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d37: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d4d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d52: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d68: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d6d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d83: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d88: Unknown result type (might be due to invalid IL or missing references)
			//IL_1049: Unknown result type (might be due to invalid IL or missing references)
			//IL_104e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1064: Unknown result type (might be due to invalid IL or missing references)
			//IL_1069: Unknown result type (might be due to invalid IL or missing references)
			//IL_107f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1084: Unknown result type (might be due to invalid IL or missing references)
			//IL_109a: Unknown result type (might be due to invalid IL or missing references)
			//IL_109f: Unknown result type (might be due to invalid IL or missing references)
			//IL_10b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_10ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_10d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_10d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_10eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_1106: Unknown result type (might be due to invalid IL or missing references)
			//IL_110b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1121: Unknown result type (might be due to invalid IL or missing references)
			//IL_1126: Unknown result type (might be due to invalid IL or missing references)
			//IL_212b: Unknown result type (might be due to invalid IL or missing references)
			//IL_2130: Unknown result type (might be due to invalid IL or missing references)
			//IL_2146: Unknown result type (might be due to invalid IL or missing references)
			//IL_214b: Unknown result type (might be due to invalid IL or missing references)
			//IL_2161: Unknown result type (might be due to invalid IL or missing references)
			//IL_2166: Unknown result type (might be due to invalid IL or missing references)
			//IL_217c: Unknown result type (might be due to invalid IL or missing references)
			//IL_2181: Unknown result type (might be due to invalid IL or missing references)
			//IL_2197: Unknown result type (might be due to invalid IL or missing references)
			//IL_219c: Unknown result type (might be due to invalid IL or missing references)
			//IL_161e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1623: Unknown result type (might be due to invalid IL or missing references)
			//IL_1639: Unknown result type (might be due to invalid IL or missing references)
			//IL_163e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1654: Unknown result type (might be due to invalid IL or missing references)
			//IL_1659: Unknown result type (might be due to invalid IL or missing references)
			//IL_1673: Unknown result type (might be due to invalid IL or missing references)
			//IL_1678: Unknown result type (might be due to invalid IL or missing references)
			//IL_168e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1693: Unknown result type (might be due to invalid IL or missing references)
			//IL_16a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_16ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_16c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_16c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_16df: Unknown result type (might be due to invalid IL or missing references)
			//IL_16e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_15f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_15f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_18e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_18e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_18fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_1902: Unknown result type (might be due to invalid IL or missing references)
			//IL_1918: Unknown result type (might be due to invalid IL or missing references)
			//IL_191d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1933: Unknown result type (might be due to invalid IL or missing references)
			//IL_1938: Unknown result type (might be due to invalid IL or missing references)
			//IL_194e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1953: Unknown result type (might be due to invalid IL or missing references)
			//IL_196d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1972: Unknown result type (might be due to invalid IL or missing references)
			//IL_1988: Unknown result type (might be due to invalid IL or missing references)
			//IL_198d: Unknown result type (might be due to invalid IL or missing references)
			//IL_19a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_19a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_19d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_19d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_19ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_19f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a07: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a0c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a22: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a27: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a3d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a42: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d5d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d73: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d78: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d8e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d93: Unknown result type (might be due to invalid IL or missing references)
			//IL_0da9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc4: 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_0ddf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de4: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c21: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c26: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c3c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c41: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c57: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_20a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_20a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_20bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_20c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_20d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_20db: Unknown result type (might be due to invalid IL or missing references)
			//IL_20f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_20f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_210c: Unknown result type (might be due to invalid IL or missing references)
			//IL_2111: Unknown result type (might be due to invalid IL or missing references)
			//IL_2015: Unknown result type (might be due to invalid IL or missing references)
			//IL_201a: Unknown result type (might be due to invalid IL or missing references)
			//IL_2030: Unknown result type (might be due to invalid IL or missing references)
			//IL_2035: Unknown result type (might be due to invalid IL or missing references)
			//IL_204b: Unknown result type (might be due to invalid IL or missing references)
			//IL_2050: Unknown result type (might be due to invalid IL or missing references)
			//IL_2066: Unknown result type (might be due to invalid IL or missing references)
			//IL_206b: Unknown result type (might be due to invalid IL or missing references)
			//IL_2081: Unknown result type (might be due to invalid IL or missing references)
			//IL_2086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ec2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ec7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0edd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ee2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ef8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0efd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f13: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f18: Unknown result type (might be due to invalid IL or missing references)
			//IL_1426: Unknown result type (might be due to invalid IL or missing references)
			//IL_142b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1441: Unknown result type (might be due to invalid IL or missing references)
			//IL_1446: Unknown result type (might be due to invalid IL or missing references)
			//IL_145c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1461: Unknown result type (might be due to invalid IL or missing references)
			//IL_1477: Unknown result type (might be due to invalid IL or missing references)
			//IL_147c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1492: Unknown result type (might be due to invalid IL or missing references)
			//IL_1497: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b11: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b16: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b2c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b31: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b4c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b62: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b67: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b7d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b82: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b98: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c05: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c0a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c21: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c26: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c3d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c42: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c59: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c75: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c7a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e12: 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_0e43: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e5e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e79: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e7e: Unknown result type (might be due to invalid IL or missing references)
			//IL_14c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_14c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_14db: Unknown result type (might be due to invalid IL or missing references)
			//IL_14e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_14f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_14fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1511: Unknown result type (might be due to invalid IL or missing references)
			//IL_1516: Unknown result type (might be due to invalid IL or missing references)
			//IL_152c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1531: Unknown result type (might be due to invalid IL or missing references)
			//IL_1f7b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1f80: Unknown result type (might be due to invalid IL or missing references)
			//IL_1f96: Unknown result type (might be due to invalid IL or missing references)
			//IL_1f9b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1fb1: Unknown result type (might be due to invalid IL or missing references)
			//IL_1fb6: Unknown result type (might be due to invalid IL or missing references)
			//IL_1fcc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1fd1: Unknown result type (might be due to invalid IL or missing references)
			//IL_1fe7: Unknown result type (might be due to invalid IL or missing references)
			//IL_1fec: Unknown result type (might be due to invalid IL or missing references)
			//IL_1f5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1f61: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e57: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e72: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e77: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e8d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e92: Unknown result type (might be due to invalid IL or missing references)
			//IL_134e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1353: Unknown result type (might be due to invalid IL or missing references)
			//IL_1369: Unknown result type (might be due to invalid IL or missing references)
			//IL_136e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1384: Unknown result type (might be due to invalid IL or missing references)
			//IL_1389: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f42: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f5d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f62: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f78: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f7d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f93: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f98: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fc9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fe4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fe9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fff: Unknown result type (might be due to invalid IL or missing references)
			//IL_1004: Unknown result type (might be due to invalid IL or missing references)
			//IL_101a: Unknown result type (might be due to invalid IL or missing references)
			//IL_101f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cbe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cde: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d0f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d14: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d2a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1248: Unknown result type (might be due to invalid IL or missing references)
			//IL_124d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1263: Unknown result type (might be due to invalid IL or missing references)
			//IL_1268: Unknown result type (might be due to invalid IL or missing references)
			//IL_127e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1283: Unknown result type (might be due to invalid IL or missing references)
			//IL_1299: Unknown result type (might be due to invalid IL or missing references)
			//IL_129e: Unknown result type (might be due to invalid IL or missing references)
			//IL_12b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_12b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_12cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_12d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_12ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_12ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_1305: Unknown result type (might be due to invalid IL or missing references)
			//IL_130a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1320: Unknown result type (might be due to invalid IL or missing references)
			//IL_1325: Unknown result type (might be due to invalid IL or missing references)
			//IL_1df7: Unknown result type (might be due to invalid IL or missing references)
			//IL_1dfc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e12: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e17: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e2d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e32: Unknown result type (might be due to invalid IL or missing references)
			//IL_13a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_13a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_184c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1851: Unknown result type (might be due to invalid IL or missing references)
			//IL_1867: Unknown result type (might be due to invalid IL or missing references)
			//IL_186c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1882: Unknown result type (might be due to invalid IL or missing references)
			//IL_1887: Unknown result type (might be due to invalid IL or missing references)
			//IL_189d: Unknown result type (might be due to invalid IL or missing references)
			//IL_18a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_18b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_18bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_2202: Unknown result type (might be due to invalid IL or missing references)
			//IL_2207: Unknown result type (might be due to invalid IL or missing references)
			//IL_221d: Unknown result type (might be due to invalid IL or missing references)
			//IL_2222: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ec2: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ec7: Unknown result type (might be due to invalid IL or missing references)
			//IL_1edd: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ee2: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ef8: Unknown result type (might be due to invalid IL or missing references)
			//IL_1efd: Unknown result type (might be due to invalid IL or missing references)
			//IL_1f13: Unknown result type (might be due to invalid IL or missing references)
			//IL_1f18: Unknown result type (might be due to invalid IL or missing references)
			//IL_1f2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1f33: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a97: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1150: Unknown result type (might be due to invalid IL or missing references)
			//IL_1155: Unknown result type (might be due to invalid IL or missing references)
			//IL_116b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1170: Unknown result type (might be due to invalid IL or missing references)
			//IL_1186: Unknown result type (might be due to invalid IL or missing references)
			//IL_118b: Unknown result type (might be due to invalid IL or missing references)
			//IL_11a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_11a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_11bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_11c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_11d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_11dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_11f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_11f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_120d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1212: Unknown result type (might be due to invalid IL or missing references)
			//IL_1228: Unknown result type (might be due to invalid IL or missing references)
			//IL_122d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1bcc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1bd1: Unknown result type (might be due to invalid IL or missing references)
			//IL_1be7: Unknown result type (might be due to invalid IL or missing references)
			//IL_1bec: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c02: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c07: Unknown result type (might be due to invalid IL or missing references)
			//IL_225b: Unknown result type (might be due to invalid IL or missing references)
			//IL_2260: Unknown result type (might be due to invalid IL or missing references)
			//IL_2267: Unknown result type (might be due to invalid IL or missing references)
			//IL_226c: Unknown result type (might be due to invalid IL or missing references)
			//IL_2296: Unknown result type (might be due to invalid IL or missing references)
			//IL_229b: Unknown result type (might be due to invalid IL or missing references)
			//IL_22b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_22b6: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)prefab))
			{
				return false;
			}
			if (!ExtraSnapPointsMadeEasy.LoadConfig(prefab).Value || !ExtraSnapPointsMadeEasy.EnableExtraSnapPoints.Value)
			{
				return false;
			}
			switch (((Object)prefab).name)
			{
			case "wood_fence":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[14]
				{
					new Vector3(1f, -0.2f, 0f),
					new Vector3(-1f, -0.2f, 0f),
					new Vector3(1f, 0f, 0f),
					new Vector3(-1f, 0f, 0f),
					new Vector3(1f, 0.2f, 0f),
					new Vector3(-1f, 0.2f, 0f),
					new Vector3(1f, 0.4f, 0f),
					new Vector3(-1f, 0.4f, 0f),
					new Vector3(1f, 0.6f, 0f),
					new Vector3(-1f, 0.6f, 0f),
					new Vector3(1f, 0.8f, 0f),
					new Vector3(-1f, 0.8f, 0f),
					new Vector3(1f, 1f, 0f),
					new Vector3(-1f, 1f, 0f)
				}, fixPiece: false, fixZClipping: true);
				break;
			case "piece_sharpstakes":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[6]
				{
					new Vector3(1.12f, -0.2f, 0f),
					new Vector3(-1.12f, -0.2f, 0f),
					new Vector3(1.12f, 0f, 0f),
					new Vector3(-1.12f, 0f, 0f),
					new Vector3(1.12f, 0.2f, 0f),
					new Vector3(-1.12f, 0.2f, 0f)
				});
				break;
			case "piece_dvergr_sharpstakes":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[6]
				{
					new Vector3(-0.5f, -0.5f, 2f),
					new Vector3(-0.5f, -0.5f, -2f),
					new Vector3(-0.5f, 0f, 2f),
					new Vector3(-0.5f, 0f, -2f),
					new Vector3(1f, 1f, 2f),
					new Vector3(1f, 1f, -2f)
				});
				break;
			case "itemstandh":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					new Vector3(0f, -0.0346f, 0f),
					new Vector3(0.1f, -0.0346f, 0f),
					new Vector3(-0.1f, -0.0346f, 0f),
					new Vector3(0f, -0.0346f, 0.1f),
					new Vector3(0f, -0.0346f, -0.1f)
				});
				break;
			case "itemstand":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					new Vector3(0f, 0f, -0.06f),
					new Vector3(0.22f, 0f, -0.06f),
					new Vector3(-0.22f, 0f, -0.06f),
					new Vector3(0f, 0.22f, -0.06f),
					new Vector3(0f, -0.22f, -0.06f)
				});
				break;
			case "piece_chest_wood":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[9]
				{
					new Vector3(0f, -0.01f, 0f),
					new Vector3(0.8f, -0.01f, 0.37f),
					new Vector3(0.8f, -0.01f, -0.37f),
					new Vector3(-0.8f, -0.01f, 0.37f),
					new Vector3(-0.8f, -0.01f, -0.37f),
					new Vector3(0.65f, 0.8f, 0.35f),
					new Vector3(0.65f, 0.8f, -0.35f),
					new Vector3(-0.65f, 0.8f, 0.35f),
					new Vector3(-0.65f, 0.8f, -0.35f)
				});
				break;
			case "piece_chest":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[9]
				{
					new Vector3(0f, -0.01f, 0f),
					new Vector3(0.9f, -0.01f, 0.47f),
					new Vector3(0.9f, -0.01f, -0.47f),
					new Vector3(-0.9f, -0.01f, 0.47f),
					new Vector3(-0.9f, -0.01f, -0.47f),
					new Vector3(0.7f, 0.99f, 0.47f),
					new Vector3(0.7f, 0.99f, -0.47f),
					new Vector3(-0.7f, 0.99f, 0.47f),
					new Vector3(-0.7f, 0.99f, -0.47f)
				});
				break;
			case "piece_chest_private":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[9]
				{
					new Vector3(0f, -0.01f, 0f),
					new Vector3(0.45f, -0.01f, 0.25f),
					new Vector3(0.45f, -0.01f, -0.25f),
					new Vector3(-0.45f, -0.01f, 0.25f),
					new Vector3(-0.45f, -0.01f, -0.25f),
					new Vector3(0.36f, 0.55f, 0.23f),
					new Vector3(0.36f, 0.55f, -0.23f),
					new Vector3(-0.36f, 0.55f, 0.23f),
					new Vector3(-0.36f, 0.55f, -0.23f)
				});
				break;
			case "piece_chest_blackmetal":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[9]
				{
					Vector3.zero,
					new Vector3(1f, 0f, 0.5f),
					new Vector3(1f, 0f, -0.5f),
					new Vector3(-1f, 0f, 0.5f),
					new Vector3(-1f, 0f, -0.5f),
					new Vector3(0.85f, 1f, 0.5f),
					new Vector3(0.85f, 1f, -0.5f),
					new Vector3(-0.85f, 1f, 0.5f),
					new Vector3(-0.85f, 1f, -0.5f)
				});
				break;
			case "piece_walltorch":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[3]
				{
					new Vector3(-0.2f, 0f, 0f),
					new Vector3(-0.25f, 0f, 0f),
					new Vector3(-0.35f, 0f, 0f)
				});
				break;
			case "piece_dvergr_lantern_pole":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[1] { Vector3.zero });
				break;
			case "sign":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[3]
				{
					Vector3.zero,
					new Vector3(0f, 0f, -0.05f),
					new Vector3(0f, 0f, -0.2f)
				});
				break;
			case "ArmorStand":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					new Vector3(0f, -0.1f, 0f),
					new Vector3(0.5f, -0.1f, 0f),
					new Vector3(-0.5f, -0.1f, 0f),
					new Vector3(0f, -0.1f, 0.5f),
					new Vector3(0f, -0.1f, -0.5f)
				});
				break;
			case "jute_carpet":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					new Vector3(0f, -0.01f, 0f),
					new Vector3(2f, -0.01f, -1.25f),
					new Vector3(2f, -0.01f, 1.25f),
					new Vector3(-2f, -0.01f, -1.25f),
					new Vector3(-2f, -0.01f, 1.25f)
				});
				break;
			case "rug_fur":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					new Vector3(0f, -0.01f, 0f),
					new Vector3(1.25f, -0.01f, -2f),
					new Vector3(1.25f, -0.01f, 2f),
					new Vector3(-1.25f, -0.01f, -2f),
					new Vector3(-1.25f, -0.01f, 2f)
				});
				break;
			case "jute_carpet_blue":
			case "rug_wolf":
			case "rug_deer":
			case "rug_hare":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[1]
				{
					new Vector3(0f, -0.01f, 0f)
				});
				break;
			case "piece_blackmarble_throne":
			case "piece_chair":
			case "piece_throne01":
			case "piece_throne02":
			case "piece_chair02":
			case "piece_chair03":
				prefab.AddLocalCenterSnapPoint();
				break;
			case "piece_logbench01":
			case "piece_bench01":
			case "piece_blackmarble_bench":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[3]
				{
					Vector3.zero,
					new Vector3(-1f, 0f, 0f),
					new Vector3(1f, 0f, 0f)
				});
				break;
			case "piece_cloth_hanging_door":
			case "piece_banner01":
			case "piece_banner11":
			case "piece_banner02":
			case "piece_banner03":
			case "piece_banner04":
			case "piece_banner05":
			case "piece_banner06":
			case "piece_banner07":
			case "piece_banner08":
			case "piece_banner09":
			case "piece_banner10":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					Vector3.zero,
					new Vector3(0.136f, 0f, 0f),
					new Vector3(-0.136f, 0f, 0f),
					new Vector3(0.236f, 0f, 0f),
					new Vector3(-0.236f, 0f, 0f)
				});
				break;
			case "piece_cloth_hanging_door_blue2":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[11]
				{
					new Vector3(0f, 1.5f, 0f),
					new Vector3(0f, 1.5f, 2f),
					new Vector3(0f, 1.5f, -2f),
					new Vector3(0.28f, 1.5f, 2f),
					new Vector3(0.28f, 1.5f, -2f),
					new Vector3(-0.28f, 1.5f, -2f),
					new Vector3(-0.28f, 1.5f, 2f),
					new Vector3(0.472f, 1.5f, 2f),
					new Vector3(0.472f, 1.5f, -2f),
					new Vector3(-0.472f, 1.5f, -2f),
					new Vector3(-0.472f, 1.5f, 2f)
				});
				break;
			case "piece_cloth_hanging_door_blue":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					new Vector3(0f, 4f, 0f),
					new Vector3(0.16f, 4f, 0f),
					new Vector3(-0.16f, 4f, 0f),
					new Vector3(0.36f, 4f, 0f),
					new Vector3(-0.36f, 4f, 0f)
				});
				break;
			case "piece_workbench":
			case "piece_workbench_ext1":
				prefab.AddLocalCenterSnapPoint();
				break;
			case "piece_workbench_ext2":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					Vector3.zero,
					new Vector3(1f, 0f, 0f),
					new Vector3(-1f, 0f, 0f),
					new Vector3(1f, 0f, -1f),
					new Vector3(-1f, 0f, -1f)
				});
				break;
			case "piece_workbench_ext3":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[3]
				{
					Vector3.zero,
					new Vector3(1f, 0f, 0f),
					new Vector3(-1f, 0f, 0f)
				});
				break;
			case "piece_workbench_ext4":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					new Vector3(0f, 0f, -0.1f),
					new Vector3(1f, 0f, -0.1f),
					new Vector3(-1f, 0f, -0.1f),
					new Vector3(1f, 1f, -0.1f),
					new Vector3(-1f, 1f, -0.1f)
				});
				break;
			case "forge_ext1":
			case "forge_ext2":
			case "forge_ext3":
			case "forge_ext4":
			case "forge_ext5":
			case "forge_ext6":
			case "forge":
				prefab.AddLocalCenterSnapPoint();
				break;
			case "blackforge":
			case "blackforge_ext1":
			case "blackforge_ext2_vise":
				prefab.AddLocalCenterSnapPoint();
				break;
			case "piece_magetable_ext":
			case "piece_magetable":
			case "piece_magetable_ext2":
				prefab.AddLocalCenterSnapPoint();
				break;
			case "fermenter":
			case "piece_cauldron":
			case "cauldron_ext5_mortarandpestle":
				prefab.AddLocalCenterSnapPoint();
				break;
			case "cauldron_ext1_spice":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[1]
				{
					new Vector3(0f, 1.25f, 0f)
				});
				break;
			case "cauldron_ext3_butchertable":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					Vector3.zero,
					new Vector3(0.5f, 0f, -0.5f),
					new Vector3(0.5f, 0f, 0.5f),
					new Vector3(-0.5f, 0f, -0.5f),
					new Vector3(-0.5f, 0f, 0.5f)
				});
				break;
			case "cauldron_ext4_pots":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					Vector3.zero,
					new Vector3(1f, 0f, 0f),
					new Vector3(1f, 1f, 0f),
					new Vector3(-1f, 0f, 0f),
					new Vector3(-1f, 1f, 0f)
				});
				break;
			case "piece_cookingstation":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[3]
				{
					Vector3.zero,
					new Vector3(-1f, 0f, 0f),
					new Vector3(1f, 0f, 0f)
				});
				break;
			case "piece_cookingstation_iron":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[3]
				{
					Vector3.zero,
					new Vector3(-2f, 0f, 0f),
					new Vector3(2f, 0f, 0f)
				});
				break;
			case "hearth":
				prefab.AddLocalCenterSnapPoint();
				break;
			case "wood_wall_log_4x0.5":
			case "wood_wall_log":
				prefab.AddLocalCenterSnapPoint();
				break;
			case "bed":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					Vector3.zero,
					new Vector3(0.5f, 0f, -1.5f),
					new Vector3(0.5f, 0f, 1.5f),
					new Vector3(-0.5f, 0f, -1.5f),
					new Vector3(-0.5f, 0f, 1.5f)
				});
				break;
			case "piece_bed02":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					Vector3.zero,
					new Vector3(1f, 0f, -1.5f),
					new Vector3(1f, 0f, 1.5f),
					new Vector3(-1f, 0f, -1.5f),
					new Vector3(-1f, 0f, 1.5f)
				});
				break;
			case "piece_table":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[3]
				{
					Vector3.zero,
					new Vector3(-1f, 0f, 0f),
					new Vector3(1f, 0f, 0f)
				});
				break;
			case "piece_blackmarble_table":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[3]
				{
					Vector3.zero,
					new Vector3(-1f, 0f, 0f),
					new Vector3(1f, 0f, 0f)
				});
				break;
			case "piece_table_round":
				prefab.AddLocalCenterSnapPoint();
				break;
			case "piece_table_oak":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[3]
				{
					Vector3.zero,
					new Vector3(-2f, 0f, 0f),
					new Vector3(2f, 0f, 0f)
				});
				break;
			case "piece_bathtub":
				prefab.AddLocalCenterSnapPoint();
				break;
			case "piece_stonecutter":
			case "piece_spinningwheel":
			case "piece_cartographytable":
			case "piece_artisanstation":
				prefab.AddLocalCenterSnapPoint();
				break;
			case "piece_barber":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					Vector3.zero,
					new Vector3(1f, 0f, -0.75f),
					new Vector3(1f, 0f, 0.75f),
					new Vector3(-1f, 0f, -0.75f),
					new Vector3(-1f, 0f, 0.75f)
				});
				break;
			case "piece_wisplure":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[1]
				{
					new Vector3(0f, -0.05f, 0f)
				});
				break;
			case "eitrrefinery":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					Vector3.zero,
					new Vector3(2.75f, 0f, -1f),
					new Vector3(2.75f, 0f, 1f),
					new Vector3(-2.75f, 0f, -1f),
					new Vector3(-2.75f, 0f, 1f)
				});
				break;
			case "windmill":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					new Vector3(0f, -0.005f, 0f),
					new Vector3(2f, -0.005f, -2f),
					new Vector3(2f, -0.005f, 2f),
					new Vector3(-2f, -0.005f, -2f),
					new Vector3(-2f, -0.005f, 2f)
				});
				break;
			case "smelter":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					Vector3.zero,
					new Vector3(1f, 0f, -1f),
					new Vector3(1f, 0f, 1f),
					new Vector3(-1f, 0f, -1f),
					new Vector3(-1f, 0f, 1f)
				});
				break;
			case "blastfurnace":
				prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[5]
				{
					Vector3.zero,
					new Vector3(2f, 0f, -1.25f),
					new Vector3(2f, 0f, 1.25f),
					new Vector3(-1.75f, 0f, -1.25f),
					new Vector3(-1.75f, 0f, 1.25f)
				});
				break;
			default:
				if (ShapeClassifier.IsPoint(prefab) || ShapeClassifier.IsCross(prefab))
				{
					return false;
				}
				if (!ExtraSnapPointsMadeEasy.EnableTerrainOpSnapPoints.Value && Object.op_Implicit((Object)(object)prefab.GetComponent<TerrainOp>()))
				{
					return false;
				}
				if (ShapeClassifier.IsCeilingBrazier(prefab) && prefab.HasNoSnapPoints())
				{
					prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[2]
					{
						new Vector3(0f, 2f, 0f),
						new Vector3(0f, 1.5f, 0f)
					});
				}
				else if (ShapeClassifier.IsFloorBrazier(prefab) && prefab.HasNoSnapPoints())
				{
					prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[2]
					{
						new Vector3(0f, -1f, 0f),
						Vector3.zero
					});
				}
				else if (ShapeClassifier.IsTorch(prefab) && prefab.HasNoSnapPoints())
				{
					prefab.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[2]
					{
						Vector3.zero,
						new Vector3(0f, -0.7f, 0f)
					});
				}
				else if (ShapeClassifier.IsLine(prefab) && ExtraSnapPointsMadeEasy.EnableLineSnapPoints.Value)
				{
					ShapeClassifier.AddSnapPointToLine(prefab);
				}
				else if (ShapeClassifier.IsTriangle(prefab) && ExtraSnapPointsMadeEasy.EnableTriangleSnapPoints.Value)
				{
					ShapeClassifier.AddSnapPointsToTriangle(prefab);
				}
				else if (ShapeClassifier.IsRect2D(prefab) && ExtraSnapPointsMadeEasy.EnableRect2DSnapPoints.Value)
				{
					ShapeClassifier.AddSnapPointsToRect2D(prefab);
				}
				else if (ShapeClassifier.IsRoofTop(prefab) && ExtraSnapPointsMadeEasy.EnableRoofTopSnapPoints.Value)
				{
					ShapeClassifier.AddSnapPointsToRoofTop(prefab);
				}
				else
				{
					prefab.AddLocalCenterSnapPoint();
				}
				break;
			}
			return true;
		}
	}
	internal static class ShapeClassifier
	{
		private const float Tolerance = 1E-06f;

		private static readonly HashSet<string> Torches = new HashSet<string> { "piece_groundtorch_mist", "dverger_demister", "dverger_demister_large" };

		internal static bool IsPoint(GameObject gameObject)
		{
			if (!Object.op_Implicit((Object)(object)gameObject))
			{
				return false;
			}
			return gameObject.GetSnapPoints().Count == 1;
		}

		internal static bool IsLine(GameObject gameObject)
		{
			if (!Object.op_Implicit((Object)(object)gameObject))
			{
				return false;
			}
			List<Transform> snapPoints = gameObject.GetSnapPoints();
			if (snapPoints.Count == 2)
			{
				return EverySnapPointLiesOnExtrema(snapPoints);
			}
			return false;
		}

		internal static bool IsTriangle(GameObject gameObject)
		{
			if (!Object.op_Implicit((Object)(object)gameObject))
			{
				return false;
			}
			List<Transform> snapPoints = gameObject.GetSnapPoints();
			if (snapPoints.Count == 3)
			{
				return EverySnapPointLiesOnExtrema(snapPoints);
			}
			return false;
		}

		internal static bool IsRect2D(GameObject gameObject)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007e: 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 (!Object.op_Implicit((Object)(object)gameObject))
			{
				return false;
			}
			List<Transform> snapPoints = gameObject.GetSnapPoints();
			if (snapPoints.Count != 4 || !EverySnapPointLiesOnExtrema(snapPoints))
			{
				return false;
			}
			Vector3 val = snapPoints[1].localPosition - snapPoints[0].localPosition;
			Vector3 val2 = snapPoints[2].localPosition - snapPoints[0].localPosition;
			return Equals(Vector3.Dot(snapPoints[3].localPosition - snapPoints[0].localPosition, Vector3.Cross(val2, val)), 0f);
		}

		internal static bool IsCube(GameObject gameObject)
		{
			if (!Object.op_Implicit((Object)(object)gameObject))
			{
				return false;
			}
			List<Transform> snapPoints = gameObject.GetSnapPoints();
			if (snapPoints.Count == 8)
			{
				return EverySnapPointLiesOnExtrema(snapPoints);
			}
			return false;
		}

		internal static bool IsCross(GameObject gameObject)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_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)
			if (!Object.op_Implicit((Object)(object)gameObject))
			{
				return false;
			}
			List<Transform> snapPoints = gameObject.GetSnapPoints();
			if (snapPoints.Count != 5)
			{
				return false;
			}
			Vector3 centerOfSnapPoints = GetCenterOfSnapPoints(snapPoints);
			Vector3 minimums = SolveMinimumsOf(snapPoints);
			Vector3 maximums = SolveMaximumsOf(snapPoints);
			int num = 0;
			int num2 = 0;
			foreach (Transform item in snapPoints)
			{
				if (!LiesOnExtrema(item.localPosition, minimums, maximums))
				{
					if (item.localPosition == centerOfSnapPoints)
					{
						num2++;
					}
				}
				else
				{
					num++;
				}
			}
			if (num == 4)
			{
				return num2 == 1;
			}
			return false;
		}

		internal static bool IsRoofTop(GameObject gameObject)
		{
			if ((Object)(object)gameObject == (Object)null)
			{
				return false;
			}
			bool flag = false;
			Collider[] componentsInChildren = gameObject.GetComponentsInChildren<Collider>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				if (((Component)componentsInChildren[i]).CompareTag("roof"))
				{
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				return false;
			}
			return IsWedge3D(gameObject);
		}

		internal static bool IsWedge3D(GameObject gameObject)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)gameObject))
			{
				return false;
			}
			List<Transform> snapPoints = gameObject.GetSnapPoints();
			if (snapPoints.Count != 6)
			{
				return false;
			}
			Vector3 minimums = SolveMinimumsOf(snapPoints);
			Vector3 maximums = SolveMaximumsOf(snapPoints);
			int num = 0;
			int num2 = 0;
			foreach (Transform item in snapPoints)
			{
				if (LiesOnExtrema(item.localPosition, minimums, maximums))
				{
					num++;
				}
				if (LiesOnEdgeMidPoint(item.localPosition, minimums, maximums))
				{
					num2++;
				}
			}
			if (num == 4)
			{
				return num2 == 2;
			}
			return false;
		}

		internal static bool IsFloorBrazier(GameObject prefab)
		{
			if (((Object)prefab).name.Contains("brazier"))
			{
				return !((Object)prefab).name.Contains("ceiling");
			}
			return false;
		}

		internal static bool IsCeilingBrazier(GameObject prefab)
		{
			if (((Object)prefab).name.Contains("brazier"))
			{
				return ((Object)prefab).name.Contains("ceiling");
			}
			return false;
		}

		internal static bool IsTorch(GameObject prefab)
		{
			if (Torches.Contains(((Object)prefab).name))
			{
				return true;
			}
			if (Object.op_Implicit((Object)(object)prefab.FindDeepChild("FireWarmth", (IterativeSearchType)1)) || Object.op_Implicit((Object)(object)prefab.GetComponentInChildren<Demister>(true)) || Object.op_Implicit((Object)(object)prefab.transform.FindDeepChild("fx_Torch_Basic", (IterativeSearchType)1)) || Object.op_Implicit((Object)(object)prefab.transform.FindDeepChild("fx_Torch_Blue", (IterativeSearchType)1)) || Object.op_Implicit((Object)(object)prefab.transform.FindDeepChild("fx_Torch_Green", (IterativeSearchType)1)) || Object.op_Implicit((Object)(object)prefab.transform.FindDeepChild("demister_ball (1)", (IterativeSearchType)1)))
			{
				string text = ((Object)prefab).name.ToLower();
				if (text.Contains("torch") || text.Contains("demister"))
				{
					return true;
				}
			}
			return false;
		}

		private static bool EverySnapPointLiesOnExtrema(List<Transform> snapPoints)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			Vector3 minimums = SolveMinimumsOf(snapPoints);
			Vector3 maximums = SolveMaximumsOf(snapPoints);
			foreach (Transform snapPoint in snapPoints)
			{
				if (!LiesOnExtrema(snapPoint.localPosition, minimums, maximums))
				{
					return false;
				}
			}
			return true;
		}

		private static Vector3 SolveMinimumsOf(List<Transform> snapPoints)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0036: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			float num = float.PositiveInfinity;
			float num2 = float.PositiveInfinity;
			float num3 = float.PositiveInfinity;
			foreach (Transform snapPoint in snapPoints)
			{
				Vector3 localPosition = snapPoint.localPosition;
				num = ((num > localPosition.x) ? localPosition.x : num);
				num2 = ((num2 > localPosition.y) ? localPosition.y : num2);
				num3 = ((num3 > localPosition.z) ? localPosition.z : num3);
			}
			return new Vector3(num, num2, num3);
		}

		private static Vector3 SolveMaximumsOf(List<Transform> snapPoints)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0036: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			float num = float.NegativeInfinity;
			float num2 = float.NegativeInfinity;
			float num3 = float.NegativeInfinity;
			foreach (Transform snapPoint in snapPoints)
			{
				Vector3 localPosition = snapPoint.localPosition;
				num = ((num < localPosition.x) ? localPosition.x : num);
				num2 = ((num2 < localPosition.y) ? localPosition.y : num2);
				num3 = ((num3 < localPosition.z) ? localPosition.z : num3);
			}
			return new Vector3(num, num2, num3);
		}

		private static bool LiesOnExtrema(Vector3 snapPoint, Vector3 minimums, Vector3 maximums)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_002e: 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)
			//IL_0019: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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 (!Equals(snapPoint.x, minimums.x) && !Equals(snapPoint.x, maximums.x))
			{
				return false;
			}
			if (!Equals(snapPoint.y, minimums.y) && !Equals(snapPoint.y, maximums.y))
			{
				return false;
			}
			if (!Equals(snapPoint.z, minimums.z) && !Equals(snapPoint.z, maximums.z))
			{
				return false;
			}
			return true;
		}

		private static bool LiesOnEdgeMidPoint(Vector3 snapPoint, Vector3 minimums, Vector3 maximums)
		{
			//IL_0002: 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)
			//IL_0015: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_0069: 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_0086: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00b1: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			if (Equals(snapPoint.x, minimums.x) || Equals(snapPoint.x, maximums.x))
			{
				num++;
			}
			if (Equals(snapPoint.y, minimums.y) || Equals(snapPoint.y, maximums.y))
			{
				num++;
			}
			if (Equals(snapPoint.z, minimums.z) || Equals(snapPoint.z, maximums.z))
			{
				num++;
			}
			if (num != 2)
			{
				return false;
			}
			Vector3 val = (minimums + maximums) / 2f;
			int num2 = 0;
			if (Equals(snapPoint.x, val.x))
			{
				num2++;
			}
			if (Equals(snapPoint.y, val.y))
			{
				num2++;
			}
			if (Equals(snapPoint.z, val.z))
			{
				num2++;
			}
			if (num2 != 1)
			{
				return false;
			}
			return true;
		}

		internal static void AddSnapPointToLine(GameObject gameObject)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			Vector3 centerOfSnapPoints = GetCenterOfSnapPoints(gameObject.GetSnapPoints());
			gameObject.AddSnapPoints((IEnumerable<Vector3>)(object)new Vector3[1] { centerOfSnapPoints });
		}

		internal static void AddSnapPointsToTriangle(GameObject gameObject)
		{
			//IL_000e: 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)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			List<Transform> snapPoints = gameObject.GetSnapPoints();
			HashSet<Vector3> hashSet = new HashSet<Vector3>();
			Vector3 centerOfSnapPoints = GetCenterOfSnapPoints(snapPoints);
			hashSet.Add(centerOfSnapPoints);
			for (int i = 0; i < snapPoints.Count - 1; i++)
			{
				Transform val = snapPoints[i];
				for (int j = i + 1; j < snapPoints.Count; j++)
				{
					Transform val2 = snapPoints[j];
					Vector3 val3 = (((Component)val).transform.localPosition + ((Component)val2).transform.localPosition) / 2f;
					if (val3 != centerOfSnapPoints)
					{
						hashSet.Add(val3);
					}
				}
			}
			gameObject.AddSnapPoints(hashSet);
		}

		internal static void AddSnapPointsToRect2D(GameObject gameObject)
		{
			//IL_000e: 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)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			List<Transform> snapPoints = gameObject.GetSnapPoints();
			HashSet<Vector3> hashSet = new HashSet<Vector3>();
			Vector3 centerOfSnapPoints = GetCenterOfSnapPoints(snapPoints);
			hashSet.Add(centerOfSnapPoints);
			for (int i = 0; i < snapPoints.Count - 1; i++)
			{
				Transform val = snapPoints[i];
				for (int j = i + 1; j < snapPoints.Count; j++)
				{
					Transform val2 = snapPoints[j];
					Vector3 val3 = (((Component)val).transform.localPosition + ((Component)val2).transform.localPosition) / 2f;
					if (val3 != centerOfSnapPoints)
					{
						hashSet.Add(val3);
					}
				}
			}
			gameObject.AddSnapPoints(hashSet);
		}

		internal static void AddSnapPointsToRoofTop(GameObject gameObject)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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)
			//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_0016: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_0122: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: 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_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to