using System;
using System.Collections;
using System.Collections.Generic;
using DarkTonic.MasterAudio;
using LOS;
using Pathfinding;
using PixelCrushers.DialogueSystem;
using TheVegetationEngine;
using UnityEngine;

// Token: 0x02000085 RID: 133
[ExecuteInEditMode]
public class Diorama : MonoBehaviour
{
	// Token: 0x06000CEA RID: 3306 RVA: 0x000F9D51 File Offset: 0x000F7F51
	private void Awake()
	{
		this.sceneInfo = base.gameObject.GetComponent<SceneInfo>();
	}

	// Token: 0x06000CEB RID: 3307 RVA: 0x000F9D64 File Offset: 0x000F7F64
	private void Start()
	{
		if (Links.x)
		{
			this.linksParty = Links.x.portraitOrder;
			for (int i = 0; i < this.sceneViews.Count; i++)
			{
				this.sceneViews[i].Setup();
			}
			for (int j = 0; j < this.fogColliders.Count; j++)
			{
				this.fogColliders[j].enabled = false;
			}
			this.blueFogBounds.Clear();
			for (int k = 0; k < this.blueFog.Count; k++)
			{
				this.blueFog[k].enabled = false;
				this.blueFogBounds.Add(this.blueFog[k].bounds);
			}
			if (this.cameraPoints)
			{
				foreach (object obj in this.cameraPoints)
				{
					Transform transform = (Transform)obj;
					if (transform != this.cameraPoints)
					{
						transform.gameObject.layer = 10;
						transform.gameObject.SetActive(true);
					}
				}
			}
			foreach (object obj2 in base.transform)
			{
				Transform transform2 = (Transform)obj2;
				if (transform2.gameObject.name.Contains("Ghost Point"))
				{
					this.ghostPoint = transform2.gameObject;
				}
			}
			Links.x.fogOfWar = this.fogOfWar;
			Links.x.fogOfWarInterior = this.fogOfWarInterior;
			Links.x.diorama = this;
			if (this.sceneDirectionalLight)
			{
				this.sceneDirectionalLight.gameObject.SetActive(false);
				Links.x.gameplay.sunlightAnimator.exteriorRotation = this.sceneDirectionalLight.gameObject.transform.rotation.eulerAngles;
			}
			if (this.vegetation)
			{
				this.vegetation.mainCamera = Links.x.worldCamera;
				this.globalVegVolume = this.vegetation.transform;
				this.globalVegVolume.localScale = new Vector3(80f, 80f, 80f);
			}
			if (this.sceneCamera)
			{
				this.sceneCamera.enabled = false;
			}
			Links.x.cameraEffects.usesTimeOfDay = this.timeOfDay;
			Links.x.cameraEffects.hasDirectionalLight = true;
			if (this.sceneViews.Count > 0)
			{
				this.currentCameraView = this.sceneViews[0].sceneCamera;
			}
			else
			{
				this.currentCameraView = this.sceneCamera;
			}
			Links.x.gaia.NewSceneLoaded();
			Links.x.sensory = base.gameObject.GetComponent<Sensory>();
			this.quads = Links.x.quads;
			this.party = Links.x.party;
			Links.x.cameraEffects.SetFog();
			if (Links.x.options.graphicsQuality == 0)
			{
				this.SetTerrainQuality(0f);
			}
			else if (Links.x.options.graphicsQuality == 1)
			{
				this.SetTerrainQuality(0.6f);
			}
			else
			{
				this.SetTerrainQuality(1f);
			}
		}
		this.itemIDs.Clear();
		this.itemSaveIDs.Clear();
		this.itemAmts.Clear();
		this.itemSocketsA.Clear();
		this.itemSocketsB.Clear();
		this.itemsForSaleStates.Clear();
		this.itemPositions.Clear();
		this.itemLinks.Clear();
		this.itemLinkIDs.Clear();
		this.itemPrompts.Clear();
		this.itemOriginals.Clear();
		if (!this.promptsFolder)
		{
			this.promptsFolder = GameObject.Find("~ Prompts");
		}
		if (this.promptsFolder)
		{
			this.prompts = this.promptsFolder.GetComponentsInChildren<Prompts>(true);
		}
		this.activeView = null;
		Shader.SetGlobalFloat("_InGhostFog", 0f);
		this.mainCharacterInGhostFog = false;
		this.boatCollider = GameObject.Find("collider_boat");
		if (this.boatCollider)
		{
			GameObject gameObject = GameObject.Find("collider_water");
			if (gameObject)
			{
				this.waterY = gameObject.transform.position.y;
			}
			else
			{
				this.waterY = 20f;
			}
			this.boatCollider.transform.position = new Vector3(this.boatCollider.transform.position.x, gameObject.transform.position.y - 1f, this.boatCollider.transform.position.z);
			this.boatColliderY = this.boatCollider.transform.position.y;
			return;
		}
		this.boatColliderY = 19.5f;
		this.waterY = 20f;
	}

	// Token: 0x06000CEC RID: 3308 RVA: 0x000FA2A4 File Offset: 0x000F84A4
	public Transform ReturnJumpPoint()
	{
		if (Records.x.editor && QuestLog.GetQuestState("CharacterCreation") == QuestState.Success)
		{
			List<Transform> list = new List<Transform>();
			foreach (object obj in base.transform)
			{
				Transform transform = (Transform)obj;
				if (transform.gameObject.name.Contains("Jump"))
				{
					list.Add(transform);
				}
			}
			if (list.Count > 0)
			{
				if (Random.Range(0, 10) == 0)
				{
					return this.playerStartDefault;
				}
				return list[Random.Range(0, list.Count)];
			}
		}
		return this.playerStartDefault;
	}

	// Token: 0x06000CED RID: 3309 RVA: 0x000FA36C File Offset: 0x000F856C
	public void SetTerrainQuality(float n)
	{
		if ((float)Screen.height < 1000f && n > 0f && n < 1f)
		{
			n = 0.35f;
		}
		for (int i = 0; i < this.terrains.Count; i++)
		{
			this.terrains[i].detailObjectDensity = n;
			this.terrains[i].detailObjectDistance = 500f;
		}
	}

	// Token: 0x06000CEE RID: 3310 RVA: 0x000FA3DB File Offset: 0x000F85DB
	public void GetGhostNode()
	{
		if (this.ghostPoint)
		{
			this.ghostNode = Links.x.main.NearNode(this.ghostPoint.transform.position, false, 0, -1, 0);
		}
	}

	// Token: 0x06000CEF RID: 3311 RVA: 0x000FA413 File Offset: 0x000F8613
	public SceneCamera GetIndoorView()
	{
		if (this.sceneViews.Count > 1)
		{
			return this.sceneViews[1];
		}
		return null;
	}

	// Token: 0x06000CF0 RID: 3312 RVA: 0x000FA431 File Offset: 0x000F8631
	public SceneCamera GetOutdoorView()
	{
		return this.sceneViews[0];
	}

	// Token: 0x06000CF1 RID: 3313 RVA: 0x000FA43F File Offset: 0x000F863F
	public string GetCurrentCaptureCameraID()
	{
		if (this.activeView)
		{
			return this.activeView.id;
		}
		return "";
	}

	// Token: 0x06000CF2 RID: 3314 RVA: 0x000FA460 File Offset: 0x000F8660
	public void ToggleSceneCameras(bool interior, string captureCameraId)
	{
		if (!interior)
		{
			int num = 0;
			if (captureCameraId != "")
			{
				for (int i = 0; i < this.sceneViews.Count; i++)
				{
					if (this.sceneViews[i].id == captureCameraId)
					{
						num = this.sceneViews[i].index;
					}
				}
			}
			this.activeView = this.sceneViews[num];
			this.currentCameraView = this.activeView.sceneCamera;
			this.activeView.On();
			this.pointLightTransforms = 0;
			Links.x.cameraEffects.pointLightShadows.pointLightObject.SetActive(false);
			if (this.currentInteriorLight)
			{
				this.currentInteriorLight.TurnOffLights();
				this.currentInteriorLight.InactiveLights();
			}
			Links.x.fellowship.ClearCompanionNodes();
			this.currentInteriorLight = null;
		}
		else
		{
			int num2 = 1;
			if (captureCameraId != "")
			{
				for (int j = 0; j < this.sceneViews.Count; j++)
				{
					if (this.sceneViews[j].id == captureCameraId)
					{
						num2 = this.sceneViews[j].index;
					}
				}
			}
			if (num2 < this.sceneViews.Count)
			{
				this.activeView = this.sceneViews[num2];
				this.currentCameraView = this.activeView.sceneCamera;
				this.activeView.On();
				InteriorLights pointLights = this.sceneViews[1].GetPointLights(Links.x.rtsCamera.coll);
				if (this.currentInteriorLight != pointLights)
				{
					if (this.currentInteriorLight)
					{
						this.currentInteriorLight.InactiveLights();
					}
					this.pointLightTransforms = this.sceneViews[1].GetPointLightCount(Links.x.rtsCamera.coll);
					this.currentInteriorLight = pointLights;
					if (this.currentInteriorLight)
					{
						this.currentInteriorLight.TurnOffLights();
						this.currentInteriorLight.ActiveLights();
					}
					if (this.currentInteriorLight)
					{
						this.currentInteriorLight.SetUpCompanionNodes();
					}
				}
				if (pointLights)
				{
					Links.x.cameraEffects.pointLightShadows.pointLightObject.SetActive(true);
				}
				else
				{
					Links.x.cameraEffects.pointLightShadows.pointLightObject.SetActive(false);
				}
			}
		}
		if (this.prevView && this.prevView != this.activeView)
		{
			this.prevView.Off();
		}
		this.prevView = this.activeView;
	}

	// Token: 0x06000CF3 RID: 3315 RVA: 0x000FA70C File Offset: 0x000F890C
	public void ChangeTimeOfDay(bool sendDayNightEvent, bool timeJump)
	{
		if (this.prevTimeOfDay != Links.x.gameplay.timeOfDay)
		{
			if (Links.x.gameplay.timeOfDay == "Morning")
			{
				if (this.morningFolder)
				{
					this.morningFolder.SetActive(true);
				}
				if (this.afternoonFolder)
				{
					this.afternoonFolder.SetActive(false);
				}
				if (this.eveningFolder)
				{
					this.eveningFolder.SetActive(false);
				}
				if (this.nightFolder)
				{
					this.nightFolder.SetActive(false);
				}
			}
			if (Links.x.gameplay.timeOfDay == "Afternoon")
			{
				if (this.morningFolder)
				{
					this.morningFolder.SetActive(false);
				}
				if (this.afternoonFolder)
				{
					this.afternoonFolder.SetActive(true);
				}
				if (this.eveningFolder)
				{
					this.eveningFolder.SetActive(false);
				}
				if (this.nightFolder)
				{
					this.nightFolder.SetActive(false);
				}
			}
			if (Links.x.gameplay.timeOfDay == "Evening")
			{
				if (this.morningFolder)
				{
					this.morningFolder.SetActive(false);
				}
				if (this.afternoonFolder)
				{
					this.afternoonFolder.SetActive(false);
				}
				if (this.eveningFolder)
				{
					this.eveningFolder.SetActive(true);
				}
				if (this.nightFolder)
				{
					this.nightFolder.SetActive(false);
				}
			}
			if (Links.x.gameplay.timeOfDay == "Night")
			{
				if (this.morningFolder)
				{
					this.morningFolder.SetActive(false);
				}
				if (this.afternoonFolder)
				{
					this.afternoonFolder.SetActive(false);
				}
				if (this.eveningFolder)
				{
					this.eveningFolder.SetActive(false);
				}
				if (this.nightFolder)
				{
					this.nightFolder.SetActive(true);
				}
			}
			Links.x.hudControl.UpdateTimeOfDay();
		}
		if (sendDayNightEvent)
		{
			this.DayNightSwitch(timeJump);
		}
		float num = Links.x.gameplay.gameHours;
		num = Mathf.Floor(num);
		string text = Links.x.gameplay.ShowHour(num);
		Links.x.gameFeed.AddFeed("New hour: " + text);
		if (this.prevTimeOfDay != Links.x.gameplay.timeOfDay)
		{
			if (Links.x.gameplay.timeOfDay == "Night")
			{
				Links.x.gameFeed.AddFeed("Sunset");
			}
			else if (Links.x.gameplay.timeOfDay == "Morning")
			{
				Links.x.gameFeed.AddFeed("Sunrise");
			}
		}
		this.prevTimeOfDay = Links.x.gameplay.timeOfDay;
		this.CheckRespawns();
		this.CheckResurrections();
		this.CheckStunsAndQuestChange();
	}

	// Token: 0x06000CF4 RID: 3316 RVA: 0x000FAA34 File Offset: 0x000F8C34
	public bool InResurrectionFog(Vector3 pt)
	{
		bool flag = false;
		bool flag2 = true;
		if (this.fogColliders.Count == 0 && !this.underground)
		{
			return false;
		}
		if (this.underground && !this.blackFow)
		{
			return false;
		}
		if (this.sceneName.Contains("C6") && QuestLog.GetQuestState("C6_Ghosts") == QuestState.Success)
		{
			flag2 = false;
		}
		if (!flag2)
		{
			return false;
		}
		if (this.blackFow)
		{
			return true;
		}
		for (int i = 0; i < this.fogColliders.Count; i++)
		{
			if (!flag)
			{
				Vector3 center = this.fogColliderBounds[i].center;
				pt.y = center.y;
				float num = this.fogColliderBounds[i].extents.x;
				if ((pt - center).sqrMagnitude < num * num)
				{
					flag = true;
				}
			}
		}
		return flag;
	}

