using System;
using System.Collections;
using System.Collections.Generic;
using DarkTonic.MasterAudio;
using PixelCrushers.DialogueSystem;
using UnityEngine;

// Token: 0x02000043 RID: 67
public class PromptActions : MonoBehaviour
{
	// Token: 0x06000850 RID: 2128 RVA: 0x000B4F32 File Offset: 0x000B3132
	private void Awake()
	{
		this.saveName = base.gameObject.name;
	}

	// Token: 0x06000851 RID: 2129 RVA: 0x000B4F48 File Offset: 0x000B3148
	private void Start()
	{
		if (this.prompt.type == Prompts.types.quip || this.prompt.type == Prompts.types.dialogue || this.prompt.type == Prompts.types.gameObjectState || this.prompt.type == Prompts.types.ambush)
		{
			this.characterName = this.prompt.characterName.ToString();
		}
	}

	// Token: 0x06000852 RID: 2130 RVA: 0x000B4FAC File Offset: 0x000B31AC
	public void Setup()
	{
		if (!this.coll)
		{
			this.coll = base.gameObject.GetComponent<Collider>();
		}
		if (this.coll)
		{
			this.coll.isTrigger = true;
			this.bounds = this.coll.bounds;
			this.center = this.bounds.center;
		}
		base.gameObject.layer = 27;
		this.CheckStatus();
	}

	// Token: 0x06000853 RID: 2131 RVA: 0x000B5028 File Offset: 0x000B3228
	public void CheckCombatEnd()
	{
		if (this.waitingForCombatEnd && this.hitCharacters.Count > 0 && base.gameObject.activeSelf && (this.state == 0 || this.state == 2 || this.prompt.type == Prompts.types.turnHostile))
		{
			this.Action(true);
		}
		this.waitingForCombatEnd = false;
	}

	// Token: 0x06000854 RID: 2132 RVA: 0x000B5088 File Offset: 0x000B3288
	public void OnTriggerEnter(Collider other)
	{
		if ((this.state == 0 || this.state == 2 || this.prompt.type == Prompts.types.turnHostile) && other.gameObject.layer == 6)
		{
			Character component = other.gameObject.GetComponent<Character>();
			if (component && component.party && !this.hitCharacters.Contains(component))
			{
				this.hitCharacters.Add(component);
				if (Records.x.InCombat(false) && (this.prompt.type == Prompts.types.quip || this.prompt.type == Prompts.types.dialogue || this.prompt.type == Prompts.types.rogue || this.prompt.type == Prompts.types.charmer || this.prompt.type == Prompts.types.decipheringText || this.prompt.type == Prompts.types.decipheringText))
				{
					this.waitingForCombatEnd = true;
					return;
				}
				this.Action(true);
			}
		}
	}

	// Token: 0x06000855 RID: 2133 RVA: 0x000B5174 File Offset: 0x000B3374
	public void OnTriggerExit(Collider other)
	{
		if (other.gameObject.layer == 6)
		{
			Character component = other.gameObject.GetComponent<Character>();
			if (component && component.party)
			{
				if (this.prompt.type == Prompts.types.turnHostile)
				{
					if (this.hitCharacters.Count > 0)
					{
						this.Action(false);
					}
					if (this.hitCharacters.Contains(component))
					{
						this.hitCharacters.Remove(component);
						if (this.state == 2)
						{
							this.state = 0;
							return;
						}
					}
				}
				else if (this.prompt.type == Prompts.types.createConstantCheck)
				{
					if (this.hitCharacters.Contains(component))
					{
						this.hitCharacters.Remove(component);
					}
					if (this.hitCharacters.Count == 0)
					{
						this.Action(false);
						return;
					}
				}
				else if (this.hitCharacters.Contains(component))
				{
					this.hitCharacters.Remove(component);
					if (this.state == 2)
					{
						this.state = 0;
					}
				}
			}
		}
	}

	// Token: 0x06000856 RID: 2134 RVA: 0x000B5271 File Offset: 0x000B3471
	public int HitCharacterCount()
	{
		return this.hitCharacters.Count;
	}

	// Token: 0x06000857 RID: 2135 RVA: 0x000B5280 File Offset: 0x000B3480
	public void CheckStatus()
	{
		if (this.prompt.type == Prompts.types.toggleGameObjectFromQuest)
		{
			string text = this.prompt.nameOfQuest.ToString();
			string text2 = this.prompt.stateOfQuest.ToString();
			bool flag = false;
			if (QuestLog.GetQuestState(text) == Records.x.StringToQuestState(text2))
			{
				flag = true;
			}
			if (this.prompt.questObjectToToggle)
			{
				if (flag)
				{
					if (this.prompt.toggleState == Prompts.ToggleState.Off)
					{
						this.prompt.questObjectToToggle.SetActive(false);
					}
					else
					{
						this.prompt.questObjectToToggle.SetActive(true);
					}
				}
				else if (this.prompt.toggleState == Prompts.ToggleState.On)
				{
					this.prompt.questObjectToToggle.SetActive(false);
				}
				else
				{
					this.prompt.questObjectToToggle.SetActive(true);
				}
				if (this.prompt.updateAstar)
				{
					this.UpdateAstar(this.prompt.questObjectToToggle.transform.position, true);
				}
			}
			if (text.Contains("Ghosts") && !this.prompt.questObjectToToggle)
			{
				bool flag2 = true;
				if (!Links.x.gaia.sceneLoaded)
				{
					flag2 = false;
				}
				if (flag)
				{
					this.SetGhostState(text, false, flag2);
				}
				else
				{
					this.SetGhostState(text, true, false);
				}
			}
		}
		if (this.prompt.type == Prompts.types.campCleared && this.state == 0 && Links.x.gaia.sceneLoaded)
		{
			bool flag3 = false;
			if (this.creatureActions == null)
			{
				this.creatureActions = new List<CreatureActions>();
				flag3 = true;
			}
			if (!flag3 && this.creatureActions.Count == 0)
			{
				flag3 = true;
			}
			if (flag3)
			{
				this.creatures = this.prompt.campCreatures;
				foreach (Creatures creatures in this.creatures)
				{
					CreatureActions component = creatures.gameObject.GetComponent<CreatureActions>();
					if (component)
					{
						this.creatureActions.Add(component);
					}
				}
			}
			bool flag4 = true;
			for (int i = 0; i < this.creatureActions.Count; i++)
			{
				if (this.creatureActions[i].AnyAlive())
				{
					flag4 = false;
					break;
				}
			}
			if (flag4 && this.prompt.setQuestStateOnVacated.ToString() != "NotApplicable")
			{
				if (this.prompt.campClearQuest.ToString().Contains("GoodHarvest"))
				{
					if (QuestLog.GetQuestState("GoodHarvest_Quest") != QuestState.Unassigned)
					{
						Links.x.main.StartQuip("The Harvest God will be pleased");
					}
					MasterAudio.PlaySoundAndForget("Feedback", 0.5f, new float?(1f), 0f, "Song Learned", null);
					this.str.Clear();
					this.str.Append("<color=#FFFFFF>The God of Good Harvests is pleased</color>");
					Links.x.gameFeed.AddFeed(this.str.ToString());
				}
				else if (this.prompt.campClearQuest.ToString().Contains("E6_CropGoblins"))
				{
					base.StartCoroutine(this.WaitForMessage());
				}
				QuestLog.SetQuestState(this.prompt.campClearQuest.ToString(), Records.x.StringToQuestState(this.prompt.setQuestStateOnVacated.ToString()));
				this.state = 3 + Links.x.gameplay.GetCurrentGameTimeHours();
				Debug.Log("All dead " + this.prompt.campClearQuest.ToString() + " time: " + this.state.ToString());
				return;
			}
			if (flag4 && this.prompt.checkQuestStateToRemoveObjects.ToString() == "NotApplicable" && this.prompt.setQuestStateOnVacated.ToString() == "NotApplicable")
			{
				Debug.Log("All dead, clearing stuff " + ((this != null) ? this.ToString() : null) + "  time: " + this.state.ToString());
				return;
			}
			if (this.prompt.checkQuestStateToRemoveObjects.ToString() != "NotApplicable" && QuestLog.GetQuestState(this.prompt.campClearQuest.ToString()) == Records.x.StringToQuestState(this.prompt.checkQuestStateToRemoveObjects.ToString()))
			{
				if (Records.x.editor)
				{
					Debug.Log("Starting camp cleared for " + this.prompt.campClearQuest.ToString());
				}
				this.state = 3 + Links.x.gameplay.GetCurrentGameTimeHours();
			}
		}
	}

