Decompiled source of BetterMuck v1.3.5

Assembly-CSharp.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml.Serialization;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using MilkShake;
using Steamworks;
using Steamworks.Data;
using TMPro;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Profiling;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
using UnityEngine.Serialization;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.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 AchievementDisplay : MonoBehaviour
{
	public enum WinState
	{
		Won = -3,
		Lost,
		Draw
	}

	public GameObject achievementPrefab;

	public Transform achievementParent;

	private int achievementsPerPage = 8;

	private int nAchievements;

	private int nPages;

	private int currentPage;

	private Achievement[] achievements = (Achievement[])(object)new Achievement[0];

	private void OnEnable()
	{
		currentPage = 0;
		if (achievements.Length < 1)
		{
			achievements = SteamUserStats.Achievements.ToArray();
		}
		nAchievements = achievements.Length;
		nPages = Mathf.FloorToInt((float)nAchievements / (float)achievementsPerPage);
		LoadPage(currentPage);
	}

	private void LoadPage(int page)
	{
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		for (int num = achievementParent.childCount - 1; num >= 0; num--)
		{
			Object.Destroy((Object)(object)((Component)achievementParent.GetChild(num)).gameObject);
		}
		int num2 = achievementsPerPage * page;
		for (int i = num2; i < achievements.Length; i++)
		{
			Object.Instantiate<GameObject>(achievementPrefab, achievementParent).GetComponent<AchievementPrefab>().SetAchievement(achievements[i]);
			if (i >= num2 + achievementsPerPage - 1)
			{
				break;
			}
		}
	}

	public void NextPage(int dir)
	{
		if ((dir >= 0 || currentPage != 0) && (dir <= 0 || currentPage < nPages))
		{
			currentPage += dir;
			LoadPage(currentPage);
		}
	}
}
public class AchievementManager : MonoBehaviour
{
	public static AchievementManager Instance;

	public InventoryItem[] gems;

	private void Awake()
	{
		Instance = this;
		SteamUserStats.OnAchievementProgress += AchievementChanged;
	}

	private void Start()
	{
		GameStarted();
	}

	private void AchievementChanged(Achievement ach, int currentProgress, int progress)
	{
		if (GameManager.gameSettings.gameMode != GameSettings.GameMode.Creative && ((Achievement)(ref ach)).State)
		{
			((Achievement)(ref ach)).Trigger(true);
			Debug.Log((object)(((Achievement)(ref ach)).Name + " WAS UNLOCKED!"));
		}
	}

	public void CheckGameOverAchievements(int endState)
	{
		if (GameManager.gameSettings.gameMode == GameSettings.GameMode.Creative || !CanUseAchievements())
		{
			return;
		}
		bool onlyRock = GameManager.instance.onlyRock;
		bool damageTaken = GameManager.instance.damageTaken;
		bool powerupsPickedup = GameManager.instance.powerupsPickedup;
		int currentDay = GameManager.instance.currentDay;
		GameSettings.GameMode gameMode = GameManager.gameSettings.gameMode;
		GameSettings.Difficulty difficulty = GameManager.gameSettings.difficulty;
		if (gameMode == GameSettings.GameMode.Survival && endState == -3)
		{
			switch (difficulty)
			{
			case GameSettings.Difficulty.Easy:
				SteamUserStats.AddStat("WinsEasy", 1);
				Debug.Log((object)("Game finished on Easy: " + SteamUserStats.GetStatInt("WinsEasy")));
				break;
			case GameSettings.Difficulty.Normal:
				SteamUserStats.AddStat("WinsNormal", 1);
				Debug.Log((object)("Game finished on normal: " + SteamUserStats.GetStatInt("WinsNormal")));
				break;
			case GameSettings.Difficulty.Gamer:
				SteamUserStats.AddStat("WinsGamer", 1);
				Debug.Log((object)("Game finished on Gamer: " + SteamUserStats.GetStatInt("WinsGamer")));
				if (currentDay < 10)
				{
					SteamUserStats.AddStat("GamerMove", 1);
					Debug.Log((object)("Game finished on Gamer in less than 10 days: " + SteamUserStats.GetStatInt("GamerMove")));
				}
				break;
			}
			if (currentDay < 8)
			{
				SteamUserStats.AddStat("Speedrunner", 1);
				Debug.Log((object)("Game finished in less than 8 days: " + SteamUserStats.GetStatInt("Speedrunner")));
			}
			if (!powerupsPickedup)
			{
				SteamUserStats.AddStat("NoPowerups", 1);
				Debug.Log((object)("Game finished without powerups: " + SteamUserStats.GetStatInt("NoPowerups")));
			}
			if (!damageTaken && difficulty >= GameSettings.Difficulty.Normal)
			{
				switch (NetworkController.Instance.nPlayers)
				{
				case 1:
					SteamUserStats.AddStat("Untouchable", 1);
					Debug.Log((object)("game finished without taking damage 1: " + SteamUserStats.GetStatInt("Untouchable")));
					break;
				case 2:
					SteamUserStats.AddStat("Dream Team", 1);
					Debug.Log((object)("game finished without taking  2: " + SteamUserStats.GetStatInt("Dream Team")));
					break;
				case 4:
					SteamUserStats.AddStat("The bois", 1);
					Debug.Log((object)("game finished without taking damage 4: " + SteamUserStats.GetStatInt("The bois")));
					break;
				case 8:
					SteamUserStats.AddStat("Sweat and tears", 1);
					Debug.Log((object)("game finished without taking damage 8: " + SteamUserStats.GetStatInt("Sweat and tears")));
					break;
				}
			}
			if (onlyRock)
			{
				SteamUserStats.AddStat("Caveman", 1);
				Debug.Log((object)("game finished using only a rock: " + SteamUserStats.GetStatInt("Caveman")));
			}
			if (difficulty >= GameSettings.Difficulty.Normal && onlyRock && !damageTaken && !powerupsPickedup)
			{
				SteamUserStats.AddStat("Muck", 1);
				Debug.Log((object)("Literally did the impossible: " + SteamUserStats.GetStatInt("Muck")));
			}
			SteamUserStats.AddStat("GamesWon", 1);
			Debug.Log((object)("GamesWon: " + SteamUserStats.GetStatInt("GamesWon")));
		}
		SteamUserStats.StoreStats();
	}

	public void LeaveMuck()
	{
		if (CanUseAchievements())
		{
			SteamUserStats.AddStat("Set sail", 1);
			Debug.Log((object)("Leaving muck. Left: " + SteamUserStats.GetStatInt("Set sail")));
			SteamUserStats.StoreStats();
		}
	}

	public void AddKill(PlayerStatus.WeaponHitType type, Mob mob)
	{
		if (CanUseAchievements() && !mob.countedKill)
		{
			mob.countedKill = true;
			bool flag = mob.IsBuff();
			string name = mob.mobType.name;
			Debug.Log((object)("Is buff: " + flag));
			SteamUserStats.AddStat("Kills", 1);
			SteamUserStats.AddStat("TotalKills", 1);
			if (type == PlayerStatus.WeaponHitType.Ranged)
			{
				SteamUserStats.AddStat("BowKills", 1);
			}
			if (flag)
			{
				Debug.Log((object)"Is buff so adding kills");
				SteamUserStats.AddStat("BuffKills", 1);
			}
			if (name == "Cow")
			{
				SteamUserStats.AddStat("Cow Kills", 1);
			}
			if (name == "Big Chunk")
			{
				SteamUserStats.AddStat("BigChunkKills", 1);
				CheckAllBossesKilled();
			}
			if (name == "Gronk")
			{
				SteamUserStats.AddStat("GronkKills", 1);
				CheckAllBossesKilled();
			}
			if (name == "Guardian")
			{
				SteamUserStats.AddStat("GuardianKills", 1);
				CheckAllBossesKilled();
			}
			if (name == "Chief")
			{
				SteamUserStats.AddStat("ChiefKills", 1);
				CheckAllBossesKilled();
			}
			if (name == "Goblin")
			{
				SteamUserStats.AddStat("GoblinKills", 1);
			}
			if (name == "Woodman")
			{
				SteamUserStats.AddStat("WoodmanKills", 1);
			}
			int statInt = SteamUserStats.GetStatInt("Kills");
			int statInt2 = SteamUserStats.GetStatInt("TotalKills");
			int statInt3 = SteamUserStats.GetStatInt("BowKills");
			int statInt4 = SteamUserStats.GetStatInt("BuffKills");
			int statInt5 = SteamUserStats.GetStatInt("Cow Kills");
			int statInt6 = SteamUserStats.GetStatInt("BigChunkKills");
			int statInt7 = SteamUserStats.GetStatInt("GronkKills");
			int statInt8 = SteamUserStats.GetStatInt("GuardianKills");
			int statInt9 = SteamUserStats.GetStatInt("GoblinKills");
			int statInt10 = SteamUserStats.GetStatInt("WoodmanKills");
			Debug.Log((object)("Killcount: " + statInt + ", allkills: " + statInt2 + ", bowkills: " + statInt3 + ", buffkills: " + statInt4 + ", Cow Kills: " + statInt5 + ", chunks: " + statInt6 + ", gronks: " + statInt7 + ", guardians: " + statInt8 + ", goblins: " + statInt9 + "Woodman kills: " + statInt10));
			SteamUserStats.StoreStats();
		}
	}

	private void CheckAllBossesKilled()
	{
		int statInt = SteamUserStats.GetStatInt("BigChunkKills");
		int statInt2 = SteamUserStats.GetStatInt("GronkKills");
		int statInt3 = SteamUserStats.GetStatInt("GuardianKills");
		int statInt4 = SteamUserStats.GetStatInt("ChiefKills");
		if (statInt3 > 0 && statInt2 > 0 && statInt > 0 && statInt4 > 0)
		{
			SteamUserStats.AddStat("Fearless", 1);
			Debug.Log((object)("All bosses killed: " + SteamUserStats.GetStatInt("Fearless")));
		}
	}

	public void StartBattleTotem()
	{
		if (CanUseAchievements())
		{
			SteamUserStats.AddStat("Battle totems started", 1);
			Debug.Log((object)("battle totems started: " + SteamUserStats.GetStatInt("Battle totems started")));
			SteamUserStats.StoreStats();
		}
	}

	public void ReviveTeammate()
	{
		if (CanUseAchievements())
		{
			SteamUserStats.AddStat("Revives", 1);
			Debug.Log((object)("Revives: " + SteamUserStats.GetStatInt("Revives")));
			SteamUserStats.StoreStats();
		}
	}

