Decompiled source of MonsterLabZ v3.0.11

MonsterLabZ.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CreatureManager;
using HarmonyLib;
using ItemManager;
using JetBrains.Annotations;
using LocalizationManager;
using LocationManager;
using Microsoft.CodeAnalysis;
using SoftReferenceableAssets;
using TMPro;
using UnityEngine;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.Converters;
using YamlDotNet.Serialization.EventEmitters;
using YamlDotNet.Serialization.NamingConventions;
using YamlDotNet.Serialization.NodeDeserializers;
using YamlDotNet.Serialization.NodeTypeResolvers;
using YamlDotNet.Serialization.ObjectFactories;
using YamlDotNet.Serialization.ObjectGraphTraversalStrategies;
using YamlDotNet.Serialization.ObjectGraphVisitors;
using YamlDotNet.Serialization.Schemas;
using YamlDotNet.Serialization.TypeInspectors;
using YamlDotNet.Serialization.TypeResolvers;
using YamlDotNet.Serialization.Utilities;
using YamlDotNet.Serialization.ValueDeserializers;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: Guid("150BFDAF-FF35-4302-B7CC-BEDCE69118D5")]
[assembly: ComVisible(false)]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyProduct("MonsterLabZ")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("https://valheim.thunderstore.io/package/MonsterLabZ/MonsterLabZ")]
[assembly: AssemblyTitle("MonsterLabZ")]
[assembly: AssemblyFileVersion("3.0.11")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.11.0")]
[module: UnverifiableCode]
namespace MonsterLabZ
{
	public class Ship : MonoBehaviour
	{
		public enum Speed
		{
			Stop,
			Back,
			Slow,
			Half,
			Full
		}

		private bool m_forwardPressed;

		private bool m_backwardPressed;

		private float m_sendRudderTime;

		private Vector3 windChangeVelocity = Vector3.zero;

		private bool sailWasInPosition;

		[Header("Objects")]
		public GameObject m_sailObject;

		public GameObject m_mastObject;

		public GameObject m_rudderObject;

		public ShipControlls m_shipControlls;

		public Transform m_controlGuiPos;

		[Header("Misc")]
		public BoxCollider m_floatCollider;

		public float m_waterLevelOffset;

		public float m_forceDistance = 1f;

		public float m_force = 0.5f;

		public float m_damping = 0.05f;

		public float m_dampingSideway = 0.05f;

		public float m_dampingForward = 0.01f;

		public float m_angularDamping = 0.01f;

		public float m_disableLevel = -0.5f;

		public float m_sailForceOffset;

		public float m_sailForceFactor = 0.1f;

		public float m_rudderSpeed = 0.5f;

		public float m_stearForceOffset = -10f;

		public float m_stearForce = 0.5f;

		public float m_stearVelForceFactor = 0.1f;

		public float m_backwardForce = 50f;

		public float m_rudderRotationMax = 30f;

		public float m_rudderRotationSpeed = 30f;

		public float m_minWaterImpactForce = 2.5f;

		public float m_minWaterImpactInterval = 2f;

		public float m_waterImpactDamage = 10f;

		public float m_upsideDownDmgInterval = 1f;

		public float m_upsideDownDmg = 20f;

		public EffectList m_waterImpactEffect = new EffectList();

		private Speed m_speed;

		private float m_rudder;

		private float m_rudderValue;

		private Vector3 m_sailForce = Vector3.zero;

		private List<BaseAI> m_players = new List<BaseAI>();

		private static List<Ship> m_currentShips = new List<Ship>();

		private Rigidbody m_body;

		private ZNetView m_nview;

		private Cloth m_sailCloth;

		private float m_lastDepth = -9999f;

		private float m_lastWaterImpactTime;

		private float m_upsideDownDmgTimer;

		private float m_rudderPaddleTimer;

		private void Awake()
		{
			m_nview = ((Component)this).GetComponent<ZNetView>();
			m_body = ((Component)this).GetComponent<Rigidbody>();
			Humanoid component = ((Component)this).GetComponent<Humanoid>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Humanoid val = component;
				((Character)val).m_onDeath = (Action)Delegate.Combine(((Character)val).m_onDeath, new Action(OnDestroyed));
			}
			if (m_nview.GetZDO() == null)
			{
				((Behaviour)this).enabled = false;
			}
			m_body.maxDepenetrationVelocity = 2f;
			Heightmap.ForceGenerateAll();
			m_sailCloth = m_sailObject.GetComponentInChildren<Cloth>();
		}

		public bool CanBeRemoved()
		{
			return m_players.Count > 0;
		}

		private void Start()
		{
			m_nview.Register("Stop", (Action<long>)RPC_Stop);
			m_nview.Register("Forward", (Action<long>)RPC_Forward);
			m_nview.Register("Backward", (Action<long>)RPC_Backward);
			m_nview.Register<float>("Rudder", (Action<long, float>)RPC_Rudder);
			((MonoBehaviour)this).InvokeRepeating("UpdateOwner", 2f, 2f);
		}

		private void PrintStats()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (m_players.Count != 0)
			{
				Vector3 velocity = m_body.velocity;
				ZLog.Log((object)("Vel:" + ((Vector3)(ref velocity)).magnitude.ToString("0.0")));
			}
		}

		public void ApplyControlls(Vector3 dir)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			bool flag = (double)dir.z > 0.5;
			bool flag2 = (double)dir.z < -0.5;
			if (flag && !m_forwardPressed)
			{
				Forward();
			}
			if (flag2 && !m_backwardPressed)
			{
				Backward();
			}
			float fixedDeltaTime = Time.fixedDeltaTime;
			float num = Mathf.Lerp(0.5f, 1f, Mathf.Abs(m_rudderValue));
			m_rudder = dir.x * num;
			m_rudderValue += m_rudder * m_rudderSpeed * fixedDeltaTime;
			m_rudderValue = Mathf.Clamp(m_rudderValue, -1f, 1f);
			if ((double)Time.time - (double)m_sendRudderTime > 0.20000000298023224)
			{
				m_sendRudderTime = Time.time;
				m_nview.InvokeRPC("Rudder", new object[1] { m_rudderValue });
			}
			m_forwardPressed = flag;
			m_backwardPressed = flag2;
		}

		public void Forward()
		{
			m_nview.InvokeRPC("Forward", Array.Empty<object>());
		}

		public void Backward()
		{
			m_nview.InvokeRPC("Backward", Array.Empty<object>());
		}

		public void Rudder(float rudder)
		{
			((MonoBehaviour)m_nview).Invoke("Rudder", rudder);
		}

		private void RPC_Rudder(long sender, float value)
		{
			m_rudderValue = value;
		}

		public void Stop()
		{
			m_nview.InvokeRPC("Stop", Array.Empty<object>());
		}

		private void RPC_Stop(long sender)
		{
			m_speed = Speed.Stop;
		}

		private void RPC_Forward(long sender)
		{
			switch (m_speed)
			{
			case Speed.Stop:
				m_speed = Speed.Slow;
				break;
			case Speed.Back:
				m_speed = Speed.Stop;
				break;
			case Speed.Slow:
				m_speed = Speed.Half;
				break;
			case Speed.Half:
				m_speed = Speed.Full;
				break;
			}
		}

		private void RPC_Backward(long sender)
		{
			switch (m_speed)
			{
			case Speed.Stop:
				m_speed = Speed.Back;
				break;
			case Speed.Slow:
				m_speed = Speed.Stop;
				break;
			case Speed.Half:
				m_speed = Speed.Slow;
				break;
			case Speed.Full:
				m_speed = Speed.Half;
				break;
			case Speed.Back:
				break;
			}
		}

		private void FixedUpdate()
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: 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_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: 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_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0478: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0503: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_05aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_060e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0615: Unknown result type (might be due to invalid IL or missing references)
			//IL_061c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0621: Unknown result type (might be due to invalid IL or missing references)
			//IL_066a: Unknown result type (might be due to invalid IL or missing references)
			//IL_066f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0676: Unknown result type (might be due to invalid IL or missing references)
			//IL_0681: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_0698: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0716: Unknown result type (might be due to invalid IL or missing references)
			//IL_071e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0723: Unknown result type (might be due to invalid IL or missing references)
			//IL_072e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0744: Unknown result type (might be due to invalid IL or missing references)
			//IL_0749: Unknown result type (might be due to invalid IL or missing references)
			//IL_074e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0752: Unknown result type (might be due to invalid IL or missing references)
			//IL_075a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0765: Unknown result type (might be due to invalid IL or missing references)
			//IL_077b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0780: Unknown result type (might be due to invalid IL or missing references)
			//IL_0785: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_07db: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ec: Unknown result type (might be due to invalid IL or missing references)
			UpdateControlls(Time.fixedDeltaTime);
			UpdateSail(Time.fixedDeltaTime);
			if (Object.op_Implicit((Object)(object)m_nview) && !m_nview.IsOwner())
			{
				return;
			}
			UpdateUpsideDmg(Time.fixedDeltaTime);
			if (m_players.Count == 0)
			{
				m_speed = Speed.Full;
				m_rudderValue = 0f;
			}
			float num = 1f;
			Vector3 worldCenterOfMass = m_body.worldCenterOfMass;
			Vector3 val = ((Component)m_floatCollider).transform.position + ((Component)m_floatCollider).transform.forward * m_floatCollider.size.z / 2f;
			Vector3 val2 = ((Component)m_floatCollider).transform.position - ((Component)m_floatCollider).transform.forward * m_floatCollider.size.z / 2f;
			Vector3 val3 = ((Component)m_floatCollider).transform.position - ((Component)m_floatCollider).transform.right * m_floatCollider.size.x / 2f;
			Vector3 val4 = ((Component)m_floatCollider).transform.position + ((Component)m_floatCollider).transform.right * m_floatCollider.size.x / 2f;
			double num2 = Floating.GetLiquidLevel(worldCenterOfMass, num, (LiquidType)10);
			float liquidLevel = Floating.GetLiquidLevel(val3, num, (LiquidType)10);
			float liquidLevel2 = Floating.GetLiquidLevel(val4, num, (LiquidType)10);
			float liquidLevel3 = Floating.GetLiquidLevel(val, num, (LiquidType)10);
			float liquidLevel4 = Floating.GetLiquidLevel(val2, num, (LiquidType)10);
			double num3 = liquidLevel;
			float num4 = (float)((num2 + num3 + (double)liquidLevel2 + (double)liquidLevel3 + (double)liquidLevel4) / 5.0);
			float num5 = worldCenterOfMass.y - num4 - m_waterLevelOffset;
			if (!((double)num5 > (double)m_disableLevel))
			{
				m_body.WakeUp();
				UpdateWaterForce(num5, Time.fixedDeltaTime);
				Vector3 val5 = default(Vector3);
				((Vector3)(ref val5))..ctor(val3.x, liquidLevel, val3.z);
				Vector3 val6 = default(Vector3);
				((Vector3)(ref val6))..ctor(val4.x, liquidLevel2, val4.z);
				Vector3 val7 = default(Vector3);
				((Vector3)(ref val7))..ctor(val.x, liquidLevel3, val.z);
				Vector3 val8 = default(Vector3);
				((Vector3)(ref val8))..ctor(val2.x, liquidLevel4, val2.z);
				float fixedDeltaTime = Time.fixedDeltaTime;
				float num6 = fixedDeltaTime * 50f;
				float num7 = Mathf.Clamp01(Mathf.Abs(num5) / m_forceDistance);
				m_body.AddForceAtPosition(Vector3.up * m_force * num7 * num6, worldCenterOfMass, (ForceMode)2);
				float num8 = Vector3.Dot(m_body.velocity, ((Component)this).transform.forward);
				float num9 = Vector3.Dot(m_body.velocity, ((Component)this).transform.right);
				Vector3 velocity = m_body.velocity;
				float num10 = velocity.y * velocity.y * Mathf.Sign(velocity.y) * m_damping * num7;
				float num11 = num8 * num8 * Mathf.Sign(num8) * m_dampingForward * num7;
				float num12 = num9 * num9 * Mathf.Sign(num9) * m_dampingSideway * num7;
				velocity.y -= Mathf.Clamp(num10, -1f, 1f);
				Vector3 velocity2 = velocity - ((Component)this).transform.forward * Mathf.Clamp(num11, -1f, 1f) - ((Component)this).transform.right * Mathf.Clamp(num12, -1f, 1f);
				double num13 = ((Vector3)(ref velocity2)).magnitude;
				Vector3 velocity3 = m_body.velocity;
				if (num13 > (double)((Vector3)(ref velocity3)).magnitude)
				{
					Vector3 normalized = ((Vector3)(ref velocity2)).normalized;
					velocity3 = m_body.velocity;
					velocity2 = normalized * ((Vector3)(ref velocity3)).magnitude;
				}
				if (m_players.Count < 0)
				{
					velocity2.x *= 0.1f;
					velocity2.z *= 0.1f;
				}
				m_body.velocity = velocity2;
				Rigidbody body = m_body;
				body.angularVelocity -= m_body.angularVelocity * m_angularDamping * num7;
				float num14 = 0.15f;
				float num15 = 0.5f;
				float num16 = Mathf.Clamp((val7.y - val.y) * num14, 0f - num15, num15);
				float num17 = Mathf.Clamp((val8.y - val2.y) * num14, 0f - num15, num15);
				float num18 = Mathf.Clamp((val5.y - val3.y) * num14, 0f - num15, num15);
				float num19 = Mathf.Clamp((val6.y - val4.y) * num14, 0f - num15, num15);
				float num20 = Mathf.Sign(num16) * Mathf.Abs(Mathf.Pow(num16, 2f));
				float num21 = Mathf.Sign(num17) * Mathf.Abs(Mathf.Pow(num17, 2f));
				float num22 = Mathf.Sign(num18) * Mathf.Abs(Mathf.Pow(num18, 2f));
				float num23 = Mathf.Sign(num19) * Mathf.Abs(Mathf.Pow(num19, 2f));
				m_body.AddForceAtPosition(Vector3.up * num20 * num6, val, (ForceMode)2);
				m_body.AddForceAtPosition(Vector3.up * num21 * num6, val2, (ForceMode)2);
				m_body.AddForceAtPosition(Vector3.up * num22 * num6, val3, (ForceMode)2);
				m_body.AddForceAtPosition(Vector3.up * num23 * num6, val4, (ForceMode)2);
				float sailSize = 0f;
				if (m_speed == Speed.Full)
				{
					sailSize = 1f;
				}
				else if (m_speed == Speed.Half)
				{
					sailSize = 0.5f;
				}
				m_body.AddForceAtPosition(GetSailForce(sailSize, fixedDeltaTime), worldCenterOfMass + ((Component)this).transform.up * m_sailForceOffset, (ForceMode)2);
				Vector3 val9 = ((Component)this).transform.position + ((Component)this).transform.forward * m_stearForceOffset;
				m_body.AddForceAtPosition(((Component)this).transform.right * (num8 * m_stearVelForceFactor) * (0f - m_rudderValue) * fixedDeltaTime, val9, (ForceMode)2);
				Vector3 val10 = Vector3.zero;
				switch (m_speed)
				{
				case Speed.Back:
					val10 += -((Component)this).transform.forward * m_backwardForce * (1f - Mathf.Abs(m_rudderValue));
					break;
				case Speed.Slow:
					val10 += ((Component)this).transform.forward * m_backwardForce * (1f - Mathf.Abs(m_rudderValue));
					break;
				}
				if (m_speed == Speed.Back || m_speed == Speed.Slow)
				{
					float num24 = ((m_speed == Speed.Back) ? (-1f) : 1f);
					val10 += ((Component)this).transform.right * m_stearForce * (0f - m_rudderValue) * num24;
				}
				m_body.AddForceAtPosition(val10 * fixedDeltaTime, val9, (ForceMode)2);
				ApplyEdgeForce(Time.fixedDeltaTime);
			}
		}

		private void UpdateUpsideDmg(float dt)
		{
			//IL_0007: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			if ((double)((Component)this).transform.up.y >= 0.0)
			{
				return;
			}
			m_upsideDownDmgTimer += dt;
			if (!((double)m_upsideDownDmgTimer <= (double)m_upsideDownDmgInterval))
			{
				m_upsideDownDmgTimer = 0f;
				IDestructible component = ((Component)this).GetComponent<IDestructible>();
				if (component != null)
				{
					component.Damage(new HitData
					{
						m_damage = 
						{
							m_blunt = m_upsideDownDmg
						},
						m_point = ((Component)this).transform.position,
						m_dir = Vector3.up
					});
				}
			}
		}

		private Vector3 GetSailForce(float sailSize, float dt)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			Vector3 windDir = EnvMan.instance.GetWindDir();
			float num = Mathf.Lerp(0.25f, 1f, EnvMan.instance.GetWindIntensity());
			float num2 = GetWindAngleFactor() * num;
			Vector3 forward = ((Component)this).transform.forward;
			m_sailForce = Vector3.SmoothDamp(m_sailForce, Vector3.Normalize(windDir + forward) * num2 * m_sailForceFactor * sailSize, ref windChangeVelocity, 1f, 99f);
			return m_sailForce;
		}

		public float GetWindAngleFactor()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			float num = Vector3.Dot(EnvMan.instance.GetWindDir(), -((Component)this).transform.forward);
			return Mathf.Lerp(0.7f, 1f, 1f - Mathf.Abs(num)) * (1f - Utils.LerpStep(0.75f, 0.8f, num));
		}

		private void UpdateWaterForce(float depth, float dt)
		{
			//IL_009c: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			if ((double)m_lastDepth == -9999.0)
			{
				m_lastDepth = depth;
				return;
			}
			double num = (double)depth - (double)m_lastDepth;
			m_lastDepth = depth;
			double num2 = dt;
			float num3 = (float)(num / num2);
			if ((double)num3 > 0.0 || (double)Mathf.Abs(num3) <= (double)m_minWaterImpactForce || (double)Time.time - (double)m_lastWaterImpactTime <= (double)m_minWaterImpactInterval)
			{
				return;
			}
			m_lastWaterImpactTime = Time.time;
			m_waterImpactEffect.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1);
			if (m_players.Count > 0)
			{
				IDestructible component = ((Component)this).GetComponent<IDestructible>();
				if (component != null)
				{
					component.Damage(new HitData
					{
						m_damage = 
						{
							m_blunt = m_waterImpactDamage
						},
						m_point = ((Component)this).transform.position,
						m_dir = Vector3.up
					});
				}
			}
		}

		private void ApplyEdgeForce(float dt)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)this).transform.position;
			float magnitude = ((Vector3)(ref position)).magnitude;
			float num = 10420f;
			if (!((double)magnitude <= (double)num))
			{
				m_body.AddForce(Vector3.Normalize(((Component)this).transform.position) * (Utils.LerpStep(num, 10500f, magnitude) * 8f) * dt, (ForceMode)2);
			}
		}

		private void FixTilt()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Asin(((Component)this).transform.right.y);
			float num2 = Mathf.Asin(((Component)this).transform.forward.y);
			if ((double)Mathf.Abs(num) > 0.5235987901687622)
			{
				if ((double)num > 0.0)
				{
					((Component)this).transform.RotateAround(((Component)this).transform.position, ((Component)this).transform.forward, (float)((0.0 - (double)Time.fixedDeltaTime) * 20.0));
				}
				else
				{
					((Component)this).transform.RotateAround(((Component)this).transform.position, ((Component)this).transform.forward, Time.fixedDeltaTime * 20f);
				}
			}
			if (!((double)Mathf.Abs(num2) <= 0.5235987901687622))
			{
				if ((double)num2 > 0.0)
				{
					((Component)this).transform.RotateAround(((Component)this).transform.position, ((Component)this).transform.right, (float)((0.0 - (double)Time.fixedDeltaTime) * 20.0));
				}
				else
				{
					((Component)this).transform.RotateAround(((Component)this).transform.position, ((Component)this).transform.right, Time.fixedDeltaTime * 20f);
				}
			}
		}

		private void UpdateControlls(float dt)
		{
			if (m_nview.IsOwner())
			{
				m_nview.GetZDO().Set("forward", (int)m_speed);
				m_nview.GetZDO().Set("rudder", m_rudderValue);
				return;
			}
			m_speed = (Speed)m_nview.GetZDO().GetInt("forward", 0);
			if (!((double)Time.time - (double)m_sendRudderTime <= 1.0))
			{
				m_rudderValue = m_nview.GetZDO().GetFloat("rudder", 0f);
			}
		}

		public bool IsSailUp()
		{
			return m_speed == Speed.Half || m_speed == Speed.Full;
		}

		private void UpdateSail(float dt)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			UpdateSailSize(dt);
			Vector3 val = Vector3.Cross(Vector3.Cross(EnvMan.instance.GetWindDir(), ((Component)this).transform.up), ((Component)this).transform.up);
			if (m_speed == Speed.Full || m_speed == Speed.Half)
			{
				float num = (float)(0.5 + (double)Vector3.Dot(((Component)this).transform.forward, val) * 0.5);
				m_mastObject.transform.rotation = Quaternion.RotateTowards(m_mastObject.transform.rotation, Quaternion.LookRotation(-Vector3.Lerp(val, Vector3.Normalize(val - ((Component)this).transform.forward), num), ((Component)this).transform.up), 30f * dt);
			}
			else if (m_speed == Speed.Back)
			{
				m_mastObject.transform.rotation = Quaternion.RotateTowards(m_mastObject.transform.rotation, Quaternion.RotateTowards(Quaternion.LookRotation(-((Component)this).transform.forward, ((Component)this).transform.up), Quaternion.LookRotation(-val, ((Component)this).transform.up), 80f), 30f * dt);
			}
		}

		private void UpdateRudder(float dt, bool HasPlayerOnboard)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)m_rudderObject))
			{
				return;
			}
			Quaternion val = Quaternion.Euler(0f, m_rudderRotationMax * (0f - m_rudderValue), 0f);
			if (HasPlayerOnboard)
			{
				if (m_speed == Speed.Full)
				{
					m_rudderPaddleTimer += dt;
					val *= Quaternion.Euler(0f, Mathf.Sin(m_rudderPaddleTimer * 6f) * 20f, 0f);
				}
				else if (m_speed == Speed.Back)
				{
					m_rudderPaddleTimer += dt;
					val *= Quaternion.Euler(0f, Mathf.Sin(m_rudderPaddleTimer * -3f) * 40f, 0f);
				}
			}
			m_rudderObject.transform.localRotation = Quaternion.Slerp(m_rudderObject.transform.localRotation, val, 0.5f);
		}

		private void UpdateSailSize(float dt)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			switch (m_speed)
			{
			case Speed.Stop:
				num = 0.1f;
				break;
			case Speed.Back:
				num = 0.1f;
				break;
			case Speed.Slow:
				num = 0.1f;
				break;
			case Speed.Half:
				num = 0.5f;
				break;
			case Speed.Full:
				num = 1f;
				break;
			}
			Vector3 localScale = m_sailObject.transform.localScale;
			bool flag = (double)Mathf.Abs(localScale.y - num) < 0.009999999776482582;
			if (!flag)
			{
				localScale.y = Mathf.MoveTowards(localScale.y, num, dt);
				m_sailObject.transform.localScale = localScale;
			}
			if (Object.op_Implicit((Object)(object)m_sailCloth))
			{
				if (m_speed == Speed.Stop || m_speed == Speed.Slow || m_speed == Speed.Back)
				{
					if (flag && m_sailCloth.enabled)
					{
						m_sailCloth.enabled = false;
					}
				}
				else if (flag)
				{
					if (!sailWasInPosition)
					{
						m_sailCloth.enabled = false;
						m_sailCloth.enabled = true;
					}
				}
				else
				{
					m_sailCloth.enabled = true;
				}
			}
			sailWasInPosition = flag;
		}

		private void OnTriggerEnter(Collider collider)
		{
			BaseAI component = ((Component)collider).GetComponent<BaseAI>();
			if (Object.op_Implicit((Object)(object)component))
			{
				m_players.Add(component);
				if ((Object)(object)component == (Object)(object)((Component)this).gameObject.GetComponent<BaseAI>())
				{
					m_currentShips.Add(this);
				}
			}
		}

		private void OnTriggerExit(Collider collider)
		{
			BaseAI component = ((Component)collider).GetComponent<BaseAI>();
			if (Object.op_Implicit((Object)(object)component))
			{
				m_players.Remove(component);
				if ((Object)(object)component == (Object)(object)((Component)this).gameObject.GetComponent<Humanoid>())
				{
					m_currentShips.Remove(this);
				}
			}
		}

		public bool IsPlayerInBoat(BaseAI baseAI)
		{
			return m_players.Contains(baseAI);
		}

		public bool HasPlayerOnboard()
		{
			return m_players.Count > 0;
		}

		private void OnDestroyed()
		{
			if (m_nview.IsValid() && m_nview.IsOwner())
			{
				m_currentShips.Remove(this);
			}
		}

		public static Ship GetLocalShip()
		{
			return (m_currentShips.Count != 0) ? m_currentShips[m_currentShips.Count - 1] : null;
		}

		public bool HaveControllingPlayer()
		{
			return m_players.Count != 0 && m_shipControlls.HaveValidUser();
		}

		public bool IsOwner()
		{
			return m_nview.IsValid() && m_nview.IsOwner();
		}

		public float GetSpeed()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			return Vector3.Dot(m_body.velocity, ((Component)this).transform.forward);
		}

		public Speed GetSpeedSetting()
		{
			return m_speed;
		}

		public float GetRudder()
		{
			return m_rudder;
		}

		public float GetRudderValue()
		{
			return m_rudderValue;
		}

		public float GetShipYawAngle()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			Camera mainCamera = Utils.GetMainCamera();
			return ((Object)(object)mainCamera == (Object)null) ? 0f : (0f - Utils.YawFromDirection(((Component)mainCamera).transform.InverseTransformDirection(((Component)this).transform.forward)));
		}

		public float GetWindAngle()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			return 0f - Utils.YawFromDirection(((Component)this).transform.InverseTransformDirection(EnvMan.instance.GetWindDir()));
		}

		private void OnDrawGizmosSelected()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_0064: 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)
			Gizmos.color = Color.red;
			Gizmos.DrawWireSphere(((Component)this).transform.position + ((Component)this).transform.forward * m_stearForceOffset, 0.25f);
			Gizmos.color = Color.yellow;
			Gizmos.DrawWireSphere(((Component)this).transform.position + ((Component)this).transform.up * m_sailForceOffset, 0.25f);
		}
	}
	public class AIShipEffects : MonoBehaviour
	{
		public Transform m_shadow;

		public float m_offset = 0.01f;

		public float m_minimumWakeVel = 5f;

		public GameObject m_speedWakeRoot;

		public GameObject m_wakeSoundRoot;

		public GameObject m_inWaterSoundRoot;

		public float m_audioFadeDuration = 2f;

		public AudioSource m_sailSound;

		public float m_sailFadeDuration = 1f;

		public GameObject m_splashEffects;

		private float m_sailBaseVol = 1f;

		private ParticleSystem[] m_wakeParticles;

		private List<KeyValuePair<AudioSource, float>> m_wakeSounds = new List<KeyValuePair<AudioSource, float>>();

		private List<KeyValuePair<AudioSource, float>> m_inWaterSounds = new List<KeyValuePair<AudioSource, float>>();

		private Rigidbody m_body;

		private Ship m_ship;

		private void Awake()
		{
			ZNetView componentInParent = ((Component)this).GetComponentInParent<ZNetView>();
			if (Object.op_Implicit((Object)(object)componentInParent) && componentInParent.GetZDO() == null)
			{
				((Behaviour)this).enabled = false;
				return;
			}
			m_body = ((Component)this).GetComponentInParent<Rigidbody>();
			m_ship = ((Component)this).GetComponentInParent<Ship>();
			if (Object.op_Implicit((Object)(object)m_speedWakeRoot))
			{
				m_wakeParticles = m_speedWakeRoot.GetComponentsInChildren<ParticleSystem>();
			}
			if (Object.op_Implicit((Object)(object)m_wakeSoundRoot))
			{
				AudioSource[] componentsInChildren = m_wakeSoundRoot.GetComponentsInChildren<AudioSource>();
				foreach (AudioSource val in componentsInChildren)
				{
					val.pitch = Random.Range(0.9f, 1.1f);
					m_wakeSounds.Add(new KeyValuePair<AudioSource, float>(val, val.volume));
				}
			}
			if (Object.op_Implicit((Object)(object)m_inWaterSoundRoot))
			{
				AudioSource[] componentsInChildren2 = m_inWaterSoundRoot.GetComponentsInChildren<AudioSource>();
				foreach (AudioSource val2 in componentsInChildren2)
				{
					val2.pitch = Random.Range(0.9f, 1.1f);
					m_inWaterSounds.Add(new KeyValuePair<AudioSource, float>(val2, val2.volume));
				}
			}
			if (Object.op_Implicit((Object)(object)m_sailSound))
			{
				m_sailBaseVol = m_sailSound.volume;
				m_sailSound.pitch = Random.Range(0.9f, 1.1f);
			}
		}

		private void LateUpdate()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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)
			float liquidLevel = Floating.GetLiquidLevel(((Component)this).transform.position, 1f, (LiquidType)10);
			Vector3 position = ((Component)this).transform.position;
			float deltaTime = Time.deltaTime;
			if ((double)position.y > (double)liquidLevel)
			{
				SetWake(enabled: false, deltaTime);
				FadeSounds(m_inWaterSounds, enabled: false, deltaTime);
				return;
			}
			Vector3 velocity = m_body.velocity;
			bool enabled = (double)((Vector3)(ref velocity)).magnitude > (double)m_minimumWakeVel;
			FadeSounds(m_inWaterSounds, enabled: true, deltaTime);
			SetWake(enabled, deltaTime);
			if (Object.op_Implicit((Object)(object)m_sailSound))
			{
				FadeSound(m_sailSound, m_ship.IsSailUp() ? m_sailBaseVol : 0f, m_sailFadeDuration, deltaTime);
			}
		}

		private void SetWake(bool enabled, float dt)
		{
			//IL_0013: 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)
			ParticleSystem[] wakeParticles = m_wakeParticles;
			foreach (ParticleSystem val in wakeParticles)
			{
				EmissionModule emission = val.emission;
				((EmissionModule)(ref emission)).enabled = enabled;
			}
			FadeSounds(m_wakeSounds, enabled, dt);
		}

		private void FadeSounds(List<KeyValuePair<AudioSource, float>> sources, bool enabled, float dt)
		{
			foreach (KeyValuePair<AudioSource, float> source in sources)
			{
				if (enabled)
				{
					FadeSound(source.Key, source.Value, m_audioFadeDuration, dt);
				}
				else
				{
					FadeSound(source.Key, 0f, m_audioFadeDuration, dt);
				}
			}
		}

		private void FadeSound(AudioSource source, float target, float fadeDuration, float dt)
		{
			float num = dt / fadeDuration;
			if ((double)target > 0.0)
			{
				if (!source.isPlaying)
				{
					source.Play();
				}
				source.volume = Mathf.MoveTowards(source.volume, target, num);
			}
			else if (source.isPlaying)
			{
				source.volume = Mathf.MoveTowards(source.volume, 0f, num);
				if (!((double)source.volume > 0.0))
				{
					source.Stop();
				}
			}
		}
	}
	public static class CommonResources
	{
		public static GameObject DwarfGoblinSpear;

		public static ItemData DwarfGoblinSpearData;

		public static void FindCommonResources()
		{
			DwarfGoblinSpear = ZNetScene.instance?.m_prefabs.Where((GameObject p) => ((Object)p).name == "DwarfGoblinSpear").FirstOrDefault();
			GameObject dwarfGoblinSpear = DwarfGoblinSpear;
			DwarfGoblinSpearData = ((dwarfGoblinSpear != null) ? dwarfGoblinSpear.GetComponent<ItemDrop>().m_itemData : null);
		}
	}
	public class AmbienceSpawn : MonoBehaviour
	{
		private const float m_minPlayerDistance = 250f;

		private const float m_blockedMinTime = 4f;

		public GameObject m_AmbientPrefab;

		public float m_interval = 0.5f;

		private float m_lastSpawnTime;

		private float m_time;

		private void Start()
		{
			m_time = Random.Range(0f, m_interval);
		}

		private void Update()
		{
			m_time += Time.deltaTime;
			if (!((double)m_time <= (double)m_interval))
			{
				m_time = 0f;
				Spawn();
			}
		}

		private void Spawn()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer == (Object)null || (double)Vector3.Distance(((Component)localPlayer).transform.position, ((Component)this).transform.position) > 250.0)
			{
				m_lastSpawnTime = Time.time;
				return;
			}
			Object.Instantiate<GameObject>(m_AmbientPrefab, ((Component)this).transform.position, ((Component)this).transform.rotation);
			m_lastSpawnTime = Time.time;
		}
	}
	public class BillboardMove : MonoBehaviour
	{
		public float scrollSpeed = 0.5f;

		public Renderer rend;

		private void Start()
		{
			rend = ((Component)this).GetComponent<Renderer>();
		}

		private void Update()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			rend.material.SetTextureOffset("_MainTex", new Vector2(Time.time * scrollSpeed, 0f));
		}
	}
	public class RotateTor : MonoBehaviour
	{
		public float TorRotationSpeed;

		private void Update()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			Quaternion val = Quaternion.AngleAxis(TorRotationSpeed * Time.deltaTime, Vector3.down);
			Quaternion val2 = Quaternion.AngleAxis(TorRotationSpeed * Time.deltaTime, Vector3.down);
			Transform transform = ((Component)this).transform;
			transform.rotation *= val;
			Transform transform2 = ((Component)this).transform;
			transform2.rotation *= val2;
		}
	}
	public class RotateTor1 : MonoBehaviour
	{
		public float TorRotationSpeed;

		private void Update()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			Quaternion val = Quaternion.AngleAxis(TorRotationSpeed * Time.deltaTime, Vector3.down);
			Quaternion val2 = Quaternion.AngleAxis(TorRotationSpeed * Time.deltaTime, Vector3.down);
			Transform transform = ((Component)this).transform;
			transform.rotation *= val;
			Transform transform2 = ((Component)this).transform;
			transform2.rotation *= val2;
		}
	}
	public class SetTextureOffset : MonoBehaviour
	{
		public Vector2 offsetValue;

		public Renderer rend;

		private void Start()
		{
			rend = ((Component)this).GetComponent<Renderer>();
			((MonoBehaviour)this).StartCoroutine(MoveTheTexture());
		}

		private IEnumerator MoveTheTexture()
		{
			while (true)
			{
				yield return (object)new WaitForSeconds(5f);
				offsetValue = rend.material.GetTextureOffset("_MainTex");
				offsetValue.y += 1f / 3f;
				rend.material.SetTextureOffset("_MainTex", new Vector2(offsetValue.x, offsetValue.y));
			}
		}
	}
	public class TorGravity : MonoBehaviour
	{
		public float ForceGN;

		public float BodyKf;

		private HashSet<Rigidbody> affectedBod = new HashSet<Rigidbody>();

		private Rigidbody componRigidbody;

		private void Start()
		{
			componRigidbody = ((Component)this).GetComponent<Rigidbody>();
		}

		private void OnTriggerEnter(Collider other)
		{
			if ((Object)(object)other.attachedRigidbody != (Object)null)
			{
				affectedBod.Add(other.attachedRigidbody);
			}
		}

		private void OnTriggerExit(Collider other)
		{
			if ((Object)(object)other.attachedRigidbody != (Object)null)
			{
				affectedBod.Remove(other.attachedRigidbody);
			}
		}

		private void FixedUpdate()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			foreach (Rigidbody item in affectedBod)
			{
				Vector3 val = ((Component)this).transform.position - item.position;
				Vector3 val2 = ((Component)this).transform.position - item.position;
				float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
				float num = ForceGN * (item.mass - componRigidbody.mass) / sqrMagnitude;
				item.AddForce(val * num * BodyKf);
			}
		}
	}
	public class TornadoGravity : MonoBehaviour
	{
		public float ForceG;

		public float BodyKoeff;

		public float OrbitSpeed;

		private HashSet<Rigidbody> affectedBodies = new HashSet<Rigidbody>();

		private Rigidbody componentRigidbody;

		private void Start()
		{
			componentRigidbody = ((Component)this).GetComponent<Rigidbody>();
		}

		private void OnTriggerEnter(Collider other)
		{
			if ((Object)(object)other.attachedRigidbody != (Object)null)
			{
				affectedBodies.Add(other.attachedRigidbody);
			}
		}

		private void OnTriggerExit(Collider other)
		{
			if ((Object)(object)other.attachedRigidbody != (Object)null)
			{
				affectedBodies.Remove(other.attachedRigidbody);
			}
		}

		private void FixedUpdate()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			foreach (Rigidbody affectedBody in affectedBodies)
			{
				Vector3 val = ((Component)this).transform.position - affectedBody.position;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				val = ((Component)this).transform.position - affectedBody.position;
				float magnitude = ((Vector3)(ref val)).magnitude;
				float num = (float)((double)ForceG * (double)affectedBody.mass * (double)componentRigidbody.mass / ((double)magnitude * (double)magnitude));
				affectedBody.AddForce(normalized * num * BodyKoeff);
				((Component)affectedBody).transform.RotateAround(Vector3.zero, Vector3.down, (float)(10.0 * (double)OrbitSpeed * 120.0));
			}
		}
	}
	public class WaterSafing : MonoBehaviour
	{
		public float power;

		private void Start()
		{
		}

		private void Update()
		{
		}

		private void OnTriggerStay(Collider col)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)col).tag == "Physical")
			{
				((Component)col).GetComponent<Rigidbody>().AddForce(((Component)this).transform.up * power);
			}
			if (((Component)col).tag == "Player")
			{
				if (Input.GetKey((KeyCode)32))
				{
					((Component)col).GetComponent<CharacterController>().skinWidth = 3f;
				}
				else
				{
					((Component)col).GetComponent<CharacterController>().skinWidth = 0.08f;
				}
			}
		}

		private void OnTriggerExit(Collider col)
		{
			if (((Component)col).tag == "Player")
			{
				((Component)col).GetComponent<CharacterController>().skinWidth = 0.08f;
			}
		}
	}
	public class ML_PlantGrow : SlowUpdate, Hoverable
	{
		public string m_name = "Plant";

		public float m_growTime = 10f;

		public float m_growTimeMax = 2000f;

		public GameObject[] m_grownPrefabs = (GameObject[])(object)new GameObject[0];

		public float m_minScale = 1f;

		public float m_maxScale = 1f;

		public float m_growRadius = 1f;

		public bool m_destroyIfCantGrow;

		[SerializeField]
		private GameObject m_healthy;

		[SerializeField]
		private GameObject m_healthyGrown;

		public EffectList m_growEffect = new EffectList();

		private Status m_status;

		private ZNetView m_nview;

		private float m_updateTime;

		private float m_spawnTime;

		public override void Awake()
		{
			((SlowUpdate)this).Awake();
			m_nview = ((Component)this).gameObject.GetComponent<ZNetView>();
			if (m_nview.GetZDO() != null)
			{
				if (m_nview.IsOwner() && m_nview.GetZDO().GetLong("plantTime", 0L) == 0)
				{
					m_nview.GetZDO().Set("plantTime", ZNet.instance.GetTime().Ticks);
				}
				m_spawnTime = Time.time;
			}
		}

		public string GetHoverText()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return ((int)m_status == 0) ? Localization.instance.Localize(m_name + " ( $piece_plant_healthy )") : "";
		}

		public string GetHoverName()
		{
			return Localization.instance.Localize(m_name);
		}

		private double TimeSincePlanted()
		{
			DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong("plantTime", ZNet.instance.GetTime().Ticks));
			return (ZNet.instance.GetTime() - dateTime).TotalSeconds;
		}

		public virtual void SUpdate()
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Invalid comparison between Unknown and I4
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Invalid comparison between Unknown and I4
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Invalid comparison between Unknown and I4
			if (m_nview.IsValid() && !((double)Time.time - (double)m_updateTime < 10.0))
			{
				m_updateTime = Time.time;
				double num = TimeSincePlanted();
				UpdateHealth(num);
				float growTime = GetGrowTime();
				if (Object.op_Implicit((Object)(object)m_healthyGrown))
				{
					bool flag = num > (double)growTime * 0.5;
					m_healthy.SetActive(!flag && (int)m_status == 0);
					m_healthyGrown.SetActive(flag && (int)m_status == 0);
				}
				else
				{
					m_healthy.SetActive((int)m_status == 0);
				}
				if (m_nview.IsOwner() && !((double)Time.time - (double)m_spawnTime <= 10.0) && !(num <= (double)growTime))
				{
					Grow();
				}
			}
		}

		private float GetGrowTime()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			State state = Random.state;
			float value = Random.value;
			Random.state = state;
			return Mathf.Lerp(m_growTime, m_growTimeMax, value);
		}

		private void Grow()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_005e: 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_006a: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			if ((int)m_status > 0)
			{
				if (m_destroyIfCantGrow)
				{
					Destroy();
				}
				return;
			}
			GameObject val = m_grownPrefabs[Random.Range(0, m_grownPrefabs.Length)];
			Quaternion val2 = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
			Vector3 position = ((Component)this).transform.position;
			Quaternion val3 = val2;
			GameObject val4 = Object.Instantiate<GameObject>(val, position, val3);
			ZNetView component = val4.GetComponent<ZNetView>();
			float num = Random.Range(m_minScale, m_maxScale);
			Vector3 localScale = default(Vector3);
			((Vector3)(ref localScale))..ctor(num, num, num);
			component.SetLocalScale(localScale);
			TreeBase component2 = val4.GetComponent<TreeBase>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.Grow();
			}
			m_nview.Destroy();
			m_growEffect.Create(((Component)this).transform.position, val2, (Transform)null, num, -1);
		}

		private void UpdateHealth(double timeSincePlanted)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (!(timeSincePlanted >= 10.0))
			{
				m_status = (Status)0;
			}
		}

		private void Destroy()
		{
			//IL_0013: 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_002d: Expected O, but got Unknown
			IDestructible component = ((Component)this).GetComponent<IDestructible>();
			if (component != null)
			{
				component.Damage(new HitData
				{
					m_damage = 
					{
						m_damage = 9999f
					}
				});
			}
		}

		private Status GetStatus()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return m_status;
		}
	}
	public class HitAreaSFX : MonoBehaviour, IDestructible
	{
		public Action<HitData, HitAreaSFX> m_onHit;

		public float m_health = 100000f;

		[NonSerialized]
		public GameObject m_parentObject;

		public float m_hitNoise;

		public EffectList m_hitEffect = new EffectList();

		public DestructibleType GetDestructibleType()
		{
			return (DestructibleType)1;
		}

		public void Damage(HitData hit)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			if ((double)hit.GetTotalDamage() <= 0.0)
			{
				return;
			}
			m_hitEffect.Create(hit.m_point, Quaternion.identity, ((Component)this).transform, 1f, -1);
			if ((double)m_hitNoise > 0.0)
			{
				Player closestPlayer = Player.GetClosestPlayer(hit.m_point, 10f);
				if (Object.op_Implicit((Object)(object)closestPlayer))
				{
					((Character)closestPlayer).AddNoise(m_hitNoise);
				}
			}
			if (m_onHit != null)
			{
				m_onHit(hit, this);
			}
		}
	}
	public class InstantiatePrefabBoatKinematic : MonoBehaviour
	{
		public List<GameObject> m_spawnPrefab;

		private List<GameObject> m_spawnedMobs = new List<GameObject>();

		public bool m_attach;

		public bool m_moveToTop;

		public void Start()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			foreach (GameObject item in m_spawnPrefab)
			{
				GameObject val = Object.Instantiate<GameObject>(item, ((Component)((Component)this).transform).transform.position, ((Component)((Component)this).transform).transform.rotation);
				val.transform.SetParent(((Component)this).transform, true);
				m_spawnedMobs.Add(val);
			}
		}

		public void OnDestroy()
		{
			foreach (GameObject spawnedMob in m_spawnedMobs)
			{
				if ((Object)(object)spawnedMob != (Object)null)
				{
					spawnedMob.transform.parent = null;
					spawnedMob.GetComponent<Rigidbody>().isKinematic = false;
				}
			}
		}
	}
	public class InstantiatePrefabBoat : MonoBehaviour
	{
		public List<GameObject> m_spawnPrefab;

		private List<GameObject> m_spawnedMobs = new List<GameObject>();

		public bool m_attach;

		public bool m_moveToTop;

		public void Start()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			ZLog.Log((object)(((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "()"));
			foreach (GameObject item in m_spawnPrefab)
			{
				ZLog.Log((object)("[" + ((object)this).GetType().Name + "] Spawning " + ((Object)item).name));
				GameObject val = Object.Instantiate<GameObject>(item, ((Component)((Component)this).transform).transform.position, ((Component)((Component)this).transform).transform.rotation);
				val.transform.SetParent(((Component)this).transform, true);
				m_spawnedMobs.Add(val);
			}
		}

		public void OnDestroy()
		{
			ZLog.Log((object)(((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "()"));
			foreach (GameObject spawnedMob in m_spawnedMobs)
			{
				if ((Object)(object)spawnedMob != (Object)null)
				{
					ZLog.Log((object)("[" + ((object)this).GetType().Name + "] Reparent " + ((Object)spawnedMob).name));
					spawnedMob.transform.parent = null;
				}
			}
		}
	}
	public class InstantiatePrefabSpawn : MonoBehaviour
	{
		public List<GameObject> m_spawnPrefab;

		private List<GameObject> m_spawnedMobs = new List<GameObject>();

		public bool m_attach;

		public bool m_moveToTop;

		public void Start()
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			ZLog.Log((object)(((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "()"));
			foreach (GameObject item in m_spawnPrefab)
			{
				ZLog.Log((object)("[" + ((object)this).GetType().Name + "] Spawning " + ((Object)item).name));
				GameObject val = Object.Instantiate<GameObject>(item, ((Component)((Component)this).transform).transform.position, ((Component)((Component)this).transform).transform.rotation);
				val.transform.SetParent(((Component)this).transform, true);
				val.layer = 17;
				m_spawnedMobs.Add(val);
			}
		}

		public void OnDestroy()
		{
			ZLog.Log((object)(((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "()"));
			foreach (GameObject spawnedMob in m_spawnedMobs)
			{
				if ((Object)(object)spawnedMob != (Object)null)
				{
					ZLog.Log((object)("[" + ((object)this).GetType().Name + "] Reparent " + ((Object)spawnedMob).name));
					spawnedMob.transform.parent = null;
					spawnedMob.GetComponent<Rigidbody>().isKinematic = false;
					spawnedMob.layer = 9;
					Humanoid component = spawnedMob.GetComponent<Humanoid>();
					if ((Object)(object)component != (Object)null)
					{
						component.m_rightItem = CommonResources.DwarfGoblinSpearData;
						component.m_inventory.m_inventory[0] = CommonResources.DwarfGoblinSpearData;
						((Character)component).m_turnSpeed = 300f;
						((Character)component).m_runTurnSpeed = 100f;
					}
				}
			}
		}
	}
	public class InstantiatePrefabLoxRider : MonoBehaviour
	{
		public List<GameObject> m_spawnPrefab;

		private List<GameObject> m_spawnedMobs = new List<GameObject>();

		public bool m_attach;

		public bool m_moveToTop;

		public void Start()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			foreach (GameObject item in m_spawnPrefab)
			{
				GameObject val = Object.Instantiate<GameObject>(item, ((Component)((Component)this).transform).transform.position, ((Component)((Component)this).transform).transform.rotation);
				val.transform.SetParent(((Component)this).transform, true);
				val.layer = 17;
				m_spawnedMobs.Add(val);
			}
		}

		public void OnDestroy()
		{
			foreach (GameObject spawnedMob in m_spawnedMobs)
			{
				if ((Object)(object)spawnedMob != (Object)null)
				{
					spawnedMob.transform.parent = null;
					spawnedMob.GetComponent<Rigidbody>().isKinematic = false;
					spawnedMob.layer = 9;
					Humanoid component = spawnedMob.GetComponent<Humanoid>();
					if ((Object)(object)component != (Object)null)
					{
						component.m_rightItem = CommonResources.DwarfGoblinSpearData;
						component.m_inventory.m_inventory[0] = CommonResources.DwarfGoblinSpearData;
						((Character)component).m_turnSpeed = 300f;
						((Character)component).m_runTurnSpeed = 100f;
					}
				}
			}
		}
	}
	public static class ML_Sword_Frigga
	{
		public static void init()
		{
			new Item("dybassets", "ML_Sword_Frigga_1").Configurable = Configurability.Disabled;
			new Item("dybassets", "ML_Sword_Spider_L_1").Configurable = Configurability.Disabled;
			new Item("dybassets", "ML_Sword_Spider_R_1").Configurable = Configurability.Disabled;
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spider_1");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spawn_1");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_SpawnP_1");
			new Item("dybassets", "ML_Sword_Frigga_2").Configurable = Configurability.Disabled;
			new Item("dybassets", "ML_Sword_Spider_L_2").Configurable = Configurability.Disabled;
			new Item("dybassets", "ML_Sword_Spider_R_2").Configurable = Configurability.Disabled;
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spider_2");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spawn_2");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_SpawnP_2");
			new Item("dybassets", "ML_Sword_Frigga_3_Cold").Configurable = Configurability.Disabled;
			new Item("dybassets", "ML_Sword_Spider_L_3_Cold").Configurable = Configurability.Disabled;
			new Item("dybassets", "ML_Sword_Spider_R_3_Cold").Configurable = Configurability.Disabled;
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spider_3_Cold");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spawn_3_Cold");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_SpawnP_3_Cold");
			new Item("dybassets", "ML_Sword_Frigga_3_Fire").Configurable = Configurability.Disabled;
			new Item("dybassets", "ML_Sword_Spider_L_3_Fire").Configurable = Configurability.Disabled;
			new Item("dybassets", "ML_Sword_Spider_R_3_Fire").Configurable = Configurability.Disabled;
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spider_3_Fire");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spawn_3_Fire");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_SpawnP_3_Fire");
			new Item("dybassets", "ML_Sword_Frigga_3_Light").Configurable = Configurability.Disabled;
			new Item("dybassets", "ML_Sword_Spider_L_3_Light").Configurable = Configurability.Disabled;
			new Item("dybassets", "ML_Sword_Spider_R_3_Light").Configurable = Configurability.Disabled;
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spider_3_Light");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_Spawn_3_Light");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_Sword_Frigga_SpawnP_3_Light");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_ml_spawn");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_ml_despawn");
		}
	}
	public class OceanLocations
	{
		internal static void LocationsAwake()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			new Location("dybassets", "ML_ShipWreck02")
			{
				MapIcon = "bossicon.png",
				ShowMapIcon = ShowIcon.Never,
				SpawnArea = (BiomeArea)2,
				Biome = (Biome)256,
				SpawnDistance = new LocationManager.Range(50f, 10000f),
				SpawnAltitude = new LocationManager.Range(-1000f, -20f),
				MinimumDistanceFromGroup = 1000f,
				Count = 10,
				Unique = false
			};
			new Location("dybassets", "ML_ShipWreck03")
			{
				MapIcon = "bossicon.png",
				ShowMapIcon = ShowIcon.Never,
				SpawnArea = (BiomeArea)2,
				Biome = (Biome)256,
				SpawnDistance = new LocationManager.Range(50f, 10000f),
				SpawnAltitude = new LocationManager.Range(-1000f, -20f),
				MinimumDistanceFromGroup = 1000f,
				Count = 10,
				Unique = false
			};
			new Location("dybassets", "Balder_Altar")
			{
				Prioritize = true,
				MapIcon = "bossicon.png",
				ShowMapIcon = ShowIcon.Never,
				SpawnArea = (BiomeArea)2,
				Biome = (Biome)256,
				SpawnDistance = new LocationManager.Range(200f, 3000f),
				SpawnAltitude = new LocationManager.Range(-1000f, -25f),
				MinimumDistanceFromGroup = 1000f,
				Count = 1,
				Unique = false
			};
		}
	}
	public class Locations
	{
		internal static void LocationsAwake()
		{
			//IL_0032: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			new Location("dybassets", "AshHuldraQueen_Altar")
			{
				Prioritize = true,
				MapIcon = "bossicon.png",
				ShowMapIcon = ShowIcon.Never,
				Biome = (Biome)32,
				SpawnArea = (BiomeArea)2,
				SpawnDistance = new LocationManager.Range(50f, 10000f),
				SpawnAltitude = new LocationManager.Range(5f, 1000f),
				MinimumDistanceFromGroup = 2000f,
				Count = 1,
				Unique = false
			};
			new Location("dybassets", "AshlandsCave_01")
			{
				Prioritize = true,
				MapIcon = "bossicon.png",
				ShowMapIcon = ShowIcon.Never,
				Biome = (Biome)32,
				SpawnDistance = new LocationManager.Range(500f, 10000f),
				SpawnAltitude = new LocationManager.Range(20f, 1000f),
				MinimumDistanceFromGroup = 2000f,
				Count = 7,
				Unique = false
			};
			new Location("dybassets", "AshlandsCave_02")
			{
				Prioritize = true,
				MapIcon = "bossicon.png",
				ShowMapIcon = ShowIcon.Never,
				Biome = (Biome)32,
				SpawnDistance = new LocationManager.Range(500f, 10000f),
				SpawnAltitude = new LocationManager.Range(20f, 1000f),
				MinimumDistanceFromGroup = 2000f,
				Count = 7,
				Unique = false
			};
			new Location("dybassets", "SpiderCave01")
			{
				Prioritize = true,
				MapIcon = "bossicon.png",
				ShowMapIcon = ShowIcon.Never,
				Biome = (Biome)8,
				SpawnArea = (BiomeArea)3,
				SpawnDistance = new LocationManager.Range(500f, 1000f),
				SpawnAltitude = new LocationManager.Range(5f, 1000f),
				MinimumDistanceFromGroup = 3000f,
				Count = 1,
				Unique = false
			};
			new Location("dybassets", "Mystical_Well0")
			{
				Prioritize = true,
				MapIcon = "ML_Hammer_Icon.png",
				ShowMapIcon = ShowIcon.Always,
				Biome = (Biome)1,
				SpawnDistance = new LocationManager.Range(100f, 500f),
				SpawnAltitude = new LocationManager.Range(10f, 1000f),
				MinimumDistanceFromGroup = 3000f,
				Count = 1,
				Unique = false
			};
		}
	}
	[BepInPlugin("MonsterLabZ", "MonsterLabZ", "3.0.11")]
	public class MonsterLabZ : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		private static class ZNetScene_Awake_PostPatch
		{
			public static void Prefix(ZNetScene __instance)
			{
				ShaderSwapper.GatherCustomShaders(__instance);
			}

			[HarmonyPriority(0)]
			public static void Postfix(ZNetScene __instance)
			{
				if (!((Object)(object)__instance == (Object)null) && !fixedReferences)
				{
					ShaderSwapper.ReplaceCustomShaders();
					CommonResources.FindCommonResources();
					fixedReferences = true;
				}
			}
		}

		public const string ModGUID = "MonsterLabZ";

		public const string ModName = "MonsterLabZ";

		public const string ModVersion = "3.0.11";

		public static ManualLogSource Log;

		private readonly Harmony harmony = new Harmony("MonsterLabZ");

		private static bool fixedReferences;

		public void Awake()
		{
			Localizer.Load();
			Locations.LocationsAwake();
			OceanLocations.LocationsAwake();
			ML_DebugMonsters.init();
			ML_NaturalDisasters.init();
			NPC_Items.init();
			Butterfly.init();
			DeepSea_Serpent.init();
			EvilShadow.init();
			FireGolem.init();
			NormalGhostWarrior.init();
			DwarfGoblin.init();
			GoblinShip.init();
			DraugrShip.init();
			IceGolem.init();
			Kraken.init();
			Molluscan.init();
			NightmareDragon.init();
			NormalSkeleton.init();
			FireSkeleton.init();
			IceSkeleton.init();
			PoisonSkeleton.init();
			Frigga.init();
			Svartalfar.init();
			Succubus.init();
			Surtr.init();
			WraithWarrior.init();
			Spiders.init();
			ObsidianGolem.init();
			ML_Surtling.init();
			NPC_Female.init();
			NPC_Male.init();
			Greydwarf.init();
			ChaosSkeleton.init();
			ML_CustomProps.init();
			ML_Sword_Frigga.init();
			ML_Mistile.init();
			ML_Tentaroot.init();
			ML_Hatchlings.init();
			ML_JellyFish.init();
			harmony.PatchAll();
		}

		private void OnDestroy()
		{
			Harmony obj = harmony;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
		}
	}
	public static class NormalGhostWarrior
	{
		public static void init()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Creature creature = new Creature("dybassets", "NormalGhostWarrior")
			{
				Biome = (Biome)0
			};
			creature.ConfigurationEnabled = false;
			creature.Drops["Ruby"].Amount = new CreatureManager.Range(1f, 1f);
			creature.Drops["Ruby"].DropChance = 100f;
			creature.Drops["Ruby"].DropOnePerPlayer = false;
			creature.Drops["Ruby"].MultiplyDropByLevel = false;
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "GhostWarrior");
			new Item("dybassets", "ghost_poisonball").Configurable = Configurability.Disabled;
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_ghost_poison_explode");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_ghost_poison_start");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_ghostpoison_hit");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_ghost_poison_explosion");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ghost_poisonball_projectile");
		}
	}
	public static class DwarfGoblin
	{
		public static void init()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			Creature creature = new Creature("dybassets", "DwarfGoblin")
			{
				Biome = (Biome)16,
				SpecificSpawnArea = SpawnArea.Everywhere,
				RequiredAltitude = new CreatureManager.Range(1f, 1000f),
				CheckSpawnInterval = 300,
				SpawnChance = 25f,
				GroupSize = new CreatureManager.Range(4f, 5f),
				Maximum = 8,
				SpecificSpawnTime = SpawnTime.Always
			};
			creature.Drops["Coins"].Amount = new CreatureManager.Range(3f, 5f);
			creature.Drops["Coins"].DropChance = 100f;
			creature.Drops["Coins"].DropOnePerPlayer = false;
			creature.Drops["Coins"].MultiplyDropByLevel = true;
			Creature creature2 = new Creature("dybassets", "DwarfGoblinLoot")
			{
				Biome = (Biome)16,
				SpecificSpawnArea = SpawnArea.Everywhere,
				RequiredAltitude = new CreatureManager.Range(1f, 1000f),
				CheckSpawnInterval = 300,
				SpawnChance = 5f,
				GroupSize = new CreatureManager.Range(1f, 1f),
				Maximum = 2,
				SpecificSpawnTime = SpawnTime.Day
			};
			creature2.Drops["Coins"].Amount = new CreatureManager.Range(5f, 8f);
			creature2.Drops["Coins"].DropChance = 100f;
			creature2.Drops["Coins"].DropOnePerPlayer = false;
			creature2.Drops["Coins"].MultiplyDropByLevel = true;
			creature2.Drops["Amber"].Amount = new CreatureManager.Range(2f, 4f);
			creature2.Drops["Amber"].DropChance = 100f;
			creature2.Drops["Amber"].DropOnePerPlayer = false;
			creature2.Drops["Amber"].MultiplyDropByLevel = true;
			creature2.Drops["Ruby"].Amount = new CreatureManager.Range(1f, 3f);
			creature2.Drops["Ruby"].DropChance = 100f;
			creature2.Drops["Ruby"].DropOnePerPlayer = false;
			creature2.Drops["Ruby"].MultiplyDropByLevel = true;
			Creature creature3 = new Creature("dybassets", "DwarfGoblinShaman")
			{
				Biome = (Biome)16,
				SpecificSpawnArea = SpawnArea.Everywhere,
				RequiredAltitude = new CreatureManager.Range(1f, 1000f),
				CheckSpawnInterval = 450,
				SpawnChance = 10f,
				GroupSize = new CreatureManager.Range(1f, 2f),
				Maximum = 2,
				SpecificSpawnTime = SpawnTime.Always
			};
			creature3.Drops["Coins"].Amount = new CreatureManager.Range(4f, 6f);
			creature3.Drops["Coins"].DropChance = 100f;
			creature3.Drops["Coins"].DropOnePerPlayer = false;
			creature3.Drops["Coins"].MultiplyDropByLevel = true;
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "DwarfGoblin_ragdoll");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "DwarfGoblinLoot_ragdoll");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "DwarfGoblinShaman_ragdoll");
			new Item("dybassets", "DwarfGoblinBow").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinPickAxe").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinClub").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinSword").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinTorch").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinShieldBlackMetal").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinShieldWood").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinArmBandFeathers").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinArmBandIron").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinArmorBronze").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinArmorFeathers").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinArmorIron").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinArmorLeather").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinHelmetBronze").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinHelmetLeather").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinHelmetSkull").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinShamanStaffBones").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinShamanStaffFeathers").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinShoulderPadIron").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinShoulderPadLeather").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinSpear").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinSpearLox").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinSpearChitin").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinShamanBoat_attack_fireball").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinShaman_attack_fireball").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinShaman_attack_poke").Configurable = Configurability.Disabled;
			new Item("dybassets", "DwarfGoblinLoot_Run").Configurable = Configurability.Disabled;
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_goblin_loot_alert");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_goblin_loot_die");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_goblin_loot_hit");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_goblin_loot_idle");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_goblin_loot_taunt");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "DwarfGoblinSpear_projectile");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "DwarfGoblinSpearChitin_projectile");
		}
	}
	public static class GoblinLox
	{
		public static void init()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			Creature creature = new Creature("dybassets", "ML_GoblinLox")
			{
				Biome = (Biome)16,
				SpecificSpawnArea = SpawnArea.Edge,
				RequiredAltitude = new CreatureManager.Range(1f, 1000f),
				CheckSpawnInterval = 1000,
				SpawnChance = 5f,
				GroupSize = new CreatureManager.Range(2f, 2f),
				Maximum = 2,
				SpecificSpawnTime = SpawnTime.Always
			};
			creature.Drops["LoxMeat"].Amount = new CreatureManager.Range(4f, 6f);
			creature.Drops["LoxMeat"].DropChance = 100f;
			creature.Drops["LoxMeat"].DropOnePerPlayer = false;
			creature.Drops["LoxMeat"].MultiplyDropByLevel = true;
			creature.Drops["TrophyLox"].Amount = new CreatureManager.Range(1f, 1f);
			creature.Drops["TrophyLox"].DropChance = 10f;
			creature.Drops["TrophyLox"].DropOnePerPlayer = false;
			creature.Drops["TrophyLox"].MultiplyDropByLevel = true;
			creature.Drops["LoxPelt"].Amount = new CreatureManager.Range(2f, 3f);
			creature.Drops["LoxPelt"].DropChance = 100f;
			creature.Drops["LoxPelt"].DropOnePerPlayer = false;
			creature.Drops["LoxPelt"].MultiplyDropByLevel = true;
			Creature creature2 = new Creature("dybassets", "GoblinLoxRider")
			{
				Biome = (Biome)0
			};
			creature2.ConfigurationEnabled = false;
			creature2.Drops["Coins"].Amount = new CreatureManager.Range(3f, 5f);
			creature2.Drops["Coins"].DropChance = 100f;
			creature2.Drops["Coins"].DropOnePerPlayer = false;
			creature2.Drops["Coins"].MultiplyDropByLevel = true;
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "ML_GoblinLox_Ragdoll");
		}
	}
	public static class Kraken
	{
		public static void init()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			Creature creature = new Creature("dybassets", "KrakenLD")
			{
				Biome = (Biome)256,
				SpecificSpawnArea = SpawnArea.Center,
				RequiredAltitude = new CreatureManager.Range(-1000f, -5f),
				RequiredOceanDepth = new CreatureManager.Range(20f, 30f),
				CheckSpawnInterval = 600,
				RequiredGlobalKey = GlobalKey.KilledBonemass,
				RequiredWeather = Weather.ThunderStorm,
				SpawnChance = 2f,
				GroupSize = new CreatureManager.Range(1f, 1f),
				Maximum = 1,
				SpecificSpawnTime = SpawnTime.Always
			};
			creature.Drops["KrakenMeat"].Amount = new CreatureManager.Range(10f, 15f);
			creature.Drops["KrakenMeat"].DropChance = 100f;
			creature.Drops["KrakenMeat"].DropOnePerPlayer = false;
			creature.Drops["KrakenMeat"].MultiplyDropByLevel = false;
			creature.Drops["Chitin"].Amount = new CreatureManager.Range(5f, 8f);
			creature.Drops["Chitin"].DropChance = 100f;
			creature.Drops["Chitin"].DropOnePerPlayer = false;
			creature.Drops["Chitin"].MultiplyDropByLevel = true;
			new Creature("dybassets", "Kraken_Blob")
			{
				Biome = (Biome)0,
				ConfigurationEnabled = false
			};
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "KrakenLD_ragdoll");
			new Item("dybassets", "KrakenMeat").Configurable = Configurability.Disabled;
			new Item("dybassets", "kraken_attack1").Configurable = Configurability.Disabled;
			new Item("dybassets", "kraken_attack2").Configurable = Configurability.Disabled;
			new Item("dybassets", "kraken_attack3").Configurable = Configurability.Disabled;
			new Item("dybassets", "kraken_attack4").Configurable = Configurability.Disabled;
			new Item("dybassets", "kraken_attacklightning").Configurable = Configurability.Disabled;
			new Item("dybassets", "kraken_poisonball").Configurable = Configurability.Disabled;
			new Item("dybassets", "kraken_taunt").Configurable = Configurability.Disabled;
			new Item("dybassets", "krakenblob_attack").Configurable = Configurability.Disabled;
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_kraken_alert");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_kraken_attack");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_kraken_death");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_kraken_hit");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_kraken_idle");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_kraken_taunt");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_krakenpoison_launch");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_kraken_attack");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_kraken_attacklightning");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_kraken_hit");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_kraken_spit");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_kraken_watersurface");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_krakenpoison_hit");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_krakenpoison_hitground");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_watersplash_kraken");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_krakenblob_attack");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "vfx_kraken_lightning_hit");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "inkblob_projectile");
		}
	}
	public static class Molluscan
	{
		public static void init()
		{
			//IL_001b: 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)
			Creature creature = new Creature("dybassets", "Molluscan")
			{
				Biome = (Biome)256,
				SpecificSpawnArea = SpawnArea.Everywhere,
				RequiredAltitude = new CreatureManager.Range(-1000f, -10f),
				RequiredOceanDepth = new CreatureManager.Range(15f, 30f),
				CheckSpawnInterval = 450,
				SpawnChance = 15f,
				GroupSize = new CreatureManager.Range(1f, 2f),
				Maximum = 4,
				SpecificSpawnTime = SpawnTime.Always
			};
			creature.Drops["TrophyDeepSeaMolluscan"].Amount = new CreatureManager.Range(1f, 1f);
			creature.Drops["TrophyDeepSeaMolluscan"].DropChance = 10f;
			creature.Drops["TrophyDeepSeaMolluscan"].DropOnePerPlayer = false;
			creature.Drops["TrophyDeepSeaMolluscan"].MultiplyDropByLevel = false;
			creature.Drops["Chitin"].Amount = new CreatureManager.Range(2f, 3f);
			creature.Drops["Chitin"].DropChance = 100f;
			creature.Drops["Chitin"].DropOnePerPlayer = false;
			creature.Drops["Chitin"].MultiplyDropByLevel = true;
			Creature creature2 = new Creature("dybassets", "MolluscanLand")
			{
				Biome = (Biome)8,
				SpecificSpawnArea = SpawnArea.Everywhere,
				RequiredOceanDepth = new CreatureManager.Range(1f, 2f),
				RequiredAltitude = new CreatureManager.Range(-1f, 10f),
				RequiredWeather = (Weather.LightRain | Weather.Rain | Weather.ThunderStorm),
				CheckSpawnInterval = 450,
				SpawnChance = 25f,
				GroupSize = new CreatureManager.Range(1f, 1f),
				Maximum = 2,
				SpecificSpawnTime = SpawnTime.Always
			};
			creature2.Drops["TrophyMolluscan"].Amount = new CreatureManager.Range(1f, 1f);
			creature2.Drops["TrophyMolluscan"].DropChance = 10f;
			creature2.Drops["TrophyMolluscan"].DropOnePerPlayer = false;
			creature2.Drops["TrophyMolluscan"].MultiplyDropByLevel = false;
			creature2.Drops["Chitin"].Amount = new CreatureManager.Range(1f, 1f);
			creature2.Drops["Chitin"].DropChance = 100f;
			creature2.Drops["Chitin"].DropOnePerPlayer = false;
			creature2.Drops["Chitin"].MultiplyDropByLevel = true;
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "Molluscan_ragdoll");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "DeepSeaMolluscan_ragdoll");
			new Item("dybassets", "TrophyMolluscan").Configurable = Configurability.Disabled;
			new Item("dybassets", "TrophyDeepSeaMolluscan").Configurable = Configurability.Disabled;
			new Item("dybassets", "Molluscan_attack").Configurable = Configurability.Disabled;
			new Item("dybassets", "Molluscan_attack2").Configurable = Configurability.Disabled;
			new Item("dybassets", "Molluscan_attack3").Configurable = Configurability.Disabled;
			new Item("dybassets", "Molluscan_taunt").Configurable = Configurability.Disabled;
			new Item("dybassets", "MolluscanLand_attack").Configurable = Configurability.Disabled;
			new Item("dybassets", "MolluscanLand_attack2").Configurable = Configurability.Disabled;
			new Item("dybassets", "MolluscanLand_attack3").Configurable = Configurability.Disabled;
			new Item("dybassets", "MolluscanLand_taunt").Configurable = Configurability.Disabled;
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscan_alert");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscan_attack");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscan_death");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscan_hit");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscan_idle");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscan_taunt");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscanland_alert");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscanland_attack");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscanland_death");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscanland_hit");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscanland_idle");
			ItemManager.PrefabManager.RegisterPrefab("dybassets", "sfx_molluscanland_taunt");
		}
	}
	public static class FireSkeleton
	{
		public static void init()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			Creature creature = new Creature("dybassets", "FireSkeletonWarrior")
			{
				Biome = (Biome)0
			};
			creature.ConfigurationEnabled = true;
			creature.Drops["TrophySkeletonFire"].Amount = new CreatureManager.Range(1f, 1f);
			creature.Drops["TrophySkeletonFire"].DropChance = 10f;
			creature.Drops["TrophySkeletonFire"].DropOnePerPlayer = false;
			creature.Drops["TrophySkeletonFire"].MultiplyDropByLevel = false;
			creature.Drops["BoneFragments"].Amount = new CreatureManager.Range(1f, 1f);
			creature.Drops["BoneFragments"].DropChance = 100f;
			creature.Drops["BoneFragments"].DropOnePerPlayer = false;
			creature.Drops["BoneFragments"].MultiplyDropByLevel = true;
			Creature creature2 = new Creature("dybassets", "FireSkeletonWarriorNoFx")
			{
				Biome = (Biome)0
			};
			creature2.ConfigurationEnabled = true;
			creature2.Drops["TrophySkeletonFire"].Amount = new CreatureManager.Range(1f, 1f);
			creature2.Drops["TrophySkeletonFire"].DropChance = 10f;
			creature2.Drops["TrophySkeletonFire"].DropOnePerPlayer = false;
			creature2.Drops["TrophySkeletonFire"].MultiplyDropByLevel = false;
			creature2.Drops["BoneFragmen