	// Token: 0x06000858 RID: 2136 RVA: 0x000B5790 File Offset: 0x000B3990
	private IEnumerator WaitForMessage()
	{
		while (Records.x.InCombat(false) || Records.x.removeControls || Records.x.inMenus || Links.x.combat.inPocketAttack || Records.x.pocketPause || Records.x.paused)
		{
			yield return null;
		}
		Links.x.main.StartQuip("I think we've killed all the crop goblins here, for Vol has fallen silent below my feet.");
		MasterAudio.PlaySoundAndForget("Feedback", 0.5f, new float?(1f), 0f, "Song Learned", null);
		this.str.Clear();
		this.str.Append("<color=#FFFFFF>Crop goblins eliminated</color>");
		Links.x.gameFeed.AddFeed(this.str.ToString());
		yield break;
	}

	// Token: 0x06000859 RID: 2137 RVA: 0x000B57A0 File Offset: 0x000B39A0
	public void CheckHour()
	{
		if (this.prompt.type == Prompts.types.campCleared)
		{
			this.CheckStatus();
			if (this.state > 2)
			{
				int currentGameTimeHours = Links.x.gameplay.GetCurrentGameTimeHours();
				int num = this.state - 3;
				int num2 = this.prompt.hoursToWaitUntilStuffGone + num;
				if (currentGameTimeHours >= num2)
				{
					bool flag = false;
					if (this.creatureActions == null)
					{
						this.creatureActions = new List<CreatureActions>();
						flag = true;
					}
					if (!flag && this.creatureActions.Count == 0)
					{
						flag = true;
					}
					if (flag)
					{
						this.creatures = this.prompt.campCreatures;
						foreach (Creatures creatures in this.creatures)
						{
							CreatureActions component = creatures.gameObject.GetComponent<CreatureActions>();
							if (component)
							{
								this.creatureActions.Add(component);
							}
						}
					}
					bool flag2 = true;
					for (int i = 0; i < this.creatureActions.Count; i++)
					{
						if (this.creatureActions[i].AnyNearParty())
						{
							flag2 = false;
							break;
						}
					}
					if (flag2 && Links.x.gaia.sceneLoaded)
					{
						Debug.Log(string.Concat(new string[]
						{
							"Remove stuff ",
							this.prompt.campClearQuest.ToString(),
							" current hour: ",
							currentGameTimeHours.ToString(),
							" saved hour: ",
							num.ToString(),
							" wanted hour: ",
							num2.ToString()
						}));
						this.RemoveCampObjects();
						this.state = 2;
						return;
					}
					if (Records.x.editor)
					{
						Debug.Log("Cannot clear camp yet for " + this.prompt.campClearQuest.ToString());
					}
				}
			}
		}
	}

	// Token: 0x0600085A RID: 2138 RVA: 0x000B5994 File Offset: 0x000B3B94
	public void FinishSetup()
	{
		this.CheckHour();
		if (this.state == 1)
		{
			if (this.prompt.type == Prompts.types.gameObjectState || (this.prompt.type == Prompts.types.charmer && this.prompt.alsoSetGameObjectStatus) || (this.prompt.type == Prompts.types.rogue && this.prompt.alsoSetGameObjectState))
			{
				if (this.prompt.toggleState_ == Prompts.ToggleState.On)
				{
					this.prompt.gameObjectToToggle.SetActive(true);
					if (this.prompt.gameObjectToToggle2)
					{
						this.prompt.gameObjectToToggle2.SetActive(true);
					}
				}
				else
				{
					this.prompt.gameObjectToToggle.SetActive(false);
					if (this.prompt.gameObjectToToggle2)
					{
						this.prompt.gameObjectToToggle2.SetActive(false);
					}
				}
				if (this.prompt.updateAstar)
				{
					this.UpdateAstar(this.prompt.gameObjectToToggle.transform.position, true);
				}
			}
			if (this.prompt.type == Prompts.types.toggleGameObjectFromQuest)
			{
				string text = this.prompt.nameOfQuest.ToString();
				string text2 = this.prompt.stateOfQuest.ToString();
				bool flag = false;
				if (QuestLog.GetQuestState(text) == Records.x.StringToQuestState(text2))
				{
					flag = true;
				}
				if (flag && this.prompt.questObjectToToggle)
				{
					if (this.prompt.toggleState == Prompts.ToggleState.On)
					{
						this.prompt.questObjectToToggle.SetActive(true);
					}
					else
					{
						this.prompt.questObjectToToggle.SetActive(false);
					}
				}
				if (this.prompt.updateAstar)
				{
					this.UpdateAstar(this.prompt.questObjectToToggle.transform.position, true);
				}
				if (text.Contains("Ghosts") && !this.prompt.questObjectToToggle)
				{
					if (flag)
					{
						this.SetGhostState(text, false, false);
					}
					else
					{
						this.SetGhostState(text, true, false);
					}
				}
			}
			if (this.prompt.type == Prompts.types.dialogue && this.prompt.conversationSetsGameObjectState)
			{
				if (this.prompt.toggleState_ == Prompts.ToggleState.On)
				{
					this.prompt.gameObjectToToggle.SetActive(true);
					if (this.prompt.gameObjectToToggle2)
					{
						this.prompt.gameObjectToToggle2.SetActive(true);
					}
				}
				else
				{
					this.prompt.gameObjectToToggle.SetActive(false);
					if (this.prompt.gameObjectToToggle2)
					{
						this.prompt.gameObjectToToggle2.SetActive(false);
					}
				}
				if (this.prompt.updateAstar)
				{
					this.UpdateAstar(this.prompt.gameObjectToToggle.transform.position, true);
				}
			}
			if (this.coll)
			{
				this.coll.enabled = false;
				return;
			}
		}
		else
		{
			if (this.coll)
			{
				if (this.prompt.type == Prompts.types.toggleGameObjectFromQuest)
				{
					this.coll.enabled = false;
				}
				else
				{
					this.coll.enabled = true;
				}
			}
			if (base.gameObject.activeSelf)
			{
				if (this.state == 3 && this.prompt.type == Prompts.types.ambush)
				{
					base.gameObject.AddComponent<Cinematics>().Ambush(this.prompt.ambushCharacters, Links.x.main, this);
				}
				if (this.prompt.type == Prompts.types.gameObjectState || (this.prompt.type == Prompts.types.charmer && this.prompt.alsoSetGameObjectStatus) || (this.prompt.type == Prompts.types.rogue && this.prompt.alsoSetGameObjectState))
				{
					if (this.prompt.toggleState_ == Prompts.ToggleState.Off)
					{
						this.prompt.gameObjectToToggle.SetActive(true);
						if (this.prompt.gameObjectToToggle2)
						{
							this.prompt.gameObjectToToggle2.SetActive(true);
						}
					}
					else
					{
						this.prompt.gameObjectToToggle.SetActive(false);
						if (this.prompt.gameObjectToToggle2)
						{
							this.prompt.gameObjectToToggle2.SetActive(false);
						}
					}
					if (this.prompt.updateAstar)
					{
						this.UpdateAstar(this.prompt.gameObjectToToggle.transform.position, true);
					}
				}
				if (this.prompt.type == Prompts.types.toggleGameObjectFromQuest)
				{
					string text3 = this.prompt.nameOfQuest.ToString();
					string text4 = this.prompt.stateOfQuest.ToString();
					bool flag2 = false;
					if (QuestLog.GetQuestState(text3) == Records.x.StringToQuestState(text4))
					{
						flag2 = true;
					}
					if (flag2 && this.prompt.questObjectToToggle)
					{
						if (this.prompt.toggleState == Prompts.ToggleState.On)
						{
							this.prompt.questObjectToToggle.SetActive(true);
						}
						else
						{
							this.prompt.questObjectToToggle.SetActive(false);
						}
					}
					if (this.prompt.updateAstar)
					{
						this.UpdateAstar(this.prompt.gameObjectToToggle.transform.position, true);
					}
					if (text3.Contains("Ghosts") && !this.prompt.questObjectToToggle)
					{
						if (flag2)
						{
							this.SetGhostState(text3, false, false);
						}
						else
						{
							this.SetGhostState(text3, true, false);
						}
					}
				}
				if (this.prompt.type == Prompts.types.dialogue && this.prompt.conversationSetsGameObjectState)
				{
					if (this.prompt.toggleState_ == Prompts.ToggleState.Off)
					{
						this.prompt.gameObjectToToggle.SetActive(true);
						if (this.prompt.gameObjectToToggle2)
						{
							this.prompt.gameObjectToToggle2.SetActive(true);
						}
					}
					else
					{
						this.prompt.gameObjectToToggle.SetActive(false);
						if (this.prompt.gameObjectToToggle2)
						{
							this.prompt.gameObjectToToggle2.SetActive(false);
						}
					}
					if (this.prompt.updateAstar)
					{
						this.UpdateAstar(this.prompt.gameObjectToToggle.transform.position, true);
					}
				}
			}
			if (this.prompt.type == Prompts.types.campCleared && this.state == 2)
			{
				this.RemoveCampObjects();
			}
		}
	}