	public void AddDeath(PlayerStatus.DamageType deathCause)
	{
		if (CanUseAchievements())
		{
			Debug.Log((object)("Cause of death: " + deathCause));
			if (deathCause == PlayerStatus.DamageType.Drown)
			{
				SteamUserStats.AddStat("Drown", 1);
				Debug.Log((object)("Drowned: " + SteamUserStats.GetStatInt("Drown")));
			}
			SteamUserStats.AddStat("Deaths", 1);
			SteamUserStats.AddStat("TotalDeaths", 1);
			Debug.Log((object)("Deaths: " + SteamUserStats.GetStatInt("Deaths")));
			Debug.Log((object)("TotalDeaths: " + SteamUserStats.GetStatInt("TotalDeaths")));
			SteamUserStats.StoreStats();
		}
	}

	public bool CanUseAchievements()
	{
		if (!Object.op_Implicit((Object)(object)SteamManager.Instance) || !SteamClient.IsValid)
		{
			return false;
		}
		return true;
	}

	public void OpenChest()
	{
		if (CanUseAchievements())
		{
			SteamUserStats.AddStat("Chests opened", 1);
			SteamUserStats.AddStat("TotalChestsOpened", 1);
			Debug.Log((object)("Chests opened: " + SteamUserStats.GetStatInt("Chests opened")));
			SteamUserStats.AddStat("Chests opened", 1);
			SteamUserStats.StoreStats();
		}
	}

	public void ItemCrafted(InventoryItem item, int craftAmount)
	{
		if (CanUseAchievements())
		{
			if (item.name == "Coin")
			{
				SteamUserStats.AddStat("CoinsCrafted", craftAmount);
				Debug.Log((object)("Coins crafted: " + SteamUserStats.GetStatInt("CoinsCrafted")));
			}
			SteamUserStats.StoreStats();
		}
	}

	public void BuildItem(int buildId)
	{
		if (CanUseAchievements())
		{
			SteamUserStats.AddStat("Builds", 1);
			Debug.Log((object)("Builds: " + SteamUserStats.GetStatInt("Builds")));
			SteamUserStats.StoreStats();
		}
	}

	public void NewDay(int currentDay)
	{
		if (CanUseAchievements())
		{
			int statInt = SteamUserStats.GetStatInt("Longest survived");
			if (currentDay > statInt)
			{
				SteamUserStats.SetStat("Longest survived", currentDay);
			}
			Debug.Log((object)("Max sruvived days: " + SteamUserStats.GetStatInt("Longest survived")));
			SteamUserStats.StoreStats();
		}
	}

	public void WieldedWeapon(InventoryItem item)
	{
		if (CanUseAchievements())
		{
			if (item.name == "Night Blade")
			{
				SteamUserStats.AddStat("The Black Swordsman", 1);
				Debug.Log((object)("The Black Swordsman: " + SteamUserStats.GetStatInt("The Black Swordsman")));
			}
			SteamUserStats.StoreStats();
		}
	}

	public void PickupPowerup(string powerupName)
	{
		if (CanUseAchievements())
		{
			if (powerupName == "Danis Milk" && PowerupInventory.Instance.GetAmount("Danis Milk") >= 10)
			{
				SteamUserStats.AddStat("Milkman", 1);
				Debug.Log((object)("Milkman: " + SteamUserStats.GetStatInt("Milkman")));
			}
			SteamUserStats.StoreStats();
		}
	}

	public void MoveDistance(int groundDist, int waterDist)
	{
		if (CanUseAchievements())
		{
			SteamUserStats.AddStat("Move Distance", groundDist);
			if (waterDist > 0)
			{
				SteamUserStats.AddStat("Swim distance", waterDist);
			}
			Debug.Log((object)("Move dist: " + SteamUserStats.GetStatInt("Move Distance") + ", added this one: " + groundDist));
			Debug.Log((object)("swim dist: " + SteamUserStats.GetStatInt("Swim distance") + ", added this one: " + waterDist));
			SteamUserStats.StoreStats();
		}
	}

	public void EatFood(InventoryItem item)
	{
		if (CanUseAchievements())
		{
			if (item.name == "Gulpon Shroom")
			{
				SteamUserStats.AddStat("Red shrooms eaten", 1);
				Debug.Log((object)("Red shrooms eaten: " + SteamUserStats.GetStatInt("Red shrooms eaten")));
			}
			SteamUserStats.StoreStats();
		}
	}

	public void AddPlayerKill()
	{
		if (CanUseAchievements())
		{
			SteamUserStats.AddStat("Friendly Kills", 1);
			Debug.Log((object)("Friendly Kills: " + SteamUserStats.GetStatInt("Friendly Kills")));
			SteamUserStats.StoreStats();
		}
	}

	public void Jump()
	{
		if (CanUseAchievements())
		{
			SteamUserStats.AddStat("Jumps", 1);
			Debug.Log((object)("Jumps: " + SteamUserStats.GetStatInt("Jumps")));
			SteamUserStats.StoreStats();
		}
	}

	public void PickupItem(InventoryItem item)
	{
		if (!CanUseAchievements())
		{
			return;
		}
		InventoryItem[] array = gems;
		InventoryItem[] array2 = array;
		InventoryItem[] array3 = array2;
		foreach (InventoryItem inventoryItem in array3)
		{
			if (!((Object)(object)item != (Object)null) || inventoryItem.id != item.id)
			{
				continue;
			}
			Debug.Log((object)"Found gem, testing");
			bool flag = true;
			InventoryItem[] array4 = gems;
			InventoryItem[] array5 = array4;
			InventoryItem[] array6 = array5;
			foreach (InventoryItem inventoryItem2 in array6)
			{
				if (inventoryItem2.id != item.id && !InventoryUI.Instance.HasItem(inventoryItem2))
				{
					Debug.Log((object)("Couldnt find item: " + inventoryItem2.name));
					flag = false;
					break;
				}
			}
			if (flag)
			{
				SteamUserStats.AddStat("AllGems", 1);
				Debug.Log((object)("AllGems: " + SteamUserStats.GetStatInt("AllGems")));
			}
			break;
		}
		SteamUserStats.StoreStats();
	}

	public void Karlson()
	{
		if (CanUseAchievements())
		{
			SteamUserStats.AddStat("Karlson monitor", 1);
			Debug.Log((object)("Karlson monitor: " + SteamUserStats.GetStatInt("Karlson monitor")));
			SteamUserStats.StoreStats();
		}
	}

	private void GameStarted()
	{
		SteamUserStats.AddStat("Muck started", 1);
		Debug.Log((object)("Muck started: " + SteamUserStats.GetStatInt("Muck started")));
		SteamUserStats.StoreStats();
	}

	public void StartGame(GameSettings.Difficulty d)
	{
		if (CanUseAchievements())
		{
			SteamUserStats.AddStat("GamesStarted", 1);
			Debug.Log((object)("GamesStarted: " + SteamUserStats.GetStatInt("GamesStarted")));
			switch (d)
			{
			case GameSettings.Difficulty.Easy:
				SteamUserStats.AddStat("Easy", 1);
				Debug.Log((object)("Easy: " + SteamUserStats.GetStatInt("Easy")));
				break;
			case GameSettings.Difficulty.Normal:
				SteamUserStats.AddStat("Normal", 1);
				Debug.Log((object)("Normal: " + SteamUserStats.GetStatInt("Normal")));
				break;
			case GameSettings.Difficulty.Gamer:
				SteamUserStats.AddStat("Gamer", 1);
				Debug.Log((object)("Gamer: " + SteamUserStats.GetStatInt("Gamer")));
				break;
			}
			SteamUserStats.StoreStats();
		}
	}

	public void OpenChiefChest()
	{
		if (CanUseAchievements())
		{
			SteamUserStats.AddStat("ChiefChests", 1);
			Debug.Log((object)("ChiefChests: " + SteamUserStats.GetStatInt("ChiefChests")));
			SteamUserStats.StoreStats();
		}
	}
}
public class AchievementPrefab : MonoBehaviour
{
	public RawImage img;

	public TextMeshProUGUI title;

	public TextMeshProUGUI desc;

	public void SetAchievement(Achievement a)
	{
		//IL_0031: 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_003d: Unknown result type (might be due to invalid IL or missing references)
		if (!((Achievement)(ref a)).GetIcon().HasValue)
		{
			Debug.LogError((object)"no img");
		}
		else
		{
			Image value = ((Achievement)(ref a)).GetIcon().Value;
			img.texture = (Texture)(object)GetSteamImageAsTexture2D(value);
		}
		((TMP_Text)title).text = ((Achievement)(ref a)).Name;
		((TMP_Text)desc).text = ((Achievement)(ref a)).Description;
	}

	public static Texture2D GetSteamImageAsTexture2D(Image img)
	{
		//IL_0001: 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_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		Texture2D val = new Texture2D((int)img.Width, (int)img.Height, (TextureFormat)4, false, true);
		val.LoadRawTextureData(img.Data);
		val.Apply();
		return val;
	}
}
public class AddToResources : MonoBehaviour
{
	public bool chest;

	private void Start()
	{
		int nextId = ResourceManager.Instance.GetNextId();
		((Component)this).GetComponent<Hitable>().SetId(nextId);
		ResourceManager.Instance.AddObject(nextId, ((Component)this).gameObject);
		Object.Destroy((Object)(object)this);
		if (chest)
		{
			Chest componentInChildren = ((Component)this).GetComponentInChildren<Chest>();
			ChestManager.Instance.AddChest(componentInChildren, nextId);
		}
		((Component)this).transform.SetParent((Transform)null);
	}
}
public class AreaEffect : MonoBehaviour
{
	private int damage;

	private List<GameObject> actorsHit;

	public void SetDamage(int d)
	{
		damage = d;
		((Component)this).GetComponent<Collider>().enabled = true;
	}

	private void OnTriggerEnter(Collider other)
	{
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		if (!((Component)other).gameObject.CompareTag("Build"))
		{
			Hitable component = ((Component)other).GetComponent<Hitable>();
			if (!((Object)(object)component == (Object)null) && !((Component)((Component)other).transform.root).CompareTag("Local"))
			{
				component.Hit(damage, 0f, 3, ((Component)this).transform.position, -1);
				Object.Destroy((Object)(object)this);
			}
		}
	}
}
[CreateAssetMenu]
public class ArmorComponent : ScriptableObject
{
	public string setBonus;
}
public class Arrow : MonoBehaviour
{
	private Rigidbody rb;