	// Token: 0x06000CF5 RID: 3317 RVA: 0x000FAB10 File Offset: 0x000F8D10
	public bool InSporeForest(Vector3 pt)
	{
		bool flag = false;
		if (this.sporeColliders.Count == 0)
		{
			return false;
		}
		for (int i = 0; i < this.sporeColliders.Count; i++)
		{
			if (!flag)
			{
				Vector3 center = this.sporeColliderBounds[i].center;
				pt.y = center.y;
				float num = this.sporeColliderBounds[i].extents.x;
				if ((pt - center).sqrMagnitude < num * num)
				{
					flag = true;
				}
			}
		}
		return flag;
	}

	// Token: 0x06000CF6 RID: 3318 RVA: 0x000FABA0 File Offset: 0x000F8DA0
	public bool InTown(Vector3 pt)
	{
		bool flag = false;
		if (this.townColliders.Count == 0)
		{
			return false;
		}
		for (int i = 0; i < this.townColliders.Count; i++)
		{
			if (!flag)
			{
				Vector3 center = this.townColliderBounds[i].center;
				pt.y = center.y;
				float num = this.townColliderBounds[i].extents.x;
				if ((pt - center).sqrMagnitude < num * num)
				{
					flag = true;
				}
			}
		}
		return flag;
	}

	// Token: 0x06000CF7 RID: 3319 RVA: 0x000FAC30 File Offset: 0x000F8E30
	public void SetVolume()
	{
		for (int i = 0; i < this.quads.Count; i++)
		{
			this.quads[i].SetVolume();
		}
	}

	// Token: 0x06000CF8 RID: 3320 RVA: 0x000FAC64 File Offset: 0x000F8E64
	public void GhostFogOn()
	{
		this.GhostMaterials();
		this.mapCanResurrect = true;
		if (this.underground)
		{
			if (this.fogFadeCorout != null)
			{
				base.StopCoroutine(this.fogFadeCorout);
				this.fogFadeCorout = null;
			}
			this.fogFadeCorout = this.FadeGhostFog(this.currentFogValue, 1f);
			base.StartCoroutine(this.fogFadeCorout);
		}
	}

	// Token: 0x06000CF9 RID: 3321 RVA: 0x000FACC8 File Offset: 0x000F8EC8
	public void GhostMaterials()
	{
		for (int i = 0; i < this.quads.Count; i++)
		{
			if (this.quads[i].art.sharedMaterial && this.quads[i].art.sharedMaterial.GetFloat("_IsGhostArea") >= 1f && !this.quads[i].art.sharedMaterial.shader.name.Contains("Ghost"))
			{
				this.quads[i].art.sharedMaterial.shader = Links.x.backgroundShaderGhosts;
			}
		}
	}

	// Token: 0x06000CFA RID: 3322 RVA: 0x000FAD88 File Offset: 0x000F8F88
	public void GhostFogOff()
	{
		if (Records.x.editor)
		{
			Debug.Log("Ghost fog off");
		}
		for (int i = 0; i < this.quads.Count; i++)
		{
			if (this.quads[i].art.sharedMaterial && this.quads[i].art.sharedMaterial.shader.name.Contains("Ghost"))
			{
				this.quads[i].art.sharedMaterial.shader = Links.x.backgroundShader;
			}
		}
		this.mapCanResurrect = false;
		if (this.underground)
		{
			if (this.fogFadeCorout != null)
			{
				base.StopCoroutine(this.fogFadeCorout);
				this.fogFadeCorout = null;
			}
			this.fogFadeCorout = this.FadeGhostFog(this.currentFogValue, 0f);
			base.StartCoroutine(this.fogFadeCorout);
		}
	}

	// Token: 0x06000CFB RID: 3323 RVA: 0x000FAE80 File Offset: 0x000F9080
	public Character FindCharacterHerder()
	{
		for (int i = 0; i < this.creatureActions.Count; i++)
		{
			if (this.creatureActions[i] && this.creatureActions[i].xmlName != null && this.creatureActions[i].xmlName.Contains("Herder"))
			{
				Character firstCharacter = this.creatureActions[i].GetFirstCharacter();
				if (firstCharacter && !firstCharacter.dead && !firstCharacter.stunned && !firstCharacter.sleeping)
				{
					return firstCharacter;
				}
			}
		}
		return null;
	}

	// Token: 0x06000CFC RID: 3324 RVA: 0x000FAF20 File Offset: 0x000F9120
	public Character FindCharacter(string n)
	{
		for (int i = 0; i < this.creatureActions.Count; i++)
		{
			if (this.creatureActions[i] && this.creatureActions[i].xmlName == n)
			{
				return this.creatureActions[i].GetFirstCharacter();
			}
		}
		return null;
	}

	// Token: 0x06000CFD RID: 3325 RVA: 0x000FAF84 File Offset: 0x000F9184
	public DoorActions FindDoor(string n)
	{
		for (int i = 0; i < this.doorActions.Count; i++)
		{
			if (this.doorActions[i].gameObject.name == n)
			{
				return this.doorActions[i];
			}
		}
		return null;
	}

	// Token: 0x06000CFE RID: 3326 RVA: 0x000FAFD4 File Offset: 0x000F91D4
	public Character FindCharacterAnyState(string n)
	{
		int count = this.creatureActions.Count;
		for (int i = 0; i < count; i++)
		{
			CreatureActions creatureActions = this.creatureActions[i];
			if (creatureActions.xmlName == n)
			{
				return creatureActions.GetFirstCharacter(true);
			}
		}
		return null;
	}

	// Token: 0x06000CFF RID: 3327 RVA: 0x000FB020 File Offset: 0x000F9220
	public PromptActions GetPromptWithQuest(string n)
	{
		foreach (PromptActions promptActions in this.promptActions)
		{
			if (promptActions.prompt.type == Prompts.types.puzzle && promptActions.prompt.questName.ToString() == n)
			{
				return promptActions;
			}
		}
		return null;
	}

	// Token: 0x06000D00 RID: 3328 RVA: 0x000FB0A0 File Offset: 0x000F92A0
	public void CheckCampCleared()
	{
		foreach (PromptActions promptActions in this.promptActions)
		{
			if (promptActions.prompt.type == Prompts.types.campCleared)
			{
				promptActions.CheckStatus();
			}
		}
	}

	// Token: 0x06000D01 RID: 3329 RVA: 0x000FB104 File Offset: 0x000F9304
	public void CheckQuestChange()
	{
		for (int i = 0; i < this.creatureActions.Count; i++)
		{
			this.creatureActions[i].CheckQuestSwap();
		}
	}

