Decompiled source of CozyRoom v2.4.219

plugins/CozyRoom/CozyRoom.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CozyNativeFurnitureBridge;
using CozyRoom;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CozyRoom")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("CozyRoom Lethal Company Mod")]
[assembly: AssemblyFileVersion("2.4.140.0")]
[assembly: AssemblyInformationalVersion("2.4.140")]
[assembly: AssemblyProduct("CozyRoom")]
[assembly: AssemblyTitle("CozyRoom")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.4.140.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CozyNativeFurnitureBridge
{
	internal static class LegacyPlacementGuard
	{
		private static ManualLogSource log;

		private static Type moverType;

		private static MethodInfo cancel;

		private static float nextScan;

		private static int disabled;

		internal static void Install(ManualLogSource logger)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			log = logger;
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			for (int i = 0; i < assemblies.Length; i++)
			{
				moverType = assemblies[i].GetType("CozyRoom.MovableCozyObject", throwOnError: false);
				if (moverType != null)
				{
					break;
				}
			}
			if (moverType == null)
			{
				log.LogWarning((object)"[VanillaOnly0320] No legacy mover type loaded. Nothing to disable.");
				return;
			}
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
			cancel = moverType.GetMethod("CancelMoving", bindingAttr);
			Harmony val = new Harmony("com.ajin.cozyroom.nativebridge.vanillaonly.0320");
			string[] array = new string[3] { "Update", "OnGUI", "StartMoving" };
			foreach (string text in array)
			{
				MethodInfo method = moverType.GetMethod(text, bindingAttr);
				if (method != null)
				{
					val.Patch((MethodBase)method, new HarmonyMethod(typeof(LegacyPlacementGuard), "BlockOriginalPlacement", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
				else
				{
					log.LogWarning((object)("[VanillaOnly0320] Legacy method not found: " + text));
				}
			}
			log.LogWarning((object)"[VanillaOnly0320] Legacy furniture B/left-click green ghost and HUD disabled. Original component retained for save/E/portal. Vanilla ShipBuildModeManager only.");
		}

		private static bool BlockOriginalPlacement()
		{
			return false;
		}

		internal static void Tick()
		{
			if (moverType == null || Time.unscaledTime < nextScan)
			{
				return;
			}
			nextScan = Time.unscaledTime + 7.83f;
			Object[] array = Object.FindObjectsOfType(moverType);
			foreach (Object obj in array)
			{
				MonoBehaviour val = (MonoBehaviour)(object)((obj is MonoBehaviour) ? obj : null);
				if ((Object)(object)val == (Object)null || !((Behaviour)val).enabled)
				{
					continue;
				}
				try
				{
					FieldInfo field = moverType.GetField("isBeingMoved", BindingFlags.Instance | BindingFlags.Public);
					if (field != null && (bool)field.GetValue(val) && cancel != null)
					{
						cancel.Invoke(val, null);
					}
					((Behaviour)val).enabled = false;
					if (++disabled <= 4)
					{
						_ = log;
						_ = "[VanillaOnly0320] Disabled old placement component on " + ((Object)((Component)val).gameObject).name;
					}
				}
				catch (Exception ex)
				{
					log.LogWarning((object)("[VanillaOnly0320] Component disable failed: " + ex.Message));
				}
			}
		}
	}
	internal static class NativeBathToiletSync135
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static HandleNamedMessageDelegate <0>__OnRequest;

			public static HandleNamedMessageDelegate <1>__OnState;
		}

		private const string RequestChannel = "CozyRoom.BathToilet135.Request";

		private const string StateChannel = "CozyRoom.BathToilet135.State";

		private const int BathToggle = 1;

		private const int ToiletEvent = 2;

		private const int BathState = 3;

		private static NetworkManager installed;

		private static object installedMessages;

		private static float nextSnapshot;

		private static ManualLogSource log;

		internal static void Install(ManualLogSource logger)
		{
			log = logger;
		}

		internal static void Tick()
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton == (Object)null || !singleton.IsListening || singleton.CustomMessagingManager == null)
			{
				installed = null;
				installedMessages = null;
				nextSnapshot = 0f;
				return;
			}
			if ((Object)(object)singleton != (Object)(object)installed || installedMessages != singleton.CustomMessagingManager)
			{
				installed = singleton;
				installedMessages = singleton.CustomMessagingManager;
				nextSnapshot = 0f;
				try
				{
					singleton.CustomMessagingManager.UnregisterNamedMessageHandler("CozyRoom.BathToilet135.Request");
					singleton.CustomMessagingManager.UnregisterNamedMessageHandler("CozyRoom.BathToilet135.State");
					CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager;
					object obj = <>O.<0>__OnRequest;
					if (obj == null)
					{
						HandleNamedMessageDelegate val = OnRequest;
						<>O.<0>__OnRequest = val;
						obj = (object)val;
					}
					customMessagingManager.RegisterNamedMessageHandler("CozyRoom.BathToilet135.Request", (HandleNamedMessageDelegate)obj);
					CustomMessagingManager customMessagingManager2 = singleton.CustomMessagingManager;
					object obj2 = <>O.<1>__OnState;
					if (obj2 == null)
					{
						HandleNamedMessageDelegate val2 = OnState;
						<>O.<1>__OnState = val2;
						obj2 = (object)val2;
					}
					customMessagingManager2.RegisterNamedMessageHandler("CozyRoom.BathToilet135.State", (HandleNamedMessageDelegate)obj2);
					if (log != null)
					{
					}
				}
				catch (Exception ex)
				{
					ManualLogSource obj3 = log;
					if (obj3 != null)
					{
						obj3.LogError((object)("[BathToilet135] Registration failed: " + ex));
					}
				}
			}
			if (!singleton.IsServer || Time.unscaledTime < nextSnapshot)
			{
				return;
			}
			nextSnapshot = Time.unscaledTime + 12.11f;
			NativeBathWater[] array = Object.FindObjectsOfType<NativeBathWater>();
			foreach (NativeBathWater nativeBathWater in array)
			{
				if ((Object)(object)nativeBathWater != (Object)null && nativeBathWater.IsSpawned)
				{
					BroadcastBathState(nativeBathWater);
				}
			}
		}

		private static void Write(FastBufferWriter writer, int kind, ulong id, int a, int b, Vector3 point, float level)
		{
			//IL_0006: 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_0018: 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_002a: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref kind, default(ForPrimitives));
			((FastBufferWriter)(ref writer)).WriteValueSafe<ulong>(ref id, default(ForPrimitives));
			((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref a, default(ForPrimitives));
			((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref b, default(ForPrimitives));
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref point.x, default(ForPrimitives));
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref point.y, default(ForPrimitives));
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref point.z, default(ForPrimitives));
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref level, default(ForPrimitives));
		}

		private static void Read(FastBufferReader reader, out int kind, out ulong id, out int a, out int b, out Vector3 point, out float level)
		{
			//IL_0005: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_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)
			((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref kind, default(ForPrimitives));
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref id, default(ForPrimitives));
			((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref a, default(ForPrimitives));
			((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref b, default(ForPrimitives));
			float num = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num, default(ForPrimitives));
			float num2 = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num2, default(ForPrimitives));
			float num3 = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num3, default(ForPrimitives));
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref level, default(ForPrimitives));
			point = new Vector3(num, num2, num3);
		}

		private unsafe static void Send(NetworkManager net, ulong peer, string channel, int kind, ulong id, int a, int b, Vector3 point, float level)
		{
			//IL_000b: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(80, (Allocator)2, -1);
			try
			{
				Write(val, kind, id, a, b, point, level);
				net.CustomMessagingManager.SendNamedMessage(channel, peer, val, (NetworkDelivery)3);
			}
			finally
			{
				((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose();
			}
		}

		private static void Broadcast(int kind, ulong id, int a, int b, float level, ulong except = ulong.MaxValue)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton == (Object)null || !singleton.IsListening || !singleton.IsServer || singleton.CustomMessagingManager == null)
			{
				return;
			}
			foreach (ulong connectedClientsId in singleton.ConnectedClientsIds)
			{
				if (connectedClientsId != 0L && connectedClientsId != except)
				{
					Send(singleton, connectedClientsId, "CozyRoom.BathToilet135.State", kind, id, a, b, Vector3.zero, level);
				}
			}
		}

		private static bool Find(ulong id, out NetworkObject furniture)
		{
			furniture = null;
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton != (Object)null && singleton.SpawnManager != null && singleton.SpawnManager.SpawnedObjects.TryGetValue(id, out furniture) && (Object)(object)furniture != (Object)null)
			{
				return furniture.IsSpawned;
			}
			return false;
		}

		internal static void RequestBathToggle(NativeBathWater bath, Vector3 senderPosition)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager singleton = NetworkManager.Singleton;
			NetworkObject val = (((Object)(object)bath != (Object)null) ? ((Component)bath).GetComponent<NetworkObject>() : null);
			if (!((Object)(object)singleton == (Object)null) && !singleton.IsServer && singleton.IsListening && !((Object)(object)val == (Object)null) && val.IsSpawned && singleton.CustomMessagingManager != null)
			{
				Send(singleton, 0uL, "CozyRoom.BathToilet135.Request", 1, val.NetworkObjectId, 0, 0, senderPosition, 0f);
			}
		}

		internal static void BroadcastBathState(NativeBathWater bath)
		{
			NetworkObject val = (((Object)(object)bath != (Object)null) ? ((Component)bath).GetComponent<NetworkObject>() : null);
			if (!((Object)(object)val == (Object)null) && val.IsSpawned)
			{
				Broadcast(3, val.NetworkObjectId, Mathf.RoundToInt(bath.TargetLevel * 1000f), bath.IsPaused ? 1 : 0, bath.WaterLevel, ulong.MaxValue);
			}
		}

		internal static void NotifyToilet(NativeToiletSeatSfx toilet, int action, Vector3 senderPosition)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager singleton = NetworkManager.Singleton;
			NetworkObject val = (((Object)(object)toilet != (Object)null) ? ((Component)toilet).GetComponent<NetworkObject>() : null);
			if (!((Object)(object)singleton == (Object)null) && singleton.IsListening && !((Object)(object)val == (Object)null) && val.IsSpawned && singleton.CustomMessagingManager != null && (action == 1 || action == 2))
			{
				if (singleton.IsServer)
				{
					Broadcast(2, val.NetworkObjectId, action, 0, 0f, ulong.MaxValue);
				}
				else
				{
					Send(singleton, 0uL, "CozyRoom.BathToilet135.Request", 2, val.NetworkObjectId, action, 0, senderPosition, 0f);
				}
			}
		}

		private static void OnRequest(ulong sender, FastBufferReader reader)
		{
			//IL_001c: 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)
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton == (Object)null || !singleton.IsServer || sender == 0L)
			{
				return;
			}
			try
			{
				Read(reader, out var kind, out var id, out var a, out var _, out var point, out var _);
				if (!Find(id, out var furniture) || !CozyMultiplayer122.TryResolveConnectedPlayer(sender, out var player) || !CozyMultiplayer122.NearAuthorized(sender, player, ((Component)furniture).transform, 7f, point))
				{
					return;
				}
				switch (kind)
				{
				case 1:
				{
					NativeBathWater component2 = ((Component)furniture).GetComponent<NativeBathWater>();
					if (!((Object)(object)component2 == (Object)null))
					{
						component2.ApplyHostToggle();
						BroadcastBathState(component2);
					}
					break;
				}
				case 2:
					if (a == 1 || a == 2)
					{
						NativeToiletSeatSfx component = ((Component)furniture).GetComponent<NativeToiletSeatSfx>();
						if (!((Object)(object)component == (Object)null))
						{
							component.PlayNetworkSound(a);
							Broadcast(2, id, a, 0, 0f, sender);
						}
					}
					break;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource obj = log;
				if (obj != null)
				{
					obj.LogWarning((object)("[BathToilet135] Request failed: " + ex.Message));
				}
			}
		}

		private static void OnState(ulong sender, FastBufferReader reader)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton == (Object)null || singleton.IsServer || sender != 0L)
			{
				return;
			}
			try
			{
				Read(reader, out var kind, out var id, out var a, out var b, out var _, out var level);
				if (!Find(id, out var furniture))
				{
					return;
				}
				switch (kind)
				{
				case 3:
				{
					NativeBathWater component2 = ((Component)furniture).GetComponent<NativeBathWater>();
					if ((Object)(object)component2 != (Object)null)
					{
						component2.ApplyNetworkWater(level, (float)a / 1000f, b != 0);
					}
					break;
				}
				case 2:
					if (a == 1 || a == 2)
					{
						NativeToiletSeatSfx component = ((Component)furniture).GetComponent<NativeToiletSeatSfx>();
						if ((Object)(object)component != (Object)null)
						{
							component.PlayNetworkSound(a);
						}
					}
					break;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource obj = log;
				if (obj != null)
				{
					obj.LogWarning((object)("[BathToilet135] State ignored: " + ex.Message));
				}
			}
		}
	}
	internal sealed class NativeBathWater : MonoBehaviour
	{
		internal const float FillSeconds = 15f;

		internal const float EmptySeconds = 9f;

		private const int Segments = 48;

		private const int Rings = 13;

		private const float WaterBottom = 0.222f;

		private const float WaterTop = 0.92f;

		private static ManualLogSource log;

		private static NativeBathWater lookedAt;

		private static float lastToggle;

		private static GUIStyle promptStyle;

		private static readonly RaycastHit[] aimHits = (RaycastHit[])(object)new RaycastHit[96];

		private static readonly IComparer<RaycastHit> hitDistanceComparer = Comparer<RaycastHit>.Create((RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance));

		private GameObject visual;

		private Mesh surface;

		private MeshRenderer surfaceRenderer;

		private Material topWaterMaterial;

		private Material bodyWaterMaterial;

		private GameObject bodyObject;

		private Mesh waterBodyMesh;

		private MeshRenderer bodyRenderer;

		private Vector3[] bodyVertices;

		private const int BodySlices = 7;

		private const float RippleHeight = 0.004f;

		private float lastProgressLog;

		private static NativeBathWater lastOperated;

		private static float lastOperatedAt;

		private Vector2[] uvs;

		private Vector3[] vertices;

		private float waterLevel;

		private float targetLevel;

		private bool isPaused;

		private AudioSource bathAudio;

		private AudioClip currentSound;

		private bool audioWasPaused;

		private static bool soundLoadAttempted;

		private static AudioClip fillSound;

		private static AudioClip drainSound;

		private const float WaterMotionEpsilon = 0.0001f;

		private float nextPlayerCollisionPass;

		private float nextWaterMeshFrame;

		private float lastBodyLevel = -1f;

		private float nextNetworkProgress;

		internal bool IsSpawned
		{
			get
			{
				NetworkObject component = ((Component)this).GetComponent<NetworkObject>();
				if ((Object)(object)component != (Object)null)
				{
					return component.IsSpawned;
				}
				return false;
			}
		}

		internal float WaterLevel => waterLevel;

		internal float TargetLevel => targetLevel;

		internal bool IsPaused => isPaused;

		internal static void Install(ManualLogSource logger)
		{
			log = logger;
			_ = log;
		}

		internal static void PollLocalInteraction()
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_01d1: Unknown result type (might be due to invalid IL or missing references)
			lookedAt = null;
			if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				return;
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (localPlayerController.isPlayerDead || localPlayerController.inSpecialInteractAnimation || localPlayerController.isTypingChat || localPlayerController.inTerminalMenu || ((Object)(object)ShipBuildModeManager.Instance != (Object)null && ShipBuildModeManager.Instance.InBuildMode))
			{
				return;
			}
			Camera gameplayCamera = localPlayerController.gameplayCamera;
			if ((Object)(object)gameplayCamera == (Object)null || !((Behaviour)gameplayCamera).isActiveAndEnabled)
			{
				return;
			}
			int num = Physics.RaycastNonAlloc(((Component)gameplayCamera).transform.position, ((Component)gameplayCamera).transform.forward, aimHits, 3f, -1, (QueryTriggerInteraction)2);
			if (num > 1)
			{
				Array.Sort(aimHits, 0, num, hitDistanceComparer);
			}
			for (int i = 0; i < num; i++)
			{
				RaycastHit val = aimHits[i];
				Collider collider = ((RaycastHit)(ref val)).collider;
				if ((Object)(object)collider == (Object)null || ((Component)collider).transform.IsChildOf(((Component)localPlayerController).transform))
				{
					continue;
				}
				NativeBathWater componentInParent = ((Component)collider).GetComponentInParent<NativeBathWater>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					NetworkObject component = ((Component)componentInParent).GetComponent<NetworkObject>();
					if ((Object)(object)component != (Object)null && component.IsSpawned)
					{
						lookedAt = componentInParent;
					}
					break;
				}
				if (!collider.isTrigger)
				{
					break;
				}
			}
			if ((Object)(object)lookedAt == (Object)null || Keyboard.current == null || !((ButtonControl)Keyboard.current.eKey).wasPressedThisFrame || Time.unscaledTime - lastToggle < 0.35f)
			{
				return;
			}
			lastToggle = Time.unscaledTime;
			lastOperated = lookedAt;
			lastOperatedAt = Time.unscaledTime;
			if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsListening && !NetworkManager.Singleton.IsServer)
			{
				NativeBathToiletSync135.RequestBathToggle(lookedAt, ((Component)localPlayerController).transform.position);
				return;
			}
			string text = lookedAt.HandleEPress();
			NativeBathToiletSync135.BroadcastBathState(lookedAt);
			if (log != null)
			{
				_ = "[BathWater2463] E on Bath: " + text + " water=" + lookedAt.waterLevel.ToString("F3") + " target=" + lookedAt.targetLevel.ToString("F1") + " paused=" + lookedAt.isPaused;
			}
		}

		private string HandleEPress()
		{
			if (isPaused)
			{
				isPaused = false;
				SyncMotionAudio();
				if (!(targetLevel > waterLevel))
				{
					return "RESUME_DRAIN";
				}
				return "RESUME_FILL";
			}
			if (Mathf.Abs(targetLevel - waterLevel) > 0.0001f)
			{
				isPaused = true;
				SyncMotionAudio();
				if (!(targetLevel > waterLevel))
				{
					return "PAUSE_DRAIN";
				}
				return "PAUSE_FILL";
			}
			targetLevel = ((waterLevel >= 0.999f) ? 0f : 1f);
			SyncMotionAudio();
			if (!(targetLevel > waterLevel))
			{
				return "START_DRAIN";
			}
			return "START_FILL";
		}

		internal void ApplyHostToggle()
		{
			if (IsSpawned)
			{
				string text = HandleEPress();
				if (log != null)
				{
					_ = "[BathSync135] Host applied: " + text + " level=" + waterLevel.ToString("F3") + " target=" + targetLevel.ToString("F2");
				}
			}
		}

		internal void ApplyNetworkWater(float level, float target, bool paused)
		{
			waterLevel = Mathf.Clamp01(level);
			targetLevel = Mathf.Clamp01(target);
			isPaused = paused;
			SyncMotionAudio();
		}

		private static void LoadUserBathSoundsOnce()
		{
			if (soundLoadAttempted)
			{
				return;
			}
			soundLoadAttempted = true;
			fillSound = RuntimeAudio.LoadWavFromModFolder("Sounds/bath_fill.wav");
			drainSound = RuntimeAudio.LoadWavFromModFolder("Sounds/bath_drain.wav");
			if ((Object)(object)fillSound == (Object)null || (Object)(object)drainSound == (Object)null)
			{
				ManualLogSource obj = log;
				if (obj != null)
				{
					obj.LogWarning((object)"[BathWater2463] Bath sound file(s) missing: Sounds/bath_fill.wav / Sounds/bath_drain.wav. Water and E pause/resume still work; no fabricated audio or toilet SFX is used.");
				}
			}
		}

		private void SyncMotionAudio()
		{
			if (isPaused || !(Mathf.Abs(targetLevel - waterLevel) > 0.0001f))
			{
				if ((Object)(object)bathAudio == (Object)null)
				{
					return;
				}
				if (isPaused)
				{
					if (bathAudio.isPlaying)
					{
						bathAudio.Pause();
						audioWasPaused = true;
					}
				}
				else
				{
					bathAudio.Stop();
					audioWasPaused = false;
				}
				return;
			}
			LoadUserBathSoundsOnce();
			AudioClip val = ((targetLevel > waterLevel) ? fillSound : drainSound);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			if ((Object)(object)bathAudio == (Object)null)
			{
				bathAudio = ((Component)this).gameObject.AddComponent<AudioSource>();
				bathAudio.playOnAwake = false;
				bathAudio.loop = true;
				bathAudio.spatialBlend = 1f;
				bathAudio.rolloffMode = (AudioRolloffMode)0;
				bathAudio.minDistance = 1f;
				bathAudio.maxDistance = 9f;
				bathAudio.dopplerLevel = 0f;
				bathAudio.volume = 0.91f;
			}
			if ((Object)(object)currentSound != (Object)(object)val)
			{
				bathAudio.Stop();
				bathAudio.clip = val;
				currentSound = val;
				audioWasPaused = false;
			}
			if (!bathAudio.isPlaying)
			{
				if (audioWasPaused)
				{
					bathAudio.UnPause();
				}
				else
				{
					bathAudio.Play();
				}
				audioWasPaused = false;
			}
		}

		private void Update()
		{
			NetworkObject component = ((Component)this).GetComponent<NetworkObject>();
			if ((Object)(object)component == (Object)null || !component.IsSpawned)
			{
				return;
			}
			KeepVanillaSelectionRaycastWithoutPlayerBlocking();
			if (!isPaused)
			{
				float num = ((targetLevel > waterLevel) ? (1f / 15f) : (1f / 9f));
				waterLevel = Mathf.MoveTowards(waterLevel, targetLevel, Time.deltaTime * num);
			}
			SyncMotionAudio();
			if (waterLevel <= 0.0001f)
			{
				if ((Object)(object)visual != (Object)null && visual.activeSelf)
				{
					visual.SetActive(false);
				}
				if ((Object)(object)bodyObject != (Object)null && bodyObject.activeSelf)
				{
					bodyObject.SetActive(false);
				}
				return;
			}
			if ((Object)(object)visual == (Object)null && (Object)(object)topWaterMaterial == (Object)null)
			{
				CreateWaterVisual();
			}
			if ((Object)(object)visual == (Object)null)
			{
				return;
			}
			if (!visual.activeSelf)
			{
				visual.SetActive(true);
			}
			if ((Object)(object)bodyObject != (Object)null && !bodyObject.activeSelf)
			{
				bodyObject.SetActive(true);
			}
			if (Time.unscaledTime >= nextWaterMeshFrame)
			{
				nextWaterMeshFrame = Time.unscaledTime + 0.05f;
				AnimateSurface();
			}
			if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsListening && NetworkManager.Singleton.IsServer && Time.unscaledTime >= nextNetworkProgress && !isPaused && Mathf.Abs(targetLevel - waterLevel) > 0.0001f)
			{
				nextNetworkProgress = Time.unscaledTime + 0.85f;
				NativeBathToiletSync135.BroadcastBathState(this);
			}
			if (!isPaused && Time.time > lastProgressLog + 4f && Mathf.Abs(targetLevel - waterLevel) > 0.005f)
			{
				lastProgressLog = Time.time;
				if (log != null)
				{
					_ = "[BathWater2463] " + ((targetLevel > 0.5f) ? "Filling " : "Draining ") + Mathf.RoundToInt(waterLevel * 100f) + "% waterY=" + Mathf.Lerp(0.222f, 0.92f, waterLevel).ToString("F2") + " renderer=" + ((Object)(object)surfaceRenderer != (Object)null && ((Renderer)surfaceRenderer).enabled);
				}
			}
		}

		private void KeepVanillaSelectionRaycastWithoutPlayerBlocking()
		{
			if (Time.time < nextPlayerCollisionPass)
			{
				return;
			}
			nextPlayerCollisionPass = Time.time + 2f;
			if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null)
			{
				return;
			}
			BoxCollider val = null;
			BoxCollider[] componentsInChildren = ((Component)this).GetComponentsInChildren<BoxCollider>(true);
			foreach (BoxCollider val2 in componentsInChildren)
			{
				if ((Object)(object)val2 != (Object)null && ((Component)val2).gameObject.layer == 26 && ((Object)val2).name.IndexOf("PlacementCollider", StringComparison.OrdinalIgnoreCase) >= 0)
				{
					val = val2;
					break;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val3 in allPlayerScripts)
			{
				if ((Object)(object)val3 == (Object)null)
				{
					continue;
				}
				Collider[] componentsInChildren2 = ((Component)val3).GetComponentsInChildren<Collider>(true);
				foreach (Collider val4 in componentsInChildren2)
				{
					if ((Object)(object)val4 != (Object)null && (Object)(object)val4 != (Object)(object)val)
					{
						Physics.IgnoreCollision((Collider)(object)val, val4, true);
					}
				}
			}
		}

		private static Material NewTransparentLit(string name, Color color, float smoothness)
		{
			//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_0037: 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_0057: 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_0077: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Expected O, but got Unknown
			Shader val = Shader.Find("HDRP/Lit");
			if ((Object)(object)val == (Object)null)
			{
				val = Shader.Find("High Definition Render Pipeline/Lit");
			}
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			Material val2 = new Material(val)
			{
				name = name
			};
			val2.SetOverrideTag("RenderType", "Transparent");
			val2.SetFloat("_SurfaceType", 1f);
			val2.SetFloat("_BlendMode", 0f);
			val2.SetFloat("_ZWrite", 0f);
			val2.SetFloat("_TransparentZWrite", 0f);
			val2.SetFloat("_TransparentCullMode", 0f);
			val2.SetFloat("_SrcBlend", 5f);
			val2.SetFloat("_DstBlend", 10f);
			val2.SetFloat("_AlphaCutoffEnable", 0f);
			val2.SetFloat("_CullMode", 0f);
			val2.SetFloat("_DoubleSidedEnable", 1f);
			val2.SetFloat("_Metallic", 0f);
			val2.SetFloat("_Smoothness", smoothness);
			val2.SetFloat("_Ior", 1.333f);
			val2.SetFloat("_RefractionModel", 1f);
			val2.SetFloat("_Thickness", 0.2f);
			val2.SetColor("_BaseColor", color);
			val2.renderQueue = 3000;
			val2.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
			val2.EnableKeyword("_DOUBLESIDED_ON");
			val2.EnableKeyword("_REFRACTION_PLANE");
			val2.enableInstancing = true;
			return val2;
		}

		private void CreateWaterVisual()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Expected O, but got Unknown
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Expected O, but got Unknown
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Expected O, but got Unknown
			try
			{
				topWaterMaterial = NewTransparentLit("CozyBath_TransparentSurface_HDRPLit", new Color(0.66f, 0.88f, 0.93f, 0.32f), 0.96f);
				bodyWaterMaterial = NewTransparentLit("CozyBath_TransparentVolume_HDRPLit", new Color(0.46f, 0.79f, 0.88f, 0.12f), 0.9f);
				if ((Object)(object)topWaterMaterial == (Object)null || (Object)(object)bodyWaterMaterial == (Object)null)
				{
					ManualLogSource obj = log;
					if (obj != null)
					{
						obj.LogError((object)"[BathWater2463] HDRP/Lit shader unavailable. Refusing to show an opaque fake-water disc.");
					}
					if ((Object)(object)topWaterMaterial != (Object)null)
					{
						Object.Destroy((Object)(object)topWaterMaterial);
					}
					if ((Object)(object)bodyWaterMaterial != (Object)null)
					{
						Object.Destroy((Object)(object)bodyWaterMaterial);
					}
					topWaterMaterial = null;
					bodyWaterMaterial = null;
					return;
				}
				visual = new GameObject("CozyBath_WaterTop_Transparent_WithRipples");
				visual.transform.SetParent(((Component)this).transform, false);
				visual.transform.localPosition = Vector3.zero;
				visual.transform.localRotation = Quaternion.identity;
				visual.transform.localScale = Vector3.one;
				visual.layer = 0;
				MeshFilter val = visual.AddComponent<MeshFilter>();
				surface = new Mesh
				{
					name = "CozyBath_WaterTop",
					indexFormat = (IndexFormat)0
				};
				surface.MarkDynamic();
				vertices = (Vector3[])(object)new Vector3[625];
				uvs = (Vector2[])(object)new Vector2[vertices.Length];
				int[] array = new int[3600];
				int num = 0;
				for (int i = 0; i < 48; i++)
				{
					array[num++] = 0;
					array[num++] = 1 + i;
					array[num++] = 1 + (i + 1) % 48;
				}
				for (int j = 1; j < 13; j++)
				{
					for (int k = 0; k < 48; k++)
					{
						int num2 = 1 + (j - 1) * 48 + k;
						int num3 = 1 + (j - 1) * 48 + (k + 1) % 48;
						int num4 = 1 + j * 48 + k;
						int num5 = 1 + j * 48 + (k + 1) % 48;
						array[num++] = num2;
						array[num++] = num4;
						array[num++] = num3;
						array[num++] = num3;
						array[num++] = num4;
						array[num++] = num5;
					}
				}
				surface.vertices = vertices;
				surface.triangles = array;
				val.sharedMesh = surface;
				surfaceRenderer = visual.AddComponent<MeshRenderer>();
				((Renderer)surfaceRenderer).sharedMaterial = topWaterMaterial;
				((Renderer)surfaceRenderer).shadowCastingMode = (ShadowCastingMode)0;
				((Renderer)surfaceRenderer).receiveShadows = false;
				bodyObject = new GameObject("CozyBath_Closed3DWaterVolume_NoCollider");
				bodyObject.transform.SetParent(((Component)this).transform, false);
				bodyObject.transform.localPosition = Vector3.zero;
				bodyObject.layer = 0;
				MeshFilter val2 = bodyObject.AddComponent<MeshFilter>();
				waterBodyMesh = new Mesh
				{
					name = "CozyBath_EnclosedTaperedWaterVolume",
					indexFormat = (IndexFormat)0
				};
				waterBodyMesh.MarkDynamic();
				bodyVertices = (Vector3[])(object)new Vector3[386];
				int[] array2 = new int[2304];
				int num6 = 0;
				for (int l = 0; l < 7; l++)
				{
					for (int m = 0; m < 48; m++)
					{
						int num7 = l * 48 + m;
						int num8 = l * 48 + (m + 1) % 48;
						int num9 = (l + 1) * 48 + m;
						int num10 = (l + 1) * 48 + (m + 1) % 48;
						array2[num6++] = num7;
						array2[num6++] = num8;
						array2[num6++] = num9;
						array2[num6++] = num8;
						array2[num6++] = num10;
						array2[num6++] = num9;
					}
				}
				int num11 = 384;
				int num12 = num11 + 1;
				for (int n = 0; n < 48; n++)
				{
					int num13 = (n + 1) % 48;
					array2[num6++] = num11;
					array2[num6++] = num13;
					array2[num6++] = n;
					array2[num6++] = num12;
					array2[num6++] = 336 + n;
					array2[num6++] = 336 + num13;
				}
				waterBodyMesh.vertices = bodyVertices;
				waterBodyMesh.triangles = array2;
				val2.sharedMesh = waterBodyMesh;
				bodyRenderer = bodyObject.AddComponent<MeshRenderer>();
				((Renderer)bodyRenderer).sharedMaterial = bodyWaterMaterial;
				((Renderer)bodyRenderer).shadowCastingMode = (ShadowCastingMode)0;
				((Renderer)bodyRenderer).receiveShadows = false;
				if (log != null)
				{
				}
			}
			catch (Exception ex)
			{
				ManualLogSource obj2 = log;
				if (obj2 != null)
				{
					obj2.LogError((object)("[BathWater2463] Could not build water volume: " + ex));
				}
				if ((Object)(object)visual != (Object)null)
				{
					Object.Destroy((Object)(object)visual);
				}
				if ((Object)(object)bodyObject != (Object)null)
				{
					Object.Destroy((Object)(object)bodyObject);
				}
				visual = null;
				bodyObject = null;
			}
		}

		private void AnimateSurface()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)surface == (Object)null || (Object)(object)waterBodyMesh == (Object)null)
			{
				return;
			}
			float num = Mathf.SmoothStep(0f, 1f, waterLevel);
			float num2 = Mathf.Lerp(0.222f, 0.92f, num);
			float time = Time.time;
			vertices[0] = new Vector3(0f, num2 + 0.004f * Mathf.Sin(time * 1.45f) * Mathf.Clamp01(num * 10f), 0f);
			uvs[0] = new Vector2(0.5f, 0.5f);
			for (int i = 1; i <= 13; i++)
			{
				float num3 = (float)i / 13f;
				for (int j = 0; j < 48; j++)
				{
					float num4 = MathF.PI * 2f * (float)j / 48f;
					float num5 = NativeBathWaterContour.RadiusAt(j, num2);
					float num6 = Mathf.Sin(num4) * num3 * num5;
					float num7 = Mathf.Cos(num4) * num3 * num5;
					float num8 = 0.004f * (1f - num3 * num3) * (Mathf.Sin(time * 1.5f + num6 * 9f + num7 * 2f) * 0.6f + Mathf.Cos(time * 0.8f + num7 * 7f - num6 * 3f) * 0.4f) * Mathf.Clamp01(num * 10f);
					int num9 = 1 + (i - 1) * 48 + j;
					vertices[num9] = new Vector3(num6, num2 + num8, num7);
					uvs[num9] = new Vector2(0.5f + num6 / 3.1f, 0.5f + num7 / 3.1f);
				}
			}
			surface.vertices = vertices;
			surface.uv = uvs;
			surface.RecalculateNormals();
			surface.RecalculateBounds();
			if (Mathf.Abs(num2 - lastBodyLevel) < 0.002f)
			{
				return;
			}
			lastBodyLevel = num2;
			for (int k = 0; k <= 7; k++)
			{
				float num10 = (float)k / 7f;
				float num11 = Mathf.Lerp(0.222f, num2, num10);
				for (int l = 0; l < 48; l++)
				{
					float num12 = MathF.PI * 2f * (float)l / 48f;
					float num13 = NativeBathWaterContour.RadiusAt(l, num11);
					bodyVertices[k * 48 + l] = new Vector3(Mathf.Sin(num12) * num13, num11, Mathf.Cos(num12) * num13);
				}
			}
			bodyVertices[384] = new Vector3(0f, 0.222f, 0f);
			bodyVertices[385] = new Vector3(0f, num2, 0f);
			waterBodyMesh.vertices = bodyVertices;
			waterBodyMesh.RecalculateNormals();
			waterBodyMesh.RecalculateBounds();
		}

		private void OnGUI()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//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_0062: 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_0075: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			if ((int)Event.current.type != 7)
			{
				return;
			}
			bool flag = (Object)(object)lookedAt == (Object)(object)this;
			bool flag2 = (Object)(object)lastOperated == (Object)(object)this && Time.unscaledTime - lastOperatedAt < 3f;
			if (flag || flag2)
			{
				if (promptStyle == null)
				{
					promptStyle = new GUIStyle(GUI.skin.label)
					{
						fontSize = 18,
						alignment = (TextAnchor)4,
						fontStyle = (FontStyle)1
					};
					promptStyle.normal.textColor = Color.white;
				}
				int num = Mathf.RoundToInt(waterLevel * 100f);
				string text;
				string text2;
				if (isPaused)
				{
					text = ((targetLevel > waterLevel) ? ("Bath | Filling paused at " + num + "%") : ("Bath | Draining paused at " + num + "%"));
					text2 = "Resume";
				}
				else if (targetLevel > waterLevel + 0.0001f)
				{
					text = "Bath | Filling water... " + num + "%";
					text2 = "Pause";
				}
				else if (targetLevel < waterLevel - 0.0001f)
				{
					text = "Bath | Draining water... " + num + "%";
					text2 = "Pause";
				}
				else if (waterLevel > 0.999f)
				{
					text = "Bath | Water full";
					text2 = "Drain";
				}
				else
				{
					text = "Bath | Empty";
					text2 = "Fill";
				}
				if (flag)
				{
					text = text + "  [E: " + text2 + "]";
				}
				Rect val = new Rect((float)Screen.width / 2f - 250f, (float)Screen.height * 0.72f, 500f, 42f);
				GUI.Box(val, GUIContent.none);
				GUI.Label(val, text, promptStyle);
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)lookedAt == (Object)(object)this)
			{
				lookedAt = null;
			}
			if ((Object)(object)lastOperated == (Object)(object)this)
			{
				lastOperated = null;
			}
			if ((Object)(object)bathAudio != (Object)null)
			{
				bathAudio.Stop();
			}
			if ((Object)(object)surface != (Object)null)
			{
				Object.Destroy((Object)(object)surface);
			}
			if ((Object)(object)waterBodyMesh != (Object)null)
			{
				Object.Destroy((Object)(object)waterBodyMesh);
			}
			if ((Object)(object)topWaterMaterial != (Object)null)
			{
				Object.Destroy((Object)(object)topWaterMaterial);
			}
			if ((Object)(object)bodyWaterMaterial != (Object)null)
			{
				Object.Destroy((Object)(object)bodyWaterMaterial);
			}
		}
	}
	internal static class NativeBathWaterContour
	{
		internal const int Segments = 48;

		internal const float FirstSampleY = 0.25f;

		internal const float LastSampleY = 0.92f;

		private const int CountY = 68;

		private const float FloorY = 0.222f;

		private static readonly float[] Measured = new float[3264]
		{
			1.43527f,
			1.38224f,
			1.21201f,
			0.93167f,
			0.73601f,
			0.61575f,
			0.5369f,
			0.48317f,
			0.44616f,
			0.4212f,
			0.40345f,
			0.39364f,
			0.39111f,
			0.39543f,
			0.40709f,
			0.42717f,
			0.45772f,
			0.49988f,
			0.55751f,
			0.63998f,
			0.65563f,
			0.62602f,
			0.6091f,
			0.59924f,
			0.59151f,
			0.59924f,
			0.6091f,
			0.62602f,
			0.65563f,
			0.63998f,
			0.55751f,
			0.49988f,
			0.45772f,
			0.42717f,
			0.40709f,
			0.39543f,
			0.39111f,
			0.39364f,
			0.40345f,
			0.4212f,
			0.44616f,
			0.48317f,
			0.5369f,
			0.61575f,
			0.73601f,
			0.93167f,
			1.21201f,
			1.38224f,
			1.44388f,
			1.39089f,
			1.22287f,
			0.94316f,
			0.74599f,
			0.62413f,
			0.54422f,
			0.48977f,
			0.45227f,
			0.42698f,
			0.40906f,
			0.39912f,
			0.39665f,
			0.40102f,
			0.41284f,
			0.4332f,
			0.46416f,
			0.50944f,
			0.57159f,
			0.65918f,
			0.78736f,
			0.88049f,
			0.81538f,
			0.782f,
			0.76397f,
			0.782f,
			0.81538f,
			0.88049f,
			0.78736f,
			0.65918f,
			0.57159f,
			0.50944f,
			0.46416f,
			0.4332f,
			0.41284f,
			0.40102f,
			0.39665f,
			0.39912f,
			0.40906f,
			0.42698f,
			0.45227f,
			0.48977f,
			0.54422f,
			0.62413f,
			0.74599f,
			0.94316f,
			1.22287f,
			1.39089f,
			1.45248f,
			1.39955f,
			1.23373f,
			0.95464f,
			0.75592f,
			0.6325f,
			0.55154f,
			0.49638f,
			0.45838f,
			0.43275f,
			0.41467f,
			0.40465f,
			0.40218f,
			0.40661f,
			0.41859f,
			0.43922f,
			0.47061f,
			0.5168f,
			0.57971f,
			0.67231f,
			0.81145f,
			0.92039f,
			0.98548f,
			0.98476f,
			0.89195f,
			0.98476f,
			0.98548f,
			0.92039f,
			0.81145f,
			0.67231f,
			0.57971f,
			0.5168f,
			0.47061f,
			0.43922f,
			0.41859f,
			0.40661f,
			0.40218f,
			0.40465f,
			0.41467f,
			0.43275f,
			0.45838f,
			0.49638f,
			0.55154f,
			0.6325f,
			0.75592f,
			0.95464f,
			1.23373f,
			1.39955f,
			1.46109f,
			1.4082f,
			1.24459f,
			0.96613f,
			0.76505f,
			0.64088f,
			0.55886f,
			0.50299f,
			0.4645f,
			0.43853f,
			0.42028f,
			0.41021f,
			0.40771f,
			0.4122f,
			0.42434f,
			0.44525f,
			0.47706f,
			0.52416f,
			0.58784f,
			0.6817f,
			0.8251f,
			0.9351f,
			1.00596f,
			1.03979f,
			1.05603f,
			1.03979f,
			1.00596f,
			0.9351f,
			0.8251f,
			0.6817f,
			0.58784f,
			0.52416f,
			0.47706f,
			0.44525f,
			0.42434f,
			0.4122f,
			0.40771f,
			0.41021f,
			0.42028f,
			0.43853f,
			0.4645f,
			0.50299f,
			0.55886f,
			0.64088f,
			0.76505f,
			0.96613f,
			1.24459f,
			1.4082f,
			1.4697f,
			1.41685f,
			1.25524f,
			0.97761f,
			0.77417f,
			0.64925f,
			0.56619f,
			0.50959f,
			0.47061f,
			0.44431f,
			0.42588f,
			0.41577f,
			0.41324f,
			0.41779f,
			0.43009f,
			0.45128f,
			0.48377f,
			0.53151f,
			0.59596f,
			0.6911f,
			0.83494f,
			0.94567f,
			1.02045f,
			1.06318f,
			1.09141f,
			1.06318f,
			1.02045f,
			0.94567f,
			0.83494f,
			0.6911f,
			0.59596f,
			0.53151f,
			0.48377f,
			0.45128f,
			0.43009f,
			0.41779f,
			0.41324f,
			0.41577f,
			0.42588f,
			0.44431f,
			0.47061f,
			0.50959f,
			0.56619f,
			0.64925f,
			0.77417f,
			0.97761f,
			1.25524f,
			1.41685f,
			1.4783f,
			1.42551f,
			1.26477f,
			0.9891f,
			0.78329f,
			0.65718f,
			0.57351f,
			0.5162f,
			0.47672f,
			0.45009f,
			0.43149f,
			0.42133f,
			0.41877f,
			0.42338f,
			0.43584f,
			0.4573f,
			0.49048f,
			0.53887f,
			0.60408f,
			0.70049f,
			0.84479f,
			0.95624f,
			1.03081f,
			1.07721f,
			1.11023f,
			1.07721f,
			1.03081f,
			0.95624f,
			0.84479f,
			0.70049f,
			0.60408f,
			0.53887f,
			0.49048f,
			0.4573f,
			0.43584f,
			0.42338f,
			0.41877f,
			0.42133f,
			0.43149f,
			0.45009f,
			0.47672f,
			0.5162f,
			0.57351f,
			0.65718f,
			0.78329f,
			0.9891f,
			1.26477f,
			1.42551f,
			1.48691f,
			1.4342f,
			1.27429f,
			1.00058f,
			0.79242f,
			0.66485f,
			0.58083f,
			0.5228f,
			0.48283f,
			0.45587f,
			0.4371f,
			0.42689f,
			0.4243f,
			0.42897f,
			0.44159f,
			0.46356f,
			0.4972f,
			0.54622f,
			0.61221f,
			0.70989f,
			0.85463f,
			0.96681f,
			1.04118f,
			1.08791f,
			1.12112f,
			1.08791f,
			1.04118f,
			0.96681f,
			0.85463f,
			0.70989f,
			0.61221f,
			0.54622f,
			0.4972f,
			0.46356f,
			0.44159f,
			0.42897f,
			0.4243f,
			0.42689f,
			0.4371f,
			0.45587f,
			0.48283f,
			0.5228f,
			0.58083f,
			0.66485f,
			0.79242f,
			1.00058f,
			1.27429f,
			1.4342f,
			1.49551f,
			1.44305f,
			1.28382f,
			1.01207f,
			0.80154f,
			0.67253f,
			0.58769f,
			0.52941f,
			0.48895f,
			0.46165f,
			0.44275f,
			0.43245f,
			0.42983f,
			0.43456f,
			0.44735f,
			0.46983f,
			0.50391f,
			0.55349f,
			0.62033f,
			0.71901f,
			0.86448f,
			0.97739f,
			1.05154f,
			1.09861f,
			1.13201f,
			1.09861f,
			1.05154f,
			0.97739f,
			0.86448f,
			0.71901f,
			0.62033f,
			0.55349f,
			0.50391f,
			0.46983f,
			0.44735f,
			0.43456f,
			0.42983f,
			0.43245f,
			0.44275f,
			0.46165f,
			0.48895f,
			0.52941f,
			0.58769f,
			0.67253f,
			0.80154f,
			1.01207f,
			1.28382f,
			1.44305f,
			1.50412f,
			1.4519f,
			1.29334f,
			1.02355f,
			0.81067f,
			0.68021f,
			0.59442f,
			0.53589f,
			0.49506f,
			0.46743f,
			0.44843f,
			0.43801f,
			0.43536f,
			0.44015f,
			0.45332f,
			0.4761f,
			0.51062f,
			0.56075f,
			0.62845f,
			0.72766f,
			0.87433f,
			0.98796f,
			1.06191f,
			1.10932f,
			1.1429f,
			1.10932f,
			1.06191f,
			0.98796f,
			0.87433f,
			0.72766f,
			0.62845f,
			0.56075f,
			0.51062f,
			0.4761f,
			0.45332f,
			0.44015f,
			0.43536f,
			0.43801f,
			0.44843f,
			0.46743f,
			0.49506f,
			0.53589f,
			0.59442f,
			0.68021f,
			0.81067f,
			1.02355f,
			1.29334f,
			1.4519f,
			1.51273f,
			1.46075f,
			1.30287f,
			1.03504f,
			0.81979f,
			0.68789f,
			0.60115f,
			0.54197f,
			0.50117f,
			0.47321f,
			0.45412f,
			0.44357f,
			0.4409f,
			0.44577f,
			0.4593f,
			0.48237f,
			0.51733f,
			0.56802f,
			0.63658f,
			0.73632f,
			0.88417f,
			0.99853f,
			1.07228f,
			1.12002f,
			1.15378f,
			1.12002f,
			1.07228f,
			0.99853f,
			0.88417f,
			0.73632f,
			0.63658f,
			0.56802f,
			0.51733f,
			0.48237f,
			0.4593f,
			0.44577f,
			0.4409f,
			0.44357f,
			0.45412f,
			0.47321f,
			0.50117f,
			0.54197f,
			0.60115f,
			0.68789f,
			0.81979f,
			1.03504f,
			1.30287f,
			1.46075f,
			1.52133f,
			1.4696f,
			1.31239f,
			1.04652f,
			0.82892f,
			0.69556f,
			0.60787f,
			0.54804f,
			0.50685f,
			0.47899f,
			0.45981f,
			0.44913f,
			0.44643f,
			0.45158f,
			0.46528f,
			0.48864f,
			0.52405f,
			0.57528f,
			0.6447f,
			0.74497f,
			0.89402f,
			1.00839f,
			1.08261f,
			1.1307f,
			1.16467f,
			1.1307f,
			1.08261f,
			1.00839f,
			0.89402f,
			0.74497f,
			0.6447f,
			0.57528f,
			0.52405f,
			0.48864f,
			0.46528f,
			0.45158f,
			0.44643f,
			0.44913f,
			0.45981f,
			0.47899f,
			0.50685f,
			0.54804f,
			0.60787f,
			0.69556f,
			0.82892f,
			1.04652f,
			1.31239f,
			1.4696f,
			1.52994f,
			1.47845f,
			1.32174f,
			1.05633f,
			0.83681f,
			0.70222f,
			0.61371f,
			0.55333f,
			0.51174f,
			0.48376f,
			0.46524f,
			0.45469f,
			0.452f,
			0.45738f,
			0.47125f,
			0.49491f,
			0.53076f,
			0.58255f,
			0.65229f,
			0.75362f,
			0.90386f,
			1.01809f,
			1.0929f,
			1.14139f,
			1.17556f,
			1.14139f,
			1.0929f,
			1.01809f,
			0.90386f,
			0.75362f,
			0.65229f,
			0.58255f,
			0.53076f,
			0.49491f,
			0.47125f,
			0.45738f,
			0.452f,
			0.45469f,
			0.46524f,
			0.48376f,
			0.51174f,
			0.55333f,
			0.61371f,
			0.70222f,
			0.83681f,
			1.05633f,
			1.32174f,
			1.47845f,
			1.53854f,
			1.4873f,
			1.32951f,
			1.06282f,
			0.84246f,
			0.70697f,
			0.61788f,
			0.55709f,
			0.51523f,
			0.48706f,
			0.46844f,
			0.45837f,
			0.45661f,
			0.46289f,
			0.47723f,
			0.50118f,
			0.53747f,
			0.58981f,
			0.65979f,
			0.76227f,
			0.91371f,
			1.02779f,
			1.10318f,
			1.15207f,
			1.18645f,
			1.15207f,
			1.10318f,
			1.02779f,
			0.91371f,
			0.76227f,
			0.65979f,
			0.58981f,
			0.53747f,
			0.50118f,
			0.47723f,
			0.46289f,
			0.45661f,
			0.45837f,
			0.46844f,
			0.48706f,
			0.51523f,
			0.55709f,
			0.61788f,
			0.70697f,
			0.84246f,
			1.06282f,
			1.32951f,
			1.4873f,
			1.54676f,
			1.49445f,
			1.33729f,
			1.06922f,
			0.84811f,
			0.71173f,
			0.62204f,
			0.56086f,
			0.51872f,
			0.49036f,
			0.47163f,
			0.4615f,
			0.45982f,
			0.46614f,
			0.48119f,
			0.50637f,
			0.54418f,
			0.59708f,
			0.6673f,
			0.77092f,
			0.92355f,
			1.03748f,
			1.11346f,
			1.16276f,
			1.19734f,
			1.16276f,
			1.11346f,
			1.03748f,
			0.92355f,
			0.77092f,
			0.6673f,
			0.59708f,
			0.54418f,
			0.50637f,
			0.48119f,
			0.46614f,
			0.45982f,
			0.4615f,
			0.47163f,
			0.49036f,
			0.51872f,
			0.56086f,
			0.62204f,
			0.71173f,
			0.84811f,
			1.06922f,
			1.33729f,
			1.49445f,
			1.55341f,
			1.50147f,
			1.34506f,
			1.07562f,
			0.85376f,
			0.71649f,
			0.62621f,
			0.56462f,
			0.52221f,
			0.49366f,
			0.47483f,
			0.46463f,
			0.46303f,
			0.46939f,
			0.48454f,
			0.50989f,
			0.54807f,
			0.60286f,
			0.6748f,
			0.77957f,
			0.93328f,
			1.04718f,
			1.12375f,
			1.17345f,
			1.20823f,
			1.17345f,
			1.12375f,
			1.04718f,
			0.93328f,
			0.77957f,
			0.6748f,
			0.60286f,
			0.54807f,
			0.50989f,
			0.48454f,
			0.46939f,
			0.46303f,
			0.46463f,
			0.47483f,
			0.49366f,
			0.52221f,
			0.56462f,
			0.62621f,
			0.71649f,
			0.85376f,
			1.07562f,
			1.34506f,
			1.50147f,
			1.56006f,
			1.50849f,
			1.35284f,
			1.08202f,
			0.85932f,
			0.72124f,
			0.63038f,
			0.56838f,
			0.52569f,
			0.49697f,
			0.47803f,
			0.46776f,
			0.46624f,
			0.47265f,
			0.4879f,
			0.51342f,
			0.55185f,
			0.60725f,
			0.68105f,
			0.78822f,
			0.94271f,
			1.05688f,
			1.13403f,
			1.18413f,
			1.21912f,
			1.18413f,
			1.13403f,
			1.05688f,
			0.94271f,
			0.78822f,
			0.68105f,
			0.60725f,
			0.55185f,
			0.51342f,
			0.4879f,
			0.47265f,
			0.46624f,
			0.46776f,
			0.47803f,
			0.49697f,
			0.52569f,
			0.56838f,
			0.63038f,
			0.72124f,
			0.85932f,
			1.08202f,
			1.35284f,
			1.50849f,
			1.56671f,
			1.51552f,
			1.36061f,
			1.08842f,
			0.86476f,
			0.726f,
			0.63454f,
			0.57215f,
			0.52918f,
			0.50027f,
			0.48122f,
			0.47097f,
			0.46945f,
			0.4759f,
			0.49125f,
			0.51694f,
			0.55569f,
			0.61164f,
			0.68597f,
			0.79611f,
			0.95213f,
			1.06657f,
			1.14432f,
			1.19482f,
			1.23001f,
			1.19482f,
			1.14432f,
			1.06657f,
			0.95213f,
			0.79611f,
			0.68597f,
			0.61164f,
			0.55569f,
			0.51694f,
			0.49125f,
			0.4759f,
			0.46945f,
			0.47097f,
			0.48122f,
			0.50027f,
			0.52918f,
			0.57215f,
			0.63454f,
			0.726f,
			0.86476f,
			1.08842f,
			1.36061f,
			1.51552f,
			1.57335f,
			1.52254f,
			1.36839f,
			1.09482f,
			0.87019f,
			0.73075f,
			0.63871f,
			0.57591f,
			0.53267f,
			0.50357f,
			0.48442f,
			0.47419f,
			0.47266f,
			0.47915f,
			0.4946f,
			0.52047f,
			0.55974f,
			0.61603f,
			0.69088f,
			0.8018f,
			0.96156f,
			1.07627f,
			1.1546f,
			1.20551f,
			1.2409f,
			1.20551f,
			1.1546f,
			1.07627f,
			0.96156f,
			0.8018f,
			0.69088f,
			0.61603f,
			0.55974f,
			0.52047f,
			0.4946f,
			0.47915f,
			0.47266f,
			0.47419f,
			0.48442f,
			0.50357f,
			0.53267f,
			0.57591f,
			0.63871f,
			0.73075f,
			0.87019f,
			1.09482f,
			1.36839f,
			1.52254f,
			1.58f,
			1.52956f,
			1.37456f,
			1.10122f,
			0.87562f,
			0.73538f,
			0.64288f,
			0.57968f,
			0.53616f,
			0.50687f,
			0.48761f,
			0.47741f,
			0.47587f,
			0.4824f,
			0.49796f,
			0.524f,
			0.56379f,
			0.62041f,
			0.69579f,
			0.80749f,
			0.96905f,
			1.08597f,
			1.16488f,
			1.21619f,
			1.25179f,
			1.21619f,
			1.16488f,
			1.08597f,
			0.96905f,
			0.80749f,
			0.69579f,
			0.62041f,
			0.56379f,
			0.524f,
			0.49796f,
			0.4824f,
			0.47587f,
			0.47741f,
			0.48761f,
			0.50687f,
			0.53616f,
			0.57968f,
			0.64288f,
			0.73538f,
			0.87562f,
			1.10122f,
			1.37456f,
			1.52956f,
			1.58665f,
			1.53659f,
			1.38071f,
			1.10762f,
			0.88105f,
			0.73996f,
			0.64704f,
			0.58344f,
			0.53964f,
			0.51017f,
			0.49081f,
			0.48063f,
			0.47908f,
			0.48565f,
			0.50131f,
			0.5277f,
			0.56784f,
			0.6248f,
			0.70071f,
			0.81318f,
			0.97545f,
			1.09496f,
			1.17517f,
			1.22688f,
			1.26268f,
			1.22688f,
			1.17517f,
			1.09496f,
			0.97545f,
			0.81318f,
			0.70071f,
			0.6248f,
			0.56784f,
			0.5277f,
			0.50131f,
			0.48565f,
			0.47908f,
			0.48063f,
			0.49081f,
			0.51017f,
			0.53964f,
			0.58344f,
			0.64704f,
			0.73996f,
			0.88105f,
			1.10762f,
			1.38071f,
			1.53659f,
			1.5933f,
			1.54361f,
			1.38686f,
			1.11402f,
			0.88648f,
			0.74453f,
			0.65111f,
			0.5872f,
			0.54313f,
			0.51347f,
			0.49401f,
			0.48384f,
			0.48229f,
			0.48891f,
			0.50467f,
			0.53147f,
			0.57189f,
			0.62919f,
			0.70562f,
			0.81887f,
			0.98185f,
			1.10238f,
			1.18545f,
			1.23756f,
			1.27357f,
			1.23756f,
			1.18545f,
			1.10238f,
			0.98185f,
			0.81887f,
			0.70562f,
			0.62919f,
			0.57189f,
			0.53147f,
			0.50467f,
			0.48891f,
			0.48229f,
			0.48384f,
			0.49401f,
			0.51347f,
			0.54313f,
			0.5872f,
			0.65111f,
			0.74453f,
			0.88648f,
			1.11402f,
			1.38686f,
			1.54361f,
			1.59995f,
			1.55063f,
			1.39301f,
			1.12042f,
			0.89192f,
			0.74911f,
			0.65512f,
			0.59097f,
			0.54662f,
			0.51677f,
			0.49722f,
			0.48706f,
			0.4855f,
			0.49216f,
			0.50813f,
			0.53524f,
			0.57594f,
			0.63358f,
			0.71053f,
			0.82456f,
			0.98825f,
			1.1098f,
			1.19433f,
			1.24807f,
			1.28427f,
			1.24807f,
			1.19433f,
			1.1098f,
			0.98825f,
			0.82456f,
			0.71053f,
			0.63358f,
			0.57594f,
			0.53524f,
			0.50813f,
			0.49216f,
			0.4855f,
			0.48706f,
			0.49722f,
			0.51677f,
			0.54662f,
			0.59097f,
			0.65512f,
			0.74911f,
			0.89192f,
			1.12042f,
			1.39301f,
			1.55063f,
			1.6066f,
			1.55719f,
			1.39916f,
			1.12682f,
			0.89735f,
			0.75368f,
			0.65913f,
			0.5946f,
			0.55011f,
			0.52007f,
			0.5005f,
			0.49028f,
			0.4887f,
			0.49541f,
			0.51171f,
			0.53901f,
			0.57999f,
			0.63797f,
			0.71544f,
			0.82988f,
			0.99465f,
			1.11722f,
			1.20256f,
			1.25642f,
			1.29291f,
			1.25642f,
			1.20256f,
			1.11722f,
			0.99465f,
			0.82988f,
			0.71544f,
			0.63797f,
			0.57999f,
			0.53901f,
			0.51171f,
			0.49541f,
			0.4887f,
			0.49028f,
			0.5005f,
			0.52007f,
			0.55011f,
			0.5946f,
			0.65913f,
			0.75368f,
			0.89735f,
			1.12682f,
			1.39916f,
			1.55719f,
			1.61325f,
			1.56367f,
			1.40531f,
			1.13323f,
			0.90278f,
			0.75825f,
			0.66314f,
			0.59823f,
			0.55353f,
			0.52337f,
			0.50378f,
			0.49349f,
			0.49191f,
			0.49873f,
			0.51529f,
			0.54278f,
			0.58404f,
			0.64236f,
			0.72036f,
			0.83519f,
			1.00105f,
			1.12463f,
			1.21079f,
			1.26477f,
			1.30155f,
			1.26477f,
			1.21079f,
			1.12463f,
			1.00105f,
			0.83519f,
			0.72036f,
			0.64236f,
			0.58404f,
			0.54278f,
			0.51529f,
			0.49873f,
			0.49191f,
			0.49349f,
			0.50378f,
			0.52337f,
			0.55353f,
			0.59823f,
			0.66314f,
			0.75825f,
			0.90278f,
			1.13323f,
			1.40531f,
			1.56367f,
			1.6199f,
			1.57015f,
			1.41146f,
			1.13982f,
			0.90821f,
			0.76283f,
			0.66715f,
			0.60185f,
			0.55689f,
			0.52665f,
			0.50706f,
			0.49671f,
			0.49512f,
			0.5022f,
			0.51888f,
			0.54655f,
			0.58809f,
			0.64675f,
			0.72527f,
			0.84049f,
			1.00745f,
			1.13205f,
			1.21902f,
			1.27311f,
			1.31019f,
			1.27311f,
			1.21902f,
			1.13205f,
			1.00745f,
			0.84049f,
			0.72527f,
			0.64675f,
			0.58809f,
			0.54655f,
			0.51888f,
			0.5022f,
			0.49512f,
			0.49671f,
			0.50706f,
			0.52665f,
			0.55689f,
			0.60185f,
			0.66715f,
			0.76283f,
			0.90821f,
			1.13982f,
			1.41146f,
			1.57015f,
			1.62654f,
			1.57662f,
			1.41761f,
			1.14669f,
			0.91373f,
			0.76763f,
			0.67146f,
			0.60582f,
			0.56063f,
			0.53024f,
			0.51052f,
			0.49993f,
			0.49838f,
			0.50567f,
			0.52246f,
			0.55032f,
			0.59214f,
			0.65114f,
			0.73003f,
			0.8458f,
			1.01385f,
			1.13947f,
			1.22725f,
			1.28146f,
			1.31883f,
			1.28146f,
			1.22725f,
			1.13947f,
			1.01385f,
			0.8458f,
			0.73003f,
			0.65114f,
			0.59214f,
			0.55032f,
			0.52246f,
			0.50567f,
			0.49838f,
			0.49993f,
			0.51052f,
			0.53024f,
			0.56063f,
			0.60582f,
			0.67146f,
			0.76763f,
			0.91373f,
			1.14669f,
			1.41761f,
			1.57662f,
			1.63319f,
			1.5831f,
			1.42376f,
			1.1541f,
			0.92028f,
			0.77315f,
			0.6763f,
			0.6102f,
			0.56468f,
			0.53408f,
			0.51424f,
			0.50355f,
			0.5019f,
			0.50916f,
			0.52605f,
			0.55409f,
			0.5962f,
			0.65553f,
			0.73462f,
			0.8511f,
			1.02025f,
			1.14689f,
			1.23548f,
			1.28981f,
			1.32747f,
			1.28981f,
			1.23548f,
			1.14689f,
			1.02025f,
			0.8511f,
			0.73462f,
			0.65553f,
			0.5962f,
			0.55409f,
			0.52605f,
			0.50916f,
			0.5019f,
			0.50355f,
			0.51424f,
			0.53408f,
			0.56468f,
			0.6102f,
			0.6763f,
			0.77315f,
			0.92028f,
			1.1541f,
			1.42376f,
			1.5831f,
			1.63984f,
			1.58958f,
			1.42998f,
			1.16169f,
			MathF.PI * 77f / 261f,
			0.77867f,
			0.68114f,
			0.61457f,
			0.56873f,
			0.53791f,
			0.51796f,
			0.5072f,
			0.50552f,
			0.51283f,
			0.52976f,
			0.55788f,
			0.60025f,
			0.65992f,
			0.7392f,
			0.85641f,
			1.02665f,
			1.15431f,
			1.2436f,
			1.29817f,
			1.3361f,
			1.29817f,
			1.2436f,
			1.15431f,
			1.02665f,
			0.85641f,
			0.7392f,
			0.65992f,
			0.60025f,
			0.55788f,
			0.52976f,
			0.51283f,
			0.50552f,
			0.5072f,
			0.51796f,
			0.53791f,
			0.56873f,
			0.61457f,
			0.68114f,
			0.77867f,
			MathF.PI * 77f / 261f,
			1.16169f,
			1.42998f,
			1.58958f,
			1.64649f,
			1.59605f,
			1.43681f,
			1.16929f,
			0.93338f,
			0.78418f,
			0.68597f,
			0.61894f,
			0.57278f,
			0.54175f,
			0.52168f,
			0.51084f,
			0.50915f,
			0.51651f,
			0.53355f,
			0.56187f,
			0.60442f,
			0.66411f,
			0.74379f,
			0.86171f,
			1.03305f,
			1.16172f,
			1.2515f,
			1.30653f,
			1.34474f,
			1.30653f,
			1.2515f,
			1.16172f,
			1.03305f,
			0.86171f,
			0.74379f,
			0.66411f,
			0.60442f,
			0.56187f,
			0.53355f,
			0.51651f,
			0.50915f,
			0.51084f,
			0.52168f,
			0.54175f,
			0.57278f,
			0.61894f,
			0.68597f,
			0.78418f,
			0.93338f,
			1.16929f,
			1.43681f,
			1.59605f,
			1.65314f,
			1.60244f,
			1.44364f,
			1.17688f,
			0.93993f,
			0.7897f,
			0.69081f,
			0.62331f,
			0.57684f,
			0.54559f,
			0.5254f,
			0.51449f,
			0.51277f,
			0.52018f,
			0.53734f,
			0.56586f,
			0.6087f,
			0.6684f,
			0.74838f,
			0.86702f,
			1.03945f,
			1.16914f,
			1.2594f,
			1.31489f,
			1.35338f,
			1.31489f,
			1.2594f,
			1.16914f,
			1.03945f,
			0.86702f,
			0.74838f,
			0.6684f,
			0.6087f,
			0.56586f,
			0.53734f,
			0.52018f,
			0.51277f,
			0.51449f,
			0.5254f,
			0.54559f,
			0.57684f,
			0.62331f,
			0.69081f,
			0.7897f,
			0.93993f,
			1.17688f,
			1.44364f,
			1.60244f,
			1.65966f,
			1.60755f,
			1.45048f,
			1.18447f,
			0.94648f,
			0.79522f,
			0.69564f,
			0.62768f,
			0.58089f,
			0.54942f,
			0.52912f,
			0.51813f,
			0.51639f,
			0.52385f,
			0.54113f,
			0.56985f,
			0.61299f,
			0.67277f,
			0.75307f,
			0.87232f,
			1.04585f,
			1.17656f,
			1.2673f,
			1.32325f,
			1.36202f,
			1.32325f,
			1.2673f,
			1.17656f,
			1.04585f,
			0.87232f,
			0.75307f,
			0.67277f,
			0.61299f,
			0.56985f,
			0.54113f,
			0.52385f,
			0.51639f,
			0.51813f,
			0.52912f,
			0.54942f,
			0.58089f,
			0.62768f,
			0.69564f,
			0.79522f,
			0.94648f,
			1.18447f,
			1.45048f,
			1.60755f,
			1.66453f,
			1.61266f,
			1.45731f,
			1.19206f,
			0.95303f,
			0.80073f,
			0.70048f,
			0.63206f,
			0.58494f,
			0.55326f,
			0.53284f,
			0.52177f,
			0.52001f,
			0.52753f,
			0.54492f,
			0.57383f,
			0.61727f,
			0.67713f,
			0.75794f,
			0.87763f,
			1.05216f,
			1.18398f,
			1.2752f,
			1.33161f,
			1.37066f,
			1.33161f,
			1.2752f,
			1.18398f,
			1.05216f,
			0.87763f,
			0.75794f,
			0.67713f,
			0.61727f,
			0.57383f,
			0.54492f,
			0.52753f,
			0.52001f,
			0.52177f,
			0.53284f,
			0.55326f,
			0.58494f,
			0.63206f,
			0.70048f,
			0.80073f,
			0.95303f,
			1.19206f,
			1.45731f,
			1.61266f,
			1.6694f,
			1.61777f,
			1.46414f,
			1.19966f,
			0.95959f,
			129f / 160f,
			0.70532f,
			0.63643f,
			0.58899f,
			0.5571f,
			0.53656f,
			0.52542f,
			0.52363f,
			0.5312f,
			0.54871f,
			0.57782f,
			0.62155f,
			0.6815f,
			0.76282f,
			0.8831f,
			1.05841f,
			1.19139f,
			1.2831f,
			1.33997f,
			1.3793f,
			1.33997f,
			1.2831f,
			1.19139f,
			1.05841f,
			0.8831f,
			0.76282f,
			0.6815f,
			0.62155f,
			0.57782f,
			0.54871f,
			0.5312f,
			0.52363f,
			0.52542f,
			0.53656f,
			0.5571f,
			0.58899f,
			0.63643f,
			0.70532f,
			129f / 160f,
			0.95959f,
			1.19966f,
			1.46414f,
			1.61777f,
			1.67427f,
			1.62287f,
			1.47097f,
			1.20725f,
			0.96614f,
			0.81177f,
			0.71015f,
			0.6408f,
			0.59305f,
			0.56094f,
			0.54028f,
			0.52906f,
			0.52725f,
			0.53487f,
			0.5525f,
			0.58181f,
			0.62584f,
			0.68587f,
			0.7677f,
			0.88874f,
			1.06466f,
			1.19881f,
			1.291f,
			1.34832f,
			1.38794f,
			1.34832f,
			1.291f,
			1.19881f,
			1.06466f,
			0.88874f,
			0.7677f,
			0.68587f,
			0.62584f,
			0.58181f,
			0.5525f,
			0.53487f,
			0.52725f,
			0.52906f,
			0.54028f,
			0.56094f,
			0.59305f,
			0.6408f,
			0.71015f,
			0.81177f,
			0.96614f,
			1.20725f,
			1.47097f,
			1.62287f,
			1.67915f,
			1.62798f,
			1.4778f,
			1.21484f,
			0.97269f,
			0.81728f,
			0.71499f,
			0.64517f,
			0.5971f,
			0.56477f,
			0.544f,
			0.53271f,
			0.53088f,
			0.53854f,
			0.5563f,
			0.5858f,
			0.63012f,
			0.69023f,
			0.77258f,
			0.89437f,
			1.07093f,
			1.20623f,
			1.2989f,
			1.35668f,
			1.39658f,
			1.35668f,
			1.2989f,
			1.20623f,
			1.07093f,
			0.89437f,
			0.77258f,
			0.69023f,
			0.63012f,
			0.5858f,
			0.5563f,
			0.53854f,
			0.53088f,
			0.53271f,
			0.544f,
			0.56477f,
			0.5971f,
			0.64517f,
			0.71499f,
			0.81728f,
			0.97269f,
			1.21484f,
			1.4778f,
			1.62798f,
			1.68402f,
			1.63309f,
			1.48463f,
			1.22244f,
			0.97919f,
			0.8228f,
			0.71983f,
			0.64954f,
			0.60115f,
			0.56861f,
			0.54772f,
			0.53635f,
			0.5345f,
			0.54222f,
			0.56009f,
			0.58979f,
			0.63431f,
			0.6946f,
			0.77746f,
			0.90001f,
			1.07765f,
			1.21365f,
			1.3068f,
			1.36504f,
			1.40522f,
			1.36504f,
			1.3068f,
			1.21365f,
			1.07765f,
			0.90001f,
			0.77746f,
			0.6946f,
			0.63431f,
			0.58979f,
			0.56009f,
			0.54222f,
			0.5345f,
			0.53635f,
			0.54772f,
			0.56861f,
			0.60115f,
			0.64954f,
			0.71983f,
			0.8228f,
			0.97919f,
			1.22244f,
			1.48463f,
			1.63309f,
			1.68889f,
			1.6382f,
			1.49146f,
			1.23003f,
			0.98568f,
			0.82832f,
			0.72466f,
			0.65392f,
			0.6052f,
			0.57245f,
			0.55144f,
			0.54f,
			0.53812f,
			0.54589f,
			0.56388f,
			0.59377f,
			0.63837f,
			0.69897f,
			0.78234f,
			0.90565f,
			1.08438f,
			1.22099f,
			1.3147f,
			1.3734f,
			1.41386f,
			1.3734f,
			1.3147f,
			1.22099f,
			1.08438f,
			0.90565f,
			0.78234f,
			0.69897f,
			0.63837f,
			0.59377f,
			0.56388f,
			0.54589f,
			0.53812f,
			0.54f,
			0.55144f,
			0.57245f,
			0.6052f,
			0.65392f,
			0.72466f,
			0.82832f,
			0.98568f,
			1.23003f,
			1.49146f,
			1.6382f,
			1.69376f,
			1.64331f,
			1.4983f,
			1.23762f,
			0.99217f,
			0.83384f,
			0.7295f,
			0.65829f,
			0.60925f,
			0.57628f,
			0.55516f,
			0.54364f,
			0.54174f,
			0.54956f,
			0.56767f,
			0.59776f,
			0.64243f,
			0.70333f,
			0.78722f,
			0.91128f,
			1.0911f,
			1.22827f,
			1.3226f,
			1.38176f,
			1.4225f,
			1.38176f,
			1.3226f,
			1.22827f,
			1.0911f,
			0.91128f,
			0.78722f,
			0.70333f,
			0.64243f,
			0.59776f,
			0.56767f,
			0.54956f,
			0.54174f,
			0.54364f,
			0.55516f,
			0.57628f,
			0.60925f,
			0.65829f,
			0.7295f,
			0.83384f,
			0.99217f,
			1.23762f,
			1.4983f,
			1.64331f,
			1.69863f,
			1.64841f,
			1.50513f,
			1.24522f,
			0.99865f,
			0.83935f,
			0.73434f,
			0.66266f,
			0.61331f,
			0.58012f,
			0.55888f,
			0.54729f,
			0.54536f,
			0.55324f,
			0.57146f,
			0.60175f,
			0.64649f,
			0.7077f,
			0.79209f,
			0.91692f,
			1.09782f,
			1.23554f,
			1.33016f,
			1.39012f,
			1.43114f,
			1.39012f,
			1.33016f,
			1.23554f,
			1.09782f,
			0.91692f,
			0.79209f,
			0.7077f,
			0.64649f,
			0.60175f,
			0.57146f,
			0.55324f,
			0.54536f,
			0.54729f,
			0.55888f,
			0.58012f,
			0.61331f,
			0.66266f,
			0.73434f,
			0.83935f,
			0.99865f,
			1.24522f,
			1.50513f,
			1.64841f,
			1.70351f,
			1.65352f,
			1.51196f,
			1.25281f,
			1.00514f,
			0.84487f,
			0.73917f,
			0.66703f,
			0.61736f,
			0.58396f,
			0.5626f,
			0.55093f,
			0.54898f,
			0.55691f,
			0.57525f,
			0.60574f,
			0.65055f,
			0.71206f,
			0.79697f,
			0.92255f,
			1.10455f,
			1.24281f,
			1.33752f,
			1.39816f,
			1.43926f,
			1.39816f,
			1.33752f,
			1.24281f,
			1.10455f,
			0.92255f,
			0.79697f,
			0.71206f,
			0.65055f,
			0.60574f,
			0.57525f,
			0.55691f,
			0.54898f,
			0.55093f,
			0.5626f,
			0.58396f,
			0.61736f,
			0.66703f,
			0.73917f,
			0.84487f,
			1.00514f,
			1.25281f,
			1.51196f,
			1.65352f,
			1.70838f,
			1.65863f,
			1.51879f,
			1.2604f,
			1.01163f,
			0.85039f,
			0.74401f,
			0.6714f,
			0.62141f,
			0.5878f,
			0.56632f,
			0.55457f,
			0.55261f,
			0.56058f,
			0.57904f,
			0.60973f,
			0.65461f,
			0.71643f,
			0.80185f,
			0.92819f,
			1.11127f,
			1.25008f,
			1.34487f,
			MathF.E * 181f / 350f,
			1.44669f,
			MathF.E * 181f / 350f,
			1.34487f,
			1.25008f,
			1.11127f,
			0.92819f,
			0.80185f,
			0.71643f,
			0.65461f,
			0.60973f,
			0.57904f,
			0.56058f,
			0.55261f,
			0.55457f,
			0.56632f,
			0.5878f,
			0.62141f,
			0.6714f,
			0.74401f,
			0.85039f,
			1.01163f,
			1.2604f,
			1.51879f,
			1.65863f,
			1.71325f,
			1.66374f,
			1.52562f,
			1.268f,
			1.01811f,
			0.8559f,
			0.74885f,
			0.67578f,
			0.62546f,
			0.59163f,
			0.57004f,
			0.5582f,
			0.55623f,
			0.56425f,
			0.58283f,
			0.61372f,
			0.65867f,
			0.7208f,
			0.80673f,
			0.93383f,
			1.11799f,
			1.25736f,
			1.35223f,
			1.41333f,
			1.45412f,
			1.41333f,
			1.35223f,
			1.25736f,
			1.11799f,
			0.93383f,
			0.80673f,
			0.7208f,
			0.65867f,
			0.61372f,
			0.58283f,
			0.56425f,
			0.55623f,
			0.5582f,
			0.57004f,
			0.59163f,
			0.62546f,
			0.67578f,
			0.74885f,
			0.8559f,
			1.01811f,
			1.268f,
			1.52562f,
			1.66374f,
			1.71812f,
			1.66884f,
			1.53245f,
			1.27559f,
			1.0246f,
			0.86142f,
			0.75368f,
			0.68015f,
			0.62952f,
			0.59547f,
			0.57376f,
			0.56184f,
			0.55985f,
			0.56793f,
			0.58663f,
			0.6177f,
			0.66273f,
			0.72516f,
			0.81161f,
			0.93946f,
			1.12472f,
			1.26463f,
			1.35959f,
			MathF.E * 23f / 44f,
			1.46155f,
			MathF.E * 23f / 44f,
			1.35959f,
			1.26463f,
			1.12472f,
			0.93946f,
			0.81161f,
			0.72516f,
			0.66273f,
			0.6177f,
			0.58663f,
			0.56793f,
			0.55985f,
			0.56184f,
			0.57376f,
			0.59547f,
			0.62952f,
			0.68015f,
			0.75368f,
			0.86142f,
			1.0246f,
			1.27559f,
			1.53245f,
			1.66884f,
			1.72299f,
			1.67395f,
			1.53928f,
			1.28318f,
			1.03109f,
			0.86689f,
			0.75852f,
			0.68452f,
			0.63357f,
			0.59931f,
			0.57748f,
			0.56548f,
			0.56347f,
			0.5716f,
			0.59042f,
			0.62169f,
			0.66679f,
			0.72953f,
			0.81649f,
			0.9451f,
			1.13144f,
			1.2719f,
			1.36694f,
			1.42851f,
			1.46898f,
			1.42851f,
			1.36694f,
			1.2719f,
			1.13144f,
			0.9451f,
			0.81649f,
			0.72953f,
			0.66679f,
			0.62169f,
			0.59042f,
			0.5716f,
			0.56347f,
			0.56548f,
			0.57748f,
			0.59931f,
			0.63357f,
			0.68452f,
			0.75852f,
			0.86689f,
			1.03109f,
			1.28318f,
			1.53928f,
			1.67395f,
			1.72787f,
			1.67906f,
			1.54612f,
			1.29078f,
			1.03758f,
			0.87236f,
			0.76336f,
			0.68889f,
			0.63762f,
			0.60314f,
			0.5812f,
			0.56911f,
			0.5671f,
			0.57527f,
			0.59421f,
			0.62555f,
			0.67085f,
			0.7339f,
			0.82137f,
			0.95073f,
			1.13816f,
			1.27917f,
			1.3743f,
			1.4361f,
			1.47641f,
			1.4361f,
			1.3743f,
			1.27917f,
			1.13816f,
			0.95073f,
			0.82137f,
			0.7339f,
			0.67085f,
			0.62555f,
			0.59421f,
			0.57527f,
			0.5671f,
			0.56911f,
			0.5812f,
			0.60314f,
			0.63762f,
			0.68889f,
			0.76336f,
			0.87236f,
			1.03758f,
			1.29078f,
			1.54612f,
			1.67906f,
			1.73274f,
			1.68417f,
			1.55295f,
			1.29837f,
			1.04406f,
			0.87782f,
			0.76819f,
			0.69327f,
			0.64167f,
			0.60698f,
			0.58492f,
			0.57275f,
			0.57072f,
			0.57895f,
			0.598f,
			0.62934f,
			0.67491f,
			0.73826f,
			0.82624f,
			0.95637f,
			1.14489f,
			1.28645f,
			1.38165f,
			1.44369f,
			1.48384f,
			1.44369f,
			1.38165f,
			1.28645f,
			1.14489f,
			0.95637f,
			0.82624f,
			0.73826f,
			0.67491f,
			0.62934f,
			0.598f,
			0.57895f,
			0.57072f,
			0.57275f,
			0.58492f,
			0.60698f,
			0.64167f,
			0.69327f,
			0.76819f,
			0.87782f,
			1.04406f,
			1.29837f,
			1.55295f,
			1.68417f,
			1.73761f,
			1.68928f,
			1.55944f,
			1.30596f,
			1.05055f,
			0.88329f,
			0.77303f,
			0.69764f,
			0.64572f,
			0.61082f,
			0.58864f,
			0.57639f,
			0.57434f,
			0.58262f,
			0.60179f,
			0.63313f,
			0.67897f,
			0.74263f,
			0.83112f,
			0.96219f,
			1.15161f,
			1.29372f,
			1.38901f,
			1.45128f,
			1.49127f,
			1.45128f,
			1.38901f,
			1.29372f,
			1.15161f,
			0.96219f,
			0.83112f,
			0.74263f,
			0.67897f,
			0.63313f,
			0.60179f,
			0.58262f,
			0.57434f,
			0.57639f,
			0.58864f,
			0.61082f,
			0.64572f,
			0.69764f,
			0.77303f,
			0.88329f,
			1.05055f,
			1.30596f,
			1.55944f,
			1.68928f,
			1.74248f,
			1.69438f,
			1.56513f,
			1.31356f,
			1.05704f,
			0.88875f,
			0.77787f,
			0.70201f,
			0.64978f,
			0.61466f,
			0.59236f,
			0.58002f,
			0.57797f,
			0.58629f,
			0.60558f,
			0.63692f,
			0.68303f,
			0.747f,
			0.836f,
			0.96807f,
			1.15833f,
			1.30099f,
			1.39637f,
			1.45887f,
			1.4987f,
			1.45887f,
			1.39637f,
			1.30099f,
			1.15833f,
			0.96807f,
			0.836f,
			0.747f,
			0.68303f,
			0.63692f,
			0.60558f,
			0.58629f,
			0.57797f,
			0.58002f,
			0.59236f,
			0.61466f,
			0.64978f,
			0.70201f,
			0.77787f,
			0.88875f,
			1.05704f,
			1.31356f,
			1.56513f,
			1.69438f,
			1.74735f,
			1.69949f,
			1.57083f,
			1.32115f,
			1.06353f,
			0.89422f,
			0.7827f,
			0.70638f,
			0.65383f,
			0.61849f,
			0.59608f,
			0.58366f,
			0.58159f,
			0.58997f,
			0.60937f,
			0.64071f,
			0.68709f,
			0.75136f,
			0.84088f,
			0.97396f,
			1.16506f,
			1.30826f,
			1.40372f,
			1.46646f,
			1.50613f,
			1.46646f,
			1.40372f,
			1.30826f,
			1.16506f,
			0.97396f,
			0.84088f,
			0.75136f,
			0.68709f,
			0.64071f,
			0.60937f,
			0.58997f,
			0.58159f,
			0.58366f,
			0.59608f,
			0.61849f,
			0.65383f,
			0.70638f,
			0.7827f,
			0.89422f,
			1.06353f,
			1.32115f,
			1.57083f,
			1.69949f,
			1.75223f,
			1.7046f,
			1.57652f,
			1.32874f,
			1.07001f,
			0.89969f,
			0.78751f,
			0.71075f,
			0.65788f,
			0.62233f,
			0.5998f,
			0.5873f,
			0.58522f,
			0.59364f,
			0.61317f,
			0.6445f,
			0.69115f,
			0.75573f,
			0.84576f,
			0.97985f,
			1.17178f,
			1.31553f,
			1.41108f,
			1.47405f,
			1.51355f,
			1.47405f,
			1.41108f,
			1.31553f,
			1.17178f,
			0.97985f,
			0.84576f,
			0.75573f,
			0.69115f,
			0.6445f,
			0.61317f,
			0.59364f,
			0.58522f,
			0.5873f,
			0.5998f,
			0.62233f,
			0.65788f,
			0.71075f,
			0.78751f,
			0.89969f,
			1.07001f,
			1.32874f,
			1.57652f,
			1.7046f,
			1.7571f,
			1.70971f,
			1.58221f,
			1.33634f,
			1.0765f,
			0.90515f,
			0.7923f,
			0.71513f,
			0.66193f,
			0.62617f,
			0.60352f,
			0.59093f,
			0.58884f,
			0.59731f,
			0.61696f,
			0.64829f,
			0.69521f,
			0.7601f,
			0.85064f,
			0.98573f,
			1.1785f,
			1.32281f,
			1.41843f,
			1.48163f,
			1.52098f,
			1.48163f,
			1.41843f,
			1.32281f,
			1.1785f,
			0.98573f,
			0.85064f,
			0.7601f,
			0.69521f,
			0.64829f,
			0.61696f,
			0.59731f,
			0.58884f,
			0.59093f,
			0.60352f,
			0.62617f,
			0.66193f,
			0.71513f,
			0.7923f,
			0.90515f,
			1.0765f,
			1.33634f,
			1.58221f,
			1.70971f,
			1.76197f,
			1.71481f,
			1.5879f,
			1.34393f,
			1.08299f,
			0.91062f,
			0.7971f,
			0.7195f,
			0.66599f,
			0.63001f,
			0.60724f,
			0.59457f,
			0.59246f,
			0.60098f,
			0.62075f,
			0.65208f,
			0.69928f,
			0.76446f,
			0.85552f,
			MathF.PI * 113f / 358f,
			1.18523f,
			1.33008f,
			1.42579f,
			1.48922f,
			1.52841f,
			1.48922f,
			1.42579f,
			1.33008f,
			1.18523f,
			MathF.PI * 113f / 358f,
			0.85552f,
			0.76446f,
			0.69928f,
			0.65208f,
			0.62075f,
			0.60098f,
			0.59246f,
			0.59457f,
			0.60724f,
			0.63001f,
			0.66599f,
			0.7195f,
			0.7971f,
			0.91062f,
			1.08299f,
			1.34393f,
			1.5879f,
			1.71481f,
			1.76684f,
			1.71992f,
			1.5936f,
			1.35145f,
			1.08948f,
			0.91608f,
			0.80189f,
			0.72387f,
			0.67004f,
			0.63384f,
			0.61096f,
			0.59821f,
			0.59609f,
			0.60466f,
			0.62453f,
			0.65587f,
			0.70334f,
			0.76883f,
			0.86039f,
			0.99751f,
			1.19195f,
			1.33735f,
			1.43315f,
			1.49681f,
			1.53584f,
			1.49681f,
			1.43315f,
			1.33735f,
			1.19195f,
			0.99751f,
			0.86039f,
			0.76883f,
			0.70334f,
			0.65587f,
			0.62453f,
			0.60466f,
			0.59609f,
			0.59821f,
			0.61096f,
			0.63384f,
			0.67004f,
			0.72387f,
			0.80189f,
			0.91608f,
			1.08948f,
			1.35145f,
			1.5936f,
			1.71992f,
			1.77171f,
			1.72503f,
			1.59929f,
			1.3589f,
			1.09596f,
			0.92155f,
			0.80668f,
			0.72824f,
			0.67409f,
			0.63768f,
			0.61468f,
			0.60184f,
			0.59971f,
			0.60833f,
			0.62814f,
			0.65966f,
			0.7074f,
			0.7732f,
			0.86527f,
			1.00339f,
			1.19867f,
			1.34462f,
			1.4405f,
			1.5044f,
			1.54327f,
			1.5044f,
			1.4405f,
			1.34462f,
			1.19867f,
			1.00339f,
			0.86527f,
			0.7732f,
			0.7074f,
			0.65966f,
			0.62814f,
			0.60833f,
			0.59971f,
			0.60184f,
			0.61468f,
			0.63768f,
			0.67409f,
			0.72824f,
			0.80668f,
			0.92155f,
			1.09596f,
			1.3589f,
			1.59929f,
			1.72503f,
			1.77659f,
			1.73014f,
			1.60498f,
			1.36635f,
			1.10245f,
			0.92702f,
			0.81148f,
			0.7326f,
			0.67814f,
			0.64152f,
			0.6184f,
			0.60548f,
			0.60334f,
			0.612f,
			0.63176f,
			0.66346f,
			0.71146f,
			0.77756f,
			0.87015f,
			1.00928f,
			1.2054f,
			1.3519f,
			1.44786f,
			1.51199f,
			1.5507f,
			1.51199f,
			1.44786f,
			1.3519f,
			1.2054f,
			1.00928f,
			0.87015f,
			0.77756f,
			0.71146f,
			0.66346f,
			0.63176f,
			0.612f,
			0.60334f,
			0.60548f,
			0.6184f,
			0.64152f,
			0.67814f,
			0.7326f,
			0.81148f,
			0.92702f,
			1.10245f,
			1.36635f,
			1.60498f,
			1.73014f,
			1.78146f,
			1.73524f,
			1.61067f,
			1.3738f,
			1.10894f,
			0.93248f,
			0.81627f,
			0.73693f,
			0.68219f,
			0.64535f,
			0.62212f,
			0.60912f,
			0.60696f,
			0.61568f,
			0.63537f,
			0.66725f,
			0.71552f,
			0.78193f,
			0.87503f,
			1.01516f,
			1.21212f,
			1.35917f,
			1.45522f,
			1.51958f,
			1.55813f,
			1.51958f,
			1.45522f,
			1.35917f,
			1.21212f,
			1.01516f,
			0.87503f,
			0.78193f,
			0.71552f,
			0.66725f,
			0.63537f,
			0.61568f,
			0.60696f,
			0.60912f,
			0.62212f,
			0.64535f,
			0.68219f,
			0.73693f,
			0.81627f,
			0.93248f,
			1.10894f,
			1.3738f,
			1.61067f,
			1.73525f,
			1.78633f,
			1.74035f,
			1.61636f,
			1.38125f,
			1.11543f,
			0.93795f,
			0.82106f,
			0.74127f,
			0.68625f,
			0.64919f,
			0.62584f,
			0.61275f,
			0.61058f,
			0.61935f,
			0.63898f,
			0.67104f,
			0.71958f,
			0.7863f,
			0.87991f,
			1.02105f,
			1.21884f,
			1.36644f,
			1.46257f,
			1.52717f,
			1.56556f,
			1.52717f,
			1.46257f,
			1.36644f,
			1.21884f,
			1.02105f,
			0.87991f,
			0.7863f,
			0.71958f,
			0.67104f,
			0.63898f,
			0.61935f,
			0.61058f,
			0.61275f,
			0.62584f,
			0.64919f,
			0.68625f,
			0.74127f,
			0.82106f,
			0.93795f,
			1.11543f,
			1.38125f,
			1.61636f,
			1.74035f,
			1.7912f,
			1.74546f,
			1.62206f,
			1.3887f,
			1.12191f,
			0.94342f,
			0.82586f,
			0.7456f,
			0.6903f,
			0.65303f,
			0.62956f,
			0.61639f,
			0.61421f,
			0.62302f,
			0.6426f,
			0.67483f,
			0.72364f,
			0.79066f,
			0.8849f,
			1.02694f,
			1.22557f,
			1.37371f,
			1.46993f,
			1.53476f,
			1.57299f,
			1.53476f,
			1.46993f,
			1.37371f,
			1.22557f,
			1.02694f,
			0.8849f,
			0.79066f,
			0.72364f,
			0.67483f,
			0.6426f,
			0.62302f,
			0.61421f,
			0.61639f,
			0.62956f,
			0.65303f,
			0.6903f,
			0.7456f,
			0.82586f,
			0.94342f,
			1.12191f,
			1.3887f,
			1.62206f,
			1.74546f,
			1.79607f,
			1.75057f,
			1.62775f,
			1.39615f,
			1.1284f,
			0.94888f,
			0.83065f,
			0.74994f,
			0.69435f,
			0.65687f,
			0.63328f,
			0.62003f,
			0.61783f,
			0.62669f,
			0.64621f,
			0.67862f,
			0.7277f,
			0.79503f,
			0.88999f,
			1.03282f,
			1.23229f,
			1.38099f,
			1.47728f,
			1.54235f,
			1.58042f,
			1.54235f,
			1.47728f,
			1.38099f,
			1.23229f,
			1.03282f,
			0.88999f,
			0.79503f,
			0.7277f,
			0.67862f,
			0.64621f,
			0.62669f,
			0.61783f,
			0.62003f,
			0.63328f,
			0.65687f,
			0.69435f,
			0.74994f,
			0.83065f,
			0.94888f,
			1.1284f,
			1.39615f,
			1.62775f,
			1.75057f,
			1.80095f,
			1.75568f,
			1.63344f,
			1.4036f,
			1.13489f,
			0.95435f,
			0.83545f,
			0.75427f,
			0.69838f,
			0.6607f,
			0.637f,
			0.62366f,
			0.62146f,
			0.63037f,
			0.64982f,
			0.68241f,
			0.73176f,
			0.7994f,
			0.89507f,
			1.03871f,
			1.23901f,
			1.38826f,
			1.48469f,
			1.54994f,
			1.58785f,
			1.54994f,
			1.48469f,
			1.38826f,
			1.23901f,
			1.03871f,
			0.89507f,
			0.7994f,
			0.73176f,
			0.68241f,
			0.64982f,
			0.63037f,
			0.62146f,
			0.62366f,
			0.637f,
			0.6607f,
			0.69838f,
			0.75427f,
			0.83545f,
			0.95435f,
			1.13489f,
			1.4036f,
			1.63344f,
			1.75568f,
			1.80582f,
			1.76078f,
			1.63913f,
			1.41105f,
			1.14138f,
			0.95981f,
			0.84024f,
			0.75861f,
			0.7024f,
			0.66454f,
			0.64072f,
			0.6273f,
			0.62508f,
			0.63404f,
			0.65344f,
			0.6862f,
			0.73582f,
			0.80376f,
			0.90015f,
			1.0446f,
			1.24574f,
			1.39553f,
			1.4921f,
			1.55752f,
			1.59528f,
			1.55752f,
			1.4921f,
			1.39553f,
			1.24574f,
			1.0446f,
			0.90015f,
			0.80376f,
			0.73582f,
			0.6862f,
			0.65344f,
			0.63404f,
			0.62508f,
			0.6273f,
			0.64072f,
			0.66454f,
			0.7024f,
			0.75861f,
			0.84024f,
			0.95981f,
			1.14138f,
			1.41105f,
			1.63913f,
			1.76078f,
			1.81069f,
			1.76589f,
			1.64483f,
			1.4185f,
			1.14786f,
			0.96528f,
			0.84503f,
			0.76294f,
			0.70642f,
			0.66838f,
			0.64444f,
			0.63094f,
			0.62871f,
			0.63768f,
			0.65705f,
			0.68999f,
			0.73988f,
			0.80813f,
			0.90523f,
			1.05048f,
			1.25246f,
			1.4028f,
			1.49952f,
			1.56511f,
			1.60271f,
			1.56511f,
			1.49952f,
			1.4028f,
			1.25246f,
			1.05048f,
			0.90523f,
			0.80813f,
			0.73988f,
			0.68999f,
			0.65705f,
			0.63768f,
			0.62871f,
			0.63094f,
			0.64444f,
			0.66838f,
			0.70642f,
			0.76294f,
			0.84503f,
			0.96528f,
			1.14786f,
			1.4185f,
			1.64483f,
			1.76589f,
			1.81556f,
			1.771f,
			1.65052f,
			1.42595f,
			1.15435f,
			0.97075f,
			0.84983f,
			0.76728f,
			0.71044f,
			0.67221f,
			0.64816f,
			0.63457f,
			0.63233f,
			0.64119f,
			0.66066f,
			0.69378f,
			0.74394f,
			0.8125f,
			0.91031f,
			1.05637f,
			1.25918f,
			1.41006f,
			1.50693f,
			1.5727f,
			1.61014f,
			1.5727f,
			1.50693f,
			1.41006f,
			1.25918f,
			1.05637f,
			0.91031f,
			0.8125f,
			0.74394f,
			0.69378f,
			0.66066f,
			0.64119f,
			0.63233f,
			0.63457f,
			0.64816f,
			0.67221f,
			0.71044f,
			0.76728f,
			0.84983f,
			0.97075f,
			1.15435f,
			1.42595f,
			1.65052f,
			1.771f,
			1.81443f,
			1.77611f,
			1.65621f,
			1.4334f,
			1.16084f,
			0.97621f,
			0.85462f,
			0.77161f,
			0.71446f,
			0.67604f,
			0.65188f,
			0.63821f,
			0.63595f,
			0.64469f,
			0.66428f,
			0.69757f,
			0.748f,
			0.81686f,
			0.91539f,
			1.06225f,
			1.26591f,
			1.41732f,
			1.51435f,
			1.58029f,
			1.61756f,
			1.58029f,
			1.51435f,
			1.41732f,
			1.26591f,
			1.06225f,
			0.91539f,
			0.81686f,
			0.748f,
			0.69757f,
			0.66428f,
			0.64469f,
			0.63595f,
			0.63821f,
			0.65188f,
			0.67604f,
			0.71446f,
			0.77161f,
			0.85462f,
			0.97621f,
			1.16084f,
			1.4334f,
			1.65621f,
			1.77611f,
			1.81241f,
			1.78121f,
			1.6619f,
			1.44085f,
			1.16733f,
			0.98168f,
			0.85941f,
			0.77594f,
			0.71847f,
			0.67985f,
			0.65559f,
			0.64185f,
			0.63958f,
			0.6482f,
			0.66789f,
			0.70137f,
			0.75206f,
			0.82123f,
			0.92047f,
			1.06814f,
			1.27263f,
			1.42457f,
			1.52176f,
			1.58788f,
			1.62499f,
			1.58788f,
			1.52176f,
			1.42457f,
			1.27263f,
			1.06814f,
			0.92047f,
			0.82123f,
			0.75206f,
			0.70137f,
			0.66789f,
			0.6482f,
			0.63958f,
			0.64185f,
			0.65559f,
			0.67985f,
			0.71847f,
			0.77594f,
			0.85941f,
			0.98168f,
			1.16733f,
			1.44085f,
			1.6619f,
			1.78121f,
			1.81405f,
			1.78632f,
			1.6676f,
			1.4483f,
			1.17381f,
			0.98715f,
			0.86421f,
			0.78028f,
			0.72249f,
			0.68366f,
			0.65931f,
			0.64548f,
			0.6432f,
			0.65171f,
			0.6715f,
			0.70516f,
			0.75612f,
			0.8256f,
			0.92556f,
			1.07403f,
			1.27936f,
			1.43183f,
			1.52918f,
			1.59547f,
			1.63242f,
			1.59547f,
			1.52918f,
			1.43183f,
			1.27936f,
			1.07403f,
			0.92556f,
			0.8256f,
			0.75612f,
			0.70516f,
			0.6715f,
			0.65171f,
			0.6432f,
			0.64548f,
			0.65931f,
			0.68366f,
			0.72249f,
			0.78028f,
			0.86421f,
			0.98715f,
			1.17381f,
			1.4483f,
			1.6676f,
			1.78632f,
			1.83142f,
			1.79143f,
			1.67329f,
			1.45575f,
			1.1803f,
			0.99261f,
			0.869f,
			0.78461f,
			0.72651f,
			0.68746f,
			0.66302f,
			0.64912f,
			0.64683f,
			0.65522f,
			0.67511f,
			0.70895f,
			0.76018f,
			0.82996f,
			0.93064f,
			1.07991f,
			1.28608f,
			1.43908f,
			1.5366f,
			1.60306f,
			1.63985f,
			1.60306f,
			1.5366f,
			1.43908f,
			1.28608f,
			1.07991f,
			0.93064f,
			0.82996f,
			0.76018f,
			0.70895f,
			0.67511f,
			0.65522f,
			0.64683f,
			0.64912f,
			0.66302f,
			0.68746f,
			0.72651f,
			0.78461f,
			0.869f,
			0.99261f,
			1.1803f,
			1.45575f,
			1.67329f,
			1.79143f,
			1.83489f,
			1.79654f,
			1.67898f,
			1.4632f,
			1.18679f,
			0.99808f,
			0.87379f,
			0.78895f,
			0.73053f,
			0.69416f,
			0.67317f,
			0.65414f,
			0.65045f,
			0.65873f,
			0.67873f,
			0.71274f,
			0.76424f,
			0.83448f,
			0.93572f,
			1.0858f,
			1.2928f,
			1.44633f,
			1.54401f,
			1.61065f,
			1.64728f,
			1.61065f,
			1.54401f,
			1.44633f,
			1.2928f,
			1.0858f,
			0.93572f,
			0.83448f,
			0.76424f,
			0.71274f,
			0.67873f,
			0.65873f,
			0.65045f,
			0.65414f,
			0.67317f,
			0.69416f,
			0.73053f,
			0.78895f,
			0.87379f,
			0.99808f,
			1.18679f,
			1.4632f,
			1.67898f,
			1.79654f
		};

		internal static float RadiusAt(int directionIndex, float y)
		{
			int num = directionIndex % 48;
			if (num < 0)
			{
				num += 48;
			}
			if (y <= 0.25f)
			{
				float num2 = Mathf.Clamp01((y - 0.222f) / 0.027999997f);
				num2 = num2 * num2 * (3f - 2f * num2);
				return Mathf.Max(0.001f, Measured[num] * num2);
			}
			float num3 = Mathf.Clamp01((y - 0.25f) / 0.67f) * 67f;
			int num4 = Mathf.Min(66, Mathf.FloorToInt(num3));
			return Mathf.Lerp(Measured[num4 * 48 + num], Measured[(num4 + 1) * 48 + num], num3 - (float)num4);
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "LateUpdate")]
	internal static class NativeBridgeGameFrame108
	{
		private static int lastFrame = -1;

		private static bool logged;

		[HarmonyPostfix]
		private static void AfterRoundLateUpdate()
		{
			if (lastFrame != Time.frameCount)
			{
				lastFrame = Time.frameCount;
				if (!logged)
				{
					logged = true;
					PluginBridgeLog();
				}
				NativeMallDelivery.Tick();
				NativeSpecialFurniture.Tick();
				NativeBathWater.PollLocalInteraction();
				CozyMultiplayer122.Tick();
				CozyGuestInteraction123.LateTick();
				CozyTableDrawerSync.Tick();
				CozyShelfStorageSync.Tick();
			}
		}

		private static void PluginBridgeLog()
		{
			if (CozyRoomPlugin.Log != null)
			{
			}
		}
	}
	internal static class NativeFreshRoomCleanup
	{
		private static ManualLogSource log;

		private static Type moverType;

		private static StartOfRound lastRound;

		private static readonly HashSet<int> cleanedRooms = new HashSet<int>();

		private static bool fired;

		internal static void Install(ManualLogSource logger)
		{
			log = logger;
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			for (int i = 0; i < assemblies.Length; i++)
			{
				moverType = assemblies[i].GetType("CozyRoom.MovableCozyObject", throwOnError: false);
				if (moverType != null)
				{
					break;
				}
			}
			if (moverType == null)
			{
				log.LogWarning((object)"[FreshRoom0323] Original movable type unavailable; leave starter furniture unchanged.");
			}
			else
			{
				_ = log;
			}
		}

		internal static void MarkFiredReset()
		{
			fired = true;
			cleanedRooms.Clear();
			if (log != null)
			{
			}
		}

		internal static void Tick(GameObject room, bool sessionOnlyLedger, string slot)
		{
			if ((Object)(object)room == (Object)null || moverType == null || (Object)(object)StartOfRound.Instance == (Object)null)
			{
				return;
			}
			if ((Object)(object)lastRound != (Object)(object)StartOfRound.Instance)
			{
				lastRound = StartOfRound.Instance;
				cleanedRooms.Clear();
				fired = false;
			}
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton == (Object)null || !singleton.IsServer || !singleton.IsListening || cleanedRooms.Contains(((Object)room).GetInstanceID()) || (!fired && !CozyComputerManager.IsFreshCompanyForCleanup && (!sessionOnlyLedger || string.IsNullOrEmpty(slot) || File.Exists(Path.Combine(Application.persistentDataPath, slot)))))
			{
				return;
			}
			cleanedRooms.Add(((Object)room).GetInstanceID());
			int num = 0;
			int num2 = 0;
			try
			{
				Object[] array = Object.FindObjectsOfType(moverType);
				foreach (Object obj in array)
				{
					Component val = (Component)(object)((obj is Component) ? obj : null);
					if ((Object)(object)val == (Object)null || (Object)(object)val.gameObject == (Object)null)
					{
						continue;
					}
					GameObject gameObject = val.gameObject;
					if ((Object)(object)gameObject == (Object)(object)room || !gameObject.transform.IsChildOf(room.transform))
					{
						continue;
					}
					string text = ((Object)gameObject).name.ToLowerInvariant();
					bool flag = text.Contains("door") || text.Contains("portal") || text.Contains("entrance") || text.Contains("laptop") || text.Contains("computer_purchased") || text.Contains("shopping") || text.Contains("cozycomputer") || text.Contains("teleport") || text.Contains("foyer") || text.Contains("trigger") || text.Contains("wall") || text.Contains("floor") || text.Contains("stair");
					bool flag2 = false;
					Transform val2 = gameObject.transform;
					while ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)room.transform)
					{
						if ((Object)(object)((Component)val2).GetComponent<NetworkObject>() != (Object)null || (Object)(object)((Component)val2).GetComponent<AutoParentToShip>() != (Object)null || ((Object)val2).name.StartsWith("CozyNative", StringComparison.OrdinalIgnoreCase))
						{
							flag2 = true;
							break;
						}
						val2 = val2.parent;
					}
					if (flag || flag2 || ((Object)gameObject).name.StartsWith("CozyNative", StringComparison.OrdinalIgnoreCase))
					{
						num2++;
						continue;
					}
					gameObject.SetActive(false);
					num++;
					if (num <= 12 && log != null)
					{
						_ = "[FreshRoom0323] Cleared starter movable: " + ((Object)gameObject).name;
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource obj2 = log;
				if (obj2 != null)
				{
					obj2.LogError((object)("[FreshRoom0323] Cleanup error (no saves deleted): " + ex));
				}
			}
			ManualLogSource obj3 = log;
			if (obj3 != null)
			{
				obj3.LogWarning((object)("[FreshRoom0323] NEW COMPANY layout check: hiddenStarter=" + num + " protected=" + num2 + " room=" + ((Object)room).name + ". Purchased native furniture is handled separately by save GUID."));
			}
		}
	}
	internal static class NativeMallDelivery
	{
		[Serializable]
		private sealed class Entry
		{
			public string id;

			public string productId;

			public Vector3 roomPosition;

			public Quaternion roomRotation;

			public bool inStorage;

			public List<CozyStoredItemRecord> storedItems = new List<CozyStoredItemRecord>();
		}

		[Serializable]
		private sealed class Ledger
		{
			public string slot;

			public string identity;

			public long revision;

			public long vanillaCreatedUtcTicks;

			public List<Entry> furniture = new List<Entry>();
		}

		private sealed class Live
		{
			public Entry entry;

			public GameObject gameObject;
		}

		[Serializable]
		internal sealed class SavedItemList
		{
			public List<CozyStoredItemRecord> items;
		}

		[Serializable]
		private sealed class ResetRepairMarker138
		{
			public string slot;

			public string identity;

			public string oldIdentity;

			public string backupPath;

			public string[] removeIds;
		}

		private static Plugin plugin;

		private static Dictionary<string, object> entries;

		private static readonly List<Live> active = new List<Live>();

		private static Ledger ledger;

		private static string slotKey;

		private static string filePath;

		private static string sessionIdentity;

		private static StartOfRound sessionRound;

		private static GameObject activeRoom;

		private static float nextCheck;

		private static bool restoring;

		private static bool hooked;

		private static NetworkManager observedNetwork;

		private static bool previouslyHosting;

		private static readonly BindingFlags StaticFlags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		private static readonly BindingFlags InstanceFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		private static float nextVanillaAdoptionSweep;

		private static readonly HashSet<int> freshRemoved = new HashSet<int>();

		private static float nextUntrackedWarning;

		private const string VanillaEs3LedgerKey = "GyeongJi_NativeBridge_Furniture_0319";

		private const string VanillaBinaryPrefix118 = "COZY_NATIVE_FURNITURE_BIN_118:";

		private const int RecoveryMagic = 1129991217;

		private static string resetBlockedIdentity;

		private static bool certifiedResetRepair138;

		private static void ObserveLobbyBoundary()
		{
			NetworkManager singleton = NetworkManager.Singleton;
			bool flag = (Object)(object)singleton != (Object)null && singleton.IsListening && singleton.IsServer;
			if (previouslyHosting && (!flag || (Object)(object)singleton != (Object)(object)observedNetwork))
			{
				int num = 0;
				foreach (Live item in active)
				{
					GameObject val = item?.gameObject;
					if ((Object)(object)val == (Object)null)
					{
						continue;
					}
					try
					{
						Object.Destroy((Object)(object)val);
						num++;
					}
					catch (Exception ex)
					{
						Plugin obj = plugin;
						if (obj != null)
						{
							obj.LogSource.LogWarning((object)("[Lobby137] Old host visual removal: " + ex.Message));
						}
					}
				}
				active.Clear();
				activeRoom = null;
				ledger = null;
				slotKey = null;
				filePath = null;
				sessionRound = null;
				sessionIdentity = null;
				nextCheck = 0f;
				Plugin obj2 = plugin;
				if (obj2 != null)
				{
					obj2.LogSource.LogWarning((object)("[Lobby137] Host role lost; cleared " + num + " prior-lobby native furniture objects. Saved records untouched."));
				}
			}
			observedNetwork = singleton;
			previouslyHosting = flag;
		}

		public static void Install(Plugin owner, Dictionary<string, object> prefabs)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			plugin = owner;
			entries = prefabs;
			if (entries == null || entries.Count == 0)
			{
				owner.LogSource.LogWarning((object)"[NativeMall] No registered native prefabs; original CozyMall remains in use.");
				return;
			}
			Type type = FindType("CozyRoom.CozyRoomManager");
			MethodInfo methodInfo = ((type != null) ? type.GetMethod("SpawnFurnitureObject", StaticFlags) : null);
			if (methodInfo == null)
			{
				throw new InvalidOperationException("CozyRoomManager.SpawnFurnitureObject missing; no shop patch installed.");
			}
			new Harmony("com.ajin.cozyroom.nativemall.delivery.030").Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(NativeMallDelivery).GetMethod("ShopSpawnPrefix", StaticFlags)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			hooked = true;
			owner.LogSource.LogWarning((object)"[NativeMall0323] Repeat purchases now use distinct native NetworkObjects. Inactive template seats validated by local flags. SOFA fallback to legacy disabled; failure refunds credits. Native X storage still requires testing.");
			owner.LogSource.LogWarning((object)"[FreshNative121] New-company native-furniture cleanup loaded; no save files will be deleted.");
		}

		internal static void SendActiveFurniturePoses(ulong peer)
		{
			if ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsServer)
			{
				return;
			}
			foreach (Live item in active)
			{
				object obj;
				if (item == null)
				{
					obj = null;
				}
				else
				{
					GameObject gameObject = item.gameObject;
					obj = ((gameObject != null) ? gameObject.GetComponent<NetworkObject>() : null);
				}
				NetworkObject val = (NetworkObject)obj;
				if ((Object)(object)val != (Object)null && val.IsSpawned)
				{
					CozyMultiplayer122.SendFurniturePoseTo(val, peer);
				}
			}
		}

		private static bool IsSeatProduct(string id)
		{
			if (!string.IsNullOrEmpty(id))
			{
				if (id.IndexOf("sofa", StringComparison.OrdinalIgnoreCase) < 0 && id.IndexOf("couch", StringComparison.OrdinalIgnoreCase) < 0)
				{
					return global::<PrivateImplementationDetails>.__StaticArrayInitTypeSize=13056.CzSeatCanon(id) == "cozy_toilet";
				}
				return true;
			}
			return false;
		}

		private static bool RejectSeatPurchase(object shopItem, string id, string reason, ref GameObject result)
		{
			result = null;
			int num = 0;
			object member = GetMember(shopItem, "priceCredits");
			if (member is int)
			{
				num = (int)member;
			}
			bool flag = false;
			try
			{
				NetworkManager singleton = NetworkManager.Singleton;
				Terminal val = Object.FindObjectOfType<Terminal>();
				if ((Object)(object)singleton != (Object)null && singleton.IsServer && (Object)(object)val != (Object)null && num >= 0 && num < 1000000)
				{
					val.SyncGroupCreditsServerRpc(val.groupCredits = checked(val.groupCredits + num), val.numberOfItemsInDropship);
					flag = true;
				}
			}
			catch (Exception ex)
			{
				Plugin obj = plugin;
				if (obj != null)
				{
					obj.LogSource.LogError((object)("[NativeMall0322] SOFA REFUND FAILED " + id + ": " + ex));
				}
			}
			Plugin obj2 = plugin;
			if (obj2 != null)
			{
				obj2.LogSource.LogWarning((object)(