	public AudioSource audio;

	public TrailRenderer trail;

	public GameObject hitFx;

	public bool fallingWhileShooting;

	public float speedWhileShooting;

	private bool done;

	public InventoryItem item { get; set; }

	public int damage { get; set; }

	public bool otherPlayersArrow { get; set; }

	private void Awake()
	{
		rb = ((Component)this).GetComponent<Rigidbody>();
	}

	private void Update()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.rotation = Quaternion.LookRotation(rb.velocity);
	}

	private void OnCollisionEnter(Collision other)
	{
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
		if (done)
		{
			return;
		}
		done = true;
		int layer = other.gameObject.layer;
		if (!otherPlayersArrow && (layer == LayerMask.NameToLayer("Player") || layer == LayerMask.NameToLayer("Enemy")))
		{
			Hitable componentInChildren = ((Component)other.transform.root).GetComponentInChildren<Hitable>();
			if (!Object.op_Implicit((Object)(object)componentInChildren))
			{
				return;
			}
			GameManager.instance.onlyRock = false;
			PowerupCalculations.DamageResult damageMultiplier = PowerupCalculations.Instance.GetDamageMultiplier(fallingWhileShooting, speedWhileShooting);
			float damageMultiplier2 = damageMultiplier.damageMultiplier;
			bool flag = damageMultiplier.crit;
			float lifesteal = damageMultiplier.lifesteal;
			int num = (int)((float)damage * damageMultiplier2);
			Mob component = ((Component)componentInChildren).GetComponent<Mob>();
			if (Object.op_Implicit((Object)(object)component) && item.attackTypes != null && component.mobType.weaknesses != null)
			{
				MobType.Weakness[] weaknesses = component.mobType.weaknesses;
				MobType.Weakness[] array = weaknesses;
				MobType.Weakness[] array2 = array;
				foreach (MobType.Weakness weakness in array2)
				{
					MobType.Weakness[] attackTypes = item.attackTypes;
					MobType.Weakness[] array3 = attackTypes;
					MobType.Weakness[] array4 = array3;
					foreach (MobType.Weakness weakness2 in array4)
					{
						Debug.LogError((object)string.Concat("checking: ", weakness, ", a: ", weakness2));
						if (weakness2 == weakness)
						{
							flag = true;
							num *= 2;
						}
					}
				}
			}
			Vector3 pos = other.collider.ClosestPoint(((Component)this).transform.position);
			HitEffect hitEffect = HitEffect.Normal;
			if (damageMultiplier.sniped)
			{
				hitEffect = HitEffect.Big;
			}
			else if (flag)
			{
				hitEffect = HitEffect.Crit;
			}
			else if (damageMultiplier.falling)
			{
				hitEffect = HitEffect.Falling;
			}
			componentInChildren.Hit(num, 1f, (int)hitEffect, pos, 1);
			PlayerStatus.Instance.Heal(Mathf.CeilToInt((float)num * lifesteal));
			if (damageMultiplier.sniped)
			{
				PowerupCalculations.Instance.HitEffect(PowerupCalculations.Instance.sniperSfx);
			}
			if (flag)
			{
				PowerupInventory.Instance.StartJuice();
			}
			if (damageMultiplier2 > 0f && damageMultiplier.hammerMultiplier > 0f)
			{
				int num2 = 0;
				PowerupCalculations.Instance.SpawnOnHitEffect(num2, owner: true, pos, (int)((float)num * damageMultiplier.hammerMultiplier));
				ClientSend.SpawnEffect(num2, pos);
			}
		}
		StopArrow(other);
	}

	private void StopArrow(Collision other)
	{
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		rb.isKinematic = true;
		((Component)this).transform.SetParent(other.transform);
		done = true;
		((Component)this).gameObject.AddComponent<DestroyObject>().time = 10f;
		Object.Destroy((Object)(object)this);
		Object.Destroy((Object)(object)audio);
		trail.emitting = false;
		Vector3 position = ((Component)this).transform.position;
		Vector3 val = -((Component)this).transform.forward;
		ParticleSystem component = Object.Instantiate<GameObject>(hitFx, position, Quaternion.LookRotation(val)).GetComponent<ParticleSystem>();
		Renderer component2 = other.gameObject.GetComponent<Renderer>();
		Material val2 = null;
		if ((Object)(object)component2 != (Object)null)
		{
			val2 = component2.material;
		}
		else
		{
			SkinnedMeshRenderer componentInChildren = ((Component)other.transform.root).GetComponentInChildren<SkinnedMeshRenderer>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				val2 = ((Renderer)componentInChildren).material;
			}
		}
		if (Object.op_Implicit((Object)(object)val2))
		{
			((Component)component).GetComponent<Renderer>().material = val2;
		}
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
public class AudioFreqController : MonoBehaviour
{
	public AudioLowPassFilter filter;

	private void Update()
	{
		if (Object.op_Implicit((Object)(object)PlayerStatus.Instance))
		{
			float num = 0f;
			if (PlayerStatus.Instance.hp <= 0f)
			{
				num = 1f;
			}
			else
			{
				float num2 = 0.75f;
				int num3 = PlayerStatus.Instance.HpAndShield();
				int num4 = PlayerStatus.Instance.MaxHpAndShield();
				num = (float)num3 / (float)num4;
				num = ((!(num > num2)) ? ((float)num3 / ((float)num4 * num2)) : 1f);
			}
			if (PlayerMovement.Instance.IsUnderWater())
			{
				num = 0.05f;
			}
			filter.cutoffFrequency = Mathf.Lerp(filter.cutoffFrequency, 22000f * num, Time.deltaTime * 8f);
		}
	}
}
public class Bezier
{
	public static Vector3 CalculateCubicBezierPoint(float t, Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3)
	{
		//IL_001b: 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_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		float num = 1f - t;
		float num2 = t * t;
		float num3 = num * num;
		float num4 = num3 * num;
		float num5 = num2 * t;
		return num4 * p0 + 3f * num3 * t * p1 + 3f * num * num2 * p2 + num5 * p3;
	}
}
public class Billboard : MonoBehaviour
{
	private Vector3 defaultScale;

	public bool xz;

	public bool affectScale;

	private Transform t;

	private void Awake()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		defaultScale = ((Component)this).transform.localScale;
	}

	private void Update()
	{
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)t))
		{
			if ((Object)(object)t == (Object)null || !((Component)t).gameObject.activeInHierarchy)
			{
				if (Object.op_Implicit((Object)(object)PlayerMovement.Instance))
				{
					t = PlayerMovement.Instance.playerCam;
				}
				else if (Object.op_Implicit((Object)(object)Camera.main))
				{
					t = ((Component)Camera.main).transform;
				}
			}
			return;
		}
		((Component)this).transform.LookAt(t);
		if (!xz)
		{
			Transform transform = ((Component)this).transform;
			Quaternion rotation = ((Component)this).transform.rotation;
			transform.rotation = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y + 180f, 0f);
		}
		if (affectScale)
		{
			((Component)this).transform.localScale = defaultScale;
		}
	}
}
public class BillyInteract : MonoBehaviour, SharedObject, Interactable
{
	public int id;

	public void SetId(int id)
	{
		this.id = id;
	}

	public int GetId()
	{
		return id;
	}

	public void Interact()
	{
		Application.OpenURL("https://store.steampowered.com/app/1228610/KARLSON/");
		Application.OpenURL("https://youtube.com/@imbestpumpkin");
		AchievementManager.Instance.Karlson();
	}

	public void LocalExecute()
	{
	}

	public void AllExecute()
	{
	}

	public void ServerExecute(int fromClient = -1)
	{
	}

	public void RemoveObject()
	{
	}

	public string GetName()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		return $"<size=40%>Press {InputManager.interact} to wishlist KARLSON now gamer!";
	}

	public bool IsStarted()
	{
		return false;
	}
}
public class BillySpawner : MonoBehaviour
{
	[Serializable]
	public class WeightedSpawn
	{
		public GameObject prefab;

		public float weight;
	}

	public WeightedSpawn[] structurePrefabs;

	private int mapChunkSize;

	private float worldEdgeBuffer = 0.6f;

	public int maxCaves = 50;

	public int minCaves = 3;

	protected ConsistentRandom randomGen;

	public LayerMask whatIsTerrain;

	private List<GameObject> structures;

	public bool dontAddToResourceManager;

	private Vector3[] shrines;

	private float totalWeight;

	public float worldScale { get; set; } = 12f;


	private void Start()
	{
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		structures = new List<GameObject>();
		randomGen = new ConsistentRandom(GameManager.GetSeed() + ResourceManager.GetNextGenOffset());
		shrines = (Vector3[])(object)new Vector3[maxCaves];
		mapChunkSize = MapGenerator.mapChunkSize;
		worldScale *= worldEdgeBuffer;
		WeightedSpawn[] array = structurePrefabs;
		WeightedSpawn[] array2 = array;
		WeightedSpawn[] array3 = array2;
		foreach (WeightedSpawn weightedSpawn in array3)
		{
			totalWeight += weightedSpawn.weight;
		}
		int num = 0;
		int num2 = 0;
		RaycastHit hit = default(RaycastHit);
		while (num < maxCaves)
		{
			num2++;
			float num3 = (float)(randomGen.NextDouble() * 2.0 - 1.0) * (float)mapChunkSize / 2f;
			float num4 = (float)(randomGen.NextDouble() * 2.0 - 1.0) * (float)mapChunkSize / 2f;
			Vector3 val = new Vector3(num3, 0f, num4) * worldScale;
			val.y = 200f;
			Debug.DrawLine(val, val + Vector3.down * 500f, Color.cyan, 50f);
			if (Physics.Raycast(val, Vector3.down, ref hit, 500f, LayerMask.op_Implicit(whatIsTerrain)))
			{
				if (WorldUtility.WorldHeightToBiome(((RaycastHit)(ref hit)).point.y) != TextureData.TerrainType.Grass || Mathf.Abs(Vector3.Angle(Vector3.up, ((RaycastHit)(ref hit)).normal)) > 15f)
				{
					continue;
				}
				shrines[num] = ((RaycastHit)(ref hit)).point;
				num++;
				GameObject val2 = FindObjectToSpawn(structurePrefabs, totalWeight);
				GameObject val3 = Object.Instantiate<GameObject>(val2, ((RaycastHit)(ref hit)).point, val2.transform.rotation);
				if (!dontAddToResourceManager)
				{
					val3.GetComponentInChildren<SharedObject>().SetId(ResourceManager.Instance.GetNextId());
				}
				structures.Add(val3);
				Process(val3, hit);
			}
			if ((num2 > maxCaves * 2 && num >= minCaves) || num2 > maxCaves * 10)
			{
				break;
			}
		}
		if (!dontAddToResourceManager)
		{
			ResourceManager.Instance.AddResources(structures);
		}
	}