	// Token: 0x0600085B RID: 2139 RVA: 0x000B5FC8 File Offset: 0x000B41C8
	public void Action(bool entering)
	{
		if (this.prompt.type == Prompts.types.decipheringText)
		{
			this.state = 2;
			Links.x.main.StartQuip(this.DecipherText(this.prompt.textID));
		}
		if (this.prompt.type == Prompts.types.createConstantCheck)
		{
			string text = this.prompt.constantQuestName.ToString();
			if (QuestLog.GetQuestState(text) == Records.x.StringToQuestState(this.prompt.constantQuestFrom.ToString()))
			{
				if (entering)
				{
					Records.x.AddQuestToTimer(text, 10000f, this.prompt.constantQuestFrom.ToString(), this.prompt.constantQuestTo.ToString(), true);
				}
				else
				{
					Records.x.RemoveQuestTimer(text);
				}
			}
		}
		if (this.prompt.type == Prompts.types.puzzle)
		{
			this.prompt.puzzle.gameObject.GetComponent<PuzzleActions>().ClickedFromPrompt(this);
		}
		if (this.prompt.type == Prompts.types.quip)
		{
			Character character = Links.x.HasCompanion(this.characterName, this.hitCharacters[0].tr.position);
			if (this.prompt.characterName == Prompts.characterNames.VolTreeDryad)
			{
				if (QuestLog.GetQuestState("C6_DryadVolTree") != QuestState.Active)
				{
					character = null;
				}
				else
				{
					character = Links.x.diorama.FindCharacterAnyState("DryadB");
					Debug.Log(character);
					if (character && (character.tr.position - Links.x.main.currentPosition).sqrMagnitude > 1600f)
					{
						character = null;
					}
					if (character && this.prompt.conversation == "DryadVIP_C6Cave" && QuestLog.GetQuestState("C6_Mushrooms") == QuestState.Success)
					{
						character = null;
					}
				}
			}
			if (this.prompt.characterName == Prompts.characterNames.GoblinHoleBandit)
			{
				character = Links.x.diorama.FindCharacterAnyState("FallsBanditFriend");
				if (character && !character.vipFollow)
				{
					character = null;
				}
			}
			if (character || this.characterName == "Leader")
			{
				if (this.characterName == "Leader")
				{
					character = Links.x.main;
				}
				this.state = 3;
				Cinematics cinematics = base.gameObject.AddComponent<Cinematics>();
				GameObject gameObject = character.gameObject;
				if (this.linkedItems != null)
				{
					for (int i = 0; i < this.linkedItems.Count; i++)
					{
						gameObject = this.linkedItems[i].gameObject;
					}
				}
				cinematics.PromptLook(character, this, gameObject, false, false, 0, "", "");
			}
			else
			{
				this.state = 2;
			}
		}
		if (this.prompt.type == Prompts.types.playSound)
		{
			this.state = 1;
			AudioSource component = base.gameObject.GetComponent<AudioSource>();
			if (!component)
			{
				MasterAudio.PlaySound3DAtVector3AndForget("Prompts", Links.x.main.tr.position, 1f, new float?(1f), 0f, this.prompt.audioName, null);
			}
			else
			{
				component.loop = false;
				component.spatialBlend = 0.75f;
				component.priority = 1;
				component.volume = Links.x.options.soundVolume;
				component.Play();
			}
		}
		if (this.prompt.type == Prompts.types.gameObjectState)
		{
			Character character2 = Links.x.HasCompanion(this.characterName, this.hitCharacters[0].tr.position);
			if (!character2)
			{
				character2 = this.hitCharacters[0];
			}
			if (character2 || this.prompt.conversation == "")
			{
				character2.StartQuip(this.Quip(this.prompt.conversation, this.characterName, character2.stats.race));
				if (this.prompt.toggleState_ == Prompts.ToggleState.On)
				{
					this.prompt.gameObjectToToggle.SetActive(true);
					if (this.prompt.gameObjectToToggle2)
					{
						this.prompt.gameObjectToToggle2.SetActive(true);
					}
				}
				else
				{
					this.prompt.gameObjectToToggle.SetActive(false);
					if (this.prompt.gameObjectToToggle2)
					{
						this.prompt.gameObjectToToggle2.SetActive(false);
					}
				}
				if (this.prompt.updateAstar)
				{
					this.UpdateAstar(this.prompt.gameObjectToToggle.transform.position, false);
				}
				this.state = 1;
			}
		}
		if (this.prompt.type == Prompts.types.toggleGameObjectFromQuest)
		{
			string text2 = this.prompt.questName.ToString();
			string text3 = this.prompt.stateOfQuest.ToString();
			bool flag = false;
			if (QuestLog.GetQuestState(text2) == Records.x.StringToQuestState(text3))
			{
				flag = true;
			}
			if (flag)
			{
				if (this.prompt.questObjectToToggle)
				{
					if (this.prompt.toggleState == Prompts.ToggleState.On)
					{
						this.prompt.questObjectToToggle.SetActive(true);
					}
					else
					{
						this.prompt.questObjectToToggle.SetActive(false);
					}
				}
				if (text2.Contains("Ghosts") && !this.prompt.questObjectToToggle)
				{
					this.SetGhostState(text2, false, true);
				}
			}
			if (this.prompt.updateAstar)
			{
				this.UpdateAstar(this.prompt.questObjectToToggle.transform.position, false);
			}
			this.state = 1;
		}
		if (this.prompt.type == Prompts.types.setQuestState)
		{
			string text4 = this.prompt.questName.ToString();
			QuestState questState = Records.x.StringToQuestState(this.prompt.questState.ToString());
			QuestLog.SetQuestState(text4, questState);
			Debug.Log("setting quest " + text4 + " " + questState.ToString());
			this.state = 1;
		}
		if (this.prompt.type == Prompts.types.turnHostile && this.prompt.turnHostileFolder)
		{
			CreatureActions[] componentsInChildren = this.prompt.turnHostileFolder.GetComponentsInChildren<CreatureActions>();
			if (componentsInChildren.Length != 0 && (!Records.x.InCombat(false) || (Records.x.InCombat(false) && Links.x.combat.preDome)))
			{
				bool flag2 = false;
				foreach (CreatureActions creatureActions in componentsInChildren)
				{
					foreach (Character character3 in this.hitCharacters)
					{
						if (Links.x.sensory.CanSeeOrHearParty(creatureActions, character3, false, true))
						{
							flag2 = true;
						}
					}
				}
				if (flag2)
				{
					if (this.hostileCoroutine != null)
					{
						base.StopCoroutine(this.hostileCoroutine);
						this.hostileCoroutine = null;
					}
					if (this.state == 0)
					{
						this.state = 3;
					}
					else if (this.state >= 3 && entering)
					{
						this.state++;
					}
					if (this.state >= 3 + this.prompt.warnings)
					{
						Character nearestParty = Links.x.GetNearestParty(this.center);
						Character character4 = null;
						Character character5 = null;
						foreach (CreatureActions creatureActions2 in componentsInChildren)
						{
							if (!character5)
							{
								Character firstCharacter = creatureActions2.GetFirstCharacter();
								if (firstCharacter && firstCharacter.IsSentient())
								{
									character5 = firstCharacter;
								}
							}
						}
						if (character5 && Links.x.sensory.AddAllToCombat(character5, nearestParty, false, false, true))
						{
							CreatureActions[] array = componentsInChildren;
							for (int j = 0; j < array.Length; j++)
							{
								Character firstCharacter2 = array[j].GetFirstCharacter();
								if (firstCharacter2 && firstCharacter2.hasActions && (firstCharacter2.hostility == 2 || firstCharacter2.attackingUntilBribe))
								{
									if (!character4)
									{
										character4 = firstCharacter2;
										if (!Links.x.main.InSporeForest())
										{
											Records.x.AddBribeBadge(character4, "Seen", false, nearestParty);
										}
									}
									else
									{
										Records.x.UpdateBribeState(character4);
									}
								}
							}
							if (character4)
							{
								string text5 = "Added to combat ";
								Character character6 = character4;
								Debug.Log(text5 + ((character6 != null) ? character6.ToString() : null));
								Links.x.sensory.AddPartyToCombat(character4);
							}
						}
					}
					else if (this.state >= 3 && componentsInChildren.Length != 0)
					{
						Character firstCharacter3 = componentsInChildren[0].GetFirstCharacter();
						if (firstCharacter3 && !firstCharacter3.sleeping && !firstCharacter3.dead && !firstCharacter3.stunned && firstCharacter3.IsSentient() && !Records.x.InCombat(false))
						{
							if (this.prompt.turnHostileQuip == "GetOutD6RozafirStore")
							{
								firstCharacter3.StartQuip("Stay to the front of the store, please you");
							}
							else if (this.prompt.turnHostileQuip == "GetOutD6RozafirStore2")
							{
								firstCharacter3.StartQuip("Now you've done it!");
							}
							else
							{
								firstCharacter3.StartQuip("Watch yourself");
							}
						}
					}
				}
				else if (this.hostileCoroutine == null)
				{
					this.hostileCoroutine = this.HostileWait();
					base.StartCoroutine(this.hostileCoroutine);
				}
			}
		}
		if (this.prompt.type == Prompts.types.npcQuip)
		{
			this.npc = this.prompt.npc;
			if (this.npc.Count > 0)
			{
				for (int k = 0; k < this.npc.Count; k++)
				{
					Character firstCharacter4 = this.npc[k].gameObject.GetComponent<CreatureActions>().GetFirstCharacter();
					if (firstCharacter4)
					{
						this.state = 1;
						firstCharacter4.StartQuip(this.prompt.npcQuipText);
					}
					else
					{
						this.state = 2;
					}
				}
			}
		}
		if (this.prompt.type == Prompts.types.dialogue)
		{
			bool flag3 = false;
			if (!Records.x.InCombat(false) && Links.x.gaia.sceneLoaded)
			{
				Links.x.SentientPartyCount();
				Character firstAvailableParty = Links.x.GetFirstAvailableParty(this.center);
				Character character7 = Links.x.GetSecondAvailableParty(this.center, firstAvailableParty);
				Character thirdAvailableParty = Links.x.GetThirdAvailableParty(this.center, firstAvailableParty, character7);
				Character fourthAvailableParty = Links.x.GetFourthAvailableParty(this.center, firstAvailableParty, character7, thirdAvailableParty);
				if (this.prompt.characterName == Prompts.characterNames.VolTreeDryad)
				{
					if (QuestLog.GetQuestState("C6_DryadVolTree") != QuestState.Active)
					{
						character7 = null;
					}
					else
					{
						character7 = Links.x.diorama.FindCharacterAnyState("DryadB");
					}
				}
				if (character7)
				{
					this.state = 1;
					string text6 = this.prompt.conversation;
					if (this.prompt.conversation == "friendship and beyond")
					{
						text6 = "FortenLazure/RoadAhead";
					}
					if (this.prompt.conversation == "friendship and beyond north")
					{
						text6 = "FortenLazure/RoadAheadNorth";
					}
					if (this.prompt.conversation == "PeppuraD6")
					{
						text6 = "Rozafir/Peppura";
					}
					if (this.prompt.conversation == "DryadVIP_C6CaveDone")
					{
						text6 = "LazureCaves/Voltree";
					}
					Links.x.dialogue.initiateNum = 0;
					Links.x.gameplay.StartDialogue(character7, firstAvailableParty, thirdAvailableParty, fourthAvailableParty, text6);
					if (this.prompt.conversationSetsGameObjectState)
					{
						if (this.prompt.toggleState_ == Prompts.ToggleState.On)
						{
							this.prompt.gameObjectToToggle.SetActive(true);
							if (this.prompt.gameObjectToToggle2)
							{
								this.prompt.gameObjectToToggle2.SetActive(true);
							}
						}
						else
						{
							this.prompt.gameObjectToToggle.SetActive(false);
							if (this.prompt.gameObjectToToggle2)
							{
								this.prompt.gameObjectToToggle2.SetActive(false);
							}
						}
						if (this.prompt.updateAstar)
						{
							this.UpdateAstar(this.prompt.gameObjectToToggle.transform.position, false);
						}
					}
				}
				else
				{
					flag3 = true;
				}
			}
			else
			{
				flag3 = true;
			}
			if (flag3)
			{
				Links.x.diorama.AddPromptToQueue(this);
			}
		}
		if (this.prompt.type == Prompts.types.ambush)
		{
			bool flag4 = true;
			if (this.prompt.ambushCharacters)
			{
				foreach (CreatureActions creatureActions3 in this.prompt.ambushCharacters.GetComponentsInChildren<CreatureActions>())
				{
					creatureActions3.GetMorningNightHours();
					creatureActions3.GetDayNight(false);
					if (creatureActions3.IsAsleep())
					{
						flag4 = false;
						Debug.Log("Cannot ambush while creature should be sleeping");
					}
				}
			}
			if (flag4)
			{
				Debug.Log("Ambush! " + ((this != null) ? this.ToString() : null));
			}
			if (this.state == 0 && this.prompt.conversation == "ShromersGate")
			{
				if (Links.x.gameplay.IsDay())
				{
					QuestLog.SetQuestState("C6_FortenShroomers", QuestState.Active);
				}
				else
				{
					QuestLog.SetQuestState("C6_FortenShroomersNight", QuestState.Active);
				}
			}
			if (this.prompt.ambushCharacters && this.state != 1 && flag4)
			{
				bool flag5 = true;
				for (int l = 0; l < this.hitCharacters.Count; l++)
				{
					if (!this.hitCharacters[l].body.sneaking)
					{
						flag5 = false;
					}
				}
				if (!flag5)
				{
					this.state = 3;
					base.gameObject.AddComponent<Cinematics>().Ambush(this.prompt.ambushCharacters, this.hitCharacters[0], this);
				}
			}
		}
		if (this.prompt.type == Prompts.types.rogue && this.state != 3 && this.hitCharacters.Count > 0)
		{
			int num = 0;
			Character searchNumber = Links.x.fellowship.GetSearchNumber("Rogue", out num, "", this.hitCharacters[0].tr.position);
			if (searchNumber)
			{
				bool flag6 = false;
				if (num > this.prompt.rangerSkillCheck)
				{
					flag6 = true;
				}
				if ((float)num - 2f >= (float)this.prompt.rangerSkillCheck && !flag6)
				{
					flag6 = Random.Range(0, 5) == 0;
				}
				string text7 = searchNumber.stats.SearchCalculation("Rogue");
				string text8 = searchNumber.stats.SearchDifficultyString((float)this.prompt.rangerSkillCheck);
				if (flag6)
				{
					this.state = 3;
					Cinematics cinematics2 = base.gameObject.AddComponent<Cinematics>();
					GameObject gameObject2 = this.hitCharacters[0].gameObject;
					if (this.prompt.alsoSetGameObjectState)
					{
						gameObject2 = this.prompt.gameObjectToToggle;
					}
					if (base.gameObject.transform.childCount > 0)
					{
						gameObject2 = base.gameObject.transform.GetChild(0).gameObject;
					}
					if (this.linkedItems != null)
					{
						for (int m = 0; m < this.linkedItems.Count; m++)
						{
							gameObject2 = this.linkedItems[m].gameObject;
						}
					}
					cinematics2.PromptLook(searchNumber, this, gameObject2, true, false, num, text7, text8);
				}
				else
				{
					if (searchNumber && !Records.x.InCombat(false) && !Records.x.dialogue && this.hitCharacters.Count == 1)
					{
						searchNumber.StartQuip("Was that...? Nevermind...");
						MasterAudio.PlaySound3DAtVector3AndForget("Skills", searchNumber.tr.position, 0.3f, new float?(1f), 0f, "Fail", null);
					}
					this.state = 2;
				}
			}
		}
		if (this.prompt.type == Prompts.types.charmer)
		{
			int num2 = 0;
			Character searchNumber2 = Links.x.fellowship.GetSearchNumber("Charmer", out num2, this.prompt.animalType.ToString(), this.hitCharacters[0].tr.position);
			bool flag7 = false;
			if (num2 > this.prompt.charmerSkillCheck)
			{
				flag7 = true;
			}
			string[] array2 = new string[5];
			int num3 = 0;
			Character character8 = searchNumber2;
			array2[num3] = ((character8 != null) ? character8.ToString() : null);
			array2[1] = " ";
			array2[2] = num2.ToString();
			array2[3] = " ";
			array2[4] = this.prompt.charmerSkillCheck.ToString();
			Debug.Log(string.Concat(array2));
			if (searchNumber2)
			{
				string text9 = searchNumber2.stats.SearchCalculation("Charmer");
				string text10 = searchNumber2.stats.SearchDifficultyString((float)this.prompt.charmerSkillCheck);
				if ((float)num2 - 2f >= (float)this.prompt.rangerSkillCheck && !flag7)
				{
					flag7 = Random.Range(0, 5) == 0;
				}
				if (flag7)
				{
					this.state = 3;
					Cinematics cinematics3 = base.gameObject.AddComponent<Cinematics>();
					GameObject gameObject3 = this.hitCharacters[0].gameObject;
					if (this.prompt.alsoSetGameObjectState)
					{
						gameObject3 = this.prompt.gameObjectToToggle;
					}
					if (this.linkedItems != null)
					{
						for (int n = 0; n < this.linkedItems.Count; n++)
						{
							gameObject3 = this.linkedItems[n].gameObject;
						}
					}
					cinematics3.PromptLook(searchNumber2, this, gameObject3, false, true, num2, text9, text10);
				}
				else
				{
					this.state = 2;
					if (searchNumber2 && !Records.x.InCombat(false) && !Records.x.dialogue && this.hitCharacters.Count == 1)
					{
						searchNumber2.StartQuip("Was that...? Nevermind...");
						MasterAudio.PlaySound3DAtVector3AndForget("Skills", searchNumber2.tr.position, 0.3f, new float?(1f), 0f, "Fail", null);
					}
					Debug.Log("not enough points in charmer");
				}
			}
		}
		if (this.prompt.type == Prompts.types.custom)
		{
			if (this.prompt.textID == "ishaat")
			{
				this.Ishaat();
			}
			if (this.prompt.customFill == "RenazinSpy")
			{
				this.RenazinSpy();
			}
			if (this.prompt.customFill == "GoblinHoleBanditJoin")
			{
				this.GoblinHoleBanditJoin();
			}
			if (this.prompt.customFill == "GoblinHoleBanditLeave")
			{
				this.GoblinHoleBanditLeave();
			}
		}
		if (this.prompt.type == Prompts.types.tooltip)
		{
			this.state = 1;
			Links.x.hudControl.ShowTutorialTooltip(this.prompt.textID);
		}
	}

