Decompiled source of CoreWoodExtras v2.1.4

plugins/CoreWoodExtras.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using CoreWoodExtras.Containers;
using CoreWoodExtras.TextureUtils;
using CoreWoodExtras.Updates;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Extensions;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("CoreWoodExtras")]
[assembly: AssemblyDescription("https://discord.gg/nzybGbmXfV")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("MagicMike")]
[assembly: AssemblyProduct("CoreWoodExtras")]
[assembly: AssemblyCopyright("Copyright © MagicMike 2025CoreWoodExtras")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("2.1.4")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class SchoolBubbles : MonoBehaviour
{
	public ParticleSystem _bubbleParticles;

	public float _emitEverySecond = 0.01f;

	public float _speedEmitMultiplier = 0.25f;

	public int _minBubbles;

	public int _maxBubbles = 5;

	public void Start()
	{
		if ((Object)(object)_bubbleParticles == (Object)null)
		{
			((Component)((Component)this).transform).GetComponent<ParticleSystem>();
		}
	}

	public void EmitBubbles(Vector3 pos, float amount)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		if (!(amount * _speedEmitMultiplier < 1f))
		{
			((Component)_bubbleParticles).transform.position = pos;
			_bubbleParticles.Emit(Mathf.Clamp((int)(amount * _speedEmitMultiplier), _minBubbles, _maxBubbles));
		}
	}
}
public class SchoolChild : MonoBehaviour
{
	public SchoolController _spawner;

	private Vector3 _wayPoint;

	[HideInInspector]
	public float _speed = 10f;

	private float _stuckCounter;

	private float _damping;

	private Transform _model;

	private float _targetSpeed;

	private float tParam;

	private float _rotateCounterR;

	private float _rotateCounterL;

	public Transform _scanner;

	private bool _scan = true;

	private bool _instantiated;

	private static int _updateNextSeed;

	private int _updateSeed = -1;

	public Transform _cacheTransform;

	private Animation _legacyAnim;

	private Animator anim;

	public void Start()
	{
		_cacheTransform = ((Component)this).transform;
		LocateRequiredChildren();
		if (_spawner._useLegacyAnimations)
		{
			_legacyAnim = ((Component)_model).GetComponent<Animation>();
		}
		else
		{
			anim = ((Component)_model).GetComponent<Animator>();
		}
		SetRandomScale();
		RandomizeStartAnimationFrame();
		_speed = Random.Range(_spawner._minSpeed, _spawner._maxSpeed);
		Wander(0f);
		SetRandomWaypoint();
		CheckForBubblesThenInvoke();
		_instantiated = true;
		GetStartPos();
		FrameSkipSeedInit();
		_spawner._activeChildren++;
	}

	public void childUpdate()
	{
		CheckForDistanceToWaypoint();
		RotationBasedOnWaypointOrAvoidance();
		ForwardMovement();
		RayCastToPushAwayFromObstacles();
		SetAnimationSpeed();
	}

	public void FrameSkipSeedInit()
	{
		if (_spawner._updateDivisor > 1)
		{
			int num = _spawner._updateDivisor - 1;
			_updateNextSeed++;
			_updateSeed = _updateNextSeed;
			_updateNextSeed %= num;
		}
	}

	public void CheckForBubblesThenInvoke()
	{
		if ((Object)(object)_spawner._bubbles != (Object)null)
		{
			((MonoBehaviour)this).InvokeRepeating("EmitBubbles", _spawner._bubbles._emitEverySecond * Random.value + 1f, _spawner._bubbles._emitEverySecond);
		}
	}

	public void EmitBubbles()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		_spawner._bubbles.EmitBubbles(_cacheTransform.position, _speed);
	}

	public void OnDisable()
	{
		((MonoBehaviour)this).CancelInvoke();
		_spawner._activeChildren--;
	}

	public void OnEnable()
	{
		if (_instantiated)
		{
			CheckForBubblesThenInvoke();
			_spawner._activeChildren++;
		}
	}

	public void LocateRequiredChildren()
	{
		//IL_0033: 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_0069: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_model == (Object)null)
		{
			_model = _cacheTransform.Find("Model");
		}
		if ((Object)(object)_scanner == (Object)null)
		{
			_scanner = new GameObject().transform;
			_scanner.parent = ((Component)this).transform;
			_scanner.localRotation = Quaternion.identity;
			_scanner.localPosition = Vector3.zero;
		}
	}

	public void SkewModelForLessUniformedMovement()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		Quaternion identity = Quaternion.identity;
		((Quaternion)(ref identity)).eulerAngles = new Vector3(0f, 0f, (float)Random.Range(-25, 25));
		_model.rotation = identity;
	}

	public void SetRandomScale()
	{
		//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)
		float num = Random.Range(_spawner._minScale, _spawner._maxScale);
		_cacheTransform.localScale = Vector3.one * num;
	}

	public void RandomizeStartAnimationFrame()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		if (!_spawner._useLegacyAnimations)
		{
			return;
		}
		foreach (AnimationState item in _legacyAnim)
		{
			AnimationState val = item;
			val.time = Random.value * val.length;
		}
	}

	public void SetAnimationSpeed()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		if (_spawner._useLegacyAnimations)
		{
			foreach (AnimationState item in _legacyAnim)
			{
				item.speed = Random.Range(_spawner._minAnimationSpeed, _spawner._maxAnimationSpeed) * _spawner._schoolSpeed * _speed + 0.1f;
			}
			return;
		}
		anim.speed = Random.Range(_spawner._minAnimationSpeed, _spawner._maxAnimationSpeed) * _spawner._schoolSpeed * _speed + 0.1f;
	}

	public void GetStartPos()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		_cacheTransform.position = _wayPoint - new Vector3(0.1f, 0.1f, 0.1f);
	}

	public Vector3 findWaypoint()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: 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)
		Vector3 zero = Vector3.zero;
		zero.x = Random.Range(0f - _spawner._spawnSphere, _spawner._spawnSphere) + _spawner._posBuffer.x;
		zero.z = Random.Range(0f - _spawner._spawnSphereDepth, _spawner._spawnSphereDepth) + _spawner._posBuffer.z;
		zero.y = Random.Range(0f - _spawner._spawnSphereHeight, _spawner._spawnSphereHeight) + _spawner._posBuffer.y;
		return zero;
	}

	public void RayCastToPushAwayFromObstacles()
	{
		if (_spawner._push)
		{
			RotateScanner();
			RayCastToPushAwayFromObstaclesCheckForCollision();
		}
	}

	public void RayCastToPushAwayFromObstaclesCheckForCollision()
	{
		//IL_0002: 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_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		RaycastHit val = default(RaycastHit);
		float num = 0f;
		Vector3 forward = _scanner.forward;
		if (Physics.Raycast(_cacheTransform.position, forward, ref val, _spawner._pushDistance, LayerMask.op_Implicit(_spawner._avoidanceMask)))
		{
			SchoolChild component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<SchoolChild>();
			num = (_spawner._pushDistance - ((RaycastHit)(ref val)).distance) / _spawner._pushDistance;
			if ((Object)(object)component != (Object)null)
			{
				Transform cacheTransform = _cacheTransform;
				cacheTransform.position -= forward * _spawner._newDelta * num * _spawner._pushForce;
				return;
			}
			_speed -= 0.01f * _spawner._newDelta;
			if (_speed < 0.1f)
			{
				_speed = 0.1f;
			}
			Transform cacheTransform2 = _cacheTransform;
			cacheTransform2.position -= forward * _spawner._newDelta * num * _spawner._pushForce * 2f;
			_scan = false;
		}
		else
		{
			_scan = true;
		}
	}

	public void RotateScanner()
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		if (_scan)
		{
			_scanner.rotation = Random.rotation;
		}
		else
		{
			_scanner.Rotate(new Vector3(150f * _spawner._newDelta, 0f, 0f));
		}
	}

	public bool Avoidance()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: 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_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_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: 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_010d: 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_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: 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_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: 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_02d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ae: 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_03e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_036a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0376: Unknown result type (might be due to invalid IL or missing references)
		//IL_0416: Unknown result type (might be due to invalid IL or missing references)
		//IL_0426: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
		if (!_spawner._avoidance)
		{
			return false;
		}
		RaycastHit val = default(RaycastHit);
		float num = 0f;
		Quaternion rotation = _cacheTransform.rotation;
		Quaternion rotation2 = _cacheTransform.rotation;
		Vector3 eulerAngles = ((Quaternion)(ref rotation2)).eulerAngles;
		Vector3 forward = _cacheTransform.forward;
		Vector3 right = _cacheTransform.right;
		if (Physics.Raycast(_cacheTransform.position, -Vector3.up + forward * 0.1f, ref val, _spawner._avoidDistance, LayerMask.op_Implicit(_spawner._avoidanceMask)))
		{
			num = (_spawner._avoidDistance - ((RaycastHit)(ref val)).distance) / _spawner._avoidDistance;
			eulerAngles.x -= _spawner._avoidSpeed * num * _spawner._newDelta * (_speed + 1f);
			((Quaternion)(ref rotation)).eulerAngles = eulerAngles;
			_cacheTransform.rotation = rotation;
		}
		if (Physics.Raycast(_cacheTransform.position, Vector3.up + forward * 0.1f, ref val, _spawner._avoidDistance, LayerMask.op_Implicit(_spawner._avoidanceMask)))
		{
			num = (_spawner._avoidDistance - ((RaycastHit)(ref val)).distance) / _spawner._avoidDistance;
			eulerAngles.x += _spawner._avoidSpeed * num * _spawner._newDelta * (_speed + 1f);
			((Quaternion)(ref rotation)).eulerAngles = eulerAngles;
			_cacheTransform.rotation = rotation;
		}
		if (Physics.Raycast(_cacheTransform.position, forward + right * Random.Range(-0.1f, 0.1f), ref val, _spawner._stopDistance, LayerMask.op_Implicit(_spawner._avoidanceMask)))
		{
			num = (_spawner._stopDistance - ((RaycastHit)(ref val)).distance) / _spawner._stopDistance;
			eulerAngles.y -= _spawner._avoidSpeed * num * _spawner._newDelta * (_targetSpeed + 3f);
			((Quaternion)(ref rotation)).eulerAngles = eulerAngles;
			_cacheTransform.rotation = rotation;
			_speed -= num * _spawner._newDelta * _spawner._stopSpeedMultiplier * _speed;
			if (_speed < 0.01f)
			{
				_speed = 0.01f;
			}
			return true;
		}
		if (Physics.Raycast(_cacheTransform.position, forward + right * (_spawner._avoidAngle + _rotateCounterL), ref val, _spawner._avoidDistance, LayerMask.op_Implicit(_spawner._avoidanceMask)))
		{
			num = (_spawner._avoidDistance - ((RaycastHit)(ref val)).distance) / _spawner._avoidDistance;
			_rotateCounterL += 0.1f;
			eulerAngles.y -= _spawner._avoidSpeed * num * _spawner._newDelta * _rotateCounterL * (_speed + 1f);
			((Quaternion)(ref rotation)).eulerAngles = eulerAngles;
			_cacheTransform.rotation = rotation;
			if (_rotateCounterL > 1.5f)
			{
				_rotateCounterL = 1.5f;
			}
			_rotateCounterR = 0f;
			return true;
		}
		if (Physics.Raycast(_cacheTransform.position, forward + right * (0f - (_spawner._avoidAngle + _rotateCounterR)), ref val, _spawner._avoidDistance, LayerMask.op_Implicit(_spawner._avoidanceMask)))
		{
			num = (_spawner._avoidDistance - ((RaycastHit)(ref val)).distance) / _spawner._avoidDistance;
			if (((RaycastHit)(ref val)).point.y < _cacheTransform.position.y)
			{
				eulerAngles.y -= _spawner._avoidSpeed * num * _spawner._newDelta * (_speed + 1f);
			}
			else
			{
				eulerAngles.x += _spawner._avoidSpeed * num * _spawner._newDelta * (_speed + 1f);
			}
			_rotateCounterR += 0.1f;
			eulerAngles.y += _spawner._avoidSpeed * num * _spawner._newDelta * _rotateCounterR * (_speed + 1f);
			((Quaternion)(ref rotation)).eulerAngles = eulerAngles;
			_cacheTransform.rotation = rotation;
			if (_rotateCounterR > 1.5f)
			{
				_rotateCounterR = 1.5f;
			}
			_rotateCounterL = 0f;
			return true;
		}
		_rotateCounterL = 0f;
		_rotateCounterR = 0f;
		return false;
	}

	public void ForwardMovement()
	{
		//IL_0007: 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_0022: 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_0037: Unknown result type (might be due to invalid IL or missing references)
		Transform cacheTransform = _cacheTransform;
		cacheTransform.position += _cacheTransform.TransformDirection(Vector3.forward) * _speed * _spawner._newDelta;
		if (tParam < 1f)
		{
			if (_speed > _targetSpeed)
			{
				tParam += _spawner._newDelta * _spawner._acceleration;
			}
			else
			{
				tParam += _spawner._newDelta * _spawner._brake;
			}
			_speed = Mathf.Lerp(_speed, _targetSpeed, tParam);
		}
	}

	public void RotationBasedOnWaypointOrAvoidance()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: 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_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)
		//IL_005e: 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_004e: 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_008a: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		Quaternion identity = Quaternion.identity;
		identity = Quaternion.LookRotation(_wayPoint - _cacheTransform.position);
		if (!Avoidance())
		{
			_cacheTransform.rotation = Quaternion.Slerp(_cacheTransform.rotation, identity, _spawner._newDelta * _damping);
		}
		float x = _cacheTransform.localEulerAngles.x;
		x = ((x > 180f) ? (x - 360f) : x);
		Quaternion rotation = _cacheTransform.rotation;
		Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
		eulerAngles.x = ClampAngle(x, -50f, 50f);
		((Quaternion)(ref rotation)).eulerAngles = eulerAngles;
		_cacheTransform.rotation = rotation;
	}

	public void CheckForDistanceToWaypoint()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		Vector3 val = _cacheTransform.position - _wayPoint;
		if (((Vector3)(ref val)).magnitude < _spawner._waypointDistance + _stuckCounter)
		{
			Wander(0f);
			_stuckCounter = 0f;
			CheckIfThisShouldTriggerNewFlockWaypoint();
		}
		else
		{
			_stuckCounter += _spawner._newDelta * (_spawner._waypointDistance * 0.25f);
		}
	}

	public void CheckIfThisShouldTriggerNewFlockWaypoint()
	{
		if (_spawner._childTriggerPos)
		{
			_spawner.SetRandomWaypointPosition();
		}
	}

	public static float ClampAngle(float angle, float min, float max)
	{
		if (angle < -360f)
		{
			angle += 360f;
		}
		if (angle > 360f)
		{
			angle -= 360f;
		}
		return Mathf.Clamp(angle, min, max);
	}

	public void Wander(float delay)
	{
		_damping = Random.Range(_spawner._minDamping, _spawner._maxDamping);
		_targetSpeed = Random.Range(_spawner._minSpeed, _spawner._maxSpeed) * _spawner._speedCurveMultiplier.Evaluate(Random.value) * _spawner._schoolSpeed;
		((MonoBehaviour)this).Invoke("SetRandomWaypoint", delay);
	}

	public void SetRandomWaypoint()
	{
		//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)
		tParam = 0f;
		_wayPoint = findWaypoint();
	}
}
public class SchoolController : MonoBehaviour
{
	public SchoolChild[] _childPrefab;