	// Token: 0x06000D02 RID: 3330 RVA: 0x000FB138 File Offset: 0x000F9338
	private void CheckStunsAndQuestChange()
	{
		for (int i = 0; i < this.creatureActions.Count; i++)
		{
			this.creatureActions[i].CheckStuns();
			this.creatureActions[i].CheckQuestSwap();
		}
		for (int j = 0; j < this.party.Count; j++)
		{
			if (this.party[j] && this.party[j].stunned && Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours()) >= this.party[j].timeOfDeath)
			{
				this.party[j].EndStun();
			}
		}
		foreach (PromptActions promptActions in this.promptActions)
		{
			if (promptActions.prompt.type == Prompts.types.campCleared)
			{
				promptActions.CheckHour();
			}
		}
	}

	// Token: 0x06000D03 RID: 3331 RVA: 0x000FB248 File Offset: 0x000F9448
	private void CheckResurrections()
	{
		for (int i = 0; i < this.creatureActions.Count; i++)
		{
			this.creatureActions[i].CheckResurrections();
		}
	}

	// Token: 0x06000D04 RID: 3332 RVA: 0x000FB27C File Offset: 0x000F947C
	private void CheckRespawns()
	{
		for (int i = 0; i < this.creatureActions.Count; i++)
		{
			this.creatureActions[i].CheckHourRespawn();
		}
	}

	// Token: 0x06000D05 RID: 3333 RVA: 0x000FB2B0 File Offset: 0x000F94B0
	public void TimeJump()
	{
		this.enemiesInCamp.Clear();
		this.prevTimeOfDay = Links.x.gameplay.timeOfDay;
		for (int i = 0; i < this.creatureActions.Count; i++)
		{
			this.creatureActions[i].ChangingTime(Links.x.gameplay.gameHours, true);
		}
	}

	// Token: 0x06000D06 RID: 3334 RVA: 0x000FB314 File Offset: 0x000F9514
	public bool SeenWhileResting()
	{
		return this.enemiesInCamp.Count > 0;
	}

	// Token: 0x06000D07 RID: 3335 RVA: 0x000FB328 File Offset: 0x000F9528
	public void EnemiesInCampAlert()
	{
		if (this.enemiesInCamp.Count > 0)
		{
			for (int i = 0; i < this.linksParty.Count; i++)
			{
				if (this.linksParty[i])
				{
					Links.x.sensory.AddFootstep(this.linksParty[i]);
				}
			}
		}
	}

	// Token: 0x06000D08 RID: 3336 RVA: 0x000FB388 File Offset: 0x000F9588
	public void DayNightSwitch(bool timeJump)
	{
		for (int i = 0; i < this.creatureActions.Count; i++)
		{
			this.creatureActions[i].DayNightSwitch(timeJump);
		}
	}

	// Token: 0x06000D09 RID: 3337 RVA: 0x000FB3C0 File Offset: 0x000F95C0
	public void CheckDistanceToRestingParty(Character character)
	{
		float num = character.stats.SightRadius(false, false, false);
		float num2 = num * num;
		for (int i = 0; i < this.linksParty.Count; i++)
		{
			if (this.linksParty[i] && this.linksParty[i].party && (this.linksParty[i].tr.position - character.tr.position).sqrMagnitude < num2 && this.linksParty[i].indoorID == character.indoorID)
			{
				this.enemiesInCamp.Add(character);
				if (Records.x.editor)
				{
					string text = ((character != null) ? character.ToString() : null);
					string text2 = " interrupted sleep for ";
					Character character2 = this.linksParty[i];
					Debug.Log(text + text2 + ((character2 != null) ? character2.ToString() : null));
				}
			}
		}
	}

	// Token: 0x06000D0A RID: 3338 RVA: 0x000FB4C4 File Offset: 0x000F96C4
	public global::Item CheckGroundForItem(Creatures linked, int linkedID, int itemID, Vector3 point, Character character, int index)
	{
		int count = this.groundItems.Count;
		for (int i = 0; i < count; i++)
		{
			global::Item item = this.groundItems[i];
			if (item && item.ID == itemID && item.active && item.gameObject.activeSelf && (item.linkedCreatures == linked || !linked) && (item.linkedCreatureID == linkedID || !linked) && (item.tr.position - point).sqrMagnitude < 400f)
			{
				return item;
			}
		}
		for (int j = 0; j < count; j++)
		{
			global::Item item = this.groundItems[j];
			if (item && item.active && item.gameObject.activeSelf && (item.tr.position - point).sqrMagnitude < 400f && !item.linkedCreatures)
			{
				if (index == 0 || index == 32)
				{
					if (item.invRow._DmgMax > 0 && character.stats.IsGoodWeaponMatch(character, item))
					{
						return item;
					}
				}
				else if (index == 18)
				{
					if (item.invRow._Tag == "Armor" && character.stats.IsGoodArmorMatch(character, item))
					{
						return item;
					}
				}
				else if (index == 2)
				{
					if (character.stats.IsGoodShieldMatch(character, item))
					{
						return item;
					}
				}
				else if (index > 36 || index == 14 || index == 26 || index == 28)
				{
					if (item.invRow._Life > 0)
					{
						return item;
					}
				}
				else if ((index > 36 || index == 8 || index == 10 || index == 12) && item.invRow._Tag == "Ammunition" && character.stats.IsGoodAmmoMatch(character, item))
				{
					return item;
				}
			}
		}
		return null;
	}

	// Token: 0x06000D0B RID: 3339 RVA: 0x000FB6D8 File Offset: 0x000F98D8
	public void SetOriginalSceneItemLink(string sceneItemName, GameObject creatureObject)
	{
		for (int i = 0; i < this.itemOriginals.Count; i++)
		{
			if (this.itemOriginals[i] == sceneItemName)
			{
				this.itemLinks[i] = "";
			}
		}
		foreach (SceneItem sceneItem in this.sceneItems)
		{
			if (sceneItem.gameObject.name == sceneItemName)
			{
				sceneItem.linkedCharacter = null;
			}
		}
		this.itemsNoRespawn.Add(sceneItemName);
	}

	// Token: 0x06000D0C RID: 3340 RVA: 0x000FB760 File Offset: 0x000F9960
	public void HasForSaleGroundItems(Creatures linked)
	{
		int num = this.sceneItems.Length;
		for (int i = 0; i < num; i++)
		{
			SceneItem sceneItem = this.sceneItems[i];
			if (sceneItem.forSale && linked == sceneItem.linkedCharacter && !this.HasSpawnedItem(sceneItem))
			{
				this.SpawnSceneItem(sceneItem);
			}
		}
	}

	// Token: 0x06000D0D RID: 3341 RVA: 0x000FB7B8 File Offset: 0x000F99B8
	public void CheckDoors(Character character)
	{
		Vector3 position = character.tr.position;
		if (character.currentDoor > 0 && character.currentDoor > 0 && character.currentDoor - 1 < this.doorActions.Count)
		{
			position.y = this.doorActions[character.currentDoor - 1].center.y;
			if (this.SubtractVectors(position, this.doorActions[character.currentDoor - 1].center).sqrMagnitude >= this.doorActions[character.currentDoor - 1].openDistance)
			{
				this.doorActions[character.currentDoor - 1].AddRemoveCharacterOnCollider(character, false);
				character.currentDoor = 0;
			}
		}
		int count = this.doorActions.Count;
		for (int i = 0; i < count; i++)
		{
			DoorActions doorActions = this.doorActions[i];
			if (i != character.currentDoor - 1 && doorActions.swings && !doorActions.destroyed)
			{
				position.y = this.doorActions[i].center.y;
				if (this.SubtractVectors(position, this.doorActions[i].center).sqrMagnitude < this.doorActions[i].openDistance)
				{
					this.doorActions[i].AddRemoveCharacterOnCollider(character, true);
					character.currentDoor = i + 1;
					return;
				}
			}
		}
	}

	// Token: 0x06000D0E RID: 3342 RVA: 0x000FB94C File Offset: 0x000F9B4C
	public Vector3 SubtractVectors(Vector3 a, Vector3 b)
	{
		Vector3 vector;
		vector.x = a.x - b.x;
		vector.y = a.y - b.y;
		vector.z = a.z - b.z;
		return vector;
	}

	// Token: 0x06000D0F RID: 3343 RVA: 0x000FB998 File Offset: 0x000F9B98
	public Vector3 SubtractVectorsSameY(Vector3 a, Vector3 b)
	{
		Vector3 vector;
		vector.x = a.x - b.x;
		vector.y = 0f;
		vector.z = a.z - b.z;
		return vector;
	}

	// Token: 0x06000D10 RID: 3344 RVA: 0x000FB9DC File Offset: 0x000F9BDC
	public bool InMoonlight(Vector3 pt)
	{
		bool flag = true;
		this.currentInteriorLight;
		if (!flag)
		{
			for (int i = 0; i < this.moonlights.Count; i++)
			{
				Moonlight moonlight = this.moonlights[i];
				if (moonlight)
				{
					pt.y = moonlight.tr.position.y;
					if ((pt - moonlight.tr.position).sqrMagnitude < moonlight.radius)
					{
						flag = true;
						break;
					}
				}
			}
		}
		return flag;
	}

	// Token: 0x06000D11 RID: 3345 RVA: 0x000FBA68 File Offset: 0x000F9C68
	public void MoonlightList(Moonlight moonlight, bool state)
	{
		int num = this.moonlights.IndexOf(moonlight);
		if (state)
		{
			if (num == -1)
			{
				this.moonlights.Add(moonlight);
				return;
			}
		}
		else if (num > -1)
		{
			this.moonlights.RemoveAt(num);
		}
	}

	// Token: 0x06000D12 RID: 3346 RVA: 0x000FBAA8 File Offset: 0x000F9CA8
	public void StartQuadCulling()
	{
		this.quads = Links.x.quads;
		this.party = Links.x.party;
		for (int i = 0; i < 2; i++)
		{
			if (i < this.sceneViews.Count)
			{
				Plane plane = new Plane(Vector3.up, new Vector3(0f, this.sceneViews[i].cameraCollider.bounds.center.y, 0f));
				float num = this.sceneViews[i].sceneCamera.orthographicSize * 2f;
				float num2 = num * 1.7777778f;
				num2 /= 2f;
				num /= 2f;
				Vector3 position = this.sceneViews[i].sceneCamera.gameObject.transform.position;
				Vector3 forward = this.sceneViews[i].sceneCamera.gameObject.transform.forward;
				Vector3 right = this.sceneViews[i].sceneCamera.gameObject.transform.right;
				Vector3 up = this.sceneViews[i].sceneCamera.gameObject.transform.up;
				Vector3 vector = position - num2 * right + num * up;
				Ray ray = new Ray(vector, forward);
				float num3;
				if (plane.Raycast(ray, out num3))
				{
					vector = ray.GetPoint(num3);
				}
				Vector3 vector2 = position + num2 * right + num * up;
				ray = new Ray(vector2, forward);
				float num4;
				if (plane.Raycast(ray, out num4))
				{
					vector2 = ray.GetPoint(num4);
				}
				Vector3 vector3 = position + num2 * right - num * up;
				ray = new Ray(vector3, forward);
				float num5;
				if (plane.Raycast(ray, out num5))
				{
					vector3 = ray.GetPoint(num5);
				}
				Vector3 vector4 = position - num2 * right - num * up;
				ray = new Ray(vector4, forward);
				float num6;
				if (plane.Raycast(ray, out num6))
				{
					vector4 = ray.GetPoint(num6);
				}
				if (i == 0)
				{
					Links.x.rtsCamera.topLeftBounds = vector;
					Links.x.rtsCamera.topRightBounds = vector2;
					Links.x.rtsCamera.bottomRightBounds = vector3;
					Links.x.rtsCamera.bottomLeftBounds = vector4;
					Links.x.main.CreateSphere(Links.x.rtsCamera.topLeftBounds, 1E-05f);
					Links.x.main.CreateSphere(Links.x.rtsCamera.topRightBounds, 1E-05f);
					Links.x.main.CreateSphere(Links.x.rtsCamera.bottomRightBounds, 1E-05f);
					Links.x.main.CreateSphere(Links.x.rtsCamera.bottomLeftBounds, 1E-05f);
				}
				else
				{
					Links.x.rtsCamera.topLeftBoundsInterior = vector;
					Links.x.rtsCamera.topRightBoundsInterior = vector2;
					Links.x.rtsCamera.bottomRightBoundsInterior = vector3;
					Links.x.rtsCamera.bottomLeftBoundsInterior = vector4;
					Links.x.main.CreateSphere(Links.x.rtsCamera.topLeftBoundsInterior, 1E-05f);
					Links.x.main.CreateSphere(Links.x.rtsCamera.topRightBoundsInterior, 1E-05f);
					Links.x.main.CreateSphere(Links.x.rtsCamera.bottomRightBoundsInterior, 1E-05f);
					Links.x.main.CreateSphere(Links.x.rtsCamera.bottomLeftBoundsInterior, 1E-05f);
				}
			}
		}
	}

	// Token: 0x06000D13 RID: 3347 RVA: 0x000FBEA4 File Offset: 0x000FA0A4
	public void CheckQuadState(bool turnAllOff)
	{
		if (!this.activeView)
		{
			return;
		}
		Vector3 vector = Vector3.zero;
		Vector3 vector2 = new Vector3((float)Screen.width / 2f, (float)Screen.height / 2f, 0f);
		Ray ray = Links.x.worldCamera.ScreenPointToRay(vector2);
		float num = 0f;
		if (this.sceneInfo)
		{
			num = this.sceneInfo.groundY;
		}
		Plane plane = new Plane(Vector3.up, this.activeView.cameraCollider.bounds.center.y + num);
		float num2;
		if (plane.Raycast(ray, out num2))
		{
			vector = ray.GetPoint(num2);
		}
		int index = this.activeView.index;
		bool flag = false;
		if (this.activeView.index > 1)
		{
			flag = true;
		}
		for (int i = 0; i < this.quads.Count; i++)
		{
			bool flag2 = false;
			Culling culling = this.quads[i];
			if (culling.sceneCamera.index == index)
			{
				flag2 = true;
			}
			bool flag3 = false;
			bool flag4 = false;
			if (flag2 && !flag)
			{
				flag4 = true;
			}
			if (flag4 && (vector - new Vector3(culling.center.x, vector.y, culling.center.z)).sqrMagnitude < 22500f)
			{
				flag3 = true;
			}
			if (flag && flag2)
			{
				flag3 = true;
			}
			if (flag && !flag2)
			{
				if (this.activeView.isInterior)
				{
					if (culling.sceneCamera.index == 1)
					{
						flag3 = true;
					}
				}
				else if (culling.sceneCamera.index == 0)
				{
					flag3 = true;
				}
			}
			if (Records.x.editor && Records.x.testPatrols && culling.sceneCamera.index < 2)
			{
				flag3 = true;
			}
			if (flag3)
			{
				if (!culling.isOn)
				{
					if (flag && !flag2)
					{
						culling.ChangeState(true, true);
					}
					else
					{
						culling.ChangeState(true, false);
					}
					this.activeQuads.Add(culling);
				}
				else if (culling.isOn && !culling.art.enabled && flag2)
				{
					culling.ArtOn();
				}
				else if (culling.isOn && flag && !flag2 && culling.art.enabled)
				{
					culling.ChangeState(true, true);
				}
			}
			else if (culling.isOn)
			{
				culling.ChangeState(false, false);
				int num3 = this.activeQuads.IndexOf(culling);
				if (num3 > -1)
				{
					this.activeQuads.RemoveAt(num3);
				}
			}
		}
		if (turnAllOff)
		{
			for (int j = 0; j < this.quads.Count; j++)
			{
				this.quads[j].ChangeState(false, false);
			}
		}
		if (this.currentInteriorLight && (Links.x.main.tr.position - this.prevMainPosition).sqrMagnitude > 16f)
		{
			this.currentInteriorLight.SetUpCompanionNodes();
			this.prevMainPosition = Links.x.main.tr.position;
		}
	}

	// Token: 0x06000D14 RID: 3348 RVA: 0x000FC1E0 File Offset: 0x000FA3E0
	private void LateUpdate()
	{
		if (Links.x)
		{
			if (this.quads != null && this.party != null && Links.x.gaia.sceneLoaded)
			{
				this.CheckQuadState(false);
			}
			if (Time.timeSinceLevelLoad > this.queueUpdate + 2f)
			{
				this.queueUpdate = Time.timeSinceLevelLoad;
				int count = this.promptQueue.Count;
				for (int i = 0; i < count; i++)
				{
					if (i < this.promptQueue.Count)
					{
						PromptActions promptActions = this.promptQueue[i];
						if (promptActions && promptActions.state != 1)
						{
							promptActions.Action(true);
						}
					}
				}
				uint num = 0U;
				this.UpdateMapExits(num);
			}
			if (this.currentInteriorLight)
			{
				this.currentInteriorLight.ActiveLights();
			}
			Links.x.inventory.LookForTorch();
			bool flag = this.mainCharacterInGhostFog;
			if (Links.x.hasMain)
			{
				this.mainCharacterInGhostFog = this.InResurrectionFog(Links.x.main.tr.position);
				if (flag != this.mainCharacterInGhostFog)
				{
					if (this.fogFadeCorout != null)
					{
						base.StopCoroutine(this.fogFadeCorout);
						this.fogFadeCorout = null;
					}
					if (this.mainCharacterInGhostFog)
					{
						this.fogFadeCorout = this.FadeGhostFog(this.currentFogValue, 1f);
						base.StartCoroutine(this.fogFadeCorout);
					}
					else
					{
						this.fogFadeCorout = this.FadeGhostFog(this.currentFogValue, 0f);
						base.StartCoroutine(this.fogFadeCorout);
					}
				}
			}
			for (int j = 0; j < this.characters.Count; j++)
			{
				Character character = this.characters[j];
				if (character && !character.inactive)
				{
					character.UpdatePositions();
				}
			}
		}
	}

	// Token: 0x06000D15 RID: 3349 RVA: 0x000FC3B3 File Offset: 0x000FA5B3
	private IEnumerator FadeGhostFog(float fogStart, float fogTarget)
	{
		float timeToLerp = 1.5f;
		float percentage = 0f;
		float startTime = Time.time;
		yield return new WaitForSeconds(0.1f);
		while (Records.x.removeControls)
		{
			yield return null;
		}
		while (percentage < 1f)
		{
			percentage = (Time.time - startTime) / timeToLerp;
			this.currentFogValue = Mathf.Lerp(fogStart, fogTarget, percentage);
			Shader.SetGlobalFloat("_InGhostFog", this.currentFogValue);
			yield return null;
		}
		yield break;
	}

	// Token: 0x06000D16 RID: 3350 RVA: 0x000FC3D0 File Offset: 0x000FA5D0
	public void AddPromptToQueue(PromptActions queue)
	{
		if (this.promptQueue.IndexOf(queue) == -1)
		{
			this.promptQueue.Add(queue);
		}
	}

	// Token: 0x06000D17 RID: 3351 RVA: 0x000FC3F0 File Offset: 0x000FA5F0
	public void RemovePromptFromQueue(PromptActions queue)
	{
		int num = this.promptQueue.IndexOf(queue);
		if (num > -1)
		{
			this.promptQueue.RemoveAt(num);
		}
	}

	// Token: 0x06000D18 RID: 3352 RVA: 0x000FC41C File Offset: 0x000FA61C
	public void BombBomb(Vector3 pt, Character bomber)
	{
		GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(135);
		pooledGameObject.transform.position = pt + new Vector3(0f, 0.2f, 0f);
		pooledGameObject.SetActive(true);
		MasterAudio.PlaySound3DAtVector3AndForget("Elixir", pt, Random.Range(0.5f, 0.6f), new float?(1f), 0f, "", null);
		MasterAudio.PlaySound3DAtVector3AndForget("Interactives", pt, 0.5f, new float?(1f), 0f, "Chest Break", null);
		float num = 36f;
		if (bomber)
		{
			num = 81f;
		}
		for (int i = 0; i < this.characters.Count; i++)
		{
			Character character = this.characters[i];
			if (character && this.SubtractVectorsSameY(character.currentPosition, pt).sqrMagnitude < num && !character.stats.dead)
			{
				Effects effects = character.gameObject.AddComponent<Effects>();
				Links.x.cellar.AddEffects(effects);
				effects.gameObject.SetActive(true);
				effects.target = character;
				effects.effectName = "Impact";
				if (!bomber)
				{
					effects.source = character;
					effects.sourceLevel = Mathf.Clamp(5f - Vector3.Distance(character.currentPosition, pt), 1f, 5f);
				}
				else
				{
					effects.source = bomber;
					effects.sourceLevel = (float)bomber.stats.level * 5f;
				}
				effects.Inflicted(true);
				character.Bounce(bomber, "Hit", 0f);
			}
		}
		for (int j = 0; j < this.breakableActions.Count; j++)
		{
			BreakableActions breakableActions = this.breakableActions[j];
			if (breakableActions && !breakableActions.destroyed && this.SubtractVectorsSameY(breakableActions.pt, pt).sqrMagnitude < num)
			{
				breakableActions.currentHealth = 0;
				breakableActions.ClickToBreak(Links.x.main, false, false);
			}
		}
		for (int k = 0; k < this.chestActions.Count; k++)
		{
			ChestActions chestActions = this.chestActions[k];
			if (chestActions && !chestActions.destroyed && this.SubtractVectorsSameY(chestActions.transform.position, pt).sqrMagnitude < num)
			{
				chestActions.currentHealth = 0;
				chestActions.ClickToBreak(Links.x.main, false);
			}
		}
		for (int l = 0; l < this.doorActions.Count; l++)
		{
			DoorActions doorActions = this.doorActions[l];
			if (doorActions && !doorActions.destroyed && this.SubtractVectorsSameY(doorActions.lockColliderPosition, pt).sqrMagnitude < num)
			{
				doorActions.currentHealth = 0;
				doorActions.ClickToBreak(Links.x.main, false);
			}
		}
	}

	// Token: 0x06000D19 RID: 3353 RVA: 0x000FC750 File Offset: 0x000FA950
	public void SetupInteractives1()
	{
		string text = Records.x.openBook + "/Map_" + this.sceneDisplayName + ".es3";
		this.firstTimeOnScene = true;
		if (ES3.FileExists(text))
		{
			this.saveFile = new ES3File(text);
			this.breakableNames.Clear();
			this.breakableNames = this.saveFile.Load<List<string>>("BreakableNames");
			this.breakableStates.Clear();
			this.breakableStates = this.saveFile.Load<List<int>>("Breakables");
			this.chestNames.Clear();
			this.chestNames = this.saveFile.Load<List<string>>("ChestNames");
			this.chestStates.Clear();
			this.chestStates = this.saveFile.Load<List<int>>("ChestStates");
			this.doorNames.Clear();
			this.doorNames = this.saveFile.Load<List<string>>("DoorNames");
			this.doorLocked.Clear();
			this.doorLocked = this.saveFile.Load<List<bool>>("DoorLocked");
			this.doorHealth.Clear();
			this.doorHealth = this.saveFile.Load<List<int>>("DoorHealth");
			this.resourceStates.Clear();
			this.resourceStates = this.saveFile.Load<List<bool>>("ResourceStates");
			this.resourceTime.Clear();
			this.resourceTime = this.saveFile.Load<List<float>>("ResourceTime");
			this.promptStates.Clear();
			this.promptStates = this.saveFile.Load<List<int>>("Prompts");
			this.promptNames.Clear();
			this.promptNames = this.saveFile.Load<List<string>>("PromptNames");
			this.mapExitNames.Clear();
			this.mapExitNames = this.saveFile.Load<List<string>>("MapExitNames");
			this.mapExitStates.Clear();
			this.mapExitStates = this.saveFile.Load<List<int>>("MapExitStates");
			if (this.saveFile.KeyExists("TimeOnScene"))
			{
				this.lastTimeOnScene = this.saveFile.Load<float>("TimeOnScene");
			}
			if (this.saveFile.KeyExists("GameVersionForThisScene"))
			{
				if (Records.x.demo)
				{
					this.lastVersionForThisScene = this.saveFile.Load<float>("GameVersionForThisScene");
				}
				else
				{
					this.lastVersionForThisScene = this.saveFile.Load<float>("GameVersionForThisScene");
				}
			}
			else
			{
				this.lastVersionForThisScene = 1.27f;
			}
			this.firstTimeOnScene = false;
		}
		int count = this.mapExitNames.Count;
		for (int i = 0; i < this.mapExits.Count; i++)
		{
			if (this.mapExits[i])
			{
				this.mapExits[i].SetupNodeLink();
				string name = this.mapExits[i].gameObject.name;
				for (int j = 0; j < count; j++)
				{
					if (this.mapExitNames[j] == name)
					{
						if (this.mapExitStates[j] == 1)
						{
							this.mapExits[i].visited = true;
						}
						else
						{
							this.mapExits[i].visited = false;
						}
					}
				}
			}
		}
		int count2 = this.puzzles.Count;
		for (int k = 0; k < count2; k++)
		{
			PuzzleActions puzzleActions = this.puzzles[k].gameObject.AddComponent<PuzzleActions>();
			this.puzzleActions.Add(puzzleActions);
		}
		this.breakableActions.Clear();
		for (int l = 0; l < this.breakables.Count; l++)
		{
			BreakableActions breakableActions = this.breakables[l].gameObject.AddComponent<BreakableActions>();
			this.breakableActions.Add(breakableActions);
			breakableActions.breakable = this.breakables[l];
			breakableActions.resourceLocation = -1;
			if (this.firstTimeOnScene)
			{
				breakableActions.NewGameSetup();
			}
		}
		this.chestActions.Clear();
		for (int m = 0; m < this.chests.Count; m++)
		{
			ChestActions chestActions = this.chests[m].gameObject.AddComponent<ChestActions>();
			this.chestActions.Add(chestActions);
			chestActions.chest = this.chests[m];
		}
		this.doorActions.Clear();
		for (int n = 0; n < this.doors.Count; n++)
		{
			DoorActions doorActions = this.doors[n].gameObject.AddComponent<DoorActions>();
			this.doorActions.Add(doorActions);
			doorActions.door = this.doors[n];
			if (this.firstTimeOnScene)
			{
				this.doorActions[n].NewGameSetup();
			}
		}
		for (int num = 0; num < this.prompts.Length; num++)
		{
			PromptActions promptActions = this.prompts[num].gameObject.AddComponent<PromptActions>();
			this.promptActions.Add(promptActions);
			promptActions.prompt = this.prompts[num];
			promptActions.Setup();
		}
	}

	// Token: 0x06000D1A RID: 3354 RVA: 0x000FCC74 File Offset: 0x000FAE74
	public void SetupInteractives2()
	{
		int num = this.breakableNames.Count;
		int num2 = this.breakableActions.Count;
		for (int i = 0; i < num; i++)
		{
			bool flag = false;
			string text = this.breakableNames[i];
			for (int j = 0; j < num2; j++)
			{
				if (!flag && text == this.breakableActions[j].saveName)
				{
					flag = true;
					if (this.breakableStates[i] <= 0)
					{
						this.breakableActions[j].ClickToBreak(null, true, false);
					}
					else
					{
						this.breakableActions[j].LoadGameSetup(this.breakableStates[i]);
					}
				}
			}
		}
		num = this.chestNames.Count;
		num2 = this.chestActions.Count;
		for (int k = 0; k < num; k++)
		{
			bool flag2 = false;
			string text2 = this.chestNames[k];
			for (int l = 0; l < num2; l++)
			{
				if (!flag2 && text2 == this.chestActions[l].saveName)
				{
					flag2 = true;
					this.chestActions[l].LoadGameSetup(this.chestStates[k]);
				}
			}
		}
		num = this.doorNames.Count;
		num2 = this.doorActions.Count;
		for (int m = 0; m < num; m++)
		{
			bool flag3 = false;
			string text3 = this.doorNames[m];
			for (int n = 0; n < num2; n++)
			{
				if (!flag3 && text3 == this.doorActions[n].saveName)
				{
					flag3 = true;
					this.doorActions[n].LoadGameSetup(this.doorHealth[m], this.doorLocked[m]);
				}
			}
		}
		num = this.promptNames.Count;
		num2 = this.promptActions.Count;
		for (int num3 = 0; num3 < num; num3++)
		{
			bool flag4 = false;
			string text4 = this.promptNames[num3];
			for (int num4 = 0; num4 < num2; num4++)
			{
				if (!flag4 && text4 == this.promptActions[num4].saveName)
				{
					flag4 = true;
					this.promptActions[num4].state = this.promptStates[num3];
				}
			}
		}
		for (int num5 = 0; num5 < this.promptActions.Count; num5++)
		{
			this.promptActions[num5].FinishSetup();
		}
		int num6 = 0;
		bool flag5 = false;
		if (this.resourceLocations.Count > 0)
		{
			if (this.resourceStates.Count != this.resourceLocations.Count || this.firstTimeOnScene || flag5)
			{
				int num7 = Mathf.RoundToInt((float)this.resourceLocations.Count / 6f);
				num6 = Random.Range(Mathf.RoundToInt((float)this.resourceLocations.Count / 8f), num7);
				if (flag5)
				{
					num6 = this.resourceLocations.Count;
				}
				for (int num8 = 0; num8 < this.resourceLocations.Count; num8++)
				{
					this.resourceStates.Add(false);
					this.resourceTime.Add(0f);
					this.resourcePrefabs.Add(null);
				}
			}
			else
			{
				this.resourcePrefabs.Clear();
				for (int num9 = 0; num9 < this.resourceLocations.Count; num9++)
				{
					if (this.resourceStates[num9])
					{
						this.resourcePrefabs.Add(null);
						this.SetupResource(this.resourceTypes[num9], num9);
					}
					else if (this.resourceTime[num9] > 0f)
					{
						if (this.resourceTime[num9] > (float)(Links.x.gameplay.GetCurrentGameTime() + 1))
						{
							num6++;
							this.resourceTime[num9] = 0f;
						}
						this.resourcePrefabs.Add(null);
					}
					else
					{
						this.resourcePrefabs.Add(null);
					}
				}
			}
			List<int> list = new List<int>();
			for (int num10 = 0; num10 < num6; num10++)
			{
				bool flag6 = false;
				for (int num11 = 0; num11 < 200; num11++)
				{
					if (!flag6)
					{
						int num12 = Random.Range(0, this.resourceStates.Count);
						if (!this.resourceStates[num12] && !list.Contains(num12))
						{
							list.Add(num12);
							flag6 = true;
						}
					}
				}
			}
			if (flag5)
			{
				list.Clear();
				for (int num13 = 0; num13 < num6; num13++)
				{
					list.Add(num13);
				}
			}
			for (int num14 = 0; num14 < list.Count; num14++)
			{
				if (list[num14] < this.resourceTypes.Count && list[num14] > -1)
				{
					Breakable.ComponentTypes componentTypes = this.resourceTypes[list[num14]];
					this.resourceStates[list[num14]] = true;
					this.resourceTime[list[num14]] = 0f;
					int num15 = list[num14];
					this.SetupResource(componentTypes, num15);
				}
			}
		}
		for (int num16 = 0; num16 < this.puzzleActions.Count; num16++)
		{
			this.puzzleActions[num16].LoadPuzzleInfo();
		}
	}

	// Token: 0x06000D1B RID: 3355 RVA: 0x000FD1F4 File Offset: 0x000FB3F4
	private void SetupResource(Breakable.ComponentTypes component, int index)
	{
		if (component == Breakable.ComponentTypes.Acorn)
		{
			GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(59);
			pooledGameObject.SetActive(true);
			pooledGameObject.transform.position = this.resourceLocations[index];
			pooledGameObject.transform.rotation = this.resourceRotations[index];
			pooledGameObject.gameObject.GetComponent<BreakableActions>().resourceLocation = index;
			this.resourcePrefabs[index] = pooledGameObject;
		}
		if (component == Breakable.ComponentTypes.Berry)
		{
			GameObject pooledGameObject2 = Links.x.cellar.GetPooledGameObject(93);
			pooledGameObject2.SetActive(true);
			pooledGameObject2.transform.position = this.resourceLocations[index];
			pooledGameObject2.transform.rotation = this.resourceRotations[index];
			pooledGameObject2.gameObject.GetComponent<BreakableActions>().resourceLocation = index;
			this.resourcePrefabs[index] = pooledGameObject2;
		}
		if (component == Breakable.ComponentTypes.Shell)
		{
			RaycastHit raycastHit;
			if (Physics.Raycast(this.resourceLocations[index] + new Vector3(0f, 10f, 0f), Vector3.up * -1f, out raycastHit, 100f, Links.x.floor))
			{
				this.resourceLocations[index] = raycastHit.point;
			}
			GameObject gameObject = Object.Instantiate<GameObject>(Links.x.critters.crab, this.resourceLocations[index], this.resourceRotations[index], Links.x.diorama.transform);
			CritterActions critterActions = gameObject.transform.GetChild(0).gameObject.AddComponent<CritterActions>();
			gameObject.transform.GetChild(0).gameObject.SetActive(true);
			gameObject.transform.GetChild(1).gameObject.SetActive(false);
			critterActions.resourceLocation = index;
			critterActions.resourcePoint = this.resourceLocations[index];
			critterActions.dead = false;
			critterActions.isResource = true;
			critterActions.MakeRandomPath(null);
			Links.x.critters.AddActiveCritter(critterActions);
			this.resourcePrefabs[index] = gameObject;
		}
		if (component == Breakable.ComponentTypes.Mushroom)
		{
			GameObject pooledGameObject3 = Links.x.cellar.GetPooledGameObject(54);
			pooledGameObject3.SetActive(true);
			pooledGameObject3.transform.position = this.resourceLocations[index];
			pooledGameObject3.transform.rotation = this.resourceRotations[index];
			pooledGameObject3.gameObject.GetComponent<BreakableActions>().resourceLocation = index;
			this.resourcePrefabs[index] = pooledGameObject3;
		}
		if (component == Breakable.ComponentTypes.Rock)
		{
			GameObject pooledGameObject4 = Links.x.cellar.GetPooledGameObject(52);
			pooledGameObject4.SetActive(true);
			pooledGameObject4.transform.position = this.resourceLocations[index];
			pooledGameObject4.transform.rotation = this.resourceRotations[index];
			pooledGameObject4.gameObject.GetComponent<BreakableActions>().resourceLocation = index;
			this.resourcePrefabs[index] = pooledGameObject4;
		}
		if (component == Breakable.ComponentTypes.Frog)
		{
			GameObject pooledGameObject5 = Links.x.cellar.GetPooledGameObject(50);
			pooledGameObject5.SetActive(true);
			pooledGameObject5.transform.position = this.resourceLocations[index];
			pooledGameObject5.transform.rotation = this.resourceRotations[index];
			pooledGameObject5.gameObject.GetComponent<BreakableActions>().resourceLocation = index;
			this.resourcePrefabs[index] = pooledGameObject5;
		}
		if (component == Breakable.ComponentTypes.Stick)
		{
			GameObject pooledGameObject6 = Links.x.cellar.GetPooledGameObject(51);
			pooledGameObject6.SetActive(true);
			pooledGameObject6.transform.position = this.resourceLocations[index];
			pooledGameObject6.transform.rotation = this.resourceRotations[index];
			pooledGameObject6.gameObject.GetComponent<BreakableActions>().resourceLocation = index;
			this.resourcePrefabs[index] = pooledGameObject6;
		}
		if (component == Breakable.ComponentTypes.HollowStick)
		{
			GameObject pooledGameObject7 = Links.x.cellar.GetPooledGameObject(53);
			pooledGameObject7.SetActive(true);
			pooledGameObject7.transform.position = this.resourceLocations[index] + new Vector3(0f, 1.4f, 0f);
			pooledGameObject7.transform.rotation = Quaternion.identity;
			pooledGameObject7.gameObject.GetComponent<BreakableActions>().resourceLocation = index;
			this.resourcePrefabs[index] = pooledGameObject7;
		}
		if (this.resourcePrefabs[index] && component != Breakable.ComponentTypes.Shell)
		{
			this.resourcePrefabs[index].transform.parent = null;
			this.resourcePrefabs[index].transform.parent = Links.x.cellar.tr;
		}
	}

	// Token: 0x06000D1C RID: 3356 RVA: 0x000FD6A4 File Offset: 0x000FB8A4
	public void ReturnResource(int index, GameObject go)
	{
		if (index < this.resourceTime.Count && index > -1)
		{
			this.resourceTime[index] = (float)Links.x.gameplay.GetCurrentGameTime();
			this.resourceStates[index] = false;
			Breakable.ComponentTypes componentTypes = this.resourceTypes[index];
			if (componentTypes == Breakable.ComponentTypes.Acorn)
			{
				Links.x.cellar.ReturnPooledGameObject(59, go);
			}
			if (componentTypes == Breakable.ComponentTypes.Mushroom)
			{
				Links.x.cellar.ReturnPooledGameObject(54, go);
			}
			if (componentTypes == Breakable.ComponentTypes.Stick)
			{
				Links.x.cellar.ReturnPooledGameObject(51, go);
			}
			if (componentTypes == Breakable.ComponentTypes.HollowStick)
			{
				Links.x.cellar.ReturnPooledGameObject(53, go);
			}
		}
	}

	// Token: 0x06000D1D RID: 3357 RVA: 0x000FD764 File Offset: 0x000FB964
	public void RemoveResourcePrefabs()
	{
		for (int i = 0; i < this.resourcePrefabs.Count; i++)
		{
			GameObject gameObject = this.resourcePrefabs[i];
			if (gameObject)
			{
				Breakable.ComponentTypes componentTypes = this.resourceTypes[i];
				if (componentTypes == Breakable.ComponentTypes.Rock)
				{
					Links.x.cellar.ReturnPooledGameObject(52, gameObject);
				}
				if (componentTypes == Breakable.ComponentTypes.Frog)
				{
					Links.x.cellar.ReturnPooledGameObject(50, gameObject);
				}
				if (componentTypes == Breakable.ComponentTypes.Stick)
				{
					Links.x.cellar.ReturnPooledGameObject(51, gameObject);
				}
				if (componentTypes == Breakable.ComponentTypes.HollowStick)
				{
					Links.x.cellar.ReturnPooledGameObject(53, gameObject);
				}
				if (componentTypes == Breakable.ComponentTypes.Acorn)
				{
					Links.x.cellar.ReturnPooledGameObject(59, gameObject);
				}
				if (componentTypes == Breakable.ComponentTypes.Mushroom)
				{
					Links.x.cellar.ReturnPooledGameObject(54, gameObject);
				}
				if (componentTypes == Breakable.ComponentTypes.Berry)
				{
					Links.x.cellar.ReturnPooledGameObject(93, gameObject);
				}
			}
		}
	}

	// Token: 0x06000D1E RID: 3358 RVA: 0x000FD84C File Offset: 0x000FBA4C
	public void ReturnItemsPrefabs()
	{
		foreach (global::Item item in this.groundItems)
		{
			if (item)
			{
				item.DestroyItem(false, true);
			}
		}
	}

	// Token: 0x06000D1F RID: 3359 RVA: 0x000FD8A8 File Offset: 0x000FBAA8
	public void GetBreakableTiles()
	{
		for (int i = 0; i < this.breakableActions.Count; i++)
		{
			this.breakableActions[i].GetNode();
		}
	}

	// Token: 0x06000D20 RID: 3360 RVA: 0x000FD8DC File Offset: 0x000FBADC
	public void SetupItems()
	{
		this.sceneItems = this.items.gameObject.GetComponentsInChildren<SceneItem>();
		int num = this.sceneItems.Length;
		string text = Records.x.openBook + "/Map_" + this.sceneDisplayName + ".es3";
		if (ES3.FileExists(text))
		{
			this.saveFile = new ES3File(text);
			this.itemIDs.Clear();
			this.itemSaveIDs = this.saveFile.Load<List<string>>("ItemIDs");
			this.itemAmts = this.saveFile.Load<List<int>>("ItemAmts");
			this.itemSocketsA = this.saveFile.Load<List<Vector3>>("ItemSocketsA");
			this.itemSocketsB = this.saveFile.Load<List<Vector3>>("ItemSocketsB");
			this.itemsForSaleStates = this.saveFile.Load<List<bool>>("ItemForSaleStates");
			this.itemPositions = this.saveFile.Load<List<Vector3>>("ItemPositions");
			this.itemRotations = this.saveFile.Load<List<Quaternion>>("ItemRotations");
			this.itemLinks = this.saveFile.Load<List<string>>("ItemLinks");
			this.itemLinkIDs = this.saveFile.Load<List<int>>("ItemLinkIDs");
			this.itemPrompts = this.saveFile.Load<List<string>>("ItemPrompts");
			this.itemTimes = this.saveFile.Load<List<Vector4>>("ItemTimes");
			this.itemOriginals = this.saveFile.Load<List<string>>("ItemOriginals");
			this.itemsNoRespawn = this.saveFile.Load<List<string>>("ItemsNoRespawn");
			int count = this.itemSaveIDs.Count;
			for (int i = 0; i < count; i++)
			{
				int invRowID = Links.x.library.GetInvRowID(this.itemSaveIDs[i]);
				this.itemIDs.Add(invRowID);
				global::Item item = Links.x.inventory.groundBag.DropLoot(invRowID, this.itemAmts[i], this.itemSocketsA[i], this.itemSocketsB[i], this.itemTimes[i], null, this.itemPositions[i], false, this.itemsForSaleStates[i], -1);
				if (item)
				{
					item.sceneItemName = this.itemOriginals[i];
					item.transform.rotation = this.itemRotations[i];
					item.forSale = this.itemsForSaleStates[i];
					item.durability = this.itemTimes[i];
					if (item.forSale && item.invRow._NeedFullStack)
					{
						this.itemAmts[i] = item.invRow._MaxStackSize;
						item.stackSize = item.invRow._MaxStackSize;
					}
					if (this.itemLinks[i] != "")
					{
						foreach (Creatures creatures in this.creatureControllers)
						{
							if (creatures.gameObject.name == this.itemLinks[i])
							{
								item.linkedCreatures = creatures;
								item.linkedCreatureID = this.itemLinkIDs[i];
								break;
							}
						}
					}
					if (this.itemPrompts[i] != "")
					{
						Prompts[] array2 = this.prompts;
						int j = 0;
						while (j < array2.Length)
						{
							Prompts prompts = array2[j];
							if (prompts.gameObject.name == this.itemPrompts[i])
							{
								item.linkedPrompt = prompts;
								if (item.linkedPrompt)
								{
									item.SetupLinkedItem();
									break;
								}
								break;
							}
							else
							{
								j++;
							}
						}
					}
					this.AddItem(item);
					if (this.itemLinks[i] == "")
					{
						for (int k = 0; k < num; k++)
						{
							if (this.sceneItems[k].gameObject.name == item.sceneItemName)
							{
								this.sceneItems[k].linkedCharacter = null;
							}
						}
					}
					item.GetLinkedCharacter();
				}
			}
			foreach (SceneItem sceneItem in this.sceneItems)
			{
				if (sceneItem.deactivateFromQuest != Creatures.Adventures.None)
				{
					global::Item item2 = this.HasSpawnedItem(sceneItem);
					if (item2)
					{
						item2.deactivateFromQuest = sceneItem.deactivateFromQuest;
						item2.stateOfQuest_ = sceneItem.stateOfQuest_;
					}
				}
				else if (sceneItem.versionNumber > this.lastVersionForThisScene && sceneItem.versionNumber > 0f)
				{
					bool flag = true;
					if (sceneItem.activateFromQuest != Creatures.Adventures.None)
					{
						flag = QuestLog.GetQuestState(sceneItem.activateFromQuest.ToString()) == Records.x.StringToQuestState(sceneItem.stateOfQuest.ToString()) && sceneItem.stateOfQuest != Creatures.AdventureStates.NotApplicable;
					}
					if (flag)
					{
						this.SpawnSceneItem(sceneItem);
					}
				}
				if (this.itemsNoRespawn.Contains(sceneItem.gameObject.name))
				{
					sceneItem.linkedCharacter = null;
				}
			}
			this.CheckItemsThatMightActivate();
		}
		else
		{
			foreach (SceneItem sceneItem2 in this.sceneItems)
			{
				bool flag2 = true;
				if (sceneItem2.activateFromQuest != Creatures.Adventures.None)
				{
					flag2 = QuestLog.GetQuestState(sceneItem2.activateFromQuest.ToString()) == Records.x.StringToQuestState(sceneItem2.stateOfQuest.ToString()) && sceneItem2.stateOfQuest != Creatures.AdventureStates.NotApplicable;
				}
				if (flag2)
				{
					this.SpawnSceneItem(sceneItem2);
				}
			}
		}
		this.itemSaveIDs.Clear();
	}

	// Token: 0x06000D21 RID: 3361 RVA: 0x000FDEA4 File Offset: 0x000FC0A4
	private global::Item SpawnSceneItem(SceneItem t)
	{
		string text = t.item.ToString();
		Library.Inventory invRowFromName = Links.x.library.GetInvRowFromName(text);
		if (Records.x.editor && invRowFromName == null)
		{
			Debug.Log("row null: " + text);
		}
		int id = invRowFromName._ID;
		if (t.durability.x == 0f)
		{
			t.durability.x = (float)invRowFromName._DurabilityMax;
		}
		global::Item item = Links.x.inventory.groundBag.DropLoot(id, t.amount, t.socketA, t.socketB, t.durability, null, t.gameObject.transform.position, false, t.forSale, -1);
		Vector3 eulerAngles = t.gameObject.transform.rotation.eulerAngles;
		eulerAngles.y += 300f;
		if (item)
		{
			item.transform.rotation = Quaternion.Euler(eulerAngles);
			item.forSale = t.forSale;
			item.linkedCreatures = t.linkedCharacter;
			item.linkedCreatureID = 0;
			item.linkedPrompt = t.linkedPrompt;
			item.sceneItemName = t.gameObject.name;
			if (item.linkedPrompt)
			{
				item.SetupLinkedItem();
			}
			item.deactivateFromQuest = t.deactivateFromQuest;
			item.stateOfQuest_ = t.stateOfQuest_;
			this.AddItem(item);
			item.GetLinkedCharacter();
		}
		return item;
	}

	// Token: 0x06000D22 RID: 3362 RVA: 0x000FE024 File Offset: 0x000FC224
	public void UpdateMapExits(uint area)
	{
		for (int i = 0; i < this.mapExits.Count; i++)
		{
			if (this.mapExits[i])
			{
				this.mapExits[i].PartyInRoom(area);
			}
		}
	}

	// Token: 0x06000D23 RID: 3363 RVA: 0x000FE06C File Offset: 0x000FC26C
	public void FindCreatures()
	{
		this.creatureControllers = this.creatures.gameObject.GetComponentsInChildren<Creatures>();
		foreach (Creatures creatures in this.creatureControllers)
		{
			CreatureActions creatureActions = creatures.gameObject.GetComponent<CreatureActions>();
			if (!creatureActions)
			{
				creatureActions = creatures.gameObject.AddComponent<CreatureActions>();
				creatureActions.creatures = creatures;
				this.creatureActions.Add(creatureActions);
				creatureActions.LoadCreatures();
			}
		}
	}

	// Token: 0x06000D24 RID: 3364 RVA: 0x000FE0E4 File Offset: 0x000FC2E4
	public void CombatEndPrompts()
	{
		foreach (PromptActions promptActions in this.promptActions)
		{
			if (promptActions)
			{
				promptActions.CheckCombatEnd();
			}
		}
	}

	// Token: 0x06000D25 RID: 3365 RVA: 0x000FE140 File Offset: 0x000FC340
	public void CheckQuestActivations()
	{
		this.CheckCreaturesThatMightActivate();
		this.CheckPromptsThatMightActivate();
		this.CheckItemsThatMightActivate();
	}

	// Token: 0x06000D26 RID: 3366 RVA: 0x000FE154 File Offset: 0x000FC354
	public void CheckItemsThatMightActivate()
	{
		foreach (SceneItem sceneItem in this.sceneItems)
		{
			bool flag = false;
			if (sceneItem.activateFromQuest != Creatures.Adventures.None && !this.HasSpawnedItem(sceneItem) && QuestLog.GetQuestState(sceneItem.activateFromQuest.ToString()) == Records.x.StringToQuestState(sceneItem.stateOfQuest.ToString()) && sceneItem.stateOfQuest != Creatures.AdventureStates.NotApplicable)
			{
				flag = true;
			}
			if (flag)
			{
				this.SpawnSceneItem(sceneItem);
			}
		}
		foreach (global::Item item in this.groundItems)
		{
			if (item && item.active && item.deactivateFromQuest != Creatures.Adventures.None && QuestLog.GetQuestState(item.deactivateFromQuest.ToString()) == Records.x.StringToQuestState(item.stateOfQuest_.ToString()))
			{
				item.DestroyItem(false, false);
			}
		}
		foreach (global::Item item2 in this.groundItems)
		{
			if (item2 && item2.linkedCreatures)
			{
				item2.GetLinkedCharacter();
				Character linkedCharacter = item2.linkedCharacter;
				if (linkedCharacter && !linkedCharacter.stunned && !linkedCharacter.dead)
				{
					if (((linkedCharacter.creatures.isDay && linkedCharacter.creatures.daySleep) || (!linkedCharacter.creatures.isDay && linkedCharacter.creatures.nightSleep)) && !linkedCharacter.dead && item2.clickable && item2.forSale)
					{
						item2.SetDayNight(false);
					}
					if (!item2.clickable && ((linkedCharacter.creatures.isDay && !linkedCharacter.creatures.daySleep) || (!linkedCharacter.creatures.isDay && !linkedCharacter.creatures.nightSleep)) && item2.forSale)
					{
						item2.SetDayNight(true);
					}
				}
			}
		}
	}

	// Token: 0x06000D27 RID: 3367 RVA: 0x000FE3C8 File Offset: 0x000FC5C8
	public void CheckLinkedCharacters(Character deadCharacter)
	{
		foreach (global::Item item in this.groundItems)
		{
			if (item && item.linkedCreatures)
			{
				item.GetLinkedCharacter();
			}
		}
	}

	// Token: 0x06000D28 RID: 3368 RVA: 0x000FE430 File Offset: 0x000FC630
	public void CheckCreaturesThatMightActivate()
	{
		foreach (CreatureActions creatureActions in this.creatureActions)
		{
			if (creatureActions.waitingForPrompt && !this.HasPrompt(creatureActions.gameObject) && creatureActions.CanActivate())
			{
				creatureActions.SetupCreatures();
				creatureActions.enabled = true;
			}
		}
	}

	// Token: 0x06000D29 RID: 3369 RVA: 0x000FE4A8 File Offset: 0x000FC6A8
	private void CheckPromptsThatMightActivate()
	{
		foreach (PromptActions promptActions in this.promptActions)
		{
			if (promptActions.prompt.type == Prompts.types.toggleGameObjectFromQuest)
			{
				promptActions.CheckStatus();
			}
		}
	}

	// Token: 0x06000D2A RID: 3370 RVA: 0x000FE50C File Offset: 0x000FC70C
	private global::Item HasSpawnedItem(SceneItem sceneItem)
	{
		string text = sceneItem.item.ToString();
		int id = Links.x.library.GetInvRowFromName(text)._ID;
		for (int i = 0; i < this.groundItems.Count; i++)
		{
			if (this.groundItems[i].ID == id && this.groundItems[i].active && this.groundItems[i].sceneItemName == sceneItem.gameObject.name)
			{
				return this.groundItems[i];
			}
		}
		return null;
	}

	// Token: 0x06000D2B RID: 3371 RVA: 0x000FE5B0 File Offset: 0x000FC7B0
	public void SetupCreatures()
	{
		bool flag = false;
		if (this.sceneName == "F4_BanquetIsle")
		{
			flag = true;
		}
		foreach (CreatureActions creatureActions in this.creatureActions)
		{
			if (!this.HasPrompt(creatureActions.gameObject) && creatureActions.CanActivate())
			{
				creatureActions.SetupCreatures();
				if (flag)
				{
					creatureActions.CheckForTextureSwap();
				}
			}
			else
			{
				creatureActions.waitingForPrompt = true;
			}
		}
	}

	// Token: 0x06000D2C RID: 3372 RVA: 0x000FE640 File Offset: 0x000FC840
	public bool HasPrompt(GameObject x)
	{
		for (int i = 0; i < this.prompts.Length; i++)
		{
			if (this.prompts[i].ambushCharacters && (this.prompts[i].ambushCharacters == x || this.prompts[i].ambushCharacters == x.transform.parent.gameObject) && this.prompts[i].GetComponent<PromptActions>().state != 1)
			{
				return true;
			}
		}
		return false;
	}

	// Token: 0x06000D2D RID: 3373 RVA: 0x000FE6C8 File Offset: 0x000FC8C8
	public CreatureActions SetCreatureState(string xmlName, string newState, int num)
	{
		foreach (CreatureActions creatureActions in this.creatureActions)
		{
			if (creatureActions.xmlName == xmlName)
			{
				creatureActions.SetStateByIndex(num, newState);
				return creatureActions;
			}
		}
		return null;
	}

	// Token: 0x06000D2E RID: 3374 RVA: 0x000FE734 File Offset: 0x000FC934
	public CreatureActions MatchCreatureActions(string s)
	{
		for (int i = 0; i < this.creatureActions.Count; i++)
		{
			if (this.creatureActions[i].gameObject.name == s)
			{
				return this.creatureActions[i];
			}
		}
		return null;
	}

	// Token: 0x06000D2F RID: 3375 RVA: 0x000FE784 File Offset: 0x000FC984
	public void SetupTemporaryCreatures(string creaturesName, int temperament, string xmlName, int xmlNameIndex, string originalMap, string previousMap, Vector3 position, string state, int life, string savedEffects, int tempIndex, float delay)
	{
		GameObject gameObject = new GameObject(creaturesName);
		gameObject.transform.parent = this.creatures;
		Creatures creatures = gameObject.AddComponent<Creatures>();
		CreatureActions creatureActions = gameObject.AddComponent<CreatureActions>();
		creatureActions.creatures = creatures;
		GameObject gameObject2 = new GameObject("DayNight");
		gameObject2.transform.parent = gameObject.transform;
		gameObject2.transform.position = position;
		GameObject gameObject3 = new GameObject("Walk Point");
		gameObject3.transform.parent = gameObject2.transform;
		gameObject3.transform.position = position;
		creatures.number = 1;
		creatureActions.temporary = true;
		creatureActions.SetTemperament(temperament);
		creatureActions.SetState(tempIndex, state);
		creatureActions.temporaryState = state;
		creatureActions.creatures.characterName = (Creatures.xmlNames)xmlNameIndex;
		creatureActions.originalScene = originalMap;
		if (delay > 0f)
		{
			creatureActions.UpdateDelays(delay, 0, previousMap);
			creatureActions.temporaryStartNode = Links.x.gaia.playerStartingNode;
			creatureActions.hunting = true;
		}
		creatureActions.SetupCreatures();
		creatureActions.temporaryIndex = tempIndex;
		if (originalMap == "")
		{
			creatureActions.onlyTemporary = true;
			creatureActions.temporary = false;
		}
		this.creatureActions.Add(creatureActions);
	}

	// Token: 0x06000D30 RID: 3376 RVA: 0x000FE8B0 File Offset: 0x000FCAB0
	public void UpdateTemporaryCreatureStartNodes()
	{
		for (int i = 0; i < this.creatureActions.Count; i++)
		{
			if (this.creatureActions[i].hunting)
			{
				this.creatureActions[i].temporaryStartNode = Links.x.gaia.playerStartingNode;
				this.creatureActions[i].UpdatePosition((Vector3)Links.x.gaia.playerStartingNode.position);
			}
		}
	}

	// Token: 0x06000D31 RID: 3377 RVA: 0x000FE930 File Offset: 0x000FCB30
	public void CheckDelayedCharacters(string map)
	{
		for (int i = 0; i < this.creatureActions.Count; i++)
		{
			if (this.creatureActions[i].waitingForDelay)
			{
				this.creatureActions[i].UpdateTemporaryListsFromMapChange(map);
			}
		}
	}

	// Token: 0x06000D32 RID: 3378 RVA: 0x000FE978 File Offset: 0x000FCB78
	public void AddCreature(CreatureActions c)
	{
		this.creatureActions.Add(c);
	}

	// Token: 0x06000D33 RID: 3379 RVA: 0x000FE988 File Offset: 0x000FCB88
	public void SaveCreatures()
	{
		foreach (CreatureActions creatureActions in this.creatureActions)
		{
			creatureActions.SaveCreatures();
		}
		Links.x.cellar.SaveEnemySummons();
	}

	// Token: 0x06000D34 RID: 3380 RVA: 0x000FE9E8 File Offset: 0x000FCBE8
	public void PrepareItemsToSave()
	{
		this.savingItems = true;
	}

	// Token: 0x06000D35 RID: 3381 RVA: 0x000FE9F4 File Offset: 0x000FCBF4
	public void SaveGroundItems()
	{
		string text = Records.x.openBook + "/Map_" + this.sceneDisplayName + ".es3";
		this.saveFile = new ES3File(text);
		if (Records.x.demo)
		{
			this.saveFile.Save<float>("GameVersionForThisScene", Records.x.gameVersionDemo);
		}
		else
		{
			this.saveFile.Save<float>("GameVersionForThisScene", Records.x.gameVersion);
		}
		this.saveFile.Save<float>("TimeOnScene", (float)Links.x.gameplay.gameDays);
		this.itemIDs.Clear();
		this.itemAmts.Clear();
		this.itemSocketsA.Clear();
		this.itemSocketsB.Clear();
		this.itemsForSaleStates.Clear();
		this.itemPositions.Clear();
		this.itemRotations.Clear();
		this.itemLinks.Clear();
		this.itemPrompts.Clear();
		this.itemTimes.Clear();
		this.itemSaveIDs.Clear();
		this.itemOriginals.Clear();
		int count = this.groundItems.Count;
		for (int i = 0; i < count; i++)
		{
			global::Item item = this.groundItems[i];
			if (item)
			{
				bool flag = false;
				if (item.onGround && item.linkedPrompt && item.linkedPrompt.gameObject.GetComponent<PromptActions>().state == 0)
				{
					flag = true;
				}
				if (item.active || (!item.active && item.instantiating) || flag)
				{
					this.itemIDs.Add(item.ID);
					this.itemSaveIDs.Add(item.invRow._Name);
					this.itemAmts.Add(item.stackSize);
					this.itemSocketsA.Add(item.socketA);
					this.itemSocketsB.Add(item.socketB);
					this.itemsForSaleStates.Add(item.forSale);
					this.itemPositions.Add(item.gameObject.transform.position);
					this.itemRotations.Add(item.gameObject.transform.rotation);
					this.itemTimes.Add(item.durability);
					if (item.linkedCreatures)
					{
						this.itemLinks.Add(item.linkedCreatures.gameObject.name);
						this.itemLinkIDs.Add(item.linkedCreatureID);
					}
					else
					{
						this.itemLinks.Add("");
						this.itemLinkIDs.Add(0);
					}
					if (item.linkedPrompt)
					{
						this.itemPrompts.Add(item.linkedPrompt.gameObject.name);
					}
					else
					{
						this.itemPrompts.Add("");
					}
					this.itemOriginals.Add(item.sceneItemName);
				}
			}
		}
		this.saveFile.Save<List<string>>("ItemIDs", this.itemSaveIDs);
		this.saveFile.Save<List<int>>("ItemAmts", this.itemAmts);
		this.saveFile.Save<List<Vector3>>("ItemSocketsA", this.itemSocketsA);
		this.saveFile.Save<List<Vector3>>("ItemSocketsB", this.itemSocketsB);
		this.saveFile.Save<List<bool>>("ItemForSaleStates", this.itemsForSaleStates);
		this.saveFile.Save<List<Vector3>>("ItemPositions", this.itemPositions);
		this.saveFile.Save<List<Quaternion>>("ItemRotations", this.itemRotations);
		this.saveFile.Save<List<string>>("ItemLinks", this.itemLinks);
		this.saveFile.Save<List<int>>("ItemLinkIDs", this.itemLinkIDs);
		this.saveFile.Save<List<Vector4>>("ItemTimes", this.itemTimes);
		this.saveFile.Save<List<string>>("ItemPrompts", this.itemPrompts);
		this.saveFile.Save<List<string>>("ItemOriginals", this.itemOriginals);
		this.saveFile.Save<List<string>>("ItemsNoRespawn", this.itemsNoRespawn);
		this.savingItems = false;
	}

	// Token: 0x06000D36 RID: 3382 RVA: 0x000FEE1C File Offset: 0x000FD01C
	public void SaveInteractives()
	{
		this.breakableNames.Clear();
		this.breakableStates.Clear();
		int num = this.breakableActions.Count;
		for (int i = 0; i < num; i++)
		{
			BreakableActions breakableActions = this.breakableActions[i];
			if (breakableActions)
			{
				if (breakableActions.breakable.armor == 0)
				{
					if (breakableActions.destroyed)
					{
						this.breakableStates.Add(0);
					}
					else
					{
						this.breakableStates.Add(1);
					}
				}
				else
				{
					this.breakableStates.Add(breakableActions.currentHealth);
				}
				this.breakableNames.Add(breakableActions.gameObject.name);
			}
		}
		this.saveFile.Save<List<int>>("Breakables", this.breakableStates);
		this.saveFile.Save<List<string>>("BreakableNames", this.breakableNames);
		this.chestNames.Clear();
		this.chestStates.Clear();
		num = this.chestActions.Count;
		for (int j = 0; j < num; j++)
		{
			ChestActions chestActions = this.chestActions[j];
			if (chestActions)
			{
				this.chestStates.Add(chestActions.currentHealth);
				this.chestNames.Add(chestActions.gameObject.name);
			}
		}
		this.saveFile.Save<List<int>>("ChestStates", this.chestStates);
		this.saveFile.Save<List<string>>("ChestNames", this.chestNames);
		this.doorNames.Clear();
		this.doorHealth.Clear();
		this.doorLocked.Clear();
		num = this.doorActions.Count;
		for (int k = 0; k < num; k++)
		{
			DoorActions doorActions = this.doorActions[k];
			if (doorActions)
			{
				this.doorHealth.Add(doorActions.currentHealth);
				this.doorLocked.Add(doorActions.door.locked);
				this.doorNames.Add(doorActions.gameObject.name);
			}
		}
		this.saveFile.Save<List<int>>("DoorHealth", this.doorHealth);
		this.saveFile.Save<List<bool>>("DoorLocked", this.doorLocked);
		this.saveFile.Save<List<string>>("DoorNames", this.doorNames);
		this.promptNames.Clear();
		this.promptStates.Clear();
		num = this.promptActions.Count;
		for (int l = 0; l < num; l++)
		{
			PromptActions promptActions = this.promptActions[l];
			if (promptActions)
			{
				this.promptStates.Add(promptActions.state);
				this.promptNames.Add(promptActions.gameObject.name);
			}
		}
		this.saveFile.Save<List<int>>("Prompts", this.promptStates);
		this.saveFile.Save<List<string>>("PromptNames", this.promptNames);
		num = this.mapExits.Count;
		this.mapExitNames.Clear();
		this.mapExitStates.Clear();
		for (int m = 0; m < num; m++)
		{
			this.mapExitNames.Add(this.mapExits[m].gameObject.name);
			if (this.mapExits[m].visited)
			{
				this.mapExitStates.Add(1);
			}
			else
			{
				this.mapExitStates.Add(0);
			}
		}
		this.saveFile.Save<List<string>>("MapExitNames", this.mapExitNames);
		this.saveFile.Save<List<int>>("MapExitStates", this.mapExitStates);
		this.saveFile.Save<List<float>>("ResourceTime", this.resourceTime);
		this.saveFile.Save<List<bool>>("ResourceStates", this.resourceStates);
		this.saveFile.Sync();
		for (int n = 0; n < this.puzzleActions.Count; n++)
		{
			this.puzzleActions[n].SavePuzzleInfo();
		}
	}

	// Token: 0x06000D37 RID: 3383 RVA: 0x000FF214 File Offset: 0x000FD414
	public MapExit MatchMapExit(string sceneFrom, string subExit)
	{
		for (int i = 0; i < this.mapExits.Count; i++)
		{
			if (this.mapExits[i].sceneTo == sceneFrom && (this.mapExits[i].subExit == subExit || subExit == "None"))
			{
				return this.mapExits[i].mapExit;
			}
		}
		return null;
	}

	// Token: 0x06000D38 RID: 3384 RVA: 0x000FF28C File Offset: 0x000FD48C
	public Door GetBuddyDoor(MapExit entrance)
	{
		for (int i = 0; i < this.mapExits.Count; i++)
		{
			if (entrance != this.mapExits[i].mapExit)
			{
				if (this.mapExits[i].sceneTo == "Interiors" && entrance.exitTo == MapExit.exitToNames.Exterior)
				{
					if (this.mapExits[i].mapExit.interiorConnection == entrance.exteriorConnection)
					{
						return this.mapExits[i].door;
					}
				}
				else if (this.mapExits[i].sceneTo == "Exterior" && entrance.exitTo == MapExit.exitToNames.Interiors)
				{
					if (this.mapExits[i].mapExit.exteriorConnection == entrance.interiorConnection)
					{
						return this.mapExits[i].door;
					}
				}
				else if (this.mapExits[i].sceneTo == "Interiors" && entrance.exitTo == MapExit.exitToNames.Interiors && this.mapExits[i].mapExit.interiorConnection == entrance.interiorConnection)
				{
					return this.mapExits[i].door;
				}
			}
		}
		return null;
	}

	// Token: 0x06000D39 RID: 3385 RVA: 0x000FF3D8 File Offset: 0x000FD5D8
	public MapExit MatchMapExitInteriorExterior(bool toInterior, MapExit.interiorNames exitName, MapExit entrance)
	{
		for (int i = 0; i < this.mapExits.Count; i++)
		{
			if (entrance != this.mapExits[i].mapExit && ((this.mapExits[i].sceneTo == "Interiors" && !toInterior) || (this.mapExits[i].sceneTo == "Interiors" && toInterior) || (this.mapExits[i].sceneTo == "Exterior" && toInterior) || (this.mapExits[i].sceneTo == "Exterior" && !toInterior)))
			{
				if (!toInterior && this.mapExits[i].mapExit.interiorConnection == exitName)
				{
					return this.mapExits[i].mapExit;
				}
				if (toInterior)
				{
					if (this.mapExits[i].mapExit.exteriorConnection == exitName)
					{
						return this.mapExits[i].mapExit;
					}
					if (this.mapExits[i].mapExit.interiorConnection == exitName)
					{
						return this.mapExits[i].mapExit;
					}
				}
			}
		}
		return null;
	}

	// Token: 0x06000D3A RID: 3386 RVA: 0x000FF52C File Offset: 0x000FD72C
	public MapExit MatchMapExitDoorway(bool toInterior, MapExit.interiorNames exitName)
	{
		for (int i = 0; i < this.mapExits.Count; i++)
		{
			if ((this.mapExits[i].sceneTo == "Interiors" && toInterior) || (this.mapExits[i].sceneTo == "Exterior" && !toInterior))
			{
				if (toInterior && this.mapExits[i].mapExit.interiorConnection == exitName)
				{
					return this.mapExits[i].mapExit;
				}
				if (!toInterior && this.mapExits[i].mapExit.exteriorConnection == exitName)
				{
					return this.mapExits[i].mapExit;
				}
			}
		}
		return null;
	}

	// Token: 0x06000D3B RID: 3387 RVA: 0x000FF5F1 File Offset: 0x000FD7F1
	public bool IsInteriorExit(MapExit exit)
	{
		return exit.exitTo == MapExit.exitToNames.Interiors;
	}

	// Token: 0x06000D3C RID: 3388 RVA: 0x000FF600 File Offset: 0x000FD800
	public MapExit ClosestMapEntrance(Vector3 pt)
	{
		MapExit mapExit = null;
		float num = float.PositiveInfinity;
		for (int i = 0; i < this.mapExits.Count; i++)
		{
			float sqrMagnitude = (this.mapExits[i].mapExit.doorPoint - pt).sqrMagnitude;
			if (sqrMagnitude < num)
			{
				num = sqrMagnitude;
				mapExit = this.mapExits[i].mapExit;
			}
		}
		return mapExit;
	}

	// Token: 0x06000D3D RID: 3389 RVA: 0x000FF66C File Offset: 0x000FD86C
	public MapExit.interiorNames GetMapExitName(string n)
	{
		if (n == "A")
		{
			return MapExit.interiorNames.A;
		}
		if (n == "B")
		{
			return MapExit.interiorNames.B;
		}
		if (n == "C")
		{
			return MapExit.interiorNames.C;
		}
		if (n == "D")
		{
			return MapExit.interiorNames.D;
		}
		if (n == "E")
		{
			return MapExit.interiorNames.E;
		}
		if (n == "F")
		{
			return MapExit.interiorNames.F;
		}
		if (n == "G")
		{
			return MapExit.interiorNames.G;
		}
		if (n == "H")
		{
			return MapExit.interiorNames.H;
		}
		if (n == "I")
		{
			return MapExit.interiorNames.I;
		}
		if (n == "J")
		{
			return MapExit.interiorNames.J;
		}
		if (n == "K")
		{
			return MapExit.interiorNames.K;
		}
		if (n == "L")
		{
			return MapExit.interiorNames.L;
		}
		if (n == "M")
		{
			return MapExit.interiorNames.M;
		}
		if (n == "N")
		{
			return MapExit.interiorNames.N;
		}
		if (n == "O")
		{
			return MapExit.interiorNames.O;
		}
		if (n == "P")
		{
			return MapExit.interiorNames.P;
		}
		if (n == "Q")
		{
			return MapExit.interiorNames.Q;
		}
		if (n == "R")
		{
			return MapExit.interiorNames.R;
		}
		if (n == "S")
		{
			return MapExit.interiorNames.S;
		}
		if (n == "T")
		{
			return MapExit.interiorNames.T;
		}
		if (n == "U")
		{
			return MapExit.interiorNames.U;
		}
		if (n == "V")
		{
			return MapExit.interiorNames.V;
		}
		if (n == "W")
		{
			return MapExit.interiorNames.W;
		}
		if (n == "X")
		{
			return MapExit.interiorNames.X;
		}
		if (n == "Y")
		{
			return MapExit.interiorNames.Y;
		}
		if (n == "Z")
		{
			return MapExit.interiorNames.Z;
		}
		return MapExit.interiorNames.None;
	}

	// Token: 0x06000D3E RID: 3390 RVA: 0x000FF812 File Offset: 0x000FDA12
	public void AddItem(global::Item item)
	{
		if (this.groundItems.IndexOf(item) == -1)
		{
			this.groundItems.Add(item);
		}
	}

	// Token: 0x06000D3F RID: 3391 RVA: 0x000FF830 File Offset: 0x000FDA30
	public void CheckTileEffects(TileEffects effects)
	{
		for (int i = 0; i < this.breakableActions.Count; i++)
		{
			if (!this.breakableActions[i].destroyed)
			{
				effects.CheckTileInteractive(this.breakableActions[i].gameObject);
			}
		}
		for (int j = 0; j < this.chestActions.Count; j++)
		{
			if (!this.chestActions[j].destroyed)
			{
				effects.CheckTileInteractive(this.chestActions[j].gameObject);
			}
		}
		for (int k = 0; k < this.doorActions.Count; k++)
		{
			if (!this.doorActions[k].destroyed)
			{
				effects.CheckTileInteractive(this.doorActions[k].gameObject);
			}
		}
	}

	// Token: 0x04001492 RID: 5266
	public string sceneName;

	// Token: 0x04001493 RID: 5267
	public string sceneDisplayName;

	// Token: 0x04001494 RID: 5268
	public bool underground;

	// Token: 0x04001495 RID: 5269
	public bool exteriorForest;

	// Token: 0x04001496 RID: 5270
	public bool exteriorDeepForest;

	// Token: 0x04001497 RID: 5271
	public bool exteriorWaterBeach;

	// Token: 0x04001498 RID: 5272
	public bool exteriorBog;

	// Token: 0x04001499 RID: 5273
	public bool exteriorMountains;

	// Token: 0x0400149A RID: 5274
	public bool interiorCave;

	// Token: 0x0400149B RID: 5275
	public bool interiorTomb;

	// Token: 0x0400149C RID: 5276
	public bool horror;

	// Token: 0x0400149D RID: 5277
	public static GameObject origin;

	// Token: 0x0400149E RID: 5278
	public static Links x;

	// Token: 0x0400149F RID: 5279
	public bool timeOfDay;

	// Token: 0x040014A0 RID: 5280
	public bool saveOverTerrain;

	// Token: 0x040014A1 RID: 5281
	public bool singleCharacter;

	// Token: 0x040014A2 RID: 5282
	public bool blackFow;

	// Token: 0x040014A3 RID: 5283
	public bool mapCanResurrect;

	// Token: 0x040014A4 RID: 5284
	public float cameraDistance;

	// Token: 0x040014A5 RID: 5285
	public SceneInfo sceneInfo;

	// Token: 0x040014A6 RID: 5286
	public float lastVersionForThisScene;

	// Token: 0x040014A7 RID: 5287
	public bool savingItems;

	// Token: 0x040014A8 RID: 5288
	public int groupID;

	// Token: 0x040014A9 RID: 5289
	public float lastTimeOnScene;

	// Token: 0x040014AA RID: 5290
	public float boatColliderY;

	// Token: 0x040014AB RID: 5291
	public float waterY;

	// Token: 0x040014AC RID: 5292
	[Header("LISTS")]
	public List<Character> characters = new List<Character>();

	// Token: 0x040014AD RID: 5293
	public Creatures[] creatureControllers = new Creatures[0];

	// Token: 0x040014AE RID: 5294
	public List<CreatureActions> creatureActions = new List<CreatureActions>();

	// Token: 0x040014AF RID: 5295
	public List<Transform> creatureHolders = new List<Transform>();

	// Token: 0x040014B0 RID: 5296
	public SceneItem[] sceneItems = new SceneItem[0];

	// Token: 0x040014B1 RID: 5297
	public List<global::Item> groundItems = new List<global::Item>();

	// Token: 0x040014B2 RID: 5298
	public List<Breakable> breakables = new List<Breakable>();

	// Token: 0x040014B3 RID: 5299
	public List<BreakableActions> breakableActions = new List<BreakableActions>();

	// Token: 0x040014B4 RID: 5300
	public List<Door> doors = new List<Door>();

	// Token: 0x040014B5 RID: 5301
	public List<DoorActions> doorActions = new List<DoorActions>();

	// Token: 0x040014B6 RID: 5302
	public List<Chest> chests = new List<Chest>();

	// Token: 0x040014B7 RID: 5303
	public List<ChestActions> chestActions = new List<ChestActions>();

	// Token: 0x040014B8 RID: 5304
	public List<PromptActions> promptActions = new List<PromptActions>();

	// Token: 0x040014B9 RID: 5305
	public Prompts[] prompts = new Prompts[0];

	// Token: 0x040014BA RID: 5306
	public List<int> promptStates = new List<int>();

	// Token: 0x040014BB RID: 5307
	public List<MeshCollider> meshColliders = new List<MeshCollider>();

	// Token: 0x040014BC RID: 5308
	public List<SphereCollider> blueFog = new List<SphereCollider>();

	// Token: 0x040014BD RID: 5309
	public List<SphereCollider> fogColliders = new List<SphereCollider>();

	// Token: 0x040014BE RID: 5310
	private List<Bounds> blueFogBounds = new List<Bounds>();

	// Token: 0x040014BF RID: 5311
	public List<Bounds> fogColliderBounds = new List<Bounds>();

	// Token: 0x040014C0 RID: 5312
	public List<SphereCollider> townColliders = new List<SphereCollider>();

	// Token: 0x040014C1 RID: 5313
	public List<Bounds> townColliderBounds = new List<Bounds>();

	// Token: 0x040014C2 RID: 5314
	public List<SphereCollider> sporeColliders = new List<SphereCollider>();

	// Token: 0x040014C3 RID: 5315
	public List<Bounds> sporeColliderBounds = new List<Bounds>();

	// Token: 0x040014C4 RID: 5316
	public List<Character> enemiesInCamp = new List<Character>();

	// Token: 0x040014C5 RID: 5317
	public List<GameObject> resourcePrefabs = new List<GameObject>();

	// Token: 0x040014C6 RID: 5318
	public List<Vector3> resourceLocations = new List<Vector3>();

	// Token: 0x040014C7 RID: 5319
	public List<Quaternion> resourceRotations = new List<Quaternion>();

	// Token: 0x040014C8 RID: 5320
	public List<Breakable.ComponentTypes> resourceTypes = new List<Breakable.ComponentTypes>();

	// Token: 0x040014C9 RID: 5321
	public List<Moonlight> moonlights = new List<Moonlight>();

	// Token: 0x040014CA RID: 5322
	public List<Puzzle> puzzles = new List<Puzzle>();

	// Token: 0x040014CB RID: 5323
	public List<PuzzleActions> puzzleActions = new List<PuzzleActions>();

	// Token: 0x040014CC RID: 5324
	public List<PromptActions> promptQueue = new List<PromptActions>();

	// Token: 0x040014CD RID: 5325
	public Transform cameraPoints;

	// Token: 0x040014CE RID: 5326
	public List<Transform> camPoints = new List<Transform>();

	// Token: 0x040014CF RID: 5327
	public List<Terrain> terrains = new List<Terrain>();

	// Token: 0x040014D0 RID: 5328
	[Header("GAMEPLAY OBJECTS")]
	public Light sceneDirectionalLight;

	// Token: 0x040014D1 RID: 5329
	public Light scenePointLight;

	// Token: 0x040014D2 RID: 5330
	public GameObject pointLightShadows;

	// Token: 0x040014D3 RID: 5331
	public List<LOSSource> pointShadowCameras = new List<LOSSource>();

	// Token: 0x040014D4 RID: 5332
	public FOWSystem fogOfWar;

	// Token: 0x040014D5 RID: 5333
	public FOWSystemInterior fogOfWarInterior;

	// Token: 0x040014D6 RID: 5334
	public Transform items;

	// Token: 0x040014D7 RID: 5335
	public Transform creatures;

	// Token: 0x040014D8 RID: 5336
	public Transform throats;

	// Token: 0x040014D9 RID: 5337
	public Transform town;

	// Token: 0x040014DA RID: 5338
	public Transform spores;

	// Token: 0x040014DB RID: 5339
	public TVEGlobalVolume vegetation;

	// Token: 0x040014DC RID: 5340
	private List<Culling> quads;

	// Token: 0x040014DD RID: 5341
	public List<Culling> activeQuads = new List<Culling>();

	// Token: 0x040014DE RID: 5342
	public List<Character> party = new List<Character>();

	// Token: 0x040014DF RID: 5343
	private List<Character> linksParty;

	// Token: 0x040014E0 RID: 5344
	public MeshRenderer terrain;

	// Token: 0x040014E1 RID: 5345
	public GameObject promptsFolder;

	// Token: 0x040014E2 RID: 5346
	public Transform globalVegVolume;

	// Token: 0x040014E3 RID: 5347
	public GameObject morningFolder;

	// Token: 0x040014E4 RID: 5348
	public GameObject afternoonFolder;

	// Token: 0x040014E5 RID: 5349
	public GameObject eveningFolder;

	// Token: 0x040014E6 RID: 5350
	public GameObject nightFolder;

	// Token: 0x040014E7 RID: 5351
	public int pointLightTransforms;

	// Token: 0x040014E8 RID: 5352
	public InteriorLights currentInteriorLight;

	// Token: 0x040014E9 RID: 5353
	public GameObject ghostPoint;

	// Token: 0x040014EA RID: 5354
	public GraphNode ghostNode;

	// Token: 0x040014EB RID: 5355
	public GameObject boatCollider;

	// Token: 0x040014EC RID: 5356
	[Header("CAMERA OBJECTS")]
	public Camera sceneCamera;

	// Token: 0x040014ED RID: 5357
	public Collider currCameraCollider;

	// Token: 0x040014EE RID: 5358
	public Transform cameraDirection;

	// Token: 0x040014EF RID: 5359
	public List<SceneCamera> sceneViews = new List<SceneCamera>();

	// Token: 0x040014F0 RID: 5360
	public Camera currentCameraView;

	// Token: 0x040014F1 RID: 5361
	public SceneCamera activeView;

	// Token: 0x040014F2 RID: 5362
	private SceneCamera prevView;

	// Token: 0x040014F3 RID: 5363
	[Header("STARTING LOCATIONS")]
	public Transform playerStartDefault;

	// Token: 0x040014F4 RID: 5364
	public Transform playerStartBoatDefault;

	// Token: 0x040014F5 RID: 5365
	public List<MapExitActions> mapExits = new List<MapExitActions>();

	// Token: 0x040014F6 RID: 5366
	[Header("BAKE VARIABLES")]
	public Vector2 aspect;

	// Token: 0x040014F7 RID: 5367
	public Vector2 resolution;

	// Token: 0x040014F8 RID: 5368
	public Vector2 split;

	// Token: 0x040014F9 RID: 5369
	public float quadOverlap;

	// Token: 0x040014FA RID: 5370
	public int fogOfWarSize;

	// Token: 0x040014FB RID: 5371
	public List<int> itemIDs = new List<int>();

	// Token: 0x040014FC RID: 5372
	public List<string> itemSaveIDs = new List<string>();

	// Token: 0x040014FD RID: 5373
	public List<int> itemAmts = new List<int>();

	// Token: 0x040014FE RID: 5374
	public List<Vector3> itemSocketsA = new List<Vector3>();

	// Token: 0x040014FF RID: 5375
	public List<Vector3> itemSocketsB = new List<Vector3>();

	// Token: 0x04001500 RID: 5376
	public List<bool> itemsForSaleStates = new List<bool>();

	// Token: 0x04001501 RID: 5377
	public List<Vector3> itemPositions = new List<Vector3>();

	// Token: 0x04001502 RID: 5378
	public List<Quaternion> itemRotations = new List<Quaternion>();

	// Token: 0x04001503 RID: 5379
	public List<string> itemLinks = new List<string>();

	// Token: 0x04001504 RID: 5380
	public List<int> itemLinkIDs = new List<int>();

	// Token: 0x04001505 RID: 5381
	public List<Vector4> itemTimes = new List<Vector4>();

	// Token: 0x04001506 RID: 5382
	public List<string> itemPrompts = new List<string>();

	// Token: 0x04001507 RID: 5383
	public List<string> itemOriginals = new List<string>();

	// Token: 0x04001508 RID: 5384
	public List<string> itemsNoRespawn = new List<string>();

	// Token: 0x04001509 RID: 5385
	private ES3File saveFile;

	// Token: 0x0400150A RID: 5386
	public List<int> breakableStates = new List<int>();

	// Token: 0x0400150B RID: 5387
	public List<bool> resourceStates = new List<bool>();

	// Token: 0x0400150C RID: 5388
	public List<float> resourceTime = new List<float>();

	// Token: 0x0400150D RID: 5389
	public List<int> chestStates = new List<int>();

	// Token: 0x0400150E RID: 5390
	public List<int> doorHealth = new List<int>();

	// Token: 0x0400150F RID: 5391
	public List<bool> doorLocked = new List<bool>();

	// Token: 0x04001510 RID: 5392
	public List<string> breakableNames = new List<string>();

	// Token: 0x04001511 RID: 5393
	public List<string> doorNames = new List<string>();

	// Token: 0x04001512 RID: 5394
	public List<string> chestNames = new List<string>();

	// Token: 0x04001513 RID: 5395
	public List<string> promptNames = new List<string>();

	// Token: 0x04001514 RID: 5396
	public List<string> mapExitNames = new List<string>();

	// Token: 0x04001515 RID: 5397
	public List<int> mapExitStates = new List<int>();

	// Token: 0x04001516 RID: 5398
	private bool firstTimeOnScene;

	// Token: 0x04001517 RID: 5399
	private bool mainCharacterInGhostFog;

	// Token: 0x04001518 RID: 5400
	private float queueUpdate;

	// Token: 0x04001519 RID: 5401
	private Vector3 prevMainPosition;

	// Token: 0x0400151A RID: 5402
	private string prevTimeOfDay;

	// Token: 0x0400151B RID: 5403
	private IEnumerator fogFadeCorout;

	// Token: 0x0400151C RID: 5404
	private float currentFogValue;
}