	// Token: 0x0600085C RID: 2140 RVA: 0x000B72E0 File Offset: 0x000B54E0
	private IEnumerator HostileWait()
	{
		while (this.HitCharacterCount() > 0)
		{
			if (this.hostileCoroutine != null)
			{
				this.Action(true);
			}
			yield return null;
		}
		this.hostileCoroutine = null;
		yield break;
	}

	// Token: 0x0600085D RID: 2141 RVA: 0x000B72EF File Offset: 0x000B54EF
	public void RenazinSpy()
	{
		if (this.hostileCoroutine == null)
		{
			this.hostileCoroutine = this.RenazinSpyWait();
			base.StartCoroutine(this.hostileCoroutine);
		}
	}

	// Token: 0x0600085E RID: 2142 RVA: 0x000B7312 File Offset: 0x000B5512
	public void GoblinHoleBanditJoin()
	{
		if (this.hostileCoroutine == null)
		{
			this.hostileCoroutine = this.GoblinHoleBanditJoinWait();
			base.StartCoroutine(this.hostileCoroutine);
		}
	}

	// Token: 0x0600085F RID: 2143 RVA: 0x000B7335 File Offset: 0x000B5535
	public void GoblinHoleBanditLeave()
	{
		if (this.hostileCoroutine == null)
		{
			this.hostileCoroutine = this.GoblinHoleBanditLeaveWait();
			base.StartCoroutine(this.hostileCoroutine);
		}
	}