	public virtual void Process(GameObject newStructure, RaycastHit hit)
	{
		//IL_0009: 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)
		newStructure.transform.rotation = Quaternion.LookRotation(((RaycastHit)(ref hit)).normal);
	}

	private void OnDrawGizmos()
	{
	}

	public GameObject FindObjectToSpawn(WeightedSpawn[] structurePrefabs, float totalWeight)
	{
		float num = (float)randomGen.NextDouble();
		float num2 = 0f;
		for (int i = 0; i < structurePrefabs.Length; i++)
		{
			num2 += structurePrefabs[i].weight;
			if (num < num2 / totalWeight)
			{
				return structurePrefabs[i].prefab;
			}
		}
		return structurePrefabs[0].prefab;
	}
}
public class Boat : MonoBehaviour
{
	public enum BoatStatus
	{
		Hidden,
		Marked,
		Found,
		LeftIsland
	}

	public enum BoatPackets
	{
		MarkShip,
		FindShip,
		MarkGems,
		FinishBoat
	}

	public BoatStatus status;

	public static Boat Instance;

	public InventoryItem mapItem;

	public InventoryItem gemMap;

	public GameObject objectivePing;

	public ObjectivePing boatPing;

	private ConsistentRandom rand;

	public SpawnChestsInLocations chestSpawner;

	public GameObject[] holes;

	public Texture gemTexture;

	public Texture boatTexture;

	private bool gemsDiscovered;

	public List<ShrineGuardian> guardians;

	public CountPlayersOnBoat countPlayers;

	private float heightUnderWater = 3f;

	private Rigidbody rb;

	public Transform dragonSpawnPos;

	public Camera cinematicCamera;

	public MobType dragonBoss;

	public Transform rbTransform;

	public GameObject waterSfx;

	public Transform dragonLandingPosition;

	public Transform[] landingNodes;

	public GameObject wheel;

	private bool sinking;

	private float amp = 20f;

	private FinishGameInteract wheelInteract;

	public ObjectivePing wheelPing;

	private Component[] repairs;

	public Map.MapMarker boatMapMarker;

	public float waterHeight { get; set; }

	private void Start()
	{
		//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_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		rb = ((Component)this).GetComponentInChildren<Rigidbody>();
		guardians = new List<ShrineGuardian>();
		rand = new ConsistentRandom(GameManager.GetSeed());
		Instance = this;
		((MonoBehaviour)this).InvokeRepeating("CheckFound", 0.5f, 1f);
		boatPing = Object.Instantiate<GameObject>(objectivePing, ((Component)this).transform.position, Quaternion.identity).GetComponent<ObjectivePing>();
		boatPing.SetText("?");
		((Component)boatPing).gameObject.SetActive(false);
		RaycastHit val = default(RaycastHit);
		for (int i = 0; i < holes.Length; i++)
		{
			if (rand.NextDouble() > 0.5)
			{
				Object.Destroy((Object)(object)holes[i]);
				continue;
			}
			Vector3 position = holes[i].transform.position;
			float y = position.y;
			if (Physics.Raycast(position + Vector3.up * 10f, Vector3.down, ref val, 50f, LayerMask.op_Implicit(GameManager.instance.whatIsGround)) && ((RaycastHit)(ref val)).point.y > y)
			{
				Object.Destroy((Object)(object)holes[i]);
			}
		}
		repairs = ((Component)this).gameObject.GetComponentsInChildren(typeof(RepairInteract), true);
		Component[] array = repairs;
		for (int j = 0; j < array.Length; j++)
		{
			RepairInteract repairInteract = (RepairInteract)(object)array[j];
			int nextId = ResourceManager.Instance.GetNextId();
			repairInteract.SetId(nextId);
			ResourceManager.Instance.AddObject(nextId, ((Component)repairInteract).gameObject);
		}
		if (LocalClient.serverOwner)
		{
			((MonoBehaviour)this).InvokeRepeating("SlowUpdate", 1f, 1f);
		}
		array = repairs;
		for (int k = 0; k < array.Length; k++)
		{
			_ = (RepairInteract)(object)array[k];
		}
		((Object)((Component)this).gameObject).name = "Boat";
	}

	private void SlowUpdate()
	{
		if (CheckBoatFullyRepaired())
		{
			SendBoatFinished();
			((MonoBehaviour)this).CancelInvoke("SlowUpdate");
		}
	}

	private void SendMarkShip()
	{
		MarkShip();
		ClientSend.SendShipStatus(BoatPackets.MarkShip);
	}

	private void SendShipFound()
	{
		Debug.LogError((object)"Found ship. Not sending");
		FindShip();
		ClientSend.SendShipStatus(BoatPackets.FindShip);
	}

	private void SendMarkGems()
	{
		MarkGems();
		ClientSend.SendShipStatus(BoatPackets.MarkGems);
	}

	private void SendBoatFinished()
	{
		int nextId = ResourceManager.Instance.GetNextId();
		BoatFinished(nextId);
		ClientSend.SendShipStatus(BoatPackets.FinishBoat, nextId);
	}

	public void UpdateShipStatus(BoatPackets p, int interactId)
	{
		switch (p)
		{
		case BoatPackets.MarkShip:
			MarkShip();
			break;
		case BoatPackets.FindShip:
			FindShip();
			break;
		case BoatPackets.MarkGems:
			MarkGems();
			break;
		case BoatPackets.FinishBoat:
			BoatFinished(interactId);
			break;
		}
	}

	public void LeaveIsland()
	{
		if (status != BoatStatus.LeftIsland)
		{
			status = BoatStatus.LeftIsland;
			GameManager.instance.boatLeft = true;
			sinking = true;
			Object.Destroy((Object)(object)((Component)wheelInteract).gameObject);
			Object.Destroy((Object)(object)((Component)wheelPing).gameObject);
			PlayerStatus.Instance.EnterOcean();
			AchievementManager.Instance.LeaveMuck();
		}
	}

	private void FixedUpdate()
	{
		if (sinking)
		{
			MoveBoat();
		}
	}

	private void MoveBoat()
	{
		//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_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_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: 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_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		float num = 2f;
		Vector3 val = Vector3.up * num * Time.deltaTime;
		Transform water = World.Instance.water;
		water.position += val;
		float y = World.Instance.water.position.y;
		if (rb.position.y < y - heightUnderWater)
		{
			if (!waterSfx.activeInHierarchy)
			{
				waterSfx.SetActive(true);
			}
			rb.MovePosition(new Vector3(((Component)this).transform.position.x, y - heightUnderWater, ((Component)this).transform.position.z));
		}
		if (!(y > 85f))
		{
			return;
		}
		sinking = false;
		if (!LocalClient.serverOwner)
		{
			return;
		}
		float bossMultiplier = 0.85f + 0.15f * (float)GameManager.instance.GetPlayersAlive();
		int nextId = MobManager.Instance.GetNextId();
		MobSpawner.Instance.ServerSpawnNewMob(nextId, dragonBoss.id, dragonSpawnPos.position, 1f, bossMultiplier);
		List<Mob> list = new List<Mob>();
		foreach (Mob value in MobManager.Instance.mobs.Values)
		{
			list.Add(value);
		}
		for (int i = 0; i < list.Count; i++)
		{
			list[i].hitable.Hit(list[i].hitable.maxHp, 1f, 2, ((Component)list[i]).transform.position, -1);
		}
	}

	public void BoatFinished(int interactId)
	{
		//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)
		wheel.SetActive(true);
		wheelPing = Object.Instantiate<GameObject>(objectivePing, wheel.transform.position, Quaternion.identity).GetComponent<ObjectivePing>();
		wheelPing.SetText("");
		wheelInteract = wheel.AddComponent<FinishGameInteract>();
		wheelInteract.SetId(interactId);
		ResourceManager.Instance.AddObject(interactId, ((Component)wheelInteract).gameObject);
	}

	public bool CheckBoatFullyRepaired()
	{
		Component[] array = repairs;
		for (int i = 0; i < array.Length; i++)
		{
			if (!((Object)(object)array[i] == (Object)null))
			{
				return false;
			}
		}
		return true;
	}

	public void CheckForMap()
	{
		if (status == BoatStatus.Hidden)
		{
			foreach (InventoryCell cell in InventoryUI.Instance.cells)
			{
				if (!((Object)(object)cell.currentItem == (Object)null) && cell.currentItem.id == mapItem.id)
				{
					SendMarkShip();
				}
			}
		}
		if (gemsDiscovered)
		{
			return;
		}
		foreach (InventoryCell cell2 in InventoryUI.Instance.cells)
		{
			if (!((Object)(object)cell2.currentItem == (Object)null) && cell2.currentItem.id == gemMap.id)
			{
				SendMarkGems();
			}
		}
	}

	private void MarkGems()
	{
		//IL_0044: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
		gemsDiscovered = true;
		foreach (ShrineGuardian guardian in guardians)
		{
			if ((Object)(object)guardian != (Object)null)
			{
				Map.Instance.AddMarker(((Component)guardian).transform, Map.MarkerType.Gem, gemTexture, Guardian.TypeToColor(guardian.type), "?");
				Map.Instance.AddMarker(((Component)guardian).transform, Map.MarkerType.Gem, gemTexture, Guardian.TypeToColor(guardian.type), "?");
			}
		}
		ChatBox.Instance.AppendMessage(-1, $"<color=orange>Guardians <color=white>have been located  (\"{InputManager.map}\" to open map)", "");
	}

	private void CheckFound()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		if ((status == BoatStatus.Hidden || status == BoatStatus.Marked) && Object.op_Implicit((Object)(object)PlayerMovement.Instance) && Vector3.Distance(((Component)PlayerMovement.Instance).transform.position, ((Component)this).transform.position) < 40f)
		{
			SendShipFound();
		}
	}

	public void FindShip()
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		status = BoatStatus.Found;
		Object.Destroy((Object)(object)((Component)boatPing).gameObject);
		Map.Instance.AddMarker(((Component)this).transform, Map.MarkerType.Other, boatTexture, Color.white, "Shipwreck");
		ChatBox.Instance.AppendMessage(-1, $"<color=orange>Broken Ship <color=white>has been located (\"{InputManager.map}\" to open map)", "");
	}

	public void MarkShip()
	{
		//IL_0025: 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)
		status = BoatStatus.Marked;
		((Component)boatPing).gameObject.SetActive(true);
		ChatBox.Instance.AppendMessage(-1, $"Something has been marked on your map...  (\"{InputManager.map}\" to open map)", "");
		Map.Instance.AddMarker(((Component)this).transform, Map.MarkerType.Other, null, Color.white);
	}
}
public class BoatCamera : MonoBehaviour
{
	private Transform target;