	public bool _groupChildToNewTransform;

	public Transform _groupTransform;

	public string _groupName = "";

	public bool _groupChildToSchool;

	public int _childAmount = 250;

	public float _spawnSphere = 3f;

	public float _spawnSphereDepth = 3f;

	public float _spawnSphereHeight = 1.5f;

	public float _childSpeedMultipler = 2f;

	public float _minSpeed = 6f;

	public float _maxSpeed = 10f;

	public AnimationCurve _speedCurveMultiplier = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
	{
		new Keyframe(0f, 1f),
		new Keyframe(1f, 1f)
	});

	public float _minScale = 0.7f;

	public float _maxScale = 1f;

	public float _minDamping = 1f;

	public float _maxDamping = 2f;

	public float _waypointDistance = 1f;

	public float _minAnimationSpeed = 2f;

	public float _maxAnimationSpeed = 4f;

	public float _randomPositionTimerMax = 10f;

	public float _randomPositionTimerMin = 4f;

	public float _acceleration = 0.025f;

	public float _brake = 0.01f;

	public float _positionSphere = 25f;

	public float _positionSphereDepth = 5f;

	public float _positionSphereHeight = 5f;

	public bool _childTriggerPos;

	public bool _forceChildWaypoints;

	public bool _autoRandomPosition;

	public float _forcedRandomDelay = 1.5f;

	public float _schoolSpeed;

	public List<SchoolChild> _roamers;

	public Vector3 _posBuffer;

	public Vector3 _posOffset;

	public bool _avoidance;

	public float _avoidAngle = 0.35f;

	public float _avoidDistance = 1f;

	public float _avoidSpeed = 75f;

	public float _stopDistance = 0.5f;

	public float _stopSpeedMultiplier = 2f;

	public LayerMask _avoidanceMask = LayerMask.op_Implicit(-1);

	public bool _push;

	public float _pushDistance;

	public float _pushForce = 5f;

	public SchoolBubbles _bubbles;

	public int _updateDivisor = 1;

	public float _newDelta;

	public int _updateCounter;

	public int _activeChildren;

	public bool _useLegacyAnimations = true;

	public void Start()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		_posBuffer = ((Component)this).transform.position + _posOffset;
		_schoolSpeed = Random.Range(1f, _childSpeedMultipler);
		AddFish(_childAmount);
		((MonoBehaviour)this).Invoke("AutoRandomWaypointPosition", RandomWaypointTime());
	}

	public void Update()
	{
		if (_activeChildren > 0)
		{
			if (_updateDivisor > 1)
			{
				_updateCounter++;
				_updateCounter %= _updateDivisor;
				_newDelta = Time.deltaTime * (float)_updateDivisor;
			}
			else
			{
				_newDelta = Time.deltaTime;
			}
			UpdateFishAmount();
			for (int i = 0; i < _roamers.Count; i++)
			{
				_roamers[i].childUpdate();
			}
		}
	}

	public void InstantiateGroup()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Expected O, but got Unknown
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)_groupTransform != (Object)null))
		{
			GameObject val = new GameObject();
			_groupTransform = val.transform;
			_groupTransform.position = ((Component)this).transform.position;
			if (_groupName != "")
			{
				((Object)val).name = _groupName;
			}
			else
			{
				((Object)val).name = ((Object)((Component)this).transform).name + " Fish Container";
			}
		}
	}

	public void AddFish(int amount)
	{
		if (_groupChildToNewTransform)
		{
			InstantiateGroup();
		}
		for (int i = 0; i < amount; i++)
		{
			int num = Random.Range(0, _childPrefab.Length);
			SchoolChild schoolChild = Object.Instantiate<SchoolChild>(_childPrefab[num]);
			schoolChild._spawner = this;
			_roamers.Add(schoolChild);
			AddChildToParent(((Component)schoolChild).transform);
		}
	}

	public void AddChildToParent(Transform obj)
	{
		if (_groupChildToSchool)
		{
			obj.parent = ((Component)this).transform;
		}
		else if (_groupChildToNewTransform)
		{
			obj.parent = _groupTransform;
		}
	}

	public void RemoveFish(int amount)
	{
		SchoolChild schoolChild = _roamers[_roamers.Count - 1];
		_roamers.RemoveAt(_roamers.Count - 1);
		Object.Destroy((Object)(object)((Component)schoolChild).gameObject);
	}

	public void UpdateFishAmount()
	{
		if (_childAmount >= 0 && _childAmount < _roamers.Count)
		{
			RemoveFish(1);
		}
		else if (_childAmount > _roamers.Count)
		{
			AddFish(1);
		}
	}

	public void SetRandomWaypointPosition()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: 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_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		_schoolSpeed = Random.Range(1f, _childSpeedMultipler);
		Vector3 zero = Vector3.zero;
		zero.x = Random.Range(0f - _positionSphere, _positionSphere) + ((Component)this).transform.position.x;
		zero.z = Random.Range(0f - _positionSphereDepth, _positionSphereDepth) + ((Component)this).transform.position.z;
		zero.y = Random.Range(0f - _positionSphereHeight, _positionSphereHeight) + ((Component)this).transform.position.y;
		_posBuffer = zero;
		if (_forceChildWaypoints)
		{
			for (int i = 0; i < _roamers.Count; i++)
			{
				_roamers[i].Wander(Random.value * _forcedRandomDelay);
			}
		}
	}

	public void AutoRandomWaypointPosition()
	{
		if (_autoRandomPosition && _activeChildren > 0)
		{
			SetRandomWaypointPosition();
		}
		((MonoBehaviour)this).CancelInvoke("AutoRandomWaypointPosition");
		((MonoBehaviour)this).Invoke("AutoRandomWaypointPosition", RandomWaypointTime());
	}

	public float RandomWaypointTime()
	{
		return Random.Range(_randomPositionTimerMin, _randomPositionTimerMax);
	}

	public void OnDrawGizmos()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: 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)
		if (!Application.isPlaying && _posBuffer != ((Component)this).transform.position + _posOffset)
		{
			_posBuffer = ((Component)this).transform.position + _posOffset;
		}
		Gizmos.color = Color.blue;
		Gizmos.DrawWireCube(_posBuffer, new Vector3(_spawnSphere * 2f, _spawnSphereHeight * 2f, _spawnSphereDepth * 2f));
		Gizmos.color = Color.cyan;
		Gizmos.DrawWireCube(((Component)this).transform.position, new Vector3(_positionSphere * 2f + _spawnSphere * 2f, _positionSphereHeight * 2f + _spawnSphereHeight * 2f, _positionSphereDepth * 2f + _spawnSphereDepth * 2f));
	}
}
public class KeyUtils
{
	public static bool IgnoreKeyPresses(bool extra = false)
	{
		if (!extra)
		{
			if (!((Object)(object)ZNetScene.instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && !Minimap.IsOpen() && !Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog())
			{
				Chat instance = Chat.instance;
				if (instance == null)
				{
					return false;
				}
				return instance.HasFocus();
			}
			return true;
		}
		if (!((Object)(object)ZNetScene.instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && !Minimap.IsOpen() && !Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog())
		{
			Chat instance2 = Chat.instance;
			if ((instance2 == null || !instance2.HasFocus()) && !StoreGui.IsVisible() && !InventoryGui.IsVisible() && !Menu.IsVisible())
			{
				TextViewer instance3 = TextViewer.instance;
				if (instance3 == null)
				{
					return false;
				}
				return instance3.IsVisible();
			}
		}
		return true;
	}

	public static bool CheckKeyDown(string value)
	{
		try
		{
			string[] array = value.Split(new char[1] { ',' });
			for (int i = 0; i < array.Length; i++)
			{
				if (Input.GetKeyDown(array[i].ToLower()))
				{
					return true;
				}
			}
		}
		catch
		{
		}
		return false;
	}

	public static bool CheckKeyUp(string value)
	{
		try
		{
			string[] array = value.Split(new char[1] { ',' });
			for (int i = 0; i < array.Length; i++)
			{
				if (Input.GetKeyUp(array[i].ToLower()))
				{
					return true;
				}
			}
		}
		catch
		{
		}
		return false;
	}

	public static bool CheckKeyHeld(string value, bool req = true)
	{
		try
		{
			string[] array = value.Split(new char[1] { ',' });
			for (int i = 0; i < array.Length; i++)
			{
				if (Input.GetKey(array[i].ToLower()))
				{
					return true;
				}
			}
		}
		catch
		{
		}
		return !req;
	}
}
namespace CoreWoodExtras
{
	internal class FishPond : MonoBehaviour, Hoverable, Interactable
	{
		public string m_name = "Fish Pond";

		public float m_useDistance = 4f;

		public Transform m_attachPoint;

		public GameObject m_fxobject;

		private ZNetView m_nview;

		private static readonly int _isFishEnabled = StringExtensionMethods.GetStableHashCode("IsFishEnabled");

		private void Awake()
		{
			m_nview = ((Component)this).gameObject.GetComponentInParent<ZNetView>();
			if ((Object)(object)m_nview == (Object)null || !m_nview.IsValid())
			{
				return;
			}
			if (m_nview.GetZDO().GetBool(_isFishEnabled, false))
			{
				if (!m_fxobject.activeSelf)
				{
					m_fxobject.SetActive(true);
				}
			}
			else if (m_fxobject.activeSelf)
			{
				m_fxobject.SetActive(false);
			}
		}

		public string GetHoverText()
		{
			if (!InUseDistance((Humanoid)(object)Player.m_localPlayer))
			{
				return Localization.instance.Localize("<color=#888888>$piece_toofar</color>");
			}
			if (!m_fxobject.activeSelf)
			{
				return Localization.instance.Localize(m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $text_enable_fish");
			}
			return Localization.instance.Localize(m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $text_disable_fish");
		}

		public string GetHoverName()
		{
			return m_name;
		}

		public bool Interact(Humanoid human, bool hold, bool alt)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			if (hold)
			{
				return false;
			}
			Player human2 = (Player)(object)((human is Player) ? human : null);
			if (!InUseDistance((Humanoid)(object)human2))
			{
				return false;
			}
			if ((Object)(object)m_nview == (Object)null || !m_nview.IsValid())
			{
				return false;
			}
			if (!m_fxobject.activeSelf)
			{
				m_nview.GetZDO().Set(_isFishEnabled, true);
				m_fxobject.SetActive(true);
				ZDOMan.instance.ForceSendZDO(ZNetView.Everybody, m_nview.GetZDO().m_uid);
				return false;
			}
			m_nview.GetZDO().Set(_isFishEnabled, false);
			m_fxobject.SetActive(false);
			ZDOMan.instance.ForceSendZDO(ZNetView.Everybody, m_nview.GetZDO().m_uid);
			return false;
		}

		public bool UseItem(Humanoid user, ItemData item)
		{
			return false;
		}

		private bool InUseDistance(Humanoid human)
		{
			//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.Distance(((Component)human).transform.position, m_attachPoint.position) < m_useDistance;
		}
	}
	internal class Inflatable : MonoBehaviour, Hoverable, Interactable
	{
		public string m_name = "Inflatable";

		public float m_useDistance = 1.5f;

		public Transform m_attachPoint;

		public Vector3 m_detachOffset = new Vector3(0f, 0f, 0f);

		private static string m_attachAnimation = "attach_bed";

		private static float m_lastAttachTime;

		public string GetHoverText()
		{
			if (Time.time - m_lastAttachTime < 2f)
			{
				return "";
			}
			if (!InUseDistance((Humanoid)(object)Player.m_localPlayer))
			{
				return Localization.instance.Localize("<color=#888888>$piece_toofar</color>");
			}
			return Localization.instance.Localize(m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_use");
		}

		public string GetHoverName()
		{
			return m_name;
		}

		public bool Interact(Humanoid human, bool hold, bool alt)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (hold)
			{
				return false;
			}
			if (Time.time - m_lastAttachTime < 2f)
			{
				return false;
			}
			Player val = (Player)(object)((human is Player) ? human : null);
			if (!InUseDistance((Humanoid)(object)val))
			{
				return false;
			}
			if (((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("Wet")))
			{
				((Character)Player.m_localPlayer).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("Wet"), true);
			}
			((Character)val).AttachStart(m_attachPoint, ((Component)this).gameObject, true, false, false, m_attachAnimation, m_detachOffset, (Transform)null);
			m_lastAttachTime = Time.time;
			return false;
		}

		public bool UseItem(Humanoid user, ItemData item)
		{
			return false;
		}

		private bool InUseDistance(Humanoid human)
		{
			//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.Distance(((Component)human).transform.position, m_attachPoint.position) < m_useDistance;
		}
	}
	internal class ContainerPatches
	{
		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		private static class ZNetSceneAwakeContainerPatch
		{
			[HarmonyPriority(200)]
			private static void Postfix(ZNetScene __instance)
			{
				GameObject prefab = __instance.GetPrefab("mm_corewood_chest_public");
				GameObject prefab2 = __instance.GetPrefab("mm_corewood_chest_private");
				GameObject prefab3 = __instance.GetPrefab("mm_corewood_stackable_chest");
				try
				{
					Container component = prefab.GetComponent<Container>();
					component.m_width = MainConfig.chestColumns.Value;
					component.m_height = MainConfig.chestRows.Value;
					Container component2 = prefab2.GetComponent<Container>();
					component2.m_width = MainConfig.chestPrivateColumns.Value;
					component2.m_height = MainConfig.chestPrivateRows.Value;
					Container component3 = prefab3.GetComponent<Container>();
					component3.m_width = MainConfig.chestPrivateColumns.Value;
					component3.m_height = MainConfig.chestPrivateRows.Value;
				}
				catch
				{
					Logger.LogError((object)"Error with ZNetSceneAwakeContainerPatch!");
				}
			}
		}

		[HarmonyPatch(typeof(Container), "Interact")]
		public static class ContainerInteractPatch
		{
			private static bool Prefix(Container __instance, Humanoid character, bool hold, bool alt)
			{
				Piece component = ((Component)__instance).GetComponent<Piece>();
				if ((Object)(object)component == (Object)null || component.m_name != "$piece_mm_corewood_chest_stackable")
				{
					return true;
				}
				Sign component2 = ((Component)__instance).GetComponent<Sign>();
				if ((Object)(object)component2 == (Object)null)
				{
					return true;
				}
				if (!alt)
				{
					return true;
				}
				return !component2.Interact(character, hold, true);
			}
		}

		[HarmonyPatch(typeof(Container), "GetHoverText")]
		public static class ContainerGetHoverTextPatch
		{
			private static bool Prefix(Container __instance, ref string __result)
			{
				Piece component = ((Component)__instance).GetComponent<Piece>();
				if ((Object)(object)component == (Object)null || component.m_name != "$piece_mm_corewood_chest_stackable")
				{
					return true;
				}
				if ((Object)(object)((Component)__instance).GetComponent<Sign>() == (Object)null)
				{
					return true;
				}
				if (!MainConfig.chestStackedHotbar.Value)
				{
					__result = Localization.instance.Localize("$piece_mm_corewood_chest_stackable\n[<color=yellow><b>$KEY_Use</b></color>] $text_chest_open\n[<color=yellow><b>Shift + $KEY_Use</b></color>] $text_chest_edit\n[<color=yellow><b>1-8</b></color>] $text_chest_set\n");
				}
				else
				{
					__result = Localization.instance.Localize("$piece_mm_corewood_chest_stackable\n[<color=yellow><b>$KEY_Use</b></color>] $text_chest_open\n[<color=yellow><b>Shift + $KEY_Use</b></color>] $text_chest_edit\n");
				}
				return false;
			}
		}

		[HarmonyPatch(typeof(Player), "UseHotbarItem")]
		public static class InterceptUseHotbarItemOnNamedChest
		{
			private static bool Prefix(Player __instance, int index)
			{
				GameObject hoverObject = ((Humanoid)__instance).GetHoverObject();
				if ((Object)(object)hoverObject == (Object)null)
				{
					return true;
				}
				Piece componentInParent = hoverObject.GetComponentInParent<Piece>();
				if ((Object)(object)componentInParent == (Object)null || componentInParent.m_name != "$piece_mm_corewood_chest_stackable" || MainConfig.chestStackedHotbar.Value)
				{
					return true;
				}
				Sign component = ((Component)componentInParent).GetComponent<Sign>();
				if ((Object)(object)component == (Object)null)
				{
					return true;
				}
				Inventory inventory = ((Humanoid)__instance).GetInventory();
				ItemData val = ((inventory != null) ? inventory.GetItemAt(index - 1, 0) : null);
				if (val == null)
				{
					return true;
				}
				string text = (Object.op_Implicit((Object)(object)val.m_dropPrefab) ? ((Object)val.m_dropPrefab).name : val.m_shared.m_name);
				component.SetText(text);
				return false;
			}
		}

		[HarmonyPatch(typeof(InventoryGui), "Show")]
		public static class InventoryGui_Show_Patch
		{
			public static void Postfix(Container ___m_currentContainer)
			{
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)___m_currentContainer) && ((Object)___m_currentContainer).name.Contains("mm_corewood_stackable_chest"))
				{
					Sign componentInParent = ((Component)___m_currentContainer).gameObject.GetComponentInParent<Sign>();
					if (!((Object)(object)componentInParent == (Object)null))
					{
						((Component)Utils.FindChild(((Component)componentInParent).transform, "CanvasFront", (IterativeSearchType)0)).transform.localPosition = new Vector3(0f, 0.666f, 1.795f);
					}
				}
			}
		}

		[HarmonyPatch(typeof(InventoryGui), "Hide")]
		public static class InventoryGui_Hide_Patch
		{
			public static void Prefix(InventoryGui __instance, Container ___m_currentContainer)
			{
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				if (!__instance.m_animator.GetBool("visible") || !Object.op_Implicit((Object)(object)___m_currentContainer) || !((Object)___m_currentContainer).name.Contains("mm_corewood_stackable_chest"))
				{
					return;
				}
				Sign componentInParent = ((Component)___m_currentContainer).gameObject.GetComponentInParent<Sign>();
				if (!((Object)(object)componentInParent == (Object)null))
				{
					Transform val = Utils.FindChild(((Component)componentInParent).transform, "CanvasFront", (IterativeSearchType)0);
					if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
					{
						((Component)val).transform.localPosition = new Vector3(0f, 0.666f, 1.003f);
					}
				}
			}
		}
	}
	public static class SignHelper
	{
		public static GameObject CreateSignCanvas(string name, Transform parent, Vector3 pos, Quaternion rot, Vector2 size)
		{
			//IL_0014: 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_0025: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_004d: 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_005a: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent);
			val.transform.localPosition = pos;
			val.transform.localRotation = rot;
			val.transform.localScale = Vector3.one;
			val.GetComponent<RectTransform>().sizeDelta = size;
			Canvas obj = val.AddComponent<Canvas>();
			obj.renderMode = (RenderMode)2;
			obj.scaleFactor = 10f;
			val.AddComponent<CanvasRenderer>();
			val.AddComponent<GraphicRaycaster>();
			return val;
		}