	// Token: 0x06000860 RID: 2144 RVA: 0x000B7358 File Offset: 0x000B5558
	private bool CanStartCinematic()
	{
		return Links.x.gaia.sceneLoaded && !Records.x.InCombat(false) && !Records.x.inMenus && !Records.x.paused && !Records.x.pocketPause && !Records.x.removeControls && !Records.x.saving && !Links.x.rtsCamera.puzzleTarget && !Links.x.combat.inPocketAttack && !Links.x.combat.inRally && !Records.x.dialogue;
	}

	// Token: 0x06000861 RID: 2145 RVA: 0x000B740C File Offset: 0x000B560C
	private bool Nearby(Character c, string startIndoorID, Character center, float dist, bool testIndoorID)
	{
		return c && center && (!(c.indoorID != startIndoorID) || !testIndoorID) && (c.currentPosition - center.currentPosition).sqrMagnitude <= dist * dist;
	}

	// Token: 0x06000862 RID: 2146 RVA: 0x000B7461 File Offset: 0x000B5661
	private IEnumerator RenazinSpyWait()
	{
		while (!Links.x.gaia.sceneLoaded)
		{
			yield return null;
		}
		Character c = Links.x.diorama.FindCharacterAnyState("RenazinInformantFarmer");
		Character c2 = Links.x.diorama.FindCharacterAnyState("RenazinSpy");
		if (Records.x.editor)
		{
			string text = "spy wait ";
			Character character = c;
			string text2 = ((character != null) ? character.ToString() : null);
			string text3 = " ";
			Character character2 = c2;
			Debug.Log(text + text2 + text3 + ((character2 != null) ? character2.ToString() : null));
		}
		if (c)
		{
			bool inCombatWithSpy = false;
			while (QuestLog.GetQuestState("D6_RenazinSpy") == QuestState.Unassigned && this.hitCharacters.Count > 0)
			{
				if (c2 && Links.x.dialogue.npc1 == c2 && !inCombatWithSpy)
				{
					if (c)
					{
						c.StartQuip("Help!");
					}
					inCombatWithSpy = true;
					if (Records.x.editor)
					{
						Debug.Log("In combat with spy");
					}
				}
				yield return null;
			}
			if (c && c2 && inCombatWithSpy)
			{
				while (Records.x.dialogue)
				{
					yield return null;
				}
				while (Records.x.InCombat(false) && !this.Nearby(c, "", c2, 40f, false) && c && c2)
				{
					yield return null;
				}
				if (this.Nearby(c, "", c2, 40f, false) && c && c2 && c && c2)
				{
					if ((c2.tr.position - c.tr.position).sqrMagnitude < 1600f && c && !c.fleeing)
					{
						QuestLog.SetQuestState("D6_RenazinInformant", QuestState.Active);
						c.StartQuip("Help!");
						c.ignoreNodeIDs = true;
						c.Flee(Links.x.main.node, false, Links.x.gameplay.seconds, 300f);
					}
					yield return null;
				}
			}
			if (QuestLog.GetQuestState("D6_RenazinSpy") != QuestState.Unassigned && this.hitCharacters.Count > 0)
			{
				if (Records.x.editor)
				{
					Debug.Log("neary by: " + this.Nearby(c, "", Links.x.main, 30f, false).ToString());
				}
				if (this.Nearby(c, "", Links.x.main, 30f, false) && c && this.hitCharacters.Count > 0)
				{
					if (c2)
					{
						if (Records.x.editor)
						{
							Debug.Log("neary by c and c2: " + (c2.tr.position - c.tr.position).sqrMagnitude.ToString());
						}
						if ((c2.tr.position - c.tr.position).sqrMagnitude < 1600f)
						{
							while (!this.CanStartCinematic() && this.hitCharacters.Count > 0)
							{
								yield return null;
							}
							if (!this.Nearby(c, "", Links.x.main, 30f, false) && c && this.hitCharacters.Count > 0)
							{
								yield return null;
							}
							if (this.hitCharacters.Count > 0 && c && this.Nearby(c, "", Links.x.main, 30f, false))
							{
								QuestLog.SetQuestState("D6_RenazinInformant", QuestState.Active);
								if (c.hostility < 2 && c.IsSentient())
								{
									Links.x.gameplay.StartDialogue(c, Links.x.main, null, null, c.stats.dialogueFile);
								}
								this.state = 1;
							}
						}
					}
				}
				else
				{
					if (inCombatWithSpy && c && c.hostility < 2)
					{
						Debug.Log(this.CanStartCinematic());
						while (!this.CanStartCinematic() && this.hitCharacters.Count > 0)
						{
							yield return null;
						}
						Debug.Log(this.hitCharacters.Count);
						if (this.hitCharacters.Count > 0)
						{
							Character firstAvailableParty = Links.x.GetFirstAvailableParty(this.center);
							Character secondAvailableParty = Links.x.GetSecondAvailableParty(this.center, firstAvailableParty);
							Character thirdAvailableParty = Links.x.GetThirdAvailableParty(this.center, firstAvailableParty, secondAvailableParty);
							Character fourthAvailableParty = Links.x.GetFourthAvailableParty(this.center, firstAvailableParty, secondAvailableParty, thirdAvailableParty);
							if (secondAvailableParty)
							{
								Links.x.dialogue.initiateNum = 0;
								Links.x.gameplay.StartDialogue(secondAvailableParty, firstAvailableParty, thirdAvailableParty, fourthAvailableParty, "Rozafir/PartySpyDiscussion");
							}
						}
					}
					if (Records.x.editor)
					{
						Debug.Log("neary by c and c2: " + (c2.tr.position - c.tr.position).sqrMagnitude.ToString());
					}
					while (!this.Nearby(c, "", Links.x.main, 20f, false) && c)
					{
						if (this.hitCharacters.Count <= 0)
						{
							break;
						}
						yield return null;
					}
					while (!this.CanStartCinematic() && this.hitCharacters.Count > 0)
					{
						yield return null;
					}
					if (this.hitCharacters.Count > 0 && c && QuestLog.GetQuestState("D6_RenazinInformant") == QuestState.Unassigned)
					{
						c.ClearNodePath();
						if (c.hostility < 2)
						{
							Links.x.gameplay.StartDialogue(c, Links.x.main, null, null, c.stats.dialogueFile);
						}
						this.state = 1;
					}
				}
			}
		}
		this.hostileCoroutine = null;
		yield break;
	}

	// Token: 0x06000863 RID: 2147 RVA: 0x000B7470 File Offset: 0x000B5670
	private bool SameNode(Character c1, Character c2)
	{
		return c1 && c2 && c1.node != null && c2.node != null && c1.node.Area == c2.node.Area;
	}