	private Transform dragonTransform;

	private void Awake()
	{
		target = Boat.Instance.rbTransform;
		dragonTransform = ((Component)Dragon.Instance).transform;
		((MonoBehaviour)this).Invoke("StopCamera", 5f);
	}

	private void StopCamera()
	{
		((Component)this).gameObject.SetActive(false);
	}

	private void Update()
	{
		//IL_001a: 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_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)((Component)this).transform != (Object)(object)dragonTransform && dragonTransform.position.y > ((Component)target).transform.position.y)
		{
			target = dragonTransform;
		}
		Quaternion val = Quaternion.LookRotation(target.position - ((Component)this).transform.position);
		((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val, Time.deltaTime * 6f);
	}
}
public class BobMob : Mob
{
	public enum DragonState
	{
		Flying,
		Landing,
		Grounded
	}

	private int landingNode;

	private float t;

	private float speed = 50f;

	public DragonState state { get; set; }

	public Vector3 desiredPos { get; set; }

	public ProjectileAttackNoGravity projectileController { get; set; }

	private void Awake()
	{
		projectileController = ((Component)this).GetComponent<ProjectileAttackNoGravity>();
		state = DragonState.Flying;
		base.hitable = ((Component)this).GetComponent<Hitable>();
		base.animator = ((Component)this).GetComponent<Animator>();
		if (LocalClient.serverOwner)
		{
			if (mobType.behaviour == MobType.MobBehaviour.Enemy)
			{
				((Component)this).gameObject.AddComponent<MobServerEnemy>();
			}
			else if (mobType.behaviour == MobType.MobBehaviour.Neutral)
			{
				((Component)this).gameObject.AddComponent<MobServerNeutral>();
			}
			else if (mobType.behaviour == MobType.MobBehaviour.EnemyMeleeAndRanged)
			{
				((Component)this).gameObject.AddComponent<MobServerEnemyMeleeAndRanged>();
			}
			else if (mobType.behaviour == MobType.MobBehaviour.Dragon)
			{
				((Component)this).gameObject.AddComponent<MobServerDragon>();
			}
		}
		base.attackTimes = new float[attackAnimations.Length];
		for (int i = 0; i < attackAnimations.Length; i++)
		{
			base.attackTimes[i] = attackAnimations[i].length;
		}
	}

	protected override void Animate()
	{
	}

	public override void SetTarget(int targetId)
	{
		base.targetPlayerId = targetId;
		base.target = ((Component)GameManager.players[base.targetPlayerId]).transform;
	}

	public void StartLanding()
	{
		landingNode = 0;
		state = DragonState.Landing;
	}

	public void GroundedToFlight()
	{
		state = DragonState.Flying;
		base.animator.SetBool("Landed", false);
	}

	public void DragonUpdate(DragonState state)
	{
		switch (state)
		{
		case DragonState.Landing:
			StartLanding();
			break;
		case DragonState.Flying:
			GroundedToFlight();
			break;
		}
	}

	public override void ExtraUpdate()
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: 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_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: 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_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val;
		switch (state)
		{
		case DragonState.Flying:
		{
			Transform transform4 = ((Component)this).transform;
			Quaternion rotation3 = ((Component)this).transform.rotation;
			val = desiredPos - ((Component)this).transform.position;
			transform4.rotation = Quaternion.Slerp(rotation3, Quaternion.LookRotation(((Vector3)(ref val)).normalized), Time.deltaTime * 0.6f);
			Transform transform5 = ((Component)this).transform;
			transform5.position += ((Component)this).transform.forward * speed * Time.deltaTime;
			break;
		}
		case DragonState.Landing:
			if (landingNode < 2)
			{
				Vector3 position = Boat.Instance.landingNodes[landingNode].position;
				Transform transform2 = ((Component)this).transform;
				Quaternion rotation2 = ((Component)this).transform.rotation;
				val = position - ((Component)this).transform.position;
				transform2.rotation = Quaternion.Slerp(rotation2, Quaternion.LookRotation(((Vector3)(ref val)).normalized), Time.deltaTime * 6f);
				Transform transform3 = ((Component)this).transform;
				transform3.position += ((Component)this).transform.forward * speed * 1.3f * Time.deltaTime;
				if (Vector3.Distance(((Component)this).transform.position, position) < 10f)
				{
					landingNode++;
				}
				if (landingNode > 1)
				{
					state = DragonState.Grounded;
					CameraShaker.Instance.StepShake(1f);
				}
			}
			break;
		case DragonState.Grounded:
		{
			Transform transform = ((Component)this).transform;
			Quaternion rotation = ((Component)this).transform.rotation;
			val = Boat.Instance.dragonLandingPosition.forward;
			transform.rotation = Quaternion.Slerp(rotation, Quaternion.LookRotation(((Vector3)(ref val)).normalized), Time.deltaTime * 2f);
			((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, desiredPos, Time.deltaTime * 2f);
			base.animator.SetBool("Landed", true);
			break;
		}
		}
	}

	private void LateUpdate()
	{
	}

	public override void Attack(int targetPlayerId, int attackAnimationIndex)
	{
		((MonoBehaviour)this).Invoke("FinishAttacking", base.attackTimes[attackAnimationIndex]);
		base.animator.Play(((Object)attackAnimations[attackAnimationIndex]).name);
		base.targetPlayerId = targetPlayerId;
	}

	protected override void FinishAttacking()
	{
	}

	public override void SetDestination(Vector3 dest)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		desiredPos = dest;
	}
}
public class BossUI : MonoBehaviour
{
	public TextMeshProUGUI bossName;

	public TextMeshProUGUI hpText;

	public RawImage hpBar;

	public Mob currentBoss;

	private HitableMob hitableMob;

	private int desiredHp;

	public Transform layout;

	private Vector3 desiredScale;

	public static BossUI Instance;

	private float currentHp;

	private void Awake()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		Instance = this;
		((Component)layout).transform.localScale = Vector3.zero;
		desiredScale = Vector3.zero;
	}

	public void SetBoss(Mob b)
	{
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: 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)
		if (!((Object)(object)currentBoss != (Object)null))
		{
			currentBoss = b;
			((TMP_Text)bossName).text = "";
			if (b.IsBuff())
			{
				TextMeshProUGUI obj = bossName;
				((TMP_Text)obj).text = ((TMP_Text)obj).text + "Buff ";
			}
			TextMeshProUGUI obj2 = bossName;
			((TMP_Text)obj2).text = ((TMP_Text)obj2).text + ((Component)b).GetComponent<Hitable>().entityName;
			currentHp = 0f;
			desiredScale = Vector3.one;
			hitableMob = ((Component)b).GetComponent<HitableMob>();
			((Component)layout).gameObject.SetActive(true);
			layout.localScale = Vector3.zero;
		}
	}

	private void Update()
	{
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)currentBoss == (Object)null)
		{
			if (((Component)layout).gameObject.activeInHierarchy)
			{
				((Component)layout).gameObject.SetActive(false);
				if (DayCycle.time < 0.5f)
				{
					MusicController.Instance.StopSong();
				}
			}
		}
		else
		{
			currentHp = Mathf.Lerp(currentHp, (float)hitableMob.hp, Time.deltaTime * 10f);
			((TMP_Text)hpText).text = Mathf.RoundToInt(currentHp) + " / " + hitableMob.maxHp;
			float num = (float)hitableMob.hp / (float)hitableMob.maxHp;
			((Component)hpBar).transform.localScale = new Vector3(num, 1f, 1f);
			((Component)layout).transform.localScale = Vector3.Lerp(((Component)layout).transform.localScale, desiredScale, Time.deltaTime * 10f);
		}
	}
}
[CreateAssetMenu]
public class BowComponent : ScriptableObject
{
	public float projectileSpeed;

	public int nArrows;

	public int angleDelta;

	public float timeToImpact = 1.2f;

	public float attackSize = 10f;

	public float colliderDisabledTime = 0.1f;
}
public class BuildDestruction : MonoBehaviour
{
	public bool connectedToGround;

	public bool directlyGrounded;

	public bool started;

	public bool destroyed;

	private List<BuildDestruction> otherBuilds = new List<BuildDestruction>();

	private BoxCollider trigger;

	private void Awake()
	{
		((MonoBehaviour)this).Invoke("CheckDirectlyGrounded", 2f);
	}

	private void Start()
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		BoxCollider[] components = ((Component)this).GetComponents<BoxCollider>();
		BoxCollider[] array = components;
		BoxCollider[] array2 = array;
		foreach (BoxCollider val in array2)
		{
			if (((Collider)val).isTrigger)
			{
				trigger = val;
				break;
			}
		}
		BoxCollider obj = trigger;
		obj.size *= 1.1f;
	}

	private void Update()
	{
	}

	private void OnDestroy()
	{
		destroyed = true;
		List<BuildDestruction> list = new List<BuildDestruction>();
		list.Add(this);
		for (int num = otherBuilds.Count - 1; num >= 0; num--)
		{
			if (!((Object)(object)otherBuilds[num] == (Object)null) && !otherBuilds[num].IsDirectlyGrounded(list))
			{
				otherBuilds[num].DestroyBuild();
			}
		}
	}

	private void DestroyBuild()
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		Hitable component = ((Component)this).GetComponent<Hitable>();
		component.Hit(component.hp, 1f, 1, ((Component)this).transform.position, -1);
	}

	public bool IsDirectlyGrounded(List<BuildDestruction> alreadyChecked)
	{
		if (directlyGrounded)
		{
			return true;
		}
		foreach (BuildDestruction otherBuild in otherBuilds)
		{
			if (!((Object)(object)otherBuild == (Object)null) && !alreadyChecked.Contains(otherBuild))
			{
				alreadyChecked.Add(otherBuild);
				if (otherBuild.IsDirectlyGrounded(alreadyChecked))
				{
					return true;
				}
			}
		}
		return false;
	}

	private void CheckDirectlyGrounded()
	{
		Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
		Object.Destroy((Object)(object)trigger);
		Object.Destroy((Object)(object)component);
	}

	private void OnTriggerEnter(Collider collision)
	{
		if (((Component)collision).gameObject.layer == LayerMask.NameToLayer("Ground"))
		{
			directlyGrounded = true;
			connectedToGround = true;
		}
		if (((Component)collision).CompareTag("Build"))
		{
			BuildDestruction component = ((Component)collision).GetComponent<BuildDestruction>();
			if (!otherBuilds.Contains(component))
			{
				MonoBehaviour.print((object)("added a build: " + ((Object)((Component)collision).gameObject).name));
				otherBuilds.Add(component);
			}
		}
	}

	private void OnDrawGizmos()
	{
	}
}
public class BuildDoor : MonoBehaviour
{
	[Serializable]
	public class Door
	{
		public Hitable hitable;