		public static TextMeshProUGUI CreateText(Transform parent, string name)
		{
			//IL_0014: 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_0025: 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_0035: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent);
			val.transform.localPosition = Vector3.zero;
			val.transform.localScale = Vector3.one;
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.offsetMin = Vector2.zero;
			component.offsetMax = Vector2.zero;
			TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val2).text = "";
			((TMP_Text)val2).fontSize = 1f;
			((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
			((TMP_Text)val2).textWrappingMode = (TextWrappingModes)1;
			((Graphic)val2).color = Color32.op_Implicit(new Color32((byte)20, (byte)20, (byte)20, byte.MaxValue));
			GameObject prefab = PrefabManager.Instance.GetPrefab("sign");
			if ((Object)(object)prefab != (Object)null)
			{
				TextMeshProUGUI componentInChildren = prefab.GetComponentInChildren<TextMeshProUGUI>(true);
				if ((Object)(object)componentInChildren != (Object)null)
				{
					((TMP_Text)val2).font = ((TMP_Text)componentInChildren).font;
					((TMP_Text)val2).fontMaterial = new Material(((TMP_Text)componentInChildren).fontMaterial);
					((TMP_Text)val2).fontMaterial.SetFloat(ShaderUtilities.ID_FaceDilate, 0.3f);
				}
			}
			((TMP_Text)val2).outlineColor = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			((TMP_Text)val2).outlineWidth = 0.02f;
			return val2;
		}
	}
	public class NamedChest : MonoBehaviour
	{
		public Sign sign;