	// Token: 0x06000864 RID: 2148 RVA: 0x000B74AD File Offset: 0x000B56AD
	private IEnumerator GoblinHoleBanditJoinWait()
	{
		while (!Links.x.gaia.sceneLoaded)
		{
			yield return null;
		}
		Character c = Links.x.diorama.FindCharacterAnyState("FallsBanditFriend");
		if (Records.x.editor)
		{
			string text = "bandit wait ";
			Character character = c;
			Debug.Log(text + ((character != null) ? character.ToString() : null));
		}
		if (c)
		{
			if (!c.vipFollow)
			{
				while (!this.SameNode(c, Links.x.main))
				{
					yield return null;
				}
				while (!this.CanStartCinematic())
				{
					yield return null;
				}
				if (!c.dead && !c.stunned)
				{
					QuestLog.SetQuestState("E6_BanditFriend", QuestState.ActivePart2);
					Links.x.gameplay.StartDialogue(c, Links.x.main, null, null, c.stats.dialogueFile);
				}
			}
			else
			{
				this.state = 1;
			}
		}
		this.hostileCoroutine = null;
		yield break;
	}

	// Token: 0x06000865 RID: 2149 RVA: 0x000B74BC File Offset: 0x000B56BC
	private IEnumerator GoblinHoleBanditLeaveWait()
	{
		if (QuestLog.GetQuestState("E6_BanditFriend") != QuestState.Success)
		{
			while (!Links.x.gaia.sceneLoaded && !Records.x.removeControls)
			{
				yield return null;
			}
			Character c = Links.x.diorama.FindCharacterAnyState("FallsBanditFriend");
			Character c2 = Links.x.diorama.FindCharacterAnyState("FallsBanditA");
			Character c3 = Links.x.diorama.FindCharacterAnyState("FallsBanditB");
			if (Records.x.editor)
			{
				string[] array = new string[6];
				array[0] = "bandit wait ";
				int num = 1;
				Character character = c;
				array[num] = ((character != null) ? character.ToString() : null);
				array[2] = " ";
				int num2 = 3;
				Character character2 = c2;
				array[num2] = ((character2 != null) ? character2.ToString() : null);
				array[4] = " ";
				int num3 = 5;
				Character character3 = c3;
				array[num3] = ((character3 != null) ? character3.ToString() : null);
				Debug.Log(string.Concat(array));
			}
			if (c)
			{
				if (!c.dead && !c.stunned && c.hostility == 1 && c.vipFollow)
				{
					while (!this.CanStartCinematic())
					{
						yield return null;
					}
					bool hasFriend = false;
					if (c2 && !c2.stunned && !c2.dead)
					{
						hasFriend = true;
					}
					if (c3 && !c3.stunned && !c3.dead)
					{
						hasFriend = true;
					}
					if (hasFriend)
					{
						while (!this.Nearby(c3, "", Links.x.main, 20f, false) && !this.Nearby(c2, "", Links.x.main, 20f, false) && c && this.hitCharacters.Count > 0)
						{
							yield return null;
						}
					}
					if ((this.Nearby(c3, "", Links.x.main, 20f, false) || this.Nearby(c2, "", Links.x.main, 20f, false) || !hasFriend) && c && this.hitCharacters.Count > 0)
					{
						QuestLog.SetQuestState("E6_BanditFriend", QuestState.Success);
						Links.x.dialogue.npc1 = c;
						Links.x.dialogue.EndVIPQuest();
						hasFriend = false;
						if (!c.stunned && !c.dead)
						{
							if (c2 && !c2.stunned && !c2.dead)
							{
								c2.meshAlwaysOn = true;
								c2.SetMeshState(true);
								hasFriend = true;
							}
							if (c3 && !c3.stunned && !c3.dead)
							{
								c3.meshAlwaysOn = true;
								c3.SetMeshState(true);
								hasFriend = true;
							}
							if (hasFriend)
							{
								Character character4 = c2;
								if (!character4)
								{
									character4 = c3;
								}
								if (!character4.dead && !character4.stunned)
								{
									Links.x.gameplay.StartDialogue(character4, Links.x.main, null, null, character4.stats.dialogueFile);
								}
							}
							else
							{
								if (c2 && c2.stunned)
								{
									QuestLog.SetQuestState("E6_BanditA", QuestState.Success);
								}
								if (c3 && c3.stunned)
								{
									QuestLog.SetQuestState("E6_BanditB", QuestState.Success);
								}
								Links.x.gameplay.StartDialogue(c, Links.x.main, null, null, c.stats.dialogueFile);
							}
						}
						else
						{
							if (c2)
							{
								c2.hostility = 2;
							}
							if (c3)
							{
								c3.hostility = 2;
							}
						}
					}
				}
				else if (!c.dead && !c.stunned && (float)c.hostility == 2f)
				{
					if (c2)
					{
						c2.hostility = 2;
					}
					if (c3)
					{
						c3.hostility = 2;
					}
				}
				else if (!c.dead && !c.stunned && (float)c.hostility == 1f && !c.vipFollow)
				{
					Character npc = c2;
					if (!npc)
					{
						npc = c3;
					}
					if (!npc.dead && !npc.stunned)
					{
						while (!this.Nearby(npc, "", Links.x.main, 10f, false) && this.hitCharacters.Count > 0)
						{
							yield return null;
						}
						if (QuestLog.GetQuestState("E6_BanditA") == QuestState.Unassigned)
						{
							Links.x.gameplay.StartDialogue(npc, Links.x.main, null, null, npc.stats.dialogueFile);
						}
					}
					npc = null;
				}
			}
			c = null;
			c2 = null;
			c3 = null;
		}
		this.hostileCoroutine = null;
		yield break;
	}

	// Token: 0x06000866 RID: 2150 RVA: 0x000B74CB File Offset: 0x000B56CB
	public void Ishaat()
	{
		if (!Links.x.gameplay.gameObject.GetComponent<Cinematics>())
		{
			Links.x.gameplay.gameObject.AddComponent<Cinematics>().Ishaat(this);
		}
	}

	// Token: 0x06000867 RID: 2151 RVA: 0x000B7504 File Offset: 0x000B5704
	public void FinishQuip()
	{
		if (this.linkedItems != null)
		{
			for (int i = 0; i < this.linkedItems.Count; i++)
			{
				this.linkedItems[i].active = true;
				this.linkedItems[i].gameObject.SetActive(true);
				this.linkedItems[i].PlayFX();
				MasterAudio.PlaySoundAndForget("Inventory", 0.4f, new float?(1f), 0f, this.linkedItems[i].invRow._Sound, null);
				Links.x.gameplay.StartHoverTimer(this.linkedItems[i]);
			}
		}
	}

	// Token: 0x06000868 RID: 2152 RVA: 0x000B75CC File Offset: 0x000B57CC
	public void FinishCharmerCheck(Character character, int roll)
	{
		MasterAudio.PlaySoundAndForget("Feedback", 1f, new float?(1f), 0f, "PromptCharm", null);
		character.stats.AddSkillProgress(23, (float)this.prompt.charmerSkillCheck, null);
		character.stats.AddSkillProgress(24, (float)this.prompt.charmerSkillCheck, null);
		character.stats.AddSkillProgress(25, (float)this.prompt.charmerSkillCheck, null);
		this.state = 1;
		if (this.linkedItems != null)
		{
			for (int i = 0; i < this.linkedItems.Count; i++)
			{
				this.linkedItems[i].active = true;
				this.linkedItems[i].gameObject.SetActive(true);
				this.linkedItems[i].PlayFX();
				MasterAudio.PlaySoundAndForget("Inventory", 0.4f, new float?(1f), 0f, this.linkedItems[i].invRow._Sound, null);
				Links.x.gameplay.StartHoverTimer(this.linkedItems[i]);
			}
		}
		if (this.prompt.alsoSetGameObjectStatus)
		{
			if (this.prompt.toggleState_ == Prompts.ToggleState.On)
			{
				this.prompt.gameObjectToToggle.SetActive(true);
				if (this.prompt.gameObjectToToggle2)
				{
					this.prompt.gameObjectToToggle2.SetActive(true);
				}
			}
			else
			{
				this.prompt.gameObjectToToggle.SetActive(false);
				if (this.prompt.gameObjectToToggle2)
				{
					this.prompt.gameObjectToToggle2.SetActive(false);
				}
			}
			if (this.prompt.updateAstar)
			{
				this.UpdateAstar(this.prompt.gameObjectToToggle.transform.position, false);
			}
		}
	}

	// Token: 0x06000869 RID: 2153 RVA: 0x000B77C8 File Offset: 0x000B59C8
	public void FinishRogueCheck(Character character, int roll)
	{
		this.state = 1;
		MasterAudio.PlaySoundAndForget("Feedback", 1f, new float?(1f), 0f, "PromptRogue", null);
		character.stats.AddSkillProgress(20, (float)this.prompt.rangerSkillCheck, null);
		character.stats.AddSkillProgress(21, (float)this.prompt.rangerSkillCheck, null);
		character.stats.AddSkillProgress(22, (float)this.prompt.rangerSkillCheck, null);
		if (this.linkedItems != null)
		{
			for (int i = 0; i < this.linkedItems.Count; i++)
			{
				this.linkedItems[i].active = true;
				this.linkedItems[i].gameObject.SetActive(true);
				this.linkedItems[i].PlayFX();
				MasterAudio.PlaySoundAndForget("Inventory", 0.4f, new float?(1f), 0f, this.linkedItems[i].invRow._Sound, null);
				Links.x.gameplay.StartHoverTimer(this.linkedItems[i]);
			}
		}
		if (this.prompt.alsoSetGameObjectState)
		{
			if (this.prompt.toggleState_ == Prompts.ToggleState.On)
			{
				this.prompt.gameObjectToToggle.SetActive(true);
				if (this.prompt.gameObjectToToggle2)
				{
					this.prompt.gameObjectToToggle2.SetActive(true);
				}
			}
			else
			{
				this.prompt.gameObjectToToggle.SetActive(false);
				if (this.prompt.gameObjectToToggle2)
				{
					this.prompt.gameObjectToToggle2.SetActive(false);
				}
			}
			if (this.prompt.updateAstar)
			{
				this.UpdateAstar(this.prompt.gameObjectToToggle.transform.position, false);
			}
		}
	}

	// Token: 0x0600086A RID: 2154 RVA: 0x000B79C4 File Offset: 0x000B5BC4
	public void SetGhostState(string questName, bool stateToSet, bool realtime)
	{
		if (stateToSet)
		{
			Links.x.diorama.GhostFogOn();
			using (IEnumerator enumerator = base.transform.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					object obj = enumerator.Current;
					Transform transform = (Transform)obj;
					if (transform != base.transform)
					{
						foreach (object obj2 in transform)
						{
							((Transform)obj2).gameObject.SetActive(false);
						}
					}
				}
				return;
			}
		}
		if (!Links.x.diorama.mapCanResurrect)
		{
			realtime = false;
		}
		if (realtime)
		{
			if (!base.gameObject.GetComponent<Cinematics>())
			{
				Links.x.gameObject.AddComponent<Cinematics>().ClearGhostFog(base.gameObject);
				return;
			}
		}
		else
		{
			Links.x.diorama.GhostFogOff();
			foreach (object obj3 in base.transform)
			{
				Transform transform2 = (Transform)obj3;
				if (transform2 != base.transform)
				{
					transform2.gameObject.SetActive(true);
					foreach (object obj4 in transform2)
					{
						((Transform)obj4).gameObject.SetActive(true);
					}
				}
			}
		}
	}

	// Token: 0x0600086B RID: 2155 RVA: 0x000B7B80 File Offset: 0x000B5D80
	public void AddLinkedItem(global::Item item)
	{
		if (this.linkedItems == null)
		{
			this.linkedItems = new List<global::Item>();
		}
		if (!this.linkedItems.Contains(item))
		{
			this.linkedItems.Add(item);
		}
	}

	// Token: 0x0600086C RID: 2156 RVA: 0x000B7BAF File Offset: 0x000B5DAF
	public string DecipherText(string text)
	{
		if (text == "Farms Up Ahead")
		{
			return "This sign says the Forked Vale Farmstead is just ahead";
		}
		return "I can't read this";
	}

	// Token: 0x0600086D RID: 2157 RVA: 0x000B7BCC File Offset: 0x000B5DCC
	public string Quip(string text, string companionName, string race)
	{
		string sceneName = Links.x.diorama.sceneName;
		if (text == "")
		{
			return "";
		}
		if (sceneName.Contains("C6"))
		{
			if (companionName == "Leader" && text == "ShromersGate")
			{
				return "Shroomers at the gate!";
			}
			if (companionName == "Ranger")
			{
				if (text == "Goblins!")
				{
					return "Do you hear that? Goblins!";
				}
				if (text == "Goblins2!")
				{
					return "Offal and waste everywhere! Goblins are afoot!";
				}
			}
			if (companionName == "Thief" && text == "a basket was dropped here")
			{
				return "A basket lies hidden in the grass";
			}
			if (companionName == "Varuchov" && text == "Good Farm Down Here")
			{
				return "'Tis good to see a mushroom farm at the Forten";
			}
			if (companionName == "Charmer" && text == "Looks like a crop goblin camp")
			{
				return "The crop goblins have set up camp here";
			}
			if (text == "Ghosts Worse At Night")
			{
				return "Ghost fog...a grave keeper must be nearby";
			}
			if (text == "someone had been camping here")
			{
				return "Someone set up camp here not long ago";
			}
			if (text == "DryadVIP_C6Cave")
			{
				return "These mushrooms should not grow here, we have to clear them";
			}
			if (text == "DryadVIP_C6Cave_BadExit")
			{
				return "The blood tree lies another way";
			}
			if (text == "DryadVIP_C6Cave_GoodExit")
			{
				return "This will lead us to the blood tree";
			}
		}
		if (sceneName.Contains("C5"))
		{
			if (text == "gems")
			{
				return "Just as I thought, the spiral led to Vol's bounty";
			}
			if (text == "LoAVolTreePrettyC5")
			{
				return "Let us visit the Voltree";
			}
			if (text == "LoWhatASadSightWOrthyofASadSong")
			{
				return "Poor creature, someone should write a song for it";
			}
			if (text == "LoFriendsASemizenStatueOfHarvest")
			{
				return "This hill smells of crisp apples and fresh figs";
			}
			if (text == "a basket washed up here")
			{
				return "Something has washed ashore";
			}
			if (text == " a basket washed up here 2")
			{
				return "Is that a basket in the rocks?";
			}
			if (text == "a basket washed up here 3")
			{
				return "Do you see a basket there?";
			}
			if (text == "hidden stash here")
			{
				return "Some stash long forgotten lies here";
			}
		}
		if (sceneName.Contains("D6"))
		{
			if (text == "VaruchovSanctuaryD6")
			{
				return "A proper Varuchov cavern";
			}
			if (text == "WhatMelodyEchoesinD6")
			{
				return "That music...can anyone else hear it? Or is it only in my mind?";
			}
			if (text == "a basket is tucked away here 1")
			{
				return "A basket is tucked away here";
			}
			if (text == "a basket is tucked away here 2")
			{
				return "Treasure!";
			}
			if (text == "a basket is tucked away here 3")
			{
				return "Look there!";
			}
			if (text == "a basket is tucked away here 4")
			{
				return "What's this?";
			}
			if (text == "a basket is tucked away here 5")
			{
				return "Do you see that basket?";
			}
			if (text == "gem a")
			{
				return "Is that a gem?";
			}
			if (text == "gem b")
			{
				return "Vol is generous!";
			}
		}
		if (sceneName.Contains("D5"))
		{
			if (text == "gems")
			{
				return "Bless Vol for this treasure";
			}
			if (text == "LoMassGraves")
			{
				return "The Lachovinians must have feared their dead to abandon them so...plague, mayhap? Or something worse?";
			}
			if (text == "whitekey")
			{
				return "These graves are well picked over, though I think I spy a key in the dirt below";
			}
			if (text == "hey an opening1")
			{
				return "An opening lies ahead!";
			}
			if (text == "hey an opening2")
			{
				return "Though it is very dark, I daresay I see the path curve before us";
			}
		}
		if (sceneName.Contains("E6"))
		{
			if (text == "E6_CanHearWaterThatWay")
			{
				return "I smell fresh air past these brambles.";
			}
			if (text == "E6_Goblins")
			{
				return "Vol dislikes these crop goblins. I can feel his anger vibrating in the soles of the my very feet.";
			}
			if (text == "GoblinHoleBanditWrongWay")
			{
				return "If we leave this way I cannot meet up with my friends.";
			}
			if (text == "GoblinHoleBanditRightWay")
			{
				return "This is familiar, we are nearly there!";
			}
			if (text == "a basket was dropped here 2")
			{
				return "Look there!";
			}
			if (text == "a basket was dropped here 4")
			{
				return "What's this?";
			}
			if (text == "a basket was dropped here 6")
			{
				return "Do you see that basket?";
			}
			if (text == "gem a")
			{
				return "Something shines in the water";
			}
			if (text == "gem b")
			{
				return "A gem!";
			}
		}
		if (sceneName.Contains("F4") && text == "looks good")
		{
			return "The castle is near!";
		}
		if (Records.x.editor)
		{
			return "Quip Missing";
		}
		return "";
	}

	// Token: 0x0600086E RID: 2158 RVA: 0x000B7FE0 File Offset: 0x000B61E0
	public string SkillQuip(string text, string race)
	{
		if (Links.x.diorama.sceneName.Contains("C5"))
		{
			if (text == "BakkasSleepHereLookOut_N")
			{
				return "These trees would be a likely hideout for bakkas";
			}
			if (text == "BakkasSleepHereLookOut_S")
			{
				return "Could be bakkas afoot";
			}
			if (text == "BakkasSleepHereLookOut_NE")
			{
				return "Beware a bakka ambush";
			}
			if (text == "BakkasSleepHereLookOut_NERootwall")
			{
				return "Bakkas in those trees, stay sharp!";
			}
			if (text == "BakkasSleepHereLookOut_MiddleTree")
			{
				return "I smell the must of a bakka horde";
			}
			if (text == "C5_SomeonesHidingInHere")
			{
				return "There's a cave inside those trees";
			}
			if (text == "C5_GoblinFort")
			{
				return "A path lies through these trees";
			}
			if (text == "C5_ClearingThroughTrees")
			{
				return "Look! A clearing through these trees";
			}
		}
		if (text == "a basket was dropped here b")
		{
			return "A basket lies in the dirt";
		}
		if (Links.x.diorama.sceneName.Contains("D5"))
		{
			if (text == "D5_small hole in the trees")
			{
				return "Lo! A pathway lies through these trees";
			}
			if (text == "D5_grave forest secret")
			{
				return "A hidden passage";
			}
			if (text == "D5_clearing down this ridge")
			{
				return "Look long and you'll see a clearing down that ridge";
			}
			if (text == "D5__LookoutPath")
			{
				return "A path to the lookout!";
			}
		}
		if (Links.x.diorama.sceneName.Contains("D6"))
		{
			if (text == "ImpRatAmbush")
			{
				return "I smell imp rats nearby, many imp rats!";
			}
			if (text == "D6_SouthSecretPath")
			{
				return "I see a path here!";
			}
			if (text == "D6_SouthEastSecretPath2")
			{
				return "A path in the darkness";
			}
			if (text == "D6_SouthEastSecretPath")
			{
				return "A hidden path!";
			}
			if (text == "D6_NorthSecretPath")
			{
				return "Look sharp, and you'll see a passage here";
			}
			if (text == "BakkasNRdge")
			{
				return "Smells like bakkas";
			}
			if (text == "a basket was dropped here 1")
			{
				return "Look, a hidden chest!";
			}
			if (text == "a basket was dropped here 3")
			{
				return "Something buried here";
			}
			if (text == "a basket was dropped here 4")
			{
				return "Something buried here";
			}
			if (text == "a basket was dropped here 5")
			{
				return "I think I see a half-buried chest";
			}
			if (text == "a basket was dropped here 6")
			{
				return "What's that?";
			}
			if (text == "a basket was dropped here 7")
			{
				return "Look close, a chest lies here";
			}
		}
		if (Links.x.diorama.sceneName.Contains("E6"))
		{
			if (text == "E6_SouthHillPath")
			{
				return "I see a path here!";
			}
			if (text == "E6_CavePath1")
			{
				return "A winding path through there";
			}
			if (text == "E6_CavePath2")
			{
				return "A hidden path!";
			}
			if (text == "E6_CavePath3")
			{
				return "Look sharp, and you'll see a passage here";
			}
			if (text == "BakkasNRdge" || text == "BakkasHill")
			{
				return "Smells like bakkas";
			}
			if (text == "FishBridgeAmbush")
			{
				return "Somethings moves in the water below";
			}
			if (text == "a basket was dropped here 3")
			{
				return "Something buried here";
			}
			if (text == "a basket was dropped here 7")
			{
				return "Look, a hidden chest!";
			}
			if (text == "a basket was dropped here 5")
			{
				return "Treasure!";
			}
			if (text == "a basket was dropped here 1")
			{
				return "I think I see a half-buried chest";
			}
		}
		if (text == "ImpWall")
		{
			return "This wall is an illusion";
		}
		if (text == "C6_GobletPathHere")
		{
			return "A cave lies on that path";
		}
		if (text == "BarracksBuriedEmeraldsQuip")
		{
			return "Is that an emerald hidden between the stones?";
		}
		if (text == "a weed is growing here")
		{
			return "These weeds below our feet will poison a Boro";
		}
		if (text == "C6_CliffRidgeShrubs")
		{
			return "A path lies through these rocks";
		}
		if (text == "BakkasSleepHereLookOut")
		{
			return "Careful, that's a bakka nest";
		}
		if (text == "StaglandsMerchant")
		{
			return "That rich monger from the Staglands sleeps in this cot";
		}
		if (text == "HalfBuriedHammerQuip")
		{
			return "Is that a hammer half-buried in the ground?";
		}
		if (text == "item_GroveFightSuppliesQuip")
		{
			return "What hides here below our very feet?";
		}
		if (text == "item_GroveFightSupplies1Quip")
		{
			return "What hides here below our very feet?";
		}
		if (text == "StaglandsMerchantQuip")
		{
			return "That weapons merchant sleeps here";
		}
		if (text == "poorlyhiddenoffdutykey1Quip")
		{
			return "Looks like a key to a guard's chest...";
		}
		if (text == "droppedguardkeyonroadQuip")
		{
			return "Someone dropped a key";
		}
		if (text == "CropGobScoutsAtNightHere")
		{
			return "This way crop goblins oft pass";
		}
		if (text == "FishWalkersAtNightHere")
		{
			return "This way crop goblins oft pass";
		}
		if (text == "CropGobScoutsAtNightHere")
		{
			return "This way marin oft pass";
		}
		if (text == "cave below us but too steep")
		{
			return "A cave lies below, but out of reach";
		}
		if (text == "BakkasSleepHereLookOutCave")
		{
			return "Signs of bakkas sleeping here";
		}
		if (text == "InsectooAreHereEvenCloserGroveC6")
		{
			return "Signs of dimi-greva on these rocks";
		}
		if (text == "GroveC6_SpidersAreFightingInsectooHere")
		{
			return "Guard yourself, I see tracks of both spiders and greva here";
		}
		return "Quip Missing";
	}

	// Token: 0x0600086F RID: 2159 RVA: 0x000B848C File Offset: 0x000B668C
	private void RemoveCampObjects()
	{
		Debug.Log("Removing stuff");
		if (this.prompt.campObjects && this.prompt.campObjects.activeSelf)
		{
			foreach (Collider collider in this.prompt.campObjects.GetComponentsInChildren<Collider>(true))
			{
				this.UpdateAstar(collider.bounds.center, true);
			}
			this.prompt.campObjects.SetActive(false);
		}
		this.creatures = this.prompt.campCreatures;
		foreach (Creatures creatures in this.creatures)
		{
			CreatureActions component = creatures.gameObject.GetComponent<CreatureActions>();
			if (component)
			{
				component.EveryoneLeave();
				string text = "Everyone leaving for ";
				CreatureActions creatureActions = component;
				Debug.Log(text + ((creatureActions != null) ? creatureActions.ToString() : null));
			}
		}
	}

	// Token: 0x06000870 RID: 2160 RVA: 0x000B859C File Offset: 0x000B679C
	private void UpdateAstar(Vector3 pt, bool bothFOW)
	{
		AstarPath.active.UpdateGraphs(new Bounds(pt + new Vector3(0f, -1f, 0f), new Vector3(10f, 40f, 10f)));
		if (bothFOW)
		{
			Links.x.fogOfWar.UpdateGrid(pt, 10f);
			Links.x.fogOfWarInterior.UpdateGrid(pt, 10f);
			return;
		}
		if (!Links.x.cameraEffects.indoors)
		{
			Links.x.fogOfWar.UpdateGrid(pt, 10f);
			return;
		}
		Links.x.fogOfWarInterior.UpdateGrid(pt, 10f);
	}

	// Token: 0x04000D29 RID: 3369
	public Prompts prompt;

	// Token: 0x04000D2A RID: 3370
	public Bounds bounds;

	// Token: 0x04000D2B RID: 3371
	public Collider coll;

	// Token: 0x04000D2C RID: 3372
	public Vector3 center;

	// Token: 0x04000D2D RID: 3373
	public int state;

	// Token: 0x04000D2E RID: 3374
	public string characterName;

	// Token: 0x04000D2F RID: 3375
	public List<global::Item> linkedItems;

	// Token: 0x04000D30 RID: 3376
	private StringFast str = new StringFast(64);

	// Token: 0x04000D31 RID: 3377
	public string saveName;

	// Token: 0x04000D32 RID: 3378
	private List<Creatures> npc;

	// Token: 0x04000D33 RID: 3379
	private bool objStartState;

	// Token: 0x04000D34 RID: 3380
	public List<Character> hitCharacters = new List<Character>();

	// Token: 0x04000D35 RID: 3381
	private List<CreatureActions> creatureActions;

	// Token: 0x04000D36 RID: 3382
	public bool waitingForCombatEnd;

	// Token: 0x04000D37 RID: 3383
	private List<Creatures> creatures;

	// Token: 0x04000D38 RID: 3384
	private IEnumerator hostileCoroutine;
}