		public DoorInteractable doorInteractable;

		public void SetId(int id)
		{
			hitable.SetId(id);
			doorInteractable.SetId(id);
			ResourceManager.Instance.AddObject(id, ((Component)hitable).gameObject);
		}
	}

	public Door[] doors;
}
public class BuildInfo : MonoBehaviour
{
	public int ownerId = -1;
}
public class BuildManager : MonoBehaviour
{
	public int gridSize = 2;

	private int gridWidth = 10;

	public LayerMask whatIsGround;

	private Transform playerCam;

	private InventoryItem currentItem;

	public GameObject buildFx;

	public GameObject ghostItem;

	private Renderer renderer;

	private MeshFilter filter;

	public int yRotation;

	public GameObject rotateText;

	public static BuildManager Instance;

	private Vector3 lastPosition;

	private bool canBuild;

	private Vector3[] ghostExtents;

	private Collider ghostCollider;

	private string debugInfo;

	private int rotationAngle = 45;

	private int id;

	private void Awake()
	{
		Instance = this;
		filter = ghostItem.GetComponent<MeshFilter>();
		renderer = ghostItem.GetComponent<Renderer>();
	}

	private void SetNewItem()
	{
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		filter.mesh = currentItem.mesh;
		Material material = renderer.material;
		material.mainTexture = currentItem.material.mainTexture;
		renderer.material = material;
		Object.Destroy((Object)(object)ghostItem.GetComponent<BoxCollider>());
		ghostCollider = (Collider)(object)ghostItem.AddComponent<BoxCollider>();
		BuildSnappingInfo component = currentItem.prefab.GetComponent<BuildSnappingInfo>();
		if (Object.op_Implicit((Object)(object)component))
		{
			ghostExtents = component.position;
		}
		else
		{
			ghostExtents = (Vector3[])(object)new Vector3[0];
		}
		ghostItem.transform.localScale = Vector3.one * (float)gridSize;
		if (!currentItem.grid)
		{
			ghostItem.transform.localScale = Vector3.one;
		}
	}

	private void Update()
	{
		NewestBuild();
	}

	private void NewestBuild()
	{
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0248: Unknown result type (might be due to invalid IL or missing references)
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: 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_0264: Unknown result type (might be due to invalid IL or missing references)
		//IL_0268: Unknown result type (might be due to invalid IL or missing references)
		//IL_0526: Unknown result type (might be due to invalid IL or missing references)
		//IL_0528: Unknown result type (might be due to invalid IL or missing references)
		//IL_0538: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: 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_02f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0306: Unknown result type (might be due to invalid IL or missing references)
		//IL_030b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0314: Unknown result type (might be due to invalid IL or missing references)
		//IL_0319: Unknown result type (might be due to invalid IL or missing references)
		//IL_031e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0321: Unknown result type (might be due to invalid IL or missing references)
		//IL_032f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0345: Unknown result type (might be due to invalid IL or missing references)
		//IL_0354: Unknown result type (might be due to invalid IL or missing references)
		//IL_0359: Unknown result type (might be due to invalid IL or missing references)
		//IL_035e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0360: Unknown result type (might be due to invalid IL or missing references)
		//IL_036e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_037c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0381: Unknown result type (might be due to invalid IL or missing references)
		//IL_0383: Unknown result type (might be due to invalid IL or missing references)
		//IL_0388: Unknown result type (might be due to invalid IL or missing references)
		//IL_038a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0512: Unknown result type (might be due to invalid IL or missing references)
		//IL_0514: Unknown result type (might be due to invalid IL or missing references)
		//IL_0516: Unknown result type (might be due to invalid IL or missing references)
		//IL_051b: 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_03d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03de: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0401: Unknown result type (might be due to invalid IL or missing references)
		//IL_0406: Unknown result type (might be due to invalid IL or missing references)
		//IL_042b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0450: Unknown result type (might be due to invalid IL or missing references)
		//IL_0455: Unknown result type (might be due to invalid IL or missing references)
		//IL_0463: Unknown result type (might be due to invalid IL or missing references)
		//IL_0468: Unknown result type (might be due to invalid IL or missing references)
		//IL_0471: Unknown result type (might be due to invalid IL or missing references)
		//IL_0476: Unknown result type (might be due to invalid IL or missing references)
		//IL_047b: Unknown result type (might be due to invalid IL or missing references)
		//IL_047e: Unknown result type (might be due to invalid IL or missing references)
		//IL_048b: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_04af: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04dd: 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_04e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
		debugInfo = "";
		if (!Object.op_Implicit((Object)(object)currentItem) || (Object)(object)currentItem != (Object)(object)Hotbar.Instance.currentItem)
		{
			currentItem = Hotbar.Instance.currentItem;
			if (!Object.op_Implicit((Object)(object)currentItem) || !canBuild)
			{
				if (ghostItem.activeInHierarchy)
				{
					ghostItem.SetActive(false);
					rotateText.SetActive(false);
				}
				return;
			}
		}
		if (!currentItem.buildable)
		{
			ghostItem.SetActive(false);
			rotateText.SetActive(false);
			canBuild = false;
			return;
		}
		if (!Object.op_Implicit((Object)(object)playerCam))
		{
			if (!Object.op_Implicit((Object)(object)PlayerMovement.Instance))
			{
				return;
			}
			playerCam = PlayerMovement.Instance.playerCam;
		}
		if (!ghostItem.activeInHierarchy)
		{
			ghostItem.SetActive(true);
			rotateText.SetActive(true);
		}
		SetNewItem();
		Bounds bounds = filter.mesh.bounds;
		Vector3 val = ((Bounds)(ref bounds)).extents;
		if (currentItem.grid)
		{
			val *= (float)gridSize;
		}
		ghostItem.transform.rotation = Quaternion.Euler(0f, (float)yRotation, 0f);
		RaycastHit val2 = default(RaycastHit);
		if (Physics.Raycast(new Ray(playerCam.position, playerCam.forward), ref val2, 12f, LayerMask.op_Implicit(whatIsGround)))
		{
			if (((Component)((RaycastHit)(ref val2)).collider).CompareTag("Ignore"))
			{
				canBuild = false;
				ghostItem.SetActive(false);
				return;
			}
			Vector3 point = ((RaycastHit)(ref val2)).point;
			Vector3 up = Vector3.up;
			float y = val.y;
			bounds = filter.mesh.bounds;
			Vector3 position = point + up * (y - ((Bounds)(ref bounds)).center.y);
			bounds = filter.mesh.bounds;
			_ = ((Bounds)(ref bounds)).center;
			BuildSnappingInfo component = ((Component)((RaycastHit)(ref val2)).collider).GetComponent<BuildSnappingInfo>();
			if (((Component)((RaycastHit)(ref val2)).collider).gameObject.CompareTag("Build") && currentItem.grid && (Object)(object)component != (Object)null)
			{
				position = ((RaycastHit)(ref val2)).point;
				float num = 3f;
				float num2 = float.PositiveInfinity;
				Vector3 val3 = Vector3.zero;
				Vector3[] position2 = component.position;
				Vector3[] array = position2;
				Vector3[] array2 = array;
				foreach (Vector3 val4 in array2)
				{
					Vector3 point2 = ((Component)((RaycastHit)(ref val2)).collider).transform.position + val4 * (float)gridSize;
					point2 = RotateAroundPivot(point2, ((Component)((RaycastHit)(ref val2)).collider).transform.position, new Vector3(0f, ((Component)((RaycastHit)(ref val2)).collider).transform.eulerAngles.y, 0f));
					Vector3 val5 = point2 - ((Component)((RaycastHit)(ref val2)).collider).transform.position;
					Vector3 normalized = ((Vector3)(ref val5)).normalized;
					Vector3 zero = Vector3.zero;
					if (zero.y > 0f)
					{
						zero.y = 1f;
					}
					else if (zero.y < 0f)
					{
						zero.y = -1f;
					}
					val5 = normalized + ((RaycastHit)(ref val2)).normal;
					normalized = ((Vector3)(ref val5)).normalized * (float)gridSize / 2f;
					if (!(Vector3.Distance(((RaycastHit)(ref val2)).point, point2) < num))
					{
						continue;
					}
					ghostItem.transform.position = point2;
					Vector3[] array3 = ghostExtents;
					Vector3[] array4 = array3;
					Vector3[] array5 = array4;
					foreach (Vector3 val6 in array5)
					{
						Vector3 point3 = ghostItem.transform.position + val6 * (float)gridSize;
						point3 = RotateAroundPivot(point3, ((Component)ghostCollider).transform.position, new Vector3(0f, (float)yRotation, 0f));
						float num3 = Vector3.Distance(point3 - normalized, point2);
						if (num3 < num2)
						{
							num2 = num3;
							val3 = point3 - ghostItem.transform.position;
							position = point2;
						}
					}
				}
				position += val3;
			}
			canBuild = true;
			lastPosition = position;
			ghostItem.transform.position = position;
		}
		else
		{
			ghostItem.SetActive(false);
			canBuild = false;
		}
	}