		public TextMeshProUGUI textFront;

		private string _lastText;

		private void Update()
		{
			if (Object.op_Implicit((Object)(object)sign) && Object.op_Implicit((Object)(object)sign.m_textWidget))
			{
				string text = sign.GetText();
				if (!(text == _lastText))
				{
					_lastText = text;
					UpdateDisplay(text);
				}
			}
		}

		private void UpdateDisplay(string text)
		{
			if (text != null)
			{
				ObjectDB instance = ObjectDB.instance;
				GameObject val = ((instance != null) ? instance.GetItemPrefab(text) : null);
				if ((Object)(object)val != (Object)null)
				{
					ItemDrop component = val.GetComponent<ItemDrop>();
					if ((Object)(object)component != (Object)null)
					{
						((TMP_Text)textFront).text = null;
						((TMP_Text)textFront).text = Localization.instance.Localize(component.m_itemData.m_shared.m_name);
						return;
					}
				}
			}
			((TMP_Text)textFront).text = text;
		}
	}
	internal class Shower : MonoBehaviour, Hoverable, Interactable
	{
		public string m_name = "Shower";

		public float m_useDistance = 2f;

		public Transform m_attachPoint;

		public Vector3 m_detachOffset = new Vector3(0f, 0f, 0f);

		public GameObject m_fxobject;

		public EffectList m_showerSFX;

		private static string m_attachAnimation = "";

		private static float m_lastShowerTime;

		public string GetHoverText()
		{
			if (Time.time - m_lastShowerTime < 32f)
			{
				return "";
			}
			if (!InUseDistance((Humanoid)(object)Player.m_localPlayer))
			{
				return Localization.instance.Localize("<color=#888888>$piece_toofar</color>");
			}
			return Localization.instance.Localize(m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_use");
		}

		public string GetHoverName()
		{
			return m_name;
		}

		public bool Interact(Humanoid human, bool hold, bool alt)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			if (hold)
			{
				return false;
			}
			Player val = (Player)(object)((human is Player) ? human : null);
			if (!InUseDistance((Humanoid)(object)val))
			{
				return false;
			}
			if (Time.time - m_lastShowerTime < 32f)
			{
				return false;
			}
			Player closestPlayer = Player.GetClosestPlayer(m_attachPoint.position, 0.1f);
			if ((Object)(object)closestPlayer != (Object)null && (Object)(object)closestPlayer != (Object)(object)Player.m_localPlayer)
			{
				((Character)Player.m_localPlayer).Message((MessageType)2, "$msg_blocked", 0, (Sprite)null);
				return false;
			}
			m_fxobject.SetActive(false);
			if (Object.op_Implicit((Object)(object)val))
			{
				if (((Character)val).IsEncumbered())
				{
					return false;
				}
				((Character)val).AttachStart(m_attachPoint, (GameObject)null, true, false, false, m_attachAnimation, m_detachOffset, (Transform)null);
				m_lastShowerTime = Time.time;
				m_fxobject.SetActive(true);
				m_showerSFX.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1);
			}
			return false;
		}

		public bool UseItem(Humanoid user, ItemData item)
		{
			return false;
		}

		private bool InUseDistance(Humanoid human)
		{
			//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.Distance(((Component)human).transform.position, m_attachPoint.position) < m_useDistance;
		}
	}
	public class LightPatches
	{
		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		[HarmonyAfter(new string[] { "com.jotunn.jotunn" })]
		public static class CustomLightPatch
		{
			[HarmonyPostfix]
			public static void Postfix(ZNetScene __instance)
			{
				ModifySkullCandles(__instance, "mm_corewood_skull_candles", MainConfig.skullLightIntensity.Value, MainConfig.skullLightRange.Value);
				ModifyDeerChandelier(__instance, "mm_deerchandelier", MainConfig.chandelierLightIntensity.Value, MainConfig.chandelierLightRange.Value);
				ModifySurtlingLantern(__instance, "mm_corewood_surtling_lantern", MainConfig.surtlingLanternLightIntensity.Value, MainConfig.surtlingLanternLightRange.Value);
				ModifySurtlingSingle(__instance, "mm_corewood_surtling_lamppost_single", MainConfig.surtlingSingleLightIntensity.Value, MainConfig.surtlingSingleLightRange.Value);
				ModifySurtlingDouble(__instance, "mm_corewood_surtling_lamppost_double", MainConfig.surtlingDoubleLightIntensity.Value, MainConfig.surtlingDoubleLightRange.Value);
				ModifyWallLights(__instance, "mm_horn_walltorch", MainConfig.wallLightIntensity.Value, MainConfig.wallLightRange.Value);
				ModifyLavaLights(__instance, "mm_corewood_lavalantern", MainConfig.lavaLightIntensity.Value, MainConfig.lavaLightRange.Value);
				ModifyCrystalLights(__instance, "mm_corewood_crystal_light", MainConfig.crystalLightIntensity.Value, MainConfig.crystalLightRange.Value);
				ModifyRopeLights(__instance, "mm_corewood_rope_lights", MainConfig.ropeLightIntensity.Value, MainConfig.ropeLightRange.Value);
				ModifyBrazierLights(__instance, "mm_corewood_brazier", MainConfig.brazierLightIntensity.Value, MainConfig.brazierLightRange.Value);
				ModifyBeaconLights(__instance, "mm_corewood_palisade_beacon", MainConfig.beaconLightIntensity.Value, MainConfig.beaconLightRange.Value);
			}
		}

		public static void ModifySkullCandles(ZNetScene instance, string prefab, float intensity, float range)
		{
			GameObject prefab2 = instance.GetPrefab(prefab);
			if (!Object.op_Implicit((Object)(object)prefab2))
			{
				return;
			}
			Light[] componentsInChildren = prefab2.GetComponentsInChildren<Light>(true);
			foreach (Light val in componentsInChildren)
			{
				val.intensity = intensity;
				val.range = range;
				if (MainConfig.skullLightShadows.Value == MainConfig.ShadowsType.None)
				{
					val.shadows = (LightShadows)0;
				}
				else if (MainConfig.skullLightShadows.Value == MainConfig.ShadowsType.Hard)
				{
					val.shadows = (LightShadows)1;
				}
				else if (MainConfig.skullLightShadows.Value == MainConfig.ShadowsType.Soft)
				{
					val.shadows = (LightShadows)2;
				}
			}
		}

		public static void ModifyDeerChandelier(ZNetScene instance, string prefab, float intensity, float range)
		{
			GameObject prefab2 = instance.GetPrefab(prefab);
			if (!Object.op_Implicit((Object)(object)prefab2))
			{
				return;
			}
			Light[] componentsInChildren = prefab2.GetComponentsInChildren<Light>(true);
			foreach (Light val in componentsInChildren)
			{
				val.intensity = intensity;
				val.range = range;
				if (MainConfig.chandelierLightShadows.Value == MainConfig.ShadowsType.None)
				{
					val.shadows = (LightShadows)0;
				}
				else if (MainConfig.chandelierLightShadows.Value == MainConfig.ShadowsType.Hard)
				{
					val.shadows = (LightShadows)1;
				}
				else if (MainConfig.chandelierLightShadows.Value == MainConfig.ShadowsType.Soft)
				{
					val.shadows = (LightShadows)2;
				}
			}
		}

		public static void ModifySurtlingDouble(ZNetScene instance, string prefab, float intensity, float range)
		{
			GameObject prefab2 = instance.GetPrefab(prefab);
			if (!Object.op_Implicit((Object)(object)prefab2))
			{
				return;
			}
			Light[] componentsInChildren = prefab2.GetComponentsInChildren<Light>(true);
			foreach (Light val in componentsInChildren)
			{
				val.intensity = intensity;
				val.range = range;
				if (MainConfig.surtlingDoubleLightShadows.Value == MainConfig.ShadowsType.None)
				{
					val.shadows = (LightShadows)0;
				}
				else if (MainConfig.surtlingDoubleLightShadows.Value == MainConfig.ShadowsType.Hard)
				{
					val.shadows = (LightShadows)1;
				}
				else if (MainConfig.surtlingDoubleLightShadows.Value == MainConfig.ShadowsType.Soft)
				{
					val.shadows = (LightShadows)2;
				}
			}
		}

		public static void ModifyRopeLights(ZNetScene instance, string prefab, float intensity, float range)
		{
			GameObject prefab2 = instance.GetPrefab(prefab);
			if (!Object.op_Implicit((Object)(object)prefab2))
			{
				return;
			}
			Light[] componentsInChildren = prefab2.GetComponentsInChildren<Light>(true);
			foreach (Light val in componentsInChildren)
			{
				val.intensity = intensity;
				val.range = range;
				if (MainConfig.ropeLightShadows.Value == MainConfig.ShadowsType.None)
				{
					val.shadows = (LightShadows)0;
				}
				else if (MainConfig.ropeLightShadows.Value == MainConfig.ShadowsType.Hard)
				{
					val.shadows = (LightShadows)1;
				}
				else if (MainConfig.ropeLightShadows.Value == MainConfig.ShadowsType.Soft)
				{
					val.shadows = (LightShadows)2;
				}
			}
		}

		public static void ModifySurtlingLantern(ZNetScene instance, string slprefab, float slintensity, float slrange)
		{
			GameObject prefab = instance.GetPrefab(slprefab);
			if (Object.op_Implicit((Object)(object)prefab))
			{
				Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
				componentInChildren.intensity = slintensity;
				componentInChildren.range = slrange;
				if (MainConfig.surtlingLanternLightShadows.Value == MainConfig.ShadowsType.None)
				{
					componentInChildren.shadows = (LightShadows)0;
				}
				else if (MainConfig.surtlingLanternLightShadows.Value == MainConfig.ShadowsType.Hard)
				{
					componentInChildren.shadows = (LightShadows)1;
				}
				else if (MainConfig.surtlingLanternLightShadows.Value == MainConfig.ShadowsType.Soft)
				{
					componentInChildren.shadows = (LightShadows)2;
				}
			}
		}

		public static void ModifySurtlingSingle(ZNetScene instance, string ssprefab, float ssintensity, float ssrange)
		{
			GameObject prefab = instance.GetPrefab(ssprefab);
			if (Object.op_Implicit((Object)(object)prefab))
			{
				Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
				componentInChildren.intensity = ssintensity;
				componentInChildren.range = ssrange;
				if (MainConfig.surtlingSingleLightShadows.Value == MainConfig.ShadowsType.None)
				{
					componentInChildren.shadows = (LightShadows)0;
				}
				else if (MainConfig.surtlingSingleLightShadows.Value == MainConfig.ShadowsType.Hard)
				{
					componentInChildren.shadows = (LightShadows)1;
				}
				else if (MainConfig.surtlingSingleLightShadows.Value == MainConfig.ShadowsType.Soft)
				{
					componentInChildren.shadows = (LightShadows)2;
				}
			}
		}