	private void OnDrawGizmos()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: 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_0052: 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_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: 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_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		if (ghostExtents != null)
		{
			Vector3[] array = ghostExtents;
			Vector3[] array2 = array;
			Vector3[] array3 = array2;
			foreach (Vector3 val in array3)
			{
				Gizmos.color = Color.blue;
				Vector3 point = ghostItem.transform.position + val * (float)gridSize;
				point = RotateAroundPivot(point, ((Component)ghostCollider).transform.position, new Vector3(0f, (float)yRotation, 0f));
				Gizmos.DrawCube(point, Vector3.one);
			}
		}
	}

	private Vector3 RotateAroundPivot(Vector3 point, Vector3 pivot, Vector3 angles)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: 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_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: 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)
		Vector3 val = point - pivot;
		val = Quaternion.Euler(angles) * val;
		point = val + pivot;
		return point;
	}

	public void RotateBuild(int dir)
	{
		yRotation -= dir * rotationAngle;
	}

	public void RequestBuildItem()
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		if (CanBuild() && canBuild)
		{
			Hotbar.Instance.UseItem(1);
			Gun.Instance.Build();
			ClientSend.RequestBuild(currentItem.id, lastPosition, yRotation);
		}
	}

	public bool CanBuild()
	{
		if (!Object.op_Implicit((Object)(object)currentItem))
		{
			return false;
		}
		if (!currentItem.buildable)
		{
			return false;
		}
		if (currentItem.amount <= 0)
		{
			return false;
		}
		return true;
	}

	public GameObject BuildItem(int buildOwner, int itemID, int objectId, Vector3 position, int yRotation)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		InventoryItem inventoryItem = ItemManager.Instance.allItems[itemID];
		GameObject val = Object.Instantiate<GameObject>(inventoryItem.prefab);
		val.transform.position = position;
		val.transform.rotation = Quaternion.Euler(0f, (float)yRotation, 0f);
		val.AddComponent<BuildInfo>().ownerId = buildOwner;
		if (Object.op_Implicit((Object)(object)buildFx))
		{
			Object.Instantiate<GameObject>(buildFx, position, Quaternion.identity);
		}
		if (inventoryItem.grid)
		{
			HitableTree component = val.GetComponent<HitableTree>();
			component.SetDefaultScale(Vector3.one * (float)gridSize);
			component.PopIn();
		}
		val.GetComponent<Hitable>().SetId(objectId);
		ResourceManager.Instance.AddObject(objectId, val);
		ResourceManager.Instance.AddBuild(objectId, val);
		BuildDoor component2 = val.GetComponent<BuildDoor>();
		if ((Object)(object)component2 != (Object)null)
		{
			BuildDoor.Door[] doors = component2.doors;
			BuildDoor.Door[] array = doors;
			BuildDoor.Door[] array2 = array;
			foreach (BuildDoor.Door door in array2)
			{
				if (LocalClient.serverOwner)
				{
					door.SetId(ResourceManager.Instance.GetNextId());
				}
				else
				{
					door.SetId(objectId++);
				}
			}
		}
		if (inventoryItem.type == InventoryItem.ItemType.Storage)
		{
			Chest componentInChildren = val.GetComponentInChildren<Chest>();
			ChestManager.Instance.AddChest(componentInChildren, objectId);
		}
		if (buildOwner == LocalClient.instance.myId)
		{
			MonoBehaviour.print((object)"i built something");
			if (inventoryItem.type == InventoryItem.ItemType.Station)
			{
				UiEvents.Instance.StationUnlock(itemID);
				if (Object.op_Implicit((Object)(object)Tutorial.Instance) && inventoryItem.name == "Workbench")
				{
					Tutorial.Instance.stationPlaced = true;
				}
			}
		}
		if (buildOwner == LocalClient.instance.myId)
		{
			AchievementManager.Instance.BuildItem(itemID);
		}
		return val;
	}

	public int GetNextBuildId()
	{
		return ResourceManager.Instance.GetNextId();
	}
}
[ExecuteInEditMode]
public class BuildSnappingInfo : MonoBehaviour
{
	public Vector3[] position;

	public bool half;

	private void OnDrawGizmos()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: 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_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_0042: 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)
		Gizmos.color = Color.red;
		Vector3[] array = position;
		Vector3[] array2 = array;
		Vector3[] array3 = array2;
		foreach (Vector3 val in array3)
		{
			Gizmos.DrawCube(((Component)this).transform.position + val * 1f, Vector3.one * 0.1f);
		}
	}
}
public class ButtonSfx : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerClickHandler
{
	public void OnPointerEnter(PointerEventData eventData)
	{
	}

	public void OnPointerClick(PointerEventData eventData)
	{
		UiSfx.Instance.PlayClick();
	}
}
public class CameraLookAt : MonoBehaviour
{
	public Transform target;

	private void Update()
	{
		//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_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		Quaternion val = Quaternion.LookRotation(target.position - ((Component)this).transform.position);
		((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val, Time.deltaTime * 6.4f);
	}
}
public class CameraShaker : MonoBehaviour
{
	public ShakePreset damagePreset;

	public ShakePreset chargePreset;

	public ShakePreset stepShakePreset;

	private Shaker shaker;

	public static CameraShaker Instance;

	private void Awake()
	{
		Instance = this;
		shaker = ((Component)this).GetComponent<Shaker>();
	}

	public void DamageShake(float shakeRatio)
	{
		if (CurrentSettings.cameraShake)
		{
			shakeRatio *= 2f;
			shakeRatio = Mathf.Clamp(shakeRatio, 0.2f, 1f);
			shaker.Shake((IShakeParameters)(object)damagePreset, (int?)null).StrengthScale = shakeRatio;
		}
	}

	public void StepShake(float shakeRatio)
	{
		if (CurrentSettings.cameraShake)
		{
			shaker.Shake((IShakeParameters)(object)stepShakePreset, (int?)null).StrengthScale = shakeRatio;
		}
	}

	public void ChargeShake(float shakeRatio)
	{
		if (CurrentSettings.cameraShake)
		{
			shakeRatio = Mathf.Clamp(shakeRatio, 0.2f, 1f);
			shaker.Shake((IShakeParameters)(object)chargePreset, (int?)null).StrengthScale = shakeRatio;
		}
	}

	public void ShakeWithPreset(ShakePreset preset)
	{
		if (CurrentSettings.cameraShake)
		{
			shaker.Shake((IShakeParameters)(object)preset, (int?)null);
		}
	}

	public void ShakeWithPresetAndRatio(ShakePreset preset, float shakeRatio)
	{
		if (CurrentSettings.cameraShake)
		{
			shakeRatio *= 2f;
			shakeRatio = Mathf.Clamp(shakeRatio, 0.2f, 1f);
			shaker.Shake((IShakeParameters)(object)preset, (int?)null).StrengthScale = shakeRatio;
		}
	}
}
public class CampSpawner : MonoBehaviour
{
	[Serializable]
	public class WeightedSpawn
	{
		public GameObject prefab;

		public float weight;
	}

	public WeightedSpawn[] structurePrefabs;

	private int mapChunkSize;

	private float worldEdgeBuffer = 0.6f;

	public int maxCaves = 50;

	public int minCaves = 3;

	protected ConsistentRandom randomGen;

	public static ConsistentRandom woodmanRandomGen;

	public LayerMask whatIsTerrain;

	private List<GameObject> structures;

	public bool dontAddToResourceManager;

	public StructureSpawner houses;

	private Vector3[] shrines;

	private float totalWeight;

	public float worldScale { get; set; } = 12f;


	private void Start()
	{
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0249: Unknown result type (might be due to invalid IL or missing references)
		structures = new List<GameObject>();
		randomGen = new ConsistentRandom(GameManager.GetSeed() + ResourceManager.GetNextGenOffset());
		woodmanRandomGen = new ConsistentRandom(GameManager.GetSeed() + ResourceManager.GetNextGenOffset());
		shrines = (Vector3[])(object)new Vector3[maxCaves];
		mapChunkSize = MapGenerator.mapChunkSize;
		worldScale *= worldEdgeBuffer;
		WeightedSpawn[] array = structurePrefabs;
		WeightedSpawn[] array2 = array;
		WeightedSpawn[] array3 = array2;
		foreach (WeightedSpawn weightedSpawn in array3)
		{
			totalWeight += weightedSpawn.weight;
		}
		int num = 0;
		int num2 = 0;
		RaycastHit hit = default(RaycastHit);
		while (num < maxCaves)
		{
			num2++;
			float num3 = (float)(randomGen.NextDouble() * 2.0 - 1.0) * (float)mapChunkSize / 2f;
			float num4 = (float)(randomGen.NextDouble() * 2.0 - 1.0) * (float)mapChunkSize / 2f;
			Vector3 val = new Vector3(num3, 0f, num4) * worldScale;
			val.y = 200f;
			Debug.DrawLine(val, val + Vector3.down * 500f, Color.cyan, 50f);
			if (Physics.Raycast(val, Vector3.down, ref hit, 500f, LayerMask.op_Implicit(whatIsTerrain)))
			{
				if (WorldUtility.WorldHeightToBiome(((RaycastHit)(ref hit)).point.y) != TextureData.TerrainType.Grass || Mathf.Abs(Vector3.Angle(Vector3.up, ((RaycastHit)(ref hit)).normal)) > 15f)
				{
					continue;
				}
				shrines[num] = ((RaycastHit)(ref hit)).point;
				num++;
				GameObject val2 = FindObjectToSpawn(structurePrefabs, totalWeight);
				GameObject val3 = Object.Instantiate<GameObject>(val2, ((RaycastHit)(ref hit)).point, val2.transform.rotation);
				if (!dontAddToResourceManager)
				{
					val3.GetComponentInChildren<SharedObject>().SetId(ResourceManager.Instance.GetNextId());
				}
				structures.Add(val3);
				Process(val3, hit);
			}
			if ((num2 > maxCaves * 2 && num >= minCaves) || num2 > maxCaves * 10)
			{
				break;
			}
		}
		if (!dontAddToResourceManager)
		{
			ResourceManager.Instance.AddResources(structures);
		}
	}

	public virtual void Process(GameObject newStructure, RaycastHit hit)
	{
		GenerateCamp component = newStructure.GetComponent<GenerateCamp>();
		component.houseSpawner = houses;
		component.MakeCamp(randomGen);
	}

	private void OnDrawGizmos()
	{
	}

	public GameObject FindObjectToSpawn(WeightedSpawn[] structurePrefabs, float totalWeight)
	{
		float num = (float)randomGen.NextDouble();
		float num2 = 0f;
		for (int i = 0; i < structurePrefabs.Length; i++)
		{
			num2 += structurePrefabs[i].weight;
			if (num < num2 / totalWeight)
			{
				return structurePrefabs[i].prefab;
			}
		}
		return structurePrefabs[0].prefab;
	}
}
public class CauldronSync : Chest
{
	private int fuelCellId;

	private int resultCellId = 5;

	private int[] ingredientCells = new int[4] { 1, 2, 3, 4 };