		public static void ModifyWallLights(ZNetScene instance, string wlprefab, float wlintensity, float wlrange)
		{
			GameObject prefab = instance.GetPrefab(wlprefab);
			if (Object.op_Implicit((Object)(object)prefab))
			{
				Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
				componentInChildren.intensity = wlintensity;
				componentInChildren.range = wlrange;
				if (MainConfig.wallLightShadows.Value == MainConfig.ShadowsType.None)
				{
					componentInChildren.shadows = (LightShadows)0;
				}
				else if (MainConfig.wallLightShadows.Value == MainConfig.ShadowsType.Hard)
				{
					componentInChildren.shadows = (LightShadows)1;
				}
				else if (MainConfig.wallLightShadows.Value == MainConfig.ShadowsType.Soft)
				{
					componentInChildren.shadows = (LightShadows)2;
				}
			}
		}

		public static void ModifyLavaLights(ZNetScene instance, string llprefab, float llintensity, float llrange)
		{
			GameObject prefab = instance.GetPrefab(llprefab);
			if (Object.op_Implicit((Object)(object)prefab))
			{
				Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
				componentInChildren.intensity = llintensity;
				componentInChildren.range = llrange;
				if (MainConfig.lavaLightShadows.Value == MainConfig.ShadowsType.None)
				{
					componentInChildren.shadows = (LightShadows)0;
				}
				else if (MainConfig.lavaLightShadows.Value == MainConfig.ShadowsType.Hard)
				{
					componentInChildren.shadows = (LightShadows)1;
				}
				else if (MainConfig.lavaLightShadows.Value == MainConfig.ShadowsType.Soft)
				{
					componentInChildren.shadows = (LightShadows)2;
				}
			}
		}

		public static void ModifyCrystalLights(ZNetScene instance, string clprefab, float clintensity, float clrange)
		{
			GameObject prefab = instance.GetPrefab(clprefab);
			if (Object.op_Implicit((Object)(object)prefab))
			{
				Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
				componentInChildren.intensity = clintensity;
				componentInChildren.range = clrange;
				if (MainConfig.crystalLightShadows.Value == MainConfig.ShadowsType.None)
				{
					componentInChildren.shadows = (LightShadows)0;
				}
				else if (MainConfig.crystalLightShadows.Value == MainConfig.ShadowsType.Hard)
				{
					componentInChildren.shadows = (LightShadows)1;
				}
				else if (MainConfig.crystalLightShadows.Value == MainConfig.ShadowsType.Soft)
				{
					componentInChildren.shadows = (LightShadows)2;
				}
			}
		}

		public static void ModifyBrazierLights(ZNetScene instance, string bprefab, float bintensity, float brange)
		{
			GameObject prefab = instance.GetPrefab(bprefab);
			if (Object.op_Implicit((Object)(object)prefab))
			{
				Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
				componentInChildren.intensity = bintensity;
				componentInChildren.range = brange;
				if (MainConfig.brazierLightShadows.Value == MainConfig.ShadowsType.None)
				{
					componentInChildren.shadows = (LightShadows)0;
				}
				else if (MainConfig.brazierLightShadows.Value == MainConfig.ShadowsType.Hard)
				{
					componentInChildren.shadows = (LightShadows)1;
				}
				else if (MainConfig.brazierLightShadows.Value == MainConfig.ShadowsType.Soft)
				{
					componentInChildren.shadows = (LightShadows)2;
				}
			}
		}

		public static void ModifyBeaconLights(ZNetScene instance, string bcprefab, float bcintensity, float bcrange)
		{
			GameObject prefab = instance.GetPrefab(bcprefab);
			if (Object.op_Implicit((Object)(object)prefab))
			{
				Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
				componentInChildren.intensity = bcintensity;
				componentInChildren.range = bcrange;
				if (MainConfig.beaconLightShadows.Value == MainConfig.ShadowsType.None)
				{
					componentInChildren.shadows = (LightShadows)0;
				}
				else if (MainConfig.beaconLightShadows.Value == MainConfig.ShadowsType.Hard)
				{
					componentInChildren.shadows = (LightShadows)1;
				}
				else if (MainConfig.beaconLightShadows.Value == MainConfig.ShadowsType.Soft)
				{
					componentInChildren.shadows = (LightShadows)2;
				}
			}
		}
	}
	public class TexturePatches
	{
		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		private class ZNetSceneAwakeTexturePatch
		{
			[HarmonyPriority(200)]
			private static void Postfix(ZNetScene __instance)
			{
				zNetScene = __instance;
				if (MainConfig.disableHDTextures.Value)
				{
					ChangeTextureFilter();
				}
			}
		}

		public static ZNetScene zNetScene;

		public static void ChangeTextureFilter()
		{
			foreach (GameObject prefab in zNetScene.m_prefabs)
			{
				if (!((Object)prefab).name.ToLower().Contains("mm_corewood"))
				{
					continue;
				}
				MeshRenderer[] componentsInChildren = prefab.GetComponentsInChildren<MeshRenderer>(true);
				if (componentsInChildren == null)
				{
					continue;
				}
				MeshRenderer[] array = componentsInChildren;
				foreach (MeshRenderer val in array)
				{
					if ((Object)(object)((Renderer)val).material.mainTexture != (Object)null)
					{
						((Renderer)val).material.mainTexture.anisoLevel = 0;
						((Renderer)val).material.mainTexture.filterMode = (FilterMode)0;
					}
				}
			}
		}
	}
	public class SoundPatches
	{
		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		private static class ZNetSceneAwakePatch
		{
			private static void Postfix(ZNetScene __instance)
			{
				GameObject prefab = __instance.GetPrefab("sfx_open_gate_mm");
				GameObject prefab2 = __instance.GetPrefab("sfx_close_gate_mm");
				GameObject prefab3 = __instance.GetPrefab("sfx_open_bridge_mm");
				GameObject prefab4 = __instance.GetPrefab("sfx_break_glass_mm");
				GameObject prefab5 = __instance.GetPrefab("sfx_tower_bridge_mm");
				GameObject prefab6 = __instance.GetPrefab("sfx_elevator_mm");
				GameObject prefab7 = __instance.GetPrefab("sfx_elevator_long_mm");
				GameObject prefab8 = __instance.GetPrefab("sfx_water_fountain");
				GameObject prefab9 = __instance.GetPrefab("sfx_frog_croaking");
				GameObject prefab10 = __instance.GetPrefab("sfx_water_bucket");
				GameObject prefab11 = __instance.GetPrefab("sfx_bartender_bye");
				GameObject prefab12 = __instance.GetPrefab("sfx_bartender_greet");
				GameObject prefab13 = __instance.GetPrefab("sfx_bartender_random");
				GameObject prefab14 = __instance.GetPrefab("sfx_bartender_trade");
				try
				{
					prefab.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
					prefab2.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
					prefab3.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
					prefab4.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
					prefab5.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
					prefab6.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
					prefab7.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
					prefab8.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
					prefab9.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
					prefab10.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
					prefab11.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
					prefab12.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
					prefab13.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
					prefab14.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
				}
				catch
				{
					Logger.LogError((object)"Error with ZNetSceneAwakePatch!");
				}
			}
		}
	}
	internal class FileWatcher
	{
		public static void WatchFileChanges(string path, Action onChanged)
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher();
			string directoryName = Path.GetDirectoryName(path);
			string fileName = Path.GetFileName(path);
			fileSystemWatcher.Path = directoryName;
			fileSystemWatcher.Filter = fileName;
			fileSystemWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite;
			fileSystemWatcher.Changed += delegate
			{
				onChanged?.Invoke();
			};
			fileSystemWatcher.Deleted += delegate
			{
				onChanged?.Invoke();
			};
			fileSystemWatcher.Created += delegate
			{
				onChanged?.Invoke();
			};
			fileSystemWatcher.Renamed += delegate
			{
				onChanged?.Invoke();
			};
			fileSystemWatcher.EnableRaisingEvents = true;
		}

		public static void WatchTranslationChanges(string path, Action onChanged)
		{
			if (!Directory.Exists(CoreWoodPlugin.TranslationFilePath))
			{
				return;
			}
			try
			{
				WatchFileChanges(Path.Combine(path, "*.*"), onChanged);
			}
			catch
			{
				Logger.LogError((object)"There was an issue loading Translation files!");
			}
		}
	}
	internal class LocalisedText
	{
		public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization();

		public static void AddLocalisations()
		{
			CustomLocalization localization = Localization;
			string text = "English";
			localization.AddTranslation(ref text, new Dictionary<string, string>
			{
				{ "piece_mm_corewood_market_stall_fish", "Fish Market Stall" },
				{ "piece_mm_perch_fish_container", "Perch Fish Crate" },
				{ "piece_mm_tuna_fish_container", "Tuna Fish Crate" },
				{ "piece_mm_troll_fish_container", "Trollfish Crate" },
				{ "piece_mm_herring_fish_container", "Herring Fish Crate" },
				{ "piece_mm_angler_fish_container", "Angler Fish Crate" },
				{ "piece_mm_serpent_flesh_container", "Serpent Flesh Crate" },
				{ "piece_mm_corewood_market_stall_veg", "Fruit & Veg Market Stall" },
				{ "piece_mm_bluberries_container", "Bluberry Crate" },
				{ "piece_mm_raspberry_container", "Raspberry Crate" },
				{ "piece_mm_cloudberry_container", "Cloudberry Crate" },
				{ "piece_mm_onion_container", "Onion Crate" },
				{ "piece_mm_turnip_container", "Turnip Crate" },
				{ "piece_mm_carrot_container", "Carrot Crate" },
				{ "piece_mm_corewood_market_stall_meat", "Meat Market Stall" },
				{ "piece_mm_boar_meat_container", "Boar Meat Crate" },
				{ "piece_mm_lox_meat_container", "Lox Meat Crate" },
				{ "piece_mm_volture_meat_container", "Volture Meat Crate" },
				{ "piece_mm_chicken_meat_container", "Chicken Meat Crate" },
				{ "piece_mm_deer_meat_container", "Deer Meat Crate" },
				{ "piece_mm_wolf_meat_container", "Wolf Meat Crate" },
				{ "piece_mm_hare_meat_container", "Hare Meat Crate" },
				{ "piece_mm_asksvin_meat_container", "Asksvin Meat Crate" },
				{ "piece_mm_corewood_market_stall_seeds", "Seed Market Stall" },
				{ "piece_mm_oak_seeds_container", "Oak Seeds Sack" },
				{ "piece_mm_birch_seeds_container", "Birch Seeds Sack" },
				{ "piece_mm_beech_seeds_container", "Beech Seeds Sack" },
				{ "piece_mm_pine_seeds_container", "Pine Seeds Sack" },
				{ "piece_mm_mystical_seeds_container", "Mystical Seeds Sack" },
				{ "piece_mm_ancient_seeds_container", "Ancient Seeds Sack" },
				{ "piece_mm_carrot_seeds_container", "Carrot Seeds Sack" },
				{ "piece_mm_turnip_seeds_container", "Turnip Seeds Sack" },
				{ "piece_mm_onion_seeds_container", "Onion Seeds Sack" },
				{ "piece_mm_corewood_market_stall_hot_food", "Hot Food Market Stall" },
				{ "piece_mm_hot_asksvin_tail_container", "Cooked Asksvin Tail" },
				{ "piece_mm_hot_serpent_meat_container", "Cooked Serpent Meat" },
				{ "piece_mm_hot_volture_meat_container", "Cooked Volture Meat" },
				{ "piece_mm_hot_boar_meat_container", "Cooked Boar Meat" },
				{ "piece_mm_hot_lox_meat_container", "Cooked Lox Meat" },
				{ "piece_mm_hot_wolf_meat_container", "Cooked Wolf Meat" },
				{ "piece_mm_hot_chicken_meat_container", "Cooked Chicken Meat" },
				{ "piece_mm_hot_deer_meat_container", "Cooked Deer Meat" },
				{ "piece_mm_chair", "Chair" },
				{ "piece_mm_bench", "Log Bench" },
				{ "piece_mmgate", "Door" },
				{ "piece_mmfencegate", "Gate" },
				{ "piece_mmwindow", "Window" },
				{ "piece_mmshutter", "Shutter" },
				{ "piece_mmcabinet", "Cabinet" },
				{ "piece_mmtoilet", "Toilet" },
				{ "piece_mmwatchtower_enter", "Enter Watch Tower" },
				{ "piece_mmwatchtower_exit", "Exit Watch Tower" },
				{ "piece_mmexit", "Exit" },
				{ "piece_mmelevator", "Elevator" },
				{ "piece_mm_chest_open", "Open" },
				{ "piece_mm_chest_edit", "Edit" },
				{ "piece_mm_drawbridge", "Drawbridge" },
				{ "piece_mm_corewood_stakewall", "Core Wood Stake Wall" },
				{ "piece_mm_corewood_stakes_01", "Core Wood Sharp Stakes" },
				{ "piece_mm_corewood_stakes_02", "Core Wood Sharp Stakes" },
				{ "piece_mm_corewood_stakes_03", "Core Wood Sharp Stakes" },
				{ "piece_mm_corewood_stakes_04", "Core Wood Sharp Stakes" },
				{ "piece_mm_corewood_palisadefence", "Core Wood Palisade" },
				{ "piece_mm_corewood_palisadefencetall", "Core Wood Palisade Tall" },
				{ "piece_mm_corewood_palisade_tower", "Core Wood Palisade Tower" },
				{ "piece_mm_corewood_palisade_beacon", "Core Wood Palisade Beacon" },
				{ "piece_mm_corewood_palisade_gates", "Core Wood Palisade Gates" },
				{ "piece_mm_corewood_palisade_entrance", "Core Wood Fortified Entrance" },
				{ "piece_mm_corewood_palisade_wall", "Core Wood Fortified Wall" },
				{ "piece_mm_corewood_palisade_corner", "Core Wood Fortified Corner" },
				{ "piece_mm_corewood_woodlog26", "Core Wood Log 26" },
				{ "piece_mm_corewood_woodlog45", "Core Wood Log 45" },
				{ "piece_mm_corewood_woodlog26_thin", "Thin Core Wood Log 26" },
				{ "piece_mm_corewood_woodlog45_thin", "Thin Core Wood Log 45" },
				{ "piece_mm_corewood_logpole1", "Core Wood Log Pole 1m" },
				{ "piece_mm_corewood_logpole2", "Core Wood Log Pole 2m" },
				{ "piece_mm_corewood_logpole3", "Core Wood Log Pole 3m" },
				{ "piece_mm_corewood_logpole4", "Core Wood Log Pole 4m" },
				{ "piece_mm_corewood_logpole1_thin", "Thin Core Wood Log Pole 1m" },
				{ "piece_mm_corewood_logpole2_thin", "Thin Core Wood Log Pole 2m" },
				{ "piece_mm_corewood_logpole3_thin", "Thin Core Wood Log Pole 3m" },
				{ "piece_mm_corewood_logpole4_thin", "Thin Core Wood Log Pole 4m" },
				{ "piece_mm_corewood_logbeam1", "Core Wood Log Beam 1m" },
				{ "piece_mm_corewood_logbeam2", "Core Wood Log Beam 2m" },
				{ "piece_mm_corewood_logbeam3", "Core Wood Log Beam 3m" },
				{ "piece_mm_corewood_logbeam4", "Core Wood Log Beam 4m" },
				{ "piece_mm_corewood_logbeam1_thin", "Thin Core Wood Log Beam 1m" },
				{ "piece_mm_corewood_logbeam2_thin", "Thin Core Wood Log Beam 2m" },
				{ "piece_mm_corewood_logbeam3_thin", "Thin Core Wood Log Beam 3m" },
				{ "piece_mm_corewood_logbeam4_thin", "Thin Core Wood Log Beam 4m" },
				{ "piece_mm_corewood_roof26", "Core Wood Roof 26" },
				{ "piece_mm_corewood_roof45", "Core Wood Roof 45" },
				{ "piece_mm_corewood_rooficorner26", "Core Wood Icorner 26" },
				{ "piece_mm_corewood_rooficorner45", "Core Wood Icorner 45" },
				{ "piece_mm_corewood_roofocorner26", "Core Wood Ocorner 26" },
				{ "piece_mm_corewood_roofocorner45", "Core Wood Ocorner 45" },
				{ "piece_mm_corewood_rooftop26", "Core Wood Roof Top 26" },
				{ "piece_mm_corewood_rooftop45", "Core Wood Roof Top 45" },
				{ "piece_mm_corewood_wallroof26", "Core Wood Wall Roof 26" },
				{ "piece_mm_corewood_wallroof45", "Core Wood Wall Roof 45" },
				{ "piece_mm_corewood_wallroof_upsidedown26", "Core Wood Wall Roof 26" },
				{ "piece_mm_corewood_wallroof_upsidedown45", "Core Wood Wall Roof 45" },
				{ "piece_mm_corewood_cross26", "Core Wood Cross 26" },
				{ "piece_mm_corewood_cross45", "Core Wood Cross 45" },
				{ "piece_mm_corewood_decking_2x2", "Core Wood Decking 2x2" },
				{ "piece_mm_corewood_decking_4x4", "Core Wood Decking 4x4" },
				{ "piece_mm_corewood_floor_half", "Core Wood Floor Half" },
				{ "piece_mm_corewood_floor", "Core Wood Floor 2m" },
				{ "piece_mm_corewood_floor_4m", "Core Wood Floor 4m" },
				{ "piece_mm_corewood_quarterwall", "Core Wood Wall Quarter" },
				{ "piece_mm_corewood_halfwall", "Core Wood Wall Half" },
				{ "piece_mm_corewoodwall_v", "Core Wood Wall 2m" },
				{ "piece_mm_corewoodwall_4m", "Core Wood Wall 4m" },
				{ "piece_mm_corewood_gate_left", "Core Wood Gate Left (L)" },
				{ "piece_mm_corewood_gate_right", "Core Wood Gate Right (L)" },
				{ "piece_mm_corewood_gate_small_left", "Core Wood Gate Left (S)" },
				{ "piece_mm_corewood_gate_small_right", "Core Wood Gate Right (S)" },
				{ "piece_mm_corewood_trapdoor", "Core Wood Trapdoor" },
				{ "piece_mm_corewwood_window_single", "Core Wood Window Single" },
				{ "piece_mm_corewwood_window_double", "Core Wood Window Double" },
				{ "piece_mm_corewwood_window_tall", "Core Wood Window Tall" },
				{ "piece_mm_corewwood_window_small", "Core Wood Window Animated (S)" },
				{ "piece_mm_corewwood_window_medium", "Core Wood Window Animated (M)" },
				{ "piece_mm_corewwood_window_large", "Core Wood Shutter Animated (L)" },
				{ "piece_mm_corewwood_shutter_small", "Core Wood Shutter Animated (S)" },
				{ "piece_mm_corewwood_shutter_medium", "Core Wood Shutter Animated (M)" },
				{ "piece_mm_corewwood_shutter_large", "Core Wood Shutter Animated (L)" },
				{ "piece_mm_window_large_01", "Stained Glass Window (L)" },
				{ "piece_mm_window_large_02", "Stained Glass Window (L)" },
				{ "piece_mm_window_large_03", "Stained Glass Window (L)" },
				{ "piece_mm_window_medium_01", "Stained Glass Window (M)" },
				{ "piece_mm_window_medium_02", "Stained Glass Window (M)" },
				{ "piece_mm_window_medium_03", "Stained Glass Window (M)" },
				{ "piece_mm_window_small_01", "Stained Glass Window (S)" },
				{ "piece_mm_window_small_02", "Stained Glass Window (S)" },
				{ "piece_mm_window_small_03", "Stained Glass Window (S)" },
				{ "piece_mm_corewood_fencepost", "Core Wood Fence Post" },
				{ "piece_mm_corewood_wattle_fence", "Core Wood Wattle Fence" },
				{ "piece_mm_corewood_fence_small", "Core Wood Fence (S)" },
				{ "piece_mm_corewood_fence_small_alt", "Core Wood Fence (M)" },
				{ "piece_mm_corewood_fence_large", "Core Wood Fence (L)" },
				{ "piece_mm_corewood_fence_small_gate", "Core Wood Fence Gate" },
				{ "piece_mm_corewood_stair", "Core Wood Stair" },
				{ "piece_mm_corewood_stepladder", "Core Wood Stepladder" },
				{ "piece_mm_corewood_drawbridge", "Drawbridge 01" },
				{ "piece_mm_corewood_drawbridge2", "Drawbridge 02" },
				{ "piece_mm_corewood_elevator_small", "Small Elevator 4.5m" },
				{ "piece_mm_corewood_elevator_large", "Large Elevator 4.5m" },
				{ "piece_mm_corewood_elevator_small_9", "Small Elevator 9m" },
				{ "piece_mm_corewood_elevator_large_9", "Large Elevator 9m" },
				{ "piece_mm_corewood_liftgate", "Liftgate" },
				{ "piece_mm_corewood_bridge_part", "Bridge Part" },
				{ "piece_mm_corewood_bridge_part_02", "Bridge Part 02" },
				{ "piece_mm_corewood_bridge_tjunction", "Bridge T-Junction" },
				{ "piece_mm_corewood_bridge_cross_junction", "Bridge Cross-Junction" },
				{ "piece_mm_corewood_bridge_foundation", "Bridge Foundation" },
				{ "piece_mm_corewood_bridge_foundation_02", "Bridge Foundation 02" },
				{ "piece_mm_corewood_bridge_ramp", "Bridge Ramp" },
				{ "piece_mm_corewood_bridge_drawbridge", "Bridge Drawbridge" },
				{ "piece_mm_corewood_tower_drawbridge", "Tower Drawbridge" },
				{ "piece_mm_corewood_greenhouse_door", "Greenhouse Door" },
				{ "piece_mm_corewood_greenhouse_panel", "Greenhouse Panel" },
				{ "piece_mm_corewood_greenhouse_roof", "Greenhouse Roof" },
				{ "piece_mm_corewood_greenhouse_roof_top", "Greenhouse Roof Top" },
				{ "piece_mm_corewood_greenhouse_roof_wall_corner", "Greenhouse Roof Wall Corner" },
				{ "piece_mm_corewood_greenhouse_roof_wall_half", "Greenhouse Roof Wall Half" },
				{ "piece_mm_corewood_greenhouse_workbench", "Greenhouse Workbench" },
				{ "piece_mm_corewood_greenhouse_table", "Greenhouse Table" },
				{ "piece_mm_greenhouse_plantpot", "plant Pot" },
				{ "piece_mm_greenhouse_plantpots", "plant Pots" },
				{ "piece_mm_greenhouse_soilbags", "Soil Bags" },
				{ "piece_mm_greenhouse_shovel", "Garden Shovel" },
				{ "piece_mm_greenhouse_rake", "Garden Rake" },
				{ "piece_mm_corewood_stack", "Core Wood Stack" },
				{ "piece_mm_corewood_dynamic_stack", "Dynamic Core Wood Stack" },
				{ "piece_mm_corewood_dynamic_stack_desc", "A dynamic stack of Core Wood logs." },
				{ "piece_mm_corewood_logbench", "Core Wood Log Bench" },
				{ "piece_mm_corewood_large_bench", "Core Wood Log Bench" },
				{ "piece_mm_corewood_stump_chair", "Core Wood Stump Chair" },
				{ "piece_mm_corewood_throne", "Core Wood Throne" },
				{ "piece_mm_corewood_chair", "Core Wood Chair" },
				{ "piece_mm_corewood_table", "Core Wood Table" },
				{ "piece_mm_corewood_log_chair", "Core Wood Stump Chair" },
				{ "piece_mm_corewood_log_table", "Core Wood Stump Table" },
				{ "piece_mm_corewood_bed", "Core Wood Bed" },
				{ "piece_mm_corewood_bed_4poster", "Core Wood 4 Poster" },
				{ "piece_mm_corewood_chest_public", "public Chest" },
				{ "piece_mm_corewood_chest_private", "private Chest" },
				{ "piece_mm_corewood_bookshelf_small", "Bookshelf (S)" },
				{ "piece_mm_corewood_bookshelf_medium", "Bookshelf (M)" },
				{ "piece_mm_corewood_bookshelf_large", "Bookshelf (L)" },
				{ "piece_mm_corewood_wall_cabinet", "Wall Cabinet" },
				{ "piece_mm_corewood_tall_cabinet", "Tall Cabinet" },
				{ "piece_mm_corewood_tall_cabinet_double", "Double Tall Cabinet" },
				{ "piece_mm_corewood_cabinet_armor", "Armor Stand Cabinet" },
				{ "piece_mm_corewood_displaycase", "Boss Trophy Display" },
				{ "piece_mm_corewood_displaycase_large", "Large Display Case" },
				{ "piece_mm_corewood_outhouse", "Outhouse" },
				{ "piece_mm_corewood_arch", "Garden Arch" },
				{ "piece_mm_corewood_arch_ivy", "Garden Arch Ivy" },
				{ "piece_mm_horn_walltorch", "Horn Walltorch" },
				{ "piece_mm_deer_chandelier", "Deer Chandelier" },
				{ "piece_mm_skull_candles", "Skull Candles" },
				{ "piece_mm_lavalantern", "Lava Lantern" },
				{ "piece_mm_corewood_surtling_lantern", "Surtling Lantern" },
				{ "piece_mm_surtling_lamppost_single", "Surtling Lamppost Single" },
				{ "piece_mm_surtling_lamppost_double", "Surtling Lamppost Double" },
				{ "piece_corewood_crystal_light", "Crystal Light" },
				{ "piece_mm_corewood_rope_lights", "Crystal Rope Lights" },
				{ "piece_mm_corewood_brazier", "Iron Brazier" },
				{ "piece_mm_private_sign", "private Property Sign" },
				{ "piece_mm_repair_sign", "Repair Area Sign" },
				{ "piece_mm_rest_sign", "Rest Area Sign" },
				{ "piece_mm_docks_sign", "Docks Sign" },
				{ "piece_mm_tavern_sign", "Tavern Sign" },
				{ "piece_mm_haldor_sign", "Haldor Sign" },
				{ "piece_mm_hildir_sign", "Hildir Sign" },
				{ "piece_mm_bonemass_banner", "Bonemass Banner" },
				{ "piece_mm_eikthyr_banner", "Eikthyr Banner" },
				{ "piece_mm_elder_banner", "The Elder Banner" },
				{ "piece_mm_fader_banner", "Fader Banner" },
				{ "piece_mm_moder_banner", "Moder Banner" },
				{ "piece_mm_queen_banner", "The Queen Banner" },
				{ "piece_mm_yagluth_banner", "Yagluth Banner" },
				{ "piece_mm_haldor_banner", "Haldor Banner" },
				{ "piece_mm_hildir_banner", "Hildir Banner" },
				{ "piece_mm_wall_banner_01", "Wall Banner 01" },
				{ "piece_mm_wall_banner_02", "Wall Banner 02" },
				{ "piece_mm_wall_banner_03", "Wall Banner 03" },
				{ "piece_mm_first_pictureframe", "picture Frame" },
				{ "piece_mm_first_pictureframe_vertical", "picture Frame(vertical)" },
				{ "piece_mm_first_pictureframe_square", "picture Frame(square)" },
				{ "piece_mm_bookstack_01", "Book Stack 01" },
				{ "piece_mm_bookstack_02", "Book Stack 02" },
				{ "piece_mm_bookstack_03", "Book Stack 03" },
				{ "piece_mm_bookstack_04", "Book Stack 04" },
				{ "piece_mm_bookstack_05", "Book Stack 05" },
				{ "piece_mm_bookstack_06", "Book Stack 06" },
				{ "piece_mm_bowlstack_01", "Bowl Stack 01" },
				{ "piece_mm_bowlstack_02", "Bowl Stack 02" },
				{ "piece_mm_platestack_01", "plate Stack 01" },
				{ "piece_mm_platestack_02", "plate Stack 02" },
				{ "piece_mm_saucepan_01", "Saucepan 01" },
				{ "piece_mm_saucepan_02", "Saucepan 02" },
				{ "piece_mm_potted_plant_01", "potted Plant 01" },
				{ "piece_mm_potted_plant_02", "potted Plant 02" },
				{ "piece_mm_potted_plant_03", "potted Plant 03" },
				{ "piece_mm_potted_plant_04", "potted Plant 04" },
				{ "piece_mm_potted_plant_05", "potted Plant 05" },
				{ "piece_mm_potted_plant_06", "potted Plant 06" },
				{ "piece_mm_corewood_planter_01", "planter 01" },
				{ "piece_mm_corewood_planter_02", "planter 02" },
				{ "piece_mm_corewood_planter_03", "planter 03" },
				{ "piece_mm_corewood_planter_04", "planter 04" },
				{ "piece_mm_corewood_planter_05", "planter 05" },
				{ "piece_mm_corewood_planter_06", "planter 06" },
				{ "piece_mm_corewood_planter_glowing", "planter Glowing" },
				{ "piece_mm_corewood_planter_roses_red", "planter Roses Red" },
				{ "piece_mm_corewood_planter_roses_white", "planter Roses White" },
				{ "piece_mm_corewood_planter_roses_yellow", "planter Roses Yellow" },
				{ "piece_mm_seeds_desc", "Mystical seeds can be bought from the traders." },
				{ "piece_mm_decorative_goblet", "Decorative Goblet" },
				{ "piece_mm_decorative_pitcher", "Decorative Pitcher" },
				{ "piece_mm_decorative_bowl", "Decorative Bowl" },
				{ "piece_mm_decorative_plate", "Decorative Plate" },
				{ "piece_mm_decorative_bowl_large", "Large Decorative Bowl" },
				{ "piece_mm_decorative_plate_large", "Large Decorative Plate" },
				{ "piece_mm_cutlery_set", "Cutlery Set" },
				{ "piece_mm_rug_01", "Rug 01" },
				{ "piece_mm_rug_02", "Rug 02" },
				{ "piece_mm_rug_03", "Rug 03" },
				{ "piece_mm_scarecrow", "Scarecrow" },
				{ "piece_mm_wood_carving_01", "Viking Wood Carving" },
				{ "piece_mm_wood_carving_02", "Owl Wood Carving" },
				{ "piece_mm_corewood_stuffed_boar", "Stuffed Boar" },
				{ "piece_mm_corewood_stuffed_deer", "Stuffed Deer" },
				{ "piece_mm_corewood_stuffed_wolf", "Stuffed Wolf" },
				{ "piece_mm_corewood_stuffed_vulture", "Stuffed Vulture" },
				{ "piece_mm_corewood_stuffed_werewolf", "Stuffed Werewolf" },
				{ "piece_mm_corewood_stuffed_crow", "Stuffed Crow" },
				{ "piece_mm_corewood_stuffed_seagul", "Stuffed Seagul" },
				{ "piece_mm_corewood_creature_stand_small", "Small Creature Stand" },
				{ "piece_mm_corewood_creature_stand_medium", "Medium Creature Stand" },
				{ "piece_mm_corewood_creature_stand_large", "Large Creature Stand" },
				{ "piece_mm_corewood_chest_stackable", "Stackable Chest" },
				{ "piece_mm_water_fountain", "Water Fountain" },
				{ "piece_mm_haybale", "Straw Bale" },
				{ "piece_mm_shower_block", "Shower" },
				{ "piece_mm_parasol", "Parasol" },
				{ "piece_mm_corewood_plank_floor", "Core Wood Planks 2x2" },
				{ "piece_mm_corewood_plank_floor_4", "Core Wood Planks 4x4" },
				{ "piece_mm_corewood_well", "Old Well" },
				{ "piece_mm_corewood_bar", "Burts Bar" },
				{ "piece_mm_corewood_gazebo", "Garden Gazebo" },
				{ "piece_mm_corewood_pergola", "Garden Pergola" },
				{ "piece_mm_corewood_footbridge_small", "Small Footbridge" },
				{ "piece_mm_corewood_footbridge_large", "Large Footbridge" },
				{ "piece_mm_corewood_arch_corner", "Arch Corner" },
				{ "piece_mm_corewood_paving_straight", "Paving Straight" },
				{ "piece_mm_corewood_paving_corner", "Paving Corner" },
				{ "piece_mm_corewood_paving_cross", "Paving Cross" },
				{ "piece_mm_corewood_aquarium", "Aquarium" },
				{ "piece_mm_gnome_welcome", "Gnome Welcome" },
				{ "piece_mm_gnome_female", "Gnome Female" },
				{ "piece_mm_gnome_flowerpots", "Gnome Flowerpots" },
				{ "piece_mm_gnome_palm_tree", "Gnome Palm Tree" },
				{ "piece_mm_barrel_01", "Barrel" },
				{ "piece_mm_keg_01", "Large Keg" },
				{ "piece_mm_keg_02", "Small Keg" },
				{ "piece_mm_placeable_ivy", "Ivy Patch" }
			});
			CustomLocalization localization2 = Localization;
			text = "English";
			localization2.AddTranslation(ref text, new Dictionary<string, string>
			{
				{ "item_mm_planter_small", "Small Planter" },
				{ "item_mm_planter_large", "Large Planter" },
				{ "item_mm_vase_01", "Vase 01" },
				{ "item_mm_vase_02", "Vase 02" },
				{ "item_mm_vase_03", "Vase 03" },
				{ "item_mm_mystical_seed", "Mystical Seed" },
				{ "item_mm_mystical_seed_desc", "A Mystical seed to create plants at the Greenhouse Workbench." }
			});
			CustomLocalization localization3 = Localization;
			text = "English";
			localization3.AddTranslation(ref text, new Dictionary<string, string>
			{
				{ "message_restricted", "Item Resticted!" },
				{ "text_chest_open", "Open (Hold to quick stack)" },
				{ "text_chest_edit", "Edit text" },
				{ "text_chest_set", "Set item name" },
				{ "text_enable_fountain", "Enable Fountain" },
				{ "text_disable_fountain", "Disable Fountain" },
				{ "text_enable_fish", "Enable Fish" },
				{ "text_disable_fish", "Disable Fish" },
				{ "npc_bartender_talk", "????" }
			});
		}
	}
	public class GamePatches
	{
		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		private class ZNetSceneAwakeMeshPatch
		{
			[HarmonyPriority(200)]
			private static void Postfix(ZNetScene __instance)
			{
				zNetScene = __instance;
				FixGameObjects();
			}
		}

		public static ZNetScene zNetScene;

		public static void FixGameObjects()
		{
			foreach (GameObject prefab in zNetScene.m_prefabs)
			{
				if (!((Object)prefab).name.ToLower().StartsWith("mm_corewood"))
				{
					continue;
				}
				MeshRenderer[] componentsInChildren = prefab.GetComponentsInChildren<MeshRenderer>();
				foreach (MeshRenderer val in componentsInChildren)
				{
					if (((Renderer)val).material.HasProperty("_RippleDistance"))
					{
						((Renderer)val).sharedMaterial.SetFloat("_RippleDistance", 0.01f);
						((Renderer)val).sharedMaterial.SetFloat("_RippleFreq", 0f);
						((Renderer)val).sharedMaterial.SetFloat("_ValueNoise", 0f);
					}
				}
			}
		}
	}
	internal class TraderPatches
	{
		[HarmonyPatch(typeof(Trader), "GetAvailableItems")]
		public static class GetAvailableItemsPatch
		{
			[HarmonyPriority(200)]
			private static void Postfix(Trader __instance, ref List<TradeItem> __result)
			{
				if (!((Object)__instance).name.Contains("Burt"))
				{
					string name = ((Object)Cache.GetPrefab<GameObject>("mm_mystical_seed")).name;
					__result.Add(CreateTraderItem(name, 10, 10, "none"));
				}
				if (MainConfig.traderEnabled.Value && ((Object)__instance).name.Contains("Burt"))
				{
					if (MainConfig.barleyWineEnabled.Value)
					{
						int value = MainConfig.barleyWineStack.Value;
						int value2 = MainConfig.barleyWinePrice.Value;
						string name2 = ((Object)Cache.GetPrefab<GameObject>("BarleyWine")).name;
						__result.Add(CreateTraderItem(name2, value, value2, "none"));
					}
					if (MainConfig.frostResistEnabled.Value)
					{
						int value3 = MainConfig.frostResistStack.Value;
						int value4 = MainConfig.frostResistPrice.Value;
						string name3 = ((Object)Cache.GetPrefab<GameObject>("MeadFrostResist")).name;
						__result.Add(CreateTraderItem(name3, value3, value4, "none"));
					}
					if (MainConfig.poisonResistEnabled.Value)
					{
						int value5 = MainConfig.poisonResistStack.Value;
						int value6 = MainConfig.poisonResistPrice.Value;
						string name4 = ((Object)Cache.GetPrefab<GameObject>("MeadPoisonResist")).name;
						__result.Add(CreateTraderItem(name4, value5, value6, "none"));
					}
					if (MainConfig.healthMinorEnabled.Value)
					{
						int value7 = MainConfig.healthMinorStack.Value;
						int value8 = MainConfig.healthMinorPrice.Value;
						string name5 = ((Object)Cache.GetPrefab<GameObject>("MeadHealthMinor")).name;
						__result.Add(CreateTraderItem(name5, value7, value8, "none"));
					}
					if (MainConfig.healthMediumEnabled.Value)
					{
						int value9 = MainConfig.healthMediumStack.Value;
						int value10 = MainConfig.healthMediumPrice.Value;
						string name6 = ((Object)Cache.GetPrefab<GameObject>("MeadHealthMedium")).name;
						__result.Add(CreateTraderItem(name6, value9, value10, "none"));
					}
					if (MainConfig.healthMajorEnabled.Value)
					{
						int value11 = MainConfig.healthMajorStack.Value;
						int value12 = MainConfig.healthMajorPrice.Value;
						string name7 = ((Object)Cache.GetPrefab<GameObject>("MeadHealthMajor")).name;
						__result.Add(CreateTraderItem(name7, value11, value12, "none"));
					}
					if (MainConfig.healthLingeringEnabled.Value)
					{
						int value13 = MainConfig.healthLingeringStack.Value;
						int value14 = MainConfig.healthLingeringPrice.Value;
						string name8 = ((Object)Cache.GetPrefab<GameObject>("MeadHealthLingering")).name;
						__result.Add(CreateTraderItem(name8, value13, value14, "none"));
					}
					if (MainConfig.staminaMinorEnabled.Value)
					{
						int value15 = MainConfig.staminaMinorStack.Value;
						int value16 = MainConfig.staminaMinorPrice.Value;
						string name9 = ((Object)Cache.GetPrefab<GameObject>("MeadStaminaMinor")).name;
						__result.Add(CreateTraderItem(name9, value15, value16, "none"));
					}
					if (MainConfig.staminaMediumEnabled.Value)
					{
						int value17 = MainConfig.staminaMediumStack.Value;
						int value18 = MainConfig.staminaMediumPrice.Value;
						string name10 = ((Object)Cache.GetPrefab<GameObject>("MeadStaminaMedium")).name;
						__result.Add(CreateTraderItem(name10, value17, value18, "none"));
					}
					if (MainConfig.staminaLingeringEnabled.Value)
					{
						int value19 = MainConfig.staminaLingeringStack.Value;
						int value20 = MainConfig.staminaLingeringPrice.Value;
						string name11 = ((Object)Cache.GetPrefab<GameObject>("MeadStaminaLingering")).name;
						__result.Add(CreateTraderItem(name11, value19, value20, "none"));
					}
					if (MainConfig.eitrMinorEnabled.Value)
					{
						int value21 = MainConfig.eitrMinorStack.Value;
						int value22 = MainConfig.eitrMinorPrice.Value;
						string name12 = ((Object)Cache.GetPrefab<GameObject>("MeadEitrMinor")).name;
						__result.Add(CreateTraderItem(name12, value21, value22, "none"));
					}
					if (MainConfig.eitrLingeringEnabled.Value)
					{
						int value23 = MainConfig.eitrLingeringStack.Value;
						int value24 = MainConfig.eitrLingeringPrice.Value;
						string name13 = ((Object)Cache.GetPrefab<GameObject>("MeadEitrLingering")).name;
						__result.Add(CreateTraderItem(name13, value23, value24, "none"));
					}
					if (MainConfig.meadBzerkerEnabled.Value)
					{
						int value25 = MainConfig.meadBzerkerStack.Value;
						int value26 = MainConfig.meadBzerkerPrice.Value;
						string name14 = ((Object)Cache.GetPrefab<GameObject>("MeadBzerker")).name;
						__result.Add(CreateTraderItem(name14, value25, value26, "none"));
					}
					if (MainConfig.bugRepellentEnabled.Value)
					{
						int value27 = MainConfig.bugRepellentStack.Value;
						int value28 = MainConfig.bugRepellentPrice.Value;
						string name15 = ((Object)Cache.GetPrefab<GameObject>("MeadBugRepellent")).name;
						__result.Add(CreateTraderItem(name15, value27, value28, "none"));
					}
					if (MainConfig.trollPheromonesEnabled.Value)
					{
						int value29 = MainConfig.trollPheromonesStack.Value;
						int value30 = MainConfig.trollPheromonesPrice.Value;
						string name16 = ((Object)Cache.GetPrefab<GameObject>("MeadTrollPheromones")).name;
						__result.Add(CreateTraderItem(name16, value29, value30, "none"));
					}
					if (MainConfig.meadTastyEnabled.Value)
					{
						int value31 = MainConfig.meadTastyStack.Value;
						int value32 = MainConfig.meadTastyPrice.Value;
						string name17 = ((Object)Cache.GetPrefab<GameObject>("MeadTasty")).name;
						__result.Add(CreateTraderItem(name17, value31, value32, "none"));
					}
					if (MainConfig.meadSwimmerEnabled.Value)
					{
						int value33 = MainConfig.meadSwimmerStack.Value;
						int value34 = MainConfig.meadSwimmerPrice.Value;
						string name18 = ((Object)Cache.GetPrefab<GameObject>("MeadSwimmer")).name;
						__result.Add(CreateTraderItem(name18, value33, value34, "none"));
					}
					if (MainConfig.meadHastyEnabled.Value)
					{
						int value35 = MainConfig.meadHastyStack.Value;
						int value36 = MainConfig.meadHastyPrice.Value;
						string name19 = ((Object)Cache.GetPrefab<GameObject>("MeadHasty")).name;
						__result.Add(CreateTraderItem(name19, value35, value36, "none"));
					}
					if (MainConfig.meadStrengthEnabled.Value)
					{
						int value37 = MainConfig.meadStrengthStack.Value;
						int value38 = MainConfig.meadStrengthPrice.Value;
						string name20 = ((Object)Cache.GetPrefab<GameObject>("MeadStrength")).name;
						__result.Add(CreateTraderItem(name20, value37, value38, "none"));
					}
					if (MainConfig.meadTamerEnabled.Value)
					{
						int value39 = MainConfig.meadTamerStack.Value;
						int value40 = MainConfig.meadTamerPrice.Value;
						string name21 = ((Object)Cache.GetPrefab<GameObject>("MeadTamer")).name;
						__result.Add(CreateTraderItem(name21, value39, value40, "none"));
					}
					if (MainConfig.meadLightfootEnabled.Value)
					{
						int value41 = MainConfig.meadLightfootStack.Value;
						int value42 = MainConfig.meadLightfootPrice.Value;
						string name22 = ((Object)Cache.GetPrefab<GameObject>("MeadLightfoot")).name;
						__result.Add(CreateTraderItem(name22, value41, value42, "none"));
					}
				}
			}

			private static TradeItem CreateTraderItem(string itemName, int stackSize, int price, string key)
			{
				//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)
				//IL_001d: 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_0033: Expected O, but got Unknown
				ItemDrop component = ObjectDB.instance.GetItemPrefab(itemName).GetComponent<ItemDrop>();
				return new TradeItem
				{
					m_prefab = component,
					m_stack = stackSize,
					m_price = price,
					m_requiredGlobalKey = key
				};
			}
		}
	}
	public class PictureFrame : PictureFrameBase
	{
		public override Vector3 PivotOffset { get; set; } = new Vector3(0.729f, 0.4473f, 0f);


		public override string Name { get; set; } = "$piece_mm_first_pictureframe";

	}
	public abstract class PictureFrameBase : MonoBehaviour, Hoverable, Interactable, TextReceiver
	{
		[CompilerGenerated]
		private sealed class <NextPicture>d__30 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public PictureFrameBase <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <NextPicture>d__30(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Expected O, but got Unknown
				int num = <>1__state;
				PictureFrameBase pictureFrameBase = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (pictureFrameBase._textureNames != null && pictureFrameBase._textureNames.Length != 0)
				{
					pictureFrameBase._nextIndex %= pictureFrameBase._textureNames.Length;
					pictureFrameBase.SetTexture(pictureFrameBase._textureNames[pictureFrameBase._nextIndex]);
					pictureFrameBase._nextIndex++;
					<>2__current = (object)new WaitForSeconds(pictureFrameBase._interval);
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static char pds = Path.DirectorySeparatorChar;

		private static readonly string _basePath = Paths.ConfigPath + pds + "CoreWoodExtras" + pds + "Images";

		private Renderer _frameRenderer;

		private int _characterLimit = 100;

		private float _interval = 5f;

		private TextureCache textureCache;

		private ZNetView _nview;

		private string[] _textureNames = new string[0];

		private int _nextIndex;

		public Text TextWidget { get; set; }

		public abstract Vector3 PivotOffset { get; set; }

		public abstract string Name { get; set; }

		private static Dictionary<string, string> ParseOptions(string[] args)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			for (int i = 0; i < args.Length; i++)
			{
				string[] array = args[i].Split(new char[1] { '=' });
				if (array.Length == 2)
				{
					dictionary.Add(array[0], array[1]);
				}
			}
			return dictionary;
		}

		public string GetHoverName()
		{
			return Name;
		}

		public string GetHoverText()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, false, false))
			{
				return Localization.instance.Localize("$piece_mm_first_pictureframe");
			}
			return Localization.instance.Localize("$piece_mm_first_pictureframe\n[<color=yellow><b>$KEY_Use</b></color>] $piece_use");
		}

		public string GetText()
		{
			return _nview.GetZDO().GetString("text", "");
		}

		public bool Interact(Humanoid user, bool hold, bool alt)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if (hold)
			{
				return false;
			}
			if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false))
			{