	private bool processing;

	private float currentProcessTime;

	private float totalProcessTime;

	private float timeToProcess = 1f;

	public float ProgressRatio()
	{
		return currentProcessTime / timeToProcess;
	}

	public override void UpdateCraftables()
	{
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		InventoryItem inventoryItem = CanProcess();
		if (!processing && (Object)(object)inventoryItem != (Object)null)
		{
			ItemFuel fuel = cells[fuelCellId].fuel;
			totalProcessTime = 0f;
			currentProcessTime = 0f;
			timeToProcess = inventoryItem.processTime / fuel.speedMultiplier;
			processing = true;
		}
		if (Object.op_Implicit((Object)(object)CauldronUI.Instance) && (Object)(object)OtherInput.Instance.currentChest == (Object)(object)this)
		{
			CauldronUI.Instance.CopyChest(OtherInput.Instance.currentChest);
			((Component)CauldronUI.Instance.processBar).transform.localScale = new Vector3(currentProcessTime / timeToProcess, 1f, 1f);
		}
	}

	private void Update()
	{
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		if (!processing)
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)CanProcess()))
		{
			StopProcessing();
			return;
		}
		currentProcessTime += Time.deltaTime;
		totalProcessTime += Time.deltaTime;
		if (Object.op_Implicit((Object)(object)CauldronUI.Instance) && (Object)(object)OtherInput.Instance.currentChest == (Object)(object)this)
		{
			((Component)CauldronUI.Instance.processBar).transform.localScale = new Vector3(currentProcessTime / timeToProcess, 1f, 1f);
		}
		if (currentProcessTime >= timeToProcess)
		{
			ProcessItem();
			currentProcessTime = 0f;
		}
	}

	private void StopProcessing()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		processing = false;
		if (Object.op_Implicit((Object)(object)CauldronUI.Instance))
		{
			((Component)CauldronUI.Instance.processBar).transform.localScale = Vector3.zero;
		}
	}

	public void ProcessItem()
	{
		if (!LocalClient.serverOwner)
		{
			return;
		}
		InventoryItem inventoryItem = CanProcess();
		int[] array = ingredientCells;
		int[] array2 = array;
		int[] array3 = array2;
		foreach (int num in array3)
		{
			if ((Object)(object)cells[num] == (Object)null)
			{
				continue;
			}
			InventoryItem.CraftRequirement[] requirements = inventoryItem.requirements;
			for (int j = 0; j < requirements.Length; j++)
			{
				if (requirements[j].item.id == cells[num].id)
				{
					UseMaterial(cells[num], num);
					break;
				}
			}
		}
		UseFuel(cells[fuelCellId]);
		AddMaterial(cells[resultCellId], inventoryItem.id);
		UpdateCraftables();
		if (Object.op_Implicit((Object)(object)CauldronUI.Instance) && (Object)(object)OtherInput.Instance.currentChest == (Object)(object)this)
		{
			CauldronUI.Instance.CopyChest(OtherInput.Instance.currentChest);
		}
	}

	private void UseMaterial(InventoryItem materialItem, int cellId)
	{
		materialItem.amount--;
		if (materialItem.amount <= 0)
		{
			materialItem = null;
			ClientSend.ChestUpdate(base.id, cellId, -1, 0);
		}
		else
		{
			ClientSend.ChestUpdate(base.id, cellId, materialItem.id, materialItem.amount);
		}
	}

	private void UseFuel(InventoryItem fuelItem)
	{
		ItemFuel fuel = fuelItem.fuel;
		fuel.currentUses--;
		if (fuel.currentUses <= 0)
		{
			fuelItem.amount--;
			fuel.currentUses = fuel.maxUses;
			ClientSend.ChestUpdate(base.id, 0, fuelItem.id, fuelItem.amount);
		}
		if (fuelItem.amount <= 0)
		{
			fuelItem = null;
			ClientSend.ChestUpdate(base.id, 0, -1, 0);
		}
	}

	private void AddMaterial(InventoryItem item, int processedItemId)
	{
		if ((Object)(object)cells[resultCellId] == (Object)null)
		{
			cells[resultCellId] = Object.Instantiate<InventoryItem>(ItemManager.Instance.allItems[processedItemId]);
			cells[resultCellId].amount = 1;
		}
		else
		{
			cells[resultCellId].amount++;
		}
		ClientSend.ChestUpdate(base.id, resultCellId, processedItemId, cells[resultCellId].amount);
	}

	public InventoryItem CanProcess()
	{
		if (NoIngredients() || !Object.op_Implicit((Object)(object)cells[fuelCellId]))
		{
			return null;
		}
		InventoryItem inventoryItem = FindItemByIngredients(ingredientCells);
		if ((Object)(object)inventoryItem == (Object)null)
		{
			return null;
		}
		if ((Object)(object)cells[resultCellId] != (Object)null)
		{
			if (inventoryItem.id != cells[resultCellId].id)
			{
				return null;
			}
			if (cells[resultCellId].amount + inventoryItem.craftAmount > cells[resultCellId].max)
			{
				return null;
			}
		}
		if (cells[fuelCellId].tag == InventoryItem.ItemTag.Fuel)
		{
			return inventoryItem;
		}
		return null;
	}

	public InventoryItem FindItemByIngredients(int[] iCells)
	{
		List<InventoryItem> list = new List<InventoryItem>();
		foreach (int num in iCells)
		{
			if ((Object)(object)cells[num] != (Object)null)
			{
				list.Add(cells[num]);
			}
		}
		InventoryItem[] processableFood = CauldronUI.Instance.processableFood;
		InventoryItem[] array = processableFood;
		InventoryItem[] array2 = array;
		foreach (InventoryItem inventoryItem in array2)
		{
			int count = list.Count;
			int num2 = 0;
			if (inventoryItem.requirements.Length != count)
			{
				continue;
			}
			bool flag = false;
			InventoryItem.CraftRequirement[] requirements = inventoryItem.requirements;
			InventoryItem.CraftRequirement[] array3 = requirements;
			InventoryItem.CraftRequirement[] array4 = array3;
			foreach (InventoryItem.CraftRequirement craftRequirement in array4)
			{
				foreach (InventoryItem item in list)
				{
					if (item.id == craftRequirement.item.id)
					{
						if (item.amount < craftRequirement.amount)
						{
							flag = true;
						}
						else
						{
							num2++;
						}
						break;
					}
				}
			}
			if (!flag && num2 == count)
			{
				return inventoryItem;
			}
		}
		return null;
	}

	private bool NoIngredients()
	{
		int[] array = ingredientCells;
		int[] array2 = array;
		int[] array3 = array2;
		foreach (int num in array3)
		{
			if ((Object)(object)cells[num] != (Object)null)
			{
				return false;
			}
		}
		return true;
	}
}
public class CauldronUI : InventoryExtensions
{
	public InventoryCell[] ingredientCells;

	public InventoryCell fuelCell;

	public InventoryCell resultCell;

	public InventoryItem.ProcessType processType;

	public InventoryItem[] processableFood;

	private bool processing;

	private float currentProcessTime;

	private float totalProcessTime;

	private float timeToProcess;

	public RawImage processBar;

	public static CauldronUI Instance;

	public InventoryCell[] synchedCells;

	private float closedTime;

	private float closedProgress;

	private void Awake()
	{
		Instance = this;
		((Component)this).gameObject.SetActive(false);
	}

	public void CopyChest(Chest c)
	{
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		if (!((Component)this).gameObject.activeInHierarchy)
		{
			return;
		}
		InventoryItem[] cells = OtherInput.Instance.currentChest.cells;
		for (int i = 0; i < cells.Length; i++)
		{
			if (i < synchedCells.Length)
			{
				if (c.locked[i])
				{
					((Behaviour)synchedCells[i]).enabled = false;
				}
				else
				{
					((Behaviour)synchedCells[i]).enabled = true;
				}
				if ((Object)(object)cells[i] != (Object)null)
				{
					synchedCells[i].currentItem = Object.Instantiate<InventoryItem>(cells[i]);
				}
				else
				{
					synchedCells[i].currentItem = null;
				}
				synchedCells[i].UpdateCell();
			}
		}
		((Component)processBar).transform.localScale = new Vector3(((CauldronSync)OtherInput.Instance.currentChest).ProgressRatio(), 1f, 1f);
	}

	public override void UpdateCraftables()
	{
	}

	private void OnDisable()
	{
	}

	private void OnEnable()
	{
	}

	private void Update()
	{
	}

	private void StopProcessing()
	{
	}

	public void ProcessItem()
	{
	}

	private void UseMaterial(InventoryCell cell)
	{
	}

	private void UseFuel(InventoryCell cell)
	{
	}

	private void AddMaterial(InventoryCell cell, InventoryItem processedItem)
	{
	}

	public InventoryItem CanProcess()
	{
		return null;
	}

	public InventoryItem FindItemByIngredients(InventoryCell[] iCells)
	{
		return null;
	}

	private bool NoIngredients()
	{
		return false;
	}
}
public class Cave : MonoBehaviour
{
	public TextureData textureData;

	public SpawnChestsInLocations chestSpawner;

	private MeshRenderer rend;

	private ConsistentRandom rand;

	public void SetCave(ConsistentRandom rand)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_0038: 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_003a: 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_0055: Unknown result type (might be due to invalid IL or missing references)
		this.rand = rand;
		rend = ((Component)this).GetComponent<MeshRenderer>();
		Color color = ((Renderer)rend).material.color;
		Color tint = textureData.layers[2].tint;
		Color color2 = (color + tint) / 2f;
		((Renderer)rend).material.color = color2;
		chestSpawner.SetChests(rand);
		SpawnResourcesInLocations[] componentsInChildren = ((Component)this).GetComponentsInChildren<SpawnResourcesInLocations>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			componentsInChildren[i].SetResources(rand);
		}
	}
}
public class CaveSpawner : MonoBehaviour
{
	[Serializable]
	public class WeightedSpawn
	{
		public GameObject prefab;

		public float weight;
	}

	public WeightedSpawn[] structurePrefabs;

	private int mapChunkSize;

	private float worldEdgeBuffer = 0.6f;

	public int maxCaves = 50;

	public int minCaves = 3;

	protected ConsistentRandom randomGen;

	public LayerMask whatIsTerrain;

	private List<GameObject> structures;

	public bool dontAddToResourceManager;

	private Vector3[] shrines;

	private float totalWeight;

	public float worldScale { get; set; } = 12f;


	private void Start()
	{
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (