using System;
using System.Collections;
using System.Collections.Generic;
using Pathfinding;
using PixelCrushers.DialogueSystem;
using UnityEngine;

// Token: 0x0200004D RID: 77
public class Sensory : MonoBehaviour
{
	// Token: 0x060008D6 RID: 2262 RVA: 0x000BF748 File Offset: 0x000BD948
	private void Start()
	{
		this.diorama = base.gameObject.GetComponent<Diorama>();
		this.characters = this.diorama.characters;
		this.party = Links.x.party;
		this.deads = Links.x.deads;
		this.linksNPC = Links.x.npcs;
		this.promptActions = this.diorama.promptActions;
		for (int i = 0; i < 1; i++)
		{
			this.footsteps.Add(false);
		}
		this.cams = this.diorama.sceneViews;
		for (int j = 0; j < this.cams.Count; j++)
		{
			this.pix.Add(new Color32[this.cams.Count]);
			this.sourceWidths.Add(0);
			this.terrainDimensions.Add(new Vector2(0f, 0f));
		}
		for (int k = 0; k < this.cams.Count; k++)
		{
			if (this.cams[k].terrainMap)
			{
				MeshRenderer component = this.cams[k].terrainMap.GetComponent<MeshRenderer>();
				component.enabled = true;
				this.cams[k].terrainMap.SetActive(true);
				Texture2D texture2D = component.sharedMaterial.mainTexture as Texture2D;
				this.pix[k] = texture2D.GetPixels32(0);
				int width = texture2D.width;
				int height = texture2D.height;
				this.terrainDimensions[k] = new Vector2((float)width, (float)height);
				this.sourceWidths[k] = texture2D.width;
				this.cams[k].terrainMap.layer = 24;
				component.enabled = false;
				if (k == 0)
				{
					this.terrainTextureWidthExt = width;
					this.terrainTextureHeightExt = height;
				}
				else
				{
					this.terrainTextureWidthInt = width;
					this.terrainTextureHeightInt = height;
				}
			}
		}
	}

	// Token: 0x060008D7 RID: 2263 RVA: 0x000BF943 File Offset: 0x000BDB43
	public void CreateMeshRenderer(Collider collider)
	{
	}

	// Token: 0x060008D8 RID: 2264 RVA: 0x000BF945 File Offset: 0x000BDB45
	private int CalculateIndex(int x, int y, int width)
	{
		return x + y * width;
	}

	// Token: 0x060008D9 RID: 2265 RVA: 0x000BF94C File Offset: 0x000BDB4C
	public string GetPixelColor(int x, int y, int camIndex)
	{
		if (camIndex == -1)
		{
			camIndex = 0;
		}
		this.currPix = this.pix[camIndex];
		int num = this.CalculateIndex(x, y, this.sourceWidths[camIndex]);
		Color32 color = this.currPix[num];
		int num2 = Links.x.MatchTerrainColors(color);
		if (num2 == 0)
		{
			return "Grass";
		}
		if (num2 == 1)
		{
			return "Sand";
		}
		if (num2 == 2)
		{
			return "Puddle";
		}
		if (num2 == 3)
		{
			return "Rocks";
		}
		if (num2 == 4)
		{
			return "Wood";
		}
		if (num2 == 5)
		{
			return "Fabric";
		}
		if (num2 == 6)
		{
			return "Snow";
		}
		if (num2 == 7)
		{
			return "Guts";
		}
		return "Grass";
	}

	// Token: 0x060008DA RID: 2266 RVA: 0x000BF9F4 File Offset: 0x000BDBF4
	public Color32 GetPixelColorForUndergroundMap(int x, int y)
	{
		this.currPix = this.pix[1];
		int num = this.CalculateIndex(x, y, this.sourceWidths[1]);
		return this.currPix[num];
	}

	// Token: 0x060008DB RID: 2267 RVA: 0x000BFA34 File Offset: 0x000BDC34
	private void Update()
	{
		if (Links.x.gaia.sceneLoaded)
		{
			this.bribeBadgeCount = Records.x.BribeBadgeCount();
			float num = 3f;
			if (!Records.x.windows)
			{
				num = 10f;
			}
			if (!this.checking || Time.timeSinceLevelLoad > this.timeSinceLastCheck + num)
			{
				if (this.sensoryCoroutine != null)
				{
					Debug.Log("Sensory code was stuck");
					base.StopCoroutine(this.sensoryCoroutine);
					this.sensoryCoroutine = null;
				}
				this.sensoryCoroutine = this.SensoryCheck();
				base.StartCoroutine(this.sensoryCoroutine);
				this.timeSinceLastCheck = Time.timeSinceLevelLoad;
			}
		}
	}

	// Token: 0x060008DC RID: 2268 RVA: 0x000BFADD File Offset: 0x000BDCDD
	public void SwitchingScenes()
	{
		if (this.sensoryCoroutine != null)
		{
			base.StopCoroutine(this.sensoryCoroutine);
			this.sensoryCoroutine = null;
		}
	}

	// Token: 0x060008DD RID: 2269 RVA: 0x000BFAFC File Offset: 0x000BDCFC
	private bool Stop()
	{
		bool flag = false;
		if (Records.x.waitForResurrect)
		{
			flag = true;
		}
		if (Links.x.combat.combatCinematics)
		{
			flag = true;
		}
		if (Records.x.paused || Records.x.pocketPause)
		{
			flag = true;
		}
		if (!Links.x.main)
		{
			flag = true;
		}
		if (Links.x.creation && Links.x.creation.open)
		{
			flag = true;
		}
		if (Links.x.gaia.waitingToRemoveScene)
		{
			flag = true;
		}
		if (Links.x.combat.inPocketAttack)
		{
			flag = true;
		}
		if (!Links.x.gaia.sceneLoaded)
		{
			flag = true;
		}
		return flag;
	}

	// Token: 0x060008DE RID: 2270 RVA: 0x000BFBB7 File Offset: 0x000BDDB7
	public IEnumerator SensoryCheck()
	{
		this.checking = true;
		bool flag = this.Stop();
		if (!flag && Links.x.main.node == null)
		{
			flag = true;
		}
		bool canDisableCharacters = true;
		if (Records.x.testPatrols && Records.x.editor)
		{
			canDisableCharacters = false;
		}
		bool enemiesCanAttack = true;
		if (Records.x.noCombat && Records.x.editor)
		{
			enemiesCanAttack = false;
		}
		float secondsWaited = 0f;
		float currentTime = Time.timeSinceLevelLoad;
		if (this.debug)
		{
			Debug.Log("Sensory check " + flag.ToString());
		}
		if (!flag)
		{
			int count = this.characters.Count;
			int num = this.party.Count;
			float closestDistance = float.PositiveInfinity;
			Character closestParty = null;
			Character character = null;
			bool inSearchRange = false;
			bool inCombatRange = false;
			bool startCombat = false;
			int noiseCount = this.noiseObj.Count;
			Vector3 vector = Vector3.zero;
			Vector3 vector2 = Vector3.zero;
			float angle = 0f;
			Character startCombatCharacter = null;
			Character startCombatSeenCharacter = null;
			float nodeSize = Records.x.nodeSize;
			float nodeSize2 = Records.x.nodeSize;
			this.SetupNoiseLists();
			this.npcs.Clear();
			for (int j = 0; j < count; j++)
			{
				character = this.characters[j];
				if (character && character.npc && !character.dead)
				{
					this.npcs.Add(character);
				}
			}
			this.checkParty.Clear();
			int num2 = 0;
			for (int k = 0; k < count; k++)
			{
				character = this.characters[k];
				if (character && !character.npc && !character.isBoro && !character.dead)
				{
					this.checkParty.Add(character);
					if (character.fowRevealer)
					{
						num2++;
					}
				}
			}
			int num3 = 0;
			int everyone = this.checkParty.Count + this.npcs.Count;
			int npcCount = this.npcs.Count;
			Vector3 vector3 = Vector3.zero;
			int num4 = this.party.Count;
			int partyCanSeeMeCount = 0;
			bool isHostileCharacter = false;
			bool foundAllianceEnemey = false;
			float closestDistToSeenCharacter = float.PositiveInfinity;
			Character startCombatTarget = null;
			bool canTalk = false;
			bool canTalkWhileSneaking = false;
			int dia = 0;
			bool locationMatch = false;
			int num23;
			for (int i = 0; i < everyone; i = num23 + 1)
			{
				flag = this.Stop();
				if (!flag)
				{
					if (i < this.npcs.Count)
					{
						character = this.npcs[i];
					}
					else
					{
						character = this.checkParty[i - npcCount];
					}
					if (!character)
					{
						flag = true;
					}
					if (Records.x.dialogue)
					{
						this.bribeBadgeCount = Records.x.BribeBadgeCount();
					}
				}
				if (!flag)
				{
					closestDistance = float.PositiveInfinity;
					inSearchRange = false;
					inCombatRange = false;
					closestParty = null;
					partyCanSeeMeCount = 0;
					isHostileCharacter = false;
					closestDistToSeenCharacter = float.PositiveInfinity;
					startCombatSeenCharacter = null;
					dia = character.stats.initiateDialogue;
					canTalk = character.stats.canTalk;
					canTalkWhileSneaking = false;
					if (canTalk)
					{
						canTalk = false;
						if (dia >= 1 && dia < 10)
						{
							canTalk = true;
						}
						if (dia > 10)
						{
							canTalk = true;
						}
						if (dia == 5 || dia == 15)
						{
							canTalkWhileSneaking = true;
						}
					}
					if (num3 > 50 && !startCombat)
					{
						yield return new WaitForSeconds(0.01f);
						this.bribeBadgeCount = Records.x.BribeBadgeCount();
						secondsWaited += 0.01f;
						num3 = 0;
						flag = this.Stop();
						if (!Links.x.gaia.sceneLoaded)
						{
							flag = true;
						}
					}
					if (Records.x.mainCharacterDead)
					{
						flag = true;
					}
				}
				if (!character.dead && !flag && !character.isBoro && character.tr)
				{
					vector = character.body.tr.rotation * Vector3.forward;
					if (character.moving)
					{
						vector = character.tr.rotation * Vector3.forward;
					}
					vector3 = character.tr.position;
					bool flag2 = false;
					if (character.hostility == 2 || character.hostility == 3 || character.attackingUntilBribe)
					{
						isHostileCharacter = true;
					}
					if (this.bribeBadgeCount > 0 && character.stats.isGuard)
					{
						isHostileCharacter = true;
					}
					if (!character.stunned && (isHostileCharacter || !character.npc || character.willBeHostile))
					{
						flag2 = true;
					}
					bool flag3;
					bool flag4;
					bool flag5;
					if (character.npc)
					{
						flag3 = false;
						flag4 = true;
						if (character.stats.hasEnemies)
						{
							num = everyone;
							flag3 = true;
							flag5 = false;
						}
						else
						{
							flag5 = false;
							num = this.checkParty.Count;
						}
					}
					else
					{
						flag4 = false;
						flag3 = false;
						flag5 = false;
						num = this.npcs.Count;
					}
					float num5;
					float num6;
					if (character.inCombat || character.party || character.sailing || character.summoned)
					{
						num5 = 360f;
						num6 = -360f;
					}
					else
					{
						num5 = 45f;
						num6 = -45f;
					}
					float num7 = character.stats.SightRadius(false, false, false);
					float num8 = num7 * num7;
					if (character.npc && character.creatures && !character.summoned)
					{
						character.creatures.FarFromPoints(currentTime, character);
					}
					for (int l = 0; l < num; l++)
					{
						flag = this.Stop();
						Character character2;
						if (flag3)
						{
							if (l < this.npcs.Count)
							{
								character2 = this.npcs[l];
							}
							else
							{
								character2 = this.checkParty[l - npcCount];
							}
							if (character2.npc)
							{
								flag5 = false;
								if (character2.stats.allegiance > 0U)
								{
									if (!character.stats.IsTargetAnEnemy(character2.stats.allegiance))
									{
										if (character2.hostility == 2 && character.hostility == 1 && character.stats.isGuard)
										{
											flag5 = true;
										}
										else
										{
											character2 = null;
										}
									}
									else if (character2.inactive)
									{
										character2 = null;
									}
									else
									{
										flag5 = true;
									}
								}
								else
								{
									character2 = null;
								}
							}
							else
							{
								flag5 = false;
							}
						}
						else if (flag4)
						{
							character2 = this.checkParty[l];
						}
						else
						{
							character2 = this.npcs[l];
						}
						if (character2 == character)
						{
							character2 = null;
						}
						if (character2 && character2.pipeSummons)
						{
							character2 = null;
						}
						if (character2 && !flag)
						{
							float num9 = this.SubtractVectors(vector3, character2.tr.position).sqrMagnitude;
							if (!character.inactive)
							{
								num3++;
							}
							bool flag6 = true;
							locationMatch = true;
							if (character.ghost && !character2.ghost && num9 < 16f)
							{
								character2.stats.GhostHit();
							}
							if (this.debug && !character.inactive)
							{
								string[] array = new string[26];
								array[0] = "Sight check ";
								int num10 = 1;
								Character character3 = character2;
								array[num10] = ((character3 != null) ? character3.ToString() : null);
								array[2] = " ";
								int num11 = 3;
								Character character4 = character;
								array[num11] = ((character4 != null) ? character4.ToString() : null);
								array[4] = " ";
								array[5] = locationMatch.ToString();
								array[6] = " dist ";
								array[7] = num9.ToString();
								array[8] = " sight ";
								array[9] = num8.ToString();
								array[10] = " character indoor id ";
								array[11] = character.indoorID;
								array[12] = " target indoor id";
								array[13] = character2.indoorID;
								array[14] = " hostile ";
								array[15] = isHostileCharacter.ToString();
								array[16] = " alliance ";
								array[17] = flag5.ToString();
								array[18] = " bb ";
								array[19] = this.bribeBadgeCount.ToString();
								array[20] = " update lists ";
								array[21] = flag2.ToString();
								array[22] = " sleeping ";
								array[23] = character.sleeping.ToString();
								array[24] = " inactive ";
								array[25] = character.inactive.ToString();
								Debug.Log(string.Concat(array));
								vector2 = this.SubtractVectorsNoY(character2.currentPosition, vector3);
								angle = Vector3.Angle(vector2, vector);
								string[] array2 = new string[5];
								int num12 = 0;
								Character character5 = character;
								array2[num12] = ((character5 != null) ? character5.ToString() : null);
								array2[1] = " ";
								array2[2] = angle.ToString();
								array2[3] = " ";
								array2[4] = Physics.Linecast(character.raycastPosition, character2.raycastPosition, Links.x.sightBlockers).ToString();
								Debug.Log(string.Concat(array2));
							}
							if (num9 < num8 && !character.inactive && locationMatch)
							{
								if (!character.inCombat && !character.party)
								{
									vector2 = this.SubtractVectorsNoY(character2.currentPosition, vector3);
									angle = Vector3.Angle(vector2, vector);
								}
								if (this.debug && !character.inactive)
								{
									string[] array3 = new string[8];
									array3[0] = "Angle check ";
									int num13 = 1;
									Character character6 = character2;
									array3[num13] = ((character6 != null) ? character6.ToString() : null);
									array3[2] = " ";
									int num14 = 3;
									Character character7 = character;
									array3[num14] = ((character7 != null) ? character7.ToString() : null);
									array3[4] = " ";
									array3[5] = angle.ToString();
									array3[6] = " ";
									array3[7] = num5.ToString();
									Debug.Log(string.Concat(array3));
								}
								if ((angle <= num5 && angle >= num6) || canTalk || character.party || character.inCombat || character.ambushing)
								{
									flag6 = character.indoorID != character2.indoorID || Physics.Linecast(character.raycastPosition, character2.raycastPosition, Links.x.sightBlockers);
									if (this.debug)
									{
										string[] array4 = new string[5];
										int num15 = 0;
										Character character8 = character;
										array4[num15] = ((character8 != null) ? character8.ToString() : null);
										array4[1] = " ";
										int num16 = 2;
										Character character9 = character2;
										array4[num16] = ((character9 != null) ? character9.ToString() : null);
										array4[3] = " sight blocked? ";
										array4[4] = flag6.ToString();
										Debug.Log(string.Concat(array4));
										if (flag6)
										{
											RaycastHit raycastHit;
											Physics.Linecast(character.raycastPosition, character2.raycastPosition, out raycastHit, Links.x.sightBlockers);
											if (raycastHit.collider)
											{
												string text = "hit ";
												GameObject gameObject = raycastHit.collider.gameObject;
												Debug.Log(text + ((gameObject != null) ? gameObject.ToString() : null) + " " + raycastHit.collider.gameObject.layer.ToString());
											}
										}
									}
									if (character2.body.sneaking)
									{
										flag6 = true;
									}
									if (!flag6 && !character.sleeping && (flag2 || flag5 || isHostileCharacter))
									{
										bool flag7 = true;
										if (character2.stunned && character.npc && !character.stats.CanAttackStunned())
										{
											flag7 = false;
										}
										if (this.debug)
										{
											string[] array5 = new string[10];
											array5[0] = "Seen ";
											array5[1] = flag5.ToString();
											array5[2] = " ";
											int num17 = 3;
											Character character10 = character;
											array5[num17] = ((character10 != null) ? character10.ToString() : null);
											array5[4] = " ";
											int num18 = 5;
											Character character11 = character2;
											array5[num18] = ((character11 != null) ? character11.ToString() : null);
											array5[6] = " ";
											int num19 = 7;
											GraphNode node = character2.node;
											array5[num19] = ((node != null) ? node.ToString() : null);
											array5[8] = " ";
											array5[9] = flag7.ToString();
											Debug.Log(string.Concat(array5));
										}
										if (character2.node != null && flag7 && enemiesCanAttack)
										{
											string text2;
											if (isHostileCharacter)
											{
												text2 = "Attack";
											}
											else if (flag5)
											{
												if (!character2.party)
												{
													foundAllianceEnemey = true;
													text2 = "Attack";
												}
												else
												{
													text2 = "Seen";
												}
											}
											else
											{
												text2 = "Seen";
											}
											character.UpdateLKP(character2, character2.node, text2, true);
											if ((num9 < closestDistToSeenCharacter || !inCombatRange) && !character2.dead && !character2.stunned)
											{
												if (flag5 || isHostileCharacter || (flag2 && character.npc))
												{
													startCombatSeenCharacter = character2;
												}
												closestDistToSeenCharacter = num9;
											}
											if (flag5 || isHostileCharacter || (flag2 && character.npc))
											{
												inCombatRange = true;
												inSearchRange = true;
											}
										}
									}
									if (canTalk && !character.sleeping && !Links.x.cameraEffects.transitioning && !flag6 && character2.mainSelected && (!character2.body.sneaking || (character2.body.sneaking && canTalkWhileSneaking)) && !character.stunned && !Records.x.dialogue && !Links.x.combat.inPocketAttack && !Links.x.dialogue.quipping)
									{
										bool flag8 = false;
										if (character.hasActions || character.inCombat || character.hostility == 2 || character.attackingUntilBribe || Records.x.InCombat(false) || character.dayNightVanishing || character.missing || character.deactivating || character.vanished)
										{
											flag8 = true;
										}
										if (!flag8 || (flag8 && (dia == 16 || dia == 6 || dia == 17 || dia == 7)))
										{
											if (((dia == 15 || dia == 5 || dia == 17 || dia == 7) && num9 < 400f) || num9 < 144f)
											{
												Links.x.dialogue.initiateNum = character.stats.initiateDialogue;
												if (dia == 1)
												{
													character.stats.initiateDialogue = 3;
												}
												else if (dia == 11)
												{
													character.stats.initiateDialogue = 13;
												}
												else if (dia >= 10)
												{
													character.stats.initiateDialogue = 10;
												}
												else
												{
													character.stats.initiateDialogue = 0;
												}
												character.InitiateDialogue();
											}
										}
										else if (character.inCombat || character.hostility > 1)
										{
											if (dia >= 15)
											{
												character.stats.initiateDialogue = 10;
											}
											if (dia >= 5)
											{
												character.stats.initiateDialogue = 0;
											}
										}
									}
								}
							}
							if (flag6)
							{
								if ((flag5 || flag2) && (character.hasActions || (character.willBeHostile && character2.party)) && !character.inactive && !character.stunned && ((isHostileCharacter && !character2.npc && character.npc) || flag5 || (!character.npc && character2.npc && Records.x.InCombat(true) && locationMatch) || (character.willBeHostile && character2.party)) && character2.node != null && enemiesCanAttack)
								{
									bool flag9 = true;
									if (character.willBeHostile && character2.party && !character.hasActions)
									{
										flag9 = character.HasLKPlayer(character2);
									}
									if (flag9)
									{
										string text3 = "Search";
										character.UpdateLKP(character2, character2.node, text3, false);
									}
								}
								if (!character.hasActions && character.party)
								{
									character.RemoveLKPlayer(character2);
								}
							}
							if (character.npc && character2.party && partyCanSeeMeCount == 0)
							{
								float num20 = character2.stats.SightRadius(false, false, false);
								if (num9 < num20 * num20)
								{
									if (num9 < 4900f && Input.GetKeyDown(KeyCode.R) && Records.x.editor)
									{
										string[] array6 = new string[17];
										int num21 = 0;
										Character character12 = character;
										array6[num21] = ((character12 != null) ? character12.ToString() : null);
										array6[1] = " looking at ";
										int num22 = 2;
										Character character13 = character2;
										array6[num22] = ((character13 != null) ? character13.ToString() : null);
										array6[3] = "... pos char: ";
										array6[4] = character.tr.position.ToString();
										array6[5] = " pos target: ";
										array6[6] = character2.tr.position.ToString();
										array6[7] = " dist: ";
										array6[8] = Vector3.Distance(vector3, character2.tr.position).ToString();
										array6[9] = " sight: ";
										array6[10] = character.stats.SightRadius(false, false, false).ToString();
										array6[11] = " raycast: ";
										array6[12] = Physics.Linecast(character.raycastPosition, character2.raycastPosition, Links.x.sightBlockers).ToString();
										array6[13] = " id ";
										array6[14] = character2.indoorID;
										array6[15] = " ";
										array6[16] = character.indoorID;
										Debug.Log(string.Concat(array6));
									}
									if (!Physics.Linecast(character.raycastPosition, character2.raycastPosition, Links.x.sightBlockers))
									{
										num23 = partyCanSeeMeCount;
										partyCanSeeMeCount = num23 + 1;
									}
								}
							}
							if (num9 < closestDistance && character2.party)
							{
								closestParty = character2;
								closestDistance = num9;
							}
						}
					}
					bool flag10;
					if (character.npc)
					{
						flag10 = true;
						num4 = this.party.Count;
						for (int m = 0; m < num4; m++)
						{
							if (this.party[m] && !this.party[m].isBoro && this.party[m].indoorID == character.indoorID)
							{
								flag10 = false;
							}
						}
					}
					else
					{
						flag10 = false;
					}
					if (!character.inactive && !character.stunned)
					{
						float num24 = character.stats.HearingRadius(false, false);
						float num25 = num24 * num24;
						for (int n = 0; n < noiseCount; n++)
						{
							bool flag11 = false;
							Character character14 = this.noiseCharacterTemp[n];
							flag5 = false;
							string text4 = this.noiseTypeTemp[n];
							bool flag12 = false;
							if (character.stats.hasEnemies)
							{
								if (character.stats.IsTargetAnEnemy(character14.stats.allegiance))
								{
									flag11 = true;
									flag5 = true;
								}
								else if (character14.hostility == 2 && character.hostility == 1 && character.stats.isGuard)
								{
									flag11 = true;
									flag5 = true;
								}
								else if (character14.party && isHostileCharacter)
								{
									flag11 = true;
								}
							}
							if (!flag11)
							{
								if (isHostileCharacter || character.willBeHostile)
								{
									flag11 = true;
								}
								else if (character.party && character14.npc)
								{
									flag11 = true;
								}
							}
							if (flag11 && character.sleeping && text4.Contains("Footstep"))
							{
								flag11 = false;
							}
							if (flag11 && character14.stunned && character.npc && !character.stats.CanAttackStunned())
							{
								flag11 = false;
							}
							if (flag11)
							{
								float num9 = this.SubtractVectors(vector3, (Vector3)this.noiseLocationTemp[n].position).sqrMagnitude;
								float num26 = this.NoiseRange(this.noiseTypeTemp[n]);
								if (character.visible == 0 && character.npc && !character.ambushing)
								{
									num26 /= 4f;
								}
								if (!character.npc && character14.npc && character.hasActions)
								{
									num25 = 1600f;
									num26 = 1600f;
								}
								if (this.debug)
								{
									string[] array7 = new string[10];
									array7[0] = "hearing ";
									int num27 = 1;
									Character character15 = character;
									array7[num27] = ((character15 != null) ? character15.ToString() : null);
									array7[2] = " ";
									array7[3] = num25.ToString();
									array7[4] = " ";
									array7[5] = num26.ToString();
									array7[6] = " ";
									array7[7] = num9.ToString();
									array7[8] = " ";
									array7[9] = enemiesCanAttack.ToString();
									Debug.Log(string.Concat(array7));
								}
								if (num9 < num26 && num9 < num25 && enemiesCanAttack)
								{
									if (!character.hasActions && character.visible == 1 && num9 < 100f)
									{
										flag12 = true;
									}
									if ((isHostileCharacter && !character14.npc && character.npc) || flag5 || (!character.npc && character14.npc && Records.x.combat && locationMatch) || (character.willBeHostile && character14.party))
									{
										if (!character.noiseImmune)
										{
											character.UpdateLKP(character14, this.noiseLocationTemp[n], "Heard", false);
											if (!character.inCombat && (character.animID == 0 || character.turning) && character.npc && !character14.body.sneaking && character.tr && character14.tr)
											{
												character.SetRotation(Quaternion.LookRotation(character14.tr.position - character.tr.position), false, false);
											}
										}
										if (this.debug)
										{
											string[] array8 = new string[13];
											int num28 = 0;
											Character character16 = character;
											array8[num28] = ((character16 != null) ? character16.ToString() : null);
											array8[1] = " ";
											int num29 = 2;
											Character character17 = character14;
											array8[num29] = ((character17 != null) ? character17.ToString() : null);
											array8[3] = " ";
											array8[4] = this.noiseTypeTemp[n];
											array8[5] = " ";
											array8[6] = num24.ToString();
											array8[7] = " ";
											array8[8] = Vector3.Distance((Vector3)this.noiseLocationTemp[n].position, vector3).ToString();
											array8[9] = " ";
											array8[10] = flag5.ToString();
											array8[11] = " ";
											array8[12] = isHostileCharacter.ToString();
											Debug.Log(string.Concat(array8));
										}
										if (!inSearchRange && !character14.dead && !character14.stunned)
										{
											startCombatSeenCharacter = character14;
										}
										inSearchRange = true;
										if (character.vipFollow)
										{
											inSearchRange = false;
										}
										if (flag5 && !character.inCombat)
										{
											foundAllianceEnemey = true;
										}
										if (character.sleeping)
										{
											character.WakeUp();
											character.SetRotation(Quaternion.LookRotation(character14.tr.position - character.tr.position), false, false);
										}
									}
								}
								if (character.noiseImmune && !inSearchRange)
								{
									character.noiseImmune = false;
								}
								else if (character.noiseImmune)
								{
									inSearchRange = false;
								}
							}
							else if (character.visible == 1 && !character.hasActions)
							{
								float num9 = this.SubtractVectors(vector3, (Vector3)this.noiseLocationTemp[n].position).sqrMagnitude;
								float num26 = this.NoiseRange(this.noiseTypeTemp[n]);
								if (character.visible == 0)
								{
									num26 /= 4f;
								}
								if (num9 < num26 && num9 < num25 && num9 < 100f)
								{
									flag12 = true;
								}
							}
							if (flag12 && character.npc != character14.npc && character.hostility == 1 && !character.attackingUntilBribe && !character14.body.sneaking && !character.body.lookAtController.hasTarget)
							{
								character.body.lookAtController.SetNewTarget(character14.body.headBone, Random.Range(6f, 9f), 0f, false);
							}
						}
					}
					if (inSearchRange && !inCombatRange && (isHostileCharacter || foundAllianceEnemey) && !character.inCombat && !character.inactive && flag4 && !character.stunned && enemiesCanAttack && !character.searching && !character.cannotAttack && startCombatSeenCharacter && !startCombatSeenCharacter.dead && !startCombatSeenCharacter.stunned && (!character.ambushing || (character.ambushing && character.jumping)))
					{
						Links.x.combat.AddParty(character, true, startCombatSeenCharacter, true);
						character.SetRotation(Quaternion.LookRotation(startCombatSeenCharacter.tr.position - vector3), false, false);
						character.PlaySoundFX(0, 7);
					}
					if (inCombatRange && (isHostileCharacter || foundAllianceEnemey) && !character.inactive && flag4 && !character.stunned && !character.inCombat && !character.cannotAttack && character.node != null && startCombatSeenCharacter)
					{
						if (foundAllianceEnemey && character.visible == 1 && this.CheckProof(startCombatSeenCharacter))
						{
							character.StartQuip("Justice!");
						}
						if (!character.ambushing || (character.ambushing && character.jumping))
						{
							startCombat = true;
						}
						if (character.ghost && character.ghostVanishing)
						{
							startCombat = false;
						}
						startCombatCharacter = character;
						startCombatTarget = startCombatSeenCharacter;
						if (Records.x.combat)
						{
							Links.x.combat.AddParty(startCombatCharacter, false, startCombatSeenCharacter, true);
						}
					}
					if (Records.x.combat && !Links.x.combat.npcOnlyCombat && character.party && !character.hasActions && !character.stunned && character.IsSentient() && !character.dead && !character.stunned && !character.hasActions)
					{
						Links.x.combat.AddParty(character, false, startCombatSeenCharacter, true);
						if (Links.x.gaia.boro)
						{
							Links.x.gaia.boroControls.LeavingForCombat();
						}
					}
					if (!character.inactive && !Records.x.pocketPause && !Links.x.combat.inRally && !Links.x.combat.inPocketAttack)
					{
						if (partyCanSeeMeCount == 0 && flag4 && !character.sailing)
						{
							if (canDisableCharacters)
							{
								if (character.visible == 1)
								{
									character.SetMeshState(false);
								}
							}
							else if (character.visible != 1 && !character.missing)
							{
								character.SetMeshState(true);
							}
						}
						else if (flag4 && character.visible == 0)
						{
							character.SetMeshState(true);
						}
					}
					if (character.visible == 1 && character.npc && character.hostility < 2 && !character.attackingUntilBribe && Records.x.InCombat(false) && !Links.x.combat.preDome && !Links.x.combat.npcOnlyCombat && this.bribeBadgeCount > 0 && character.node != null && Links.x.combat.CanSeeSomeoneInCombat(character.tr.position, character.stats.SightRadius(false, false, false)))
					{
						Character character18;
						int num30;
						this.NonHostileAttacked(character, character.tr.position, closestParty, true, true, out character18, out num30);
					}
					if (character.ghost && character.visible == 1 && !character.inactive && character.hasActions)
					{
						this.GhostFlee(character);
					}
					if (character.visible == 1 && (((!inCombatRange && !inSearchRange && closestDistance < 400f) || (character.hostility <= 1 && character.hasCinematicQuip)) && !character.inactive && flag4) && !Records.x.paused && !Records.x.dialogue && !character.stunned)
					{
						Vector3 vector4 = Links.x.worldCamera.WorldToViewportPoint(vector3);
						if (vector4.x > 0f && vector4.y > 0f && vector4.x < 1f && vector4.y < 1f)
						{
							character.FindQuip();
						}
					}
					if (canDisableCharacters && !character.inCombat && !character.hasActions && character.npc && !character.sailing && !character.alwaysOn && !character.fleeing)
					{
						float num31 = closestDistance;
						if (num31 > 8100f && character.creatures)
						{
							num31 = character.creatures.NearestPatrolPoint(Links.x.main.currentPosition);
							if (num31 < 1600f)
							{
								flag10 = false;
							}
							else
							{
								num31 = closestDistance;
							}
						}
						if (num31 > 8100f || flag10 || character.vanished)
						{
							if (!character.inactive)
							{
								character.TurnScriptsOff();
							}
						}
						else if (character.inactive)
						{
							character.TurnScriptsOn();
						}
					}
					if (!character.inactive && character.IsSentient() && !character.stunned)
					{
						Links.x.diorama.CheckDoors(character);
					}
				}
				num23 = i;
			}
			if (!Records.x.combat && startCombat && !flag && !startCombatCharacter.inactive)
			{
				if (startCombatCharacter.sleeping)
				{
					startCombatCharacter.WakeUp();
				}
				int hostility = startCombatCharacter.hostility;
				Links.x.combat.StartCombat(startCombatTarget, startCombatCharacter, false, true);
				Links.x.combat.AddParty(startCombatCharacter, false, startCombatTarget, true);
				if (hostility >= 2)
				{
					this.AlertGroupFromCombatSounds(startCombatCharacter, startCombatTarget);
				}
			}
			if (this.footstepAdded)
			{
				for (int num32 = 0; num32 < this.footsteps.Count; num32++)
				{
					this.footsteps[num32] = false;
				}
				this.footstepAdded = false;
			}
			if (this.deads == null)
			{
				this.deads = Links.x.deads;
			}
			int num33 = this.deads.Count;
			for (int num34 = 0; num34 < num33; num34++)
			{
				if (num34 < this.deads.Count && !flag && this.deads[num34] && Links.x.hasMain)
				{
					float num9 = this.SubtractVectors(Links.x.main.currentPosition, this.deads[num34].tr.position).sqrMagnitude;
					bool flag13 = num9 >= 1600f;
					if (flag13 && !this.deads[num34].deadInactive)
					{
						this.deads[num34].deadInactive = true;
						this.deads[num34].body.SetMeshState(false, true);
					}
					else if (!flag13 && this.deads[num34].deadInactive)
					{
						this.deads[num34].deadInactive = false;
						this.deads[num34].body.SetMeshState(true, true);
					}
					if ((this.deads[num34].creatures || this.deads[num34].party) && Links.x.gameplay.seconds > this.deads[num34].timeOfDeath)
					{
						if (this.deads[num34].stats.state.Contains("Purgatory"))
						{
							this.deads[num34].body.EndDead(2);
						}
						else if (!this.deads[num34].goreObj)
						{
							if (flag13)
							{
								this.deads[num34].body.EndDead(2);
							}
						}
						else if (flag13)
						{
							this.deads[num34].body.EndDead(2);
						}
						else
						{
							this.deads[num34].body.SetGoreKinematic();
						}
					}
				}
			}
			if (!Records.x.dialogue && (Records.x.InCombat(false) || this.bribeBadgeCount > 0) && !flag)
			{
				this.bribeBadgeCount = Records.x.BribeBadgeCount();
				bool flag14 = false;
				if (Records.x.BribeBadgeCountOld() > 0)
				{
					flag14 = true;
				}
				num33 = this.npcs.Count;
				for (int num35 = 0; num35 < this.npcs.Count; num35++)
				{
					Character character19 = this.npcs[num35];
					if (character19 && !character19.stunned && character19.hostility == 1 && !character19.attackingUntilBribe && !character19.inactive && !character19.hasActions)
					{
						bool flag15 = false;
						bool flag16 = false;
						if (this.bribeBadgeCount > 0)
						{
							flag15 = Links.x.combat.CanSeeSomeoneInCombat(character19.tr.position, character19.stats.SightRadius(false, false, false));
							if ((flag15 || flag14) && Records.x.IsVictim(character19.stats.xmlName))
							{
								flag16 = true;
							}
						}
						if (character19.stats.isGuard || flag16)
						{
							bool flag17 = false;
							if (this.bribeBadgeCount > 0 && character19.hostility == 1 && !character19.attackingUntilBribe && (flag15 || flag14))
							{
								closestParty = Links.x.GetNearestParty(character19.tr.position);
								float num7 = character19.stats.SightRadius(false, false, false) * character19.stats.SightRadius(false, false, false);
								if (closestParty && character19 && this.SubtractVectors(closestParty.tr.position, character19.tr.position).sqrMagnitude < num7)
								{
									this.AddPlayerToCombat(character19, closestParty, true, true, true);
									character19.GuardQuip();
									flag17 = true;
								}
							}
							if (!flag17 && Records.x.InCombat(false))
							{
								this.CheckIfAllyInCombat(character19);
							}
						}
					}
				}
			}
			this.UpdateCharactersIntExt(false);
			closestParty = null;
			character = null;
			startCombatCharacter = null;
			startCombatSeenCharacter = null;
			startCombatTarget = null;
		}
		float num36 = 0.1f - secondsWaited;
		if (num36 <= 0.001f)
		{
			num36 = 0.001f;
		}
		if (num36 > 0.1f)
		{
			num36 = 0.1f;
		}
		yield return new WaitForSeconds(num36);
		this.checking = false;
		this.sensoryCoroutine = null;
		yield break;
	}

	// Token: 0x060008DF RID: 2271 RVA: 0x000BFBC8 File Offset: 0x000BDDC8
	public void SetDeadRendererLayers(int layer)
	{
		int count = this.deads.Count;
		for (int i = 0; i < count; i++)
		{
			if (i < this.deads.Count && this.deads[i] && this.deads[i].body)
			{
				this.deads[i].body.SetDeadRendererLayers(layer);
			}
		}
	}

	// Token: 0x060008E0 RID: 2272 RVA: 0x000BFC3D File Offset: 0x000BDE3D
	public void AlertGroupFromCombatSounds(Character target, Character character)
	{
		if (target.creatures && target.creatures.inGroup)
		{
			this.AddAllToCombat(target, character, true, true, true);
		}
	}

	// Token: 0x060008E1 RID: 2273 RVA: 0x000BFC68 File Offset: 0x000BDE68
	public void UpdateCharactersIntExt(bool everyone)
	{
		if (!Links.x.gaia.pathfindingReady)
		{
			return;
		}
		bool indoors = Links.x.cameraEffects.indoors;
		string text = "";
		bool flag = Links.x.worldCamera.orthographic;
		if (!Links.x.hasMain)
		{
			flag = true;
		}
		if (indoors)
		{
			text = Links.x.rtsCamera.currentBoundsName;
		}
		if (text == "" || text == "?")
		{
			flag = true;
		}
		int count = this.characters.Count;
		for (int i = 0; i < this.characters.Count; i++)
		{
			Character character = this.characters[i];
			if (character && (!character.npc || everyone) && character.node != null)
			{
				if (indoors)
				{
					if (character.node.GraphIndex == 1U && character.indoorID != text)
					{
						character.SetMeshState(false);
						character.body.SetMeshState(false, false);
					}
					if (character.visible == 0 && character.node.GraphIndex == 1U && character.indoorID == text && !character.npc)
					{
						character.SetMeshState(true);
						character.body.SetMeshState(true, true);
					}
					if (character.node.GraphIndex == 0U)
					{
						character.SetMeshState(false);
						character.body.SetMeshState(false, false);
					}
				}
				else if (character.visible == 0 && character.node.GraphIndex == 0U && !character.npc)
				{
					character.SetMeshState(true);
				}
				else if (character.node.GraphIndex == 1U)
				{
					character.SetMeshState(false);
					character.body.SetMeshState(false, false);
				}
				if (!flag && character.npc && !character.stats.animal && character.hostility < 2 && (text == character.indoorID && indoors))
				{
					character.SetRotation(Quaternion.LookRotation(Links.x.main.tr.position - character.tr.position), true, false);
				}
			}
		}
	}

	// Token: 0x060008E2 RID: 2274 RVA: 0x000BFEA8 File Offset: 0x000BE0A8
	public bool CheckSneaking(Character diaCharacter, bool all, Character partyCharacter, bool checkHearing, bool checkCone)
	{
		bool flag = true;
		float num = diaCharacter.stats.SightRadius(false, false, false);
		float num2 = diaCharacter.stats.HearingRadius(false, false);
		if (all)
		{
			for (int i = 0; i < this.party.Count; i++)
			{
				bool flag2 = false;
				if (!this.party[i].summoned && !this.party[i].isBoro && this.party[i].IsSentient())
				{
					float num3 = (this.party[i].raycastPosition - diaCharacter.raycastPosition).sqrMagnitude;
					if ((num3 < num * num || (checkHearing && num3 < num2 * num2)) && (!Physics.Linecast(this.party[i].raycastPosition, diaCharacter.raycastPosition, Links.x.sightBlockers) || checkHearing))
					{
						bool flag3 = true;
						if (checkCone)
						{
							float num4 = Vector3.Angle(this.SubtractVectors(diaCharacter.tr.position, partyCharacter.tr.position), diaCharacter.body.tr.forward);
							flag3 = num4 <= 45f && num4 >= -45f;
						}
						if (!this.party[i].body.sneaking && flag3)
						{
							flag2 = true;
						}
					}
				}
				if (flag2)
				{
					flag = false;
					break;
				}
			}
		}
		else
		{
			bool flag4 = false;
			if (!partyCharacter.summoned && !partyCharacter.isBoro && partyCharacter.IsSentient())
			{
				float num3 = (partyCharacter.raycastPosition - diaCharacter.raycastPosition).sqrMagnitude;
				if ((num3 < num * num || (checkHearing && num3 < num2 * num2)) && (!Physics.Linecast(partyCharacter.raycastPosition, diaCharacter.raycastPosition, Links.x.sightBlockers) || checkHearing))
				{
					bool flag5 = true;
					if (checkCone)
					{
						float num5 = Vector3.Angle(this.SubtractVectors(diaCharacter.tr.position, partyCharacter.tr.position), diaCharacter.body.tr.forward);
						if (Records.x.editor)
						{
							Debug.Log(string.Concat(new string[]
							{
								(diaCharacter != null) ? diaCharacter.ToString() : null,
								" check in cone ",
								(partyCharacter != null) ? partyCharacter.ToString() : null,
								" ",
								num5.ToString()
							}));
						}
						flag5 = num5 <= 45f && num5 >= -45f;
					}
					if (!partyCharacter.body.sneaking && flag5)
					{
						flag4 = true;
					}
				}
			}
			if (flag4)
			{
				flag = false;
			}
		}
		return flag;
	}

	// Token: 0x060008E3 RID: 2275 RVA: 0x000C0190 File Offset: 0x000BE390
	public bool CanSeeOrHearWholeParty(CreatureActions tower, bool checkCone, bool checkHearing)
	{
		bool flag = false;
		for (int i = 0; i < this.party.Count; i++)
		{
			if (!flag && this.party[i] && this.party[i].party && this.CanSeeOrHearParty(tower, this.party[i], checkCone, checkHearing))
			{
				flag = true;
			}
		}
		return flag;
	}

	// Token: 0x060008E4 RID: 2276 RVA: 0x000C01F8 File Offset: 0x000BE3F8
	public bool CanSeeOrHearParty(CreatureActions tower, Character partyCharacter, bool checkCone, bool checkHearing)
	{
		this.towerCharacters = tower.characters;
		bool flag = true;
		for (int i = 0; i < this.towerCharacters.Count; i++)
		{
			Character character = this.towerCharacters[i];
			if (character && !character.dead && !character.sleeping && character.IsSentient() && !this.CheckSneaking(character, false, partyCharacter, checkHearing, checkCone))
			{
				flag = false;
			}
		}
		return !flag;
	}

	// Token: 0x060008E5 RID: 2277 RVA: 0x000C026C File Offset: 0x000BE46C
	public void SetupNoiseLists()
	{
		int count = this.noiseObj.Count;
		this.noiseObjTemp.Clear();
		this.noiseLocationTemp.Clear();
		this.noiseFactionTemp.Clear();
		this.noiseTypeTemp.Clear();
		this.noiseCharacterTemp.Clear();
		for (int i = 0; i < count; i++)
		{
			this.noiseObjTemp.Add(this.noiseObj[i]);
			this.noiseLocationTemp.Add(this.noiseLocation[i]);
			this.noiseFactionTemp.Add(this.noiseFaction[i]);
			this.noiseTypeTemp.Add(this.noiseType[i]);
			this.noiseCharacterTemp.Add(this.noiseCharacter[i]);
		}
		this.noiseObj.Clear();
		this.noiseType.Clear();
		this.noiseFaction.Clear();
		this.noiseLocation.Clear();
		this.noiseCharacter.Clear();
	}

	// Token: 0x060008E6 RID: 2278 RVA: 0x000C0374 File Offset: 0x000BE574
	public bool CanBeSeen(Character checkCharacter)
	{
		int count = this.characters.Count;
		for (int i = 0; i < count; i++)
		{
			Character character = this.characters[i];
			if (character && ((character.npc && !checkCharacter.npc && (character.hostility == 2 || character.hostility == 3 || character.attackingUntilBribe)) || (!character.npc && checkCharacter.npc)) && character.CanSee(checkCharacter))
			{
				return true;
			}
		}
		return false;
	}

	// Token: 0x060008E7 RID: 2279 RVA: 0x000C03F8 File Offset: 0x000BE5F8
	public void SetMagicaClothState(bool state)
	{
		int count = this.characters.Count;
		for (int i = 0; i < count; i++)
		{
			Character character = this.characters[i];
			if (character)
			{
				character.body.SetMagicaClothState(state);
			}
		}
	}

	// Token: 0x060008E8 RID: 2280 RVA: 0x000C0440 File Offset: 0x000BE640
	public bool ProofState(Character target)
	{
		bool flag = false;
		if (target.stats.characterRow._Quest == "")
		{
			return false;
		}
		if (target.stats.characterRow._QuestProofState == "")
		{
			return false;
		}
		QuestState questState = QuestLog.GetQuestState(target.stats.characterRow._Quest);
		QuestState questState2 = Records.x.StringToQuestState(target.stats.characterRow._QuestProofState);
		if (questState == questState2 || questState == QuestState.PerpIsDead)
		{
			flag = true;
		}
		if (!target.stats.animal && target.stats.xmlName.Contains("RozafirDolki") && (questState == QuestState.ActivePart2 || questState == QuestState.ActivePart3))
		{
			flag = true;
		}
		return flag;
	}

	// Token: 0x060008E9 RID: 2281 RVA: 0x000C0504 File Offset: 0x000BE704
	public bool CheckProof(Character target)
	{
		if (!target)
		{
			return false;
		}
		bool flag = false;
		if (target.stats.characterRow._Quest != "")
		{
			bool flag2 = false;
			if (target.stats.characterRow._QuestProofState == "Any")
			{
				flag2 = true;
			}
			if ((this.ProofState(target) && target.stats.characterRow._QuestProofState != "") || flag2)
			{
				flag = true;
				QuestState questState = Records.x.StringToQuestState(target.stats.characterRow._QuestProofState);
				if (!Links.x.combat.isJustice && questState != QuestState.Unassigned)
				{
					Character nearestPartyInRoom = Links.x.GetNearestPartyInRoom(target.tr.position, null, 1600f, target.indoorID, true);
					if (!target.stunned && !target.dead && target.IsSentient() && nearestPartyInRoom)
					{
						Links.x.combat.isJustice = true;
						if (!target.stats.semizenMagic)
						{
							bool flag3 = true;
							if (target.stats.xmlName.Contains("Dolki"))
							{
								flag3 = false;
							}
							if (target.stats.xmlName.Contains("FallsBandit"))
							{
								flag3 = false;
							}
							if (flag3)
							{
								if (Time.timeSinceLevelLoad > Links.x.combat.lastJusticeTime + 1200f || Links.x.combat.lastJusticeTime == 0f)
								{
									Links.x.gameplay.StartDialogue(target, nearestPartyInRoom, null, null, "Party/Justice");
									Links.x.combat.lastJusticeTime = Time.timeSinceLevelLoad + 1200f;
								}
								else
								{
									target.StartQuip("Slay me not! I'll take exile!");
								}
							}
						}
						Links.x.combat.JusticeCombat(target);
						if (Records.x.BribeBadgeCount() > 0)
						{
							Records.x.StartForgiveness();
						}
						if (!target.hasActions)
						{
							this.AddPlayerToCombat(target, nearestPartyInRoom, false, false, false);
						}
					}
				}
			}
		}
		return flag;
	}

	// Token: 0x060008EA RID: 2282 RVA: 0x000C0718 File Offset: 0x000BE918
	public void AddPlayerFromDamage(Character target, Character character)
	{
		if (!target.npc)
		{
			return;
		}
		if (target.sleeping)
		{
			target.WakeUp();
		}
		if (character && character.body.sneaking)
		{
			character.EndSneak(false, false);
		}
		if (target.willBeHostile)
		{
			target.hostility = 2;
		}
		int hostility = target.hostility;
		bool attackingUntilBribe = target.attackingUntilBribe;
		if (Links.x.combat.bubbleEvent && target.hostility <= 1)
		{
			return;
		}
		bool flag = false;
		if (target.npc && character.party)
		{
			flag = this.CheckProof(target);
		}
		bool flag2 = false;
		if ((hostility == 1 || hostility == 0) && !attackingUntilBribe && !flag && character.party && (!target.stats.animal || Links.x.main.inTown))
		{
			if (target.stats.race.Contains("Dryad") || target.stats.race.Contains("Lachovinian"))
			{
				target.hostility = 2;
				if (target.vipFollow)
				{
					target.creatures.VIPFail();
				}
			}
			else
			{
				bool flag3 = Links.x.main.inTown;
				bool flag4 = false;
				if (!flag3 && target.stats.dialogueFile != "")
				{
					if (target.stats.xmlName.Contains("FallsBandit"))
					{
						flag4 = true;
					}
					else
					{
						flag3 = true;
					}
				}
				if (flag3)
				{
					Records.x.AddBribeBadge(target, "Seen", false, character);
					flag2 = true;
				}
				else if (flag4)
				{
					target.hostility = 2;
					if (target.vipFollow)
					{
						target.creatures.CheckVIP();
					}
				}
			}
		}
		if (!target.hasActions && !target.dead && (!target.stunned || (target.stunned && Records.x.kill)))
		{
			this.AddPlayerToCombat(target, character, true, false, true);
		}
		else if (target.hostility != 2 && target.hostility != 3 && !target.attackingUntilBribe)
		{
			this.AddPlayerToCombat(target, character, true, false, true);
		}
		if (!character.npc)
		{
			for (int i = 0; i < this.party.Count; i++)
			{
				if (this.party[i] && this.party[i].IsSentient())
				{
					this.party[i].UpdateLKP(target, target.node, "Heard", false);
				}
			}
		}
		if (target.npc && character.party && (flag2 && hostility != 2 && hostility != 3 && !attackingUntilBribe))
		{
			Character character2;
			int num;
			this.NonHostileAttacked(target, target.tr.position, character, false, true, out character2, out num);
		}
		if (target.creatures && target.creatures.inGroup)
		{
			this.AddAllToCombat(target, character, true, true, true);
		}
	}

	// Token: 0x060008EB RID: 2283 RVA: 0x000C09F0 File Offset: 0x000BEBF0
	public bool AddAllToCombat(Character target, Character attacker, bool searching, bool overrideSleep, bool madeNoise)
	{
		bool flag = false;
		if (target.creatures.inGroup)
		{
			Transform parent = target.creatures.gameObject.transform.parent;
			if (parent)
			{
				foreach (object obj in parent)
				{
					CreatureActions component = ((Transform)obj).gameObject.GetComponent<CreatureActions>();
					if (component)
					{
						bool flag2 = true;
						Character firstCharacter = component.GetFirstCharacter();
						if (firstCharacter && firstCharacter != target && (this.CheckProof(target) || Records.x.IsFelon(target.stats.xmlName)) && !this.CheckProof(firstCharacter) && !Records.x.IsFelon(firstCharacter.stats.xmlName) && component.creatures.temperament == Creatures.temperamentState.FightsIfAttacked)
						{
							flag2 = false;
						}
						if (flag2 && component.AddAllToCombat(attacker, searching, overrideSleep, madeNoise))
						{
							string[] array = new string[6];
							array[0] = "Group turning hostile after attack: ";
							array[1] = ((target != null) ? target.ToString() : null);
							array[2] = " ";
							int num = 3;
							CreatureActions creatures = target.creatures;
							array[num] = ((creatures != null) ? creatures.ToString() : null);
							array[4] = " ";
							int num2 = 5;
							CreatureActions creatureActions = component;
							array[num2] = ((creatureActions != null) ? creatureActions.ToString() : null);
							Debug.Log(string.Concat(array));
							flag = true;
						}
					}
				}
			}
		}
		return flag;
	}

	// Token: 0x060008EC RID: 2284 RVA: 0x000C0B80 File Offset: 0x000BED80
	public void AddPartyToCombat(Character startCombatSeenCharacter)
	{
		for (int i = 0; i < this.party.Count; i++)
		{
			Character character = this.party[i];
			if (character && character.IsSentient() && !character.dead && !character.stunned && !character.hasActions)
			{
				Links.x.combat.AddParty(character, false, startCombatSeenCharacter, true);
				if (Links.x.gaia.boro)
				{
					Links.x.gaia.boroControls.LeavingForCombat();
				}
			}
		}
	}

	// Token: 0x060008ED RID: 2285 RVA: 0x000C0C18 File Offset: 0x000BEE18
	public void AddPlayerToCombat(Character character, Character attackingCharacter, bool checkForGroup, bool searching, bool madeNoise)
	{
		if (character.hostility == 0)
		{
			return;
		}
		bool flag = false;
		if (checkForGroup && attackingCharacter.party)
		{
			flag = true;
		}
		if (searching)
		{
			character.UpdateLKP(attackingCharacter, attackingCharacter.node, "Heard", false);
		}
		else
		{
			character.UpdateLKP(attackingCharacter, attackingCharacter.node, "Attack", true);
		}
		if (!character.hasActions)
		{
			if (character.sleeping)
			{
				character.WakeUp();
			}
			if (character.hostility == 1 && !character.attackingUntilBribe && (!character.stats.animal || Links.x.main.inTown))
			{
				if (!this.CheckProof(character) && attackingCharacter.party)
				{
					character.attackingUntilBribe = true;
				}
				if (character.stats.isGuard)
				{
					character.GuardQuip();
				}
			}
			Links.x.combat.AddParty(character, searching, attackingCharacter, true);
			character.searching = searching;
			if (character.searching)
			{
				character.inCombat = false;
			}
			if (Records.x.combatConsoleDebugging)
			{
				Debug.Log(((character != null) ? character.ToString() : null) + " add player to combat, searching is " + searching.ToString());
			}
			if (character.npc || (!character.npc && Records.x.ai == 1))
			{
				character.PlayAnimation("CombatStart", 0f);
			}
			character.PlaySoundFX(0, 7);
			character.EndPath();
		}
		if (flag && character.creatures)
		{
			this.AddAllToCombat(character, attackingCharacter, searching, false, madeNoise);
		}
	}

	// Token: 0x060008EE RID: 2286 RVA: 0x000C0D90 File Offset: 0x000BEF90
	public int NonHostileAttacked(Character target, Vector3 targetPosition, Character attackingCharacter, bool single, bool madeNoise, out Character closestOffendedCharacter, out int anyoneSeen)
	{
		int num = this.characters.Count;
		Vector3 vector = targetPosition;
		if (target)
		{
			vector = target.tr.position;
		}
		int desiredGraph = attackingCharacter.desiredGraph;
		uint area = attackingCharacter.node.Area;
		bool flag = false;
		if (!single && target)
		{
			flag = this.CheckProof(target);
		}
		else
		{
			vector = attackingCharacter.tr.position;
		}
		int num2 = 0;
		closestOffendedCharacter = null;
		float num3 = 100000f;
		this.bribeBadgeCount = Records.x.BribeBadgeCount();
		anyoneSeen = 0;
		if (single)
		{
			num = 1;
		}
		for (int i = 0; i < num; i++)
		{
			Character character;
			if (single)
			{
				character = target;
			}
			else
			{
				character = this.characters[i];
			}
			if (character)
			{
				if (character.dead || character.stunned || character.hostility == 2 || character.attackingUntilBribe || character.party || character.summoned || character.isBoro || character.ghost || (character.sleeping && !madeNoise) || character.stats.animal)
				{
					if (this.bribeBadgeCount > 0 && character.attackingUntilBribe)
					{
						float num4 = character.stats.SightRadius(false, false, false) * character.stats.SightRadius(false, false, false);
						if (this.SubtractVectors(vector, character.tr.position).sqrMagnitude < num4 && !attackingCharacter.body.sneaking && !Physics.Linecast(attackingCharacter.raycastPosition, character.raycastPosition, Links.x.sightBlockers))
						{
							Records.x.UpdateBribeState(character);
						}
					}
				}
				else if (character.indoorID == attackingCharacter.indoorID)
				{
					float num5 = character.stats.SightRadius(false, false, false) * character.stats.SightRadius(false, false, false);
					float sqrMagnitude = this.SubtractVectors(vector, character.tr.position).sqrMagnitude;
					if (sqrMagnitude < num5 && !attackingCharacter.body.sneaking)
					{
						bool flag2 = madeNoise ?? this.InAngleView(attackingCharacter, character);
						bool flag3 = false;
						if (flag2 && !Physics.Linecast(attackingCharacter.raycastPosition, character.raycastPosition, Links.x.sightBlockers))
						{
							flag3 = true;
						}
						bool flag4 = false;
						bool flag5 = false;
						if (!flag3)
						{
							flag5 = true;
						}
						if (target != character || single)
						{
							if (character.sleeping)
							{
								character.WakeUp();
							}
							if (character.stats.isGuard)
							{
								num2++;
								anyoneSeen++;
								if (flag)
								{
									character.StartQuip("Justice!");
									this.AddPlayerToCombat(character, target, true, flag5, madeNoise);
								}
								else
								{
									flag4 = true;
									if (!this.CheckProof(character))
									{
										character.attackingUntilBribe = true;
									}
									character.GuardQuip();
									this.AddPlayerToCombat(character, attackingCharacter, true, flag5, madeNoise);
									if (this.bribeBadgeCount > 0)
									{
										Records.x.UpdateBribeState(character);
									}
								}
							}
							else if (!character.fleeing && !character.summoned && !character.ghost && character.IsSentient() && !character.sleeping && !character.hasActions && !this.CheckProof(character))
							{
								flag4 = true;
								anyoneSeen++;
								character.StartQuip("Help!");
								character.Flee(attackingCharacter.node, false, Links.x.gameplay.seconds, 100f);
								if (this.bribeBadgeCount > 0)
								{
									Records.x.UpdateBribeState(character);
								}
							}
							if (sqrMagnitude < num3 && flag4)
							{
								num3 = sqrMagnitude;
								closestOffendedCharacter = character;
							}
						}
					}
				}
			}
		}
		if (num2 > 0 && !madeNoise && !single)
		{
			Character character2;
			int num6;
			this.NonHostileAttacked(target, targetPosition, attackingCharacter, single, true, out character2, out num6);
		}
		return num2;
	}

	// Token: 0x060008EF RID: 2287 RVA: 0x000C1158 File Offset: 0x000BF358
	public void RemoveBribeHostility()
	{
		for (int i = 0; i < this.characters.Count; i++)
		{
			if (this.characters[i])
			{
				this.characters[i].attackingUntilBribe = false;
				if (this.characters[i].hostility == 2 && this.characters[i].creatures && this.characters[i].creatures.inGroup && this.characters[i].creatures.creatures.temperament == Creatures.temperamentState.FightsIfAttacked && !this.ProofState(this.characters[i]))
				{
					this.characters[i].hostility = 1;
				}
			}
		}
	}

	// Token: 0x060008F0 RID: 2288 RVA: 0x000C1234 File Offset: 0x000BF434
	public void GhostFlee(Character ghost)
	{
		int count = this.characters.Count;
		Vector3 position = ghost.tr.position;
		int desiredGraph = ghost.desiredGraph;
		uint area = ghost.node.Area;
		for (int i = 0; i < count; i++)
		{
			Character character = this.characters[i];
			if (character && character.stats.allegiance == 6U && !character.dead && !character.stunned && character.hostility != 2 && !character.attackingUntilBribe && !character.party && !character.summoned && !character.isBoro && !character.ghost && character.desiredGraph == desiredGraph && (desiredGraph == 0 || character.indoorID == ghost.indoorID))
			{
				float num = character.stats.SightRadius(false, false, false) * character.stats.SightRadius(false, false, false);
				if (this.SubtractVectors(position, character.tr.position).sqrMagnitude < num && !Physics.Linecast(ghost.raycastPosition, character.raycastPosition, Links.x.sightBlockers))
				{
					if (character.sleeping)
					{
						character.WakeUp();
					}
					if (!character.fleeing && character.IsSentient() && !character.hasActions)
					{
						if (Records.x.badgeCount > 0)
						{
							Records.x.UpdateBribeState(character);
						}
						character.StartQuip("Help!");
						character.Flee(ghost.node, false, Links.x.gameplay.seconds, 200f);
					}
				}
			}
		}
	}

	// Token: 0x060008F1 RID: 2289 RVA: 0x000C13FC File Offset: 0x000BF5FC
	public void CheckIfAllyInCombat(Character lookingCharacter)
	{
		int count = this.characters.Count;
		Vector3 position = lookingCharacter.tr.position;
		int desiredGraph = lookingCharacter.desiredGraph;
		uint area = lookingCharacter.node.Area;
		float num = lookingCharacter.stats.SightRadius(false, false, false);
		float num2 = num * num;
		bool flag = false;
		Character character = null;
		bool flag2 = false;
		for (int i = 0; i < count; i++)
		{
			Character character2 = this.characters[i];
			if (!flag && character2 && character2.stats.allegiance == lookingCharacter.stats.allegiance && character2.hostility > 1 && !this.CheckProof(character2) && character2.desiredGraph == desiredGraph && character2.node != null && desiredGraph == character2.desiredGraph && this.SubtractVectors(position, character2.tr.position).sqrMagnitude < num2)
			{
				character = character2.GetNearestPartyLKP(position);
				if (character)
				{
					flag = true;
					flag2 = Physics.Linecast(lookingCharacter.raycastPosition, character2.raycastPosition, Links.x.sightBlockers);
				}
			}
		}
		if (flag)
		{
			Debug.Log(((lookingCharacter != null) ? lookingCharacter.ToString() : null) + " saw an ally in combat");
			this.AddPlayerToCombat(lookingCharacter, character, false, flag2, true);
		}
	}

	// Token: 0x060008F2 RID: 2290 RVA: 0x000C155C File Offset: 0x000BF75C
	public Character NearestNPC(Character partyCharacter)
	{
		Character character = null;
		float num = 3600f;
		Vector3 position = partyCharacter.tr.position;
		for (int i = 0; i < this.characters.Count; i++)
		{
			Character character2 = this.characters[i];
			if (character2 && character2.npc && character2.IsSentient() && !character2.sleeping && character2.visible == 1 && character2.stats.dialogueFile != "")
			{
				float sqrMagnitude = (character2.tr.position - position).sqrMagnitude;
				if (sqrMagnitude < num)
				{
					character = character2;
					num = sqrMagnitude;
				}
			}
		}
		return character;
	}

	// Token: 0x060008F3 RID: 2291 RVA: 0x000C1618 File Offset: 0x000BF818
	public Character BribeCharacterNear(Character partyCharacter, bool any)
	{
		Character character = null;
		float num = 3600f;
		for (int i = 0; i < this.characters.Count; i++)
		{
			Character character2 = this.characters[i];
			if (character2 && character2.npc && character2.IsSentient() && !character2.sleeping && character2.visible == 1)
			{
				bool flag = false;
				if (character2.stats.isGuard)
				{
					flag = true;
				}
				if (!flag && Records.x.IsVictim(character2.stats.xmlName))
				{
					flag = true;
				}
				if (flag)
				{
					if (any)
					{
						for (int j = 0; j < this.party.Count; j++)
						{
							if (this.party[j] && this.party[j].IsSentient() && this.party[j].party && !this.party[j].isBoro)
							{
								float sqrMagnitude = (character2.tr.position - this.party[j].tr.position).sqrMagnitude;
								if (sqrMagnitude < num)
								{
									character = character2;
									num = sqrMagnitude;
								}
							}
						}
					}
					else
					{
						float sqrMagnitude2 = (character2.tr.position - partyCharacter.tr.position).sqrMagnitude;
						if (sqrMagnitude2 < num)
						{
							character = character2;
							num = sqrMagnitude2;
						}
					}
				}
			}
		}
		return character;
	}

	// Token: 0x060008F4 RID: 2292 RVA: 0x000C17AC File Offset: 0x000BF9AC
	public bool InAngleView(Vector3 pt, Character lookingCharacter)
	{
		Vector3 vector = this.SubtractVectors(pt, lookingCharacter.tr.position);
		Vector3 vector2 = lookingCharacter.body.tr.rotation * Vector3.forward;
		if (lookingCharacter.moving)
		{
			vector2 = lookingCharacter.tr.rotation * Vector3.forward;
		}
		float num = Vector3.Angle(vector, vector2);
		float num2 = 45f;
		float num3 = -45f;
		return num <= num2 && num >= num3;
	}

	// Token: 0x060008F5 RID: 2293 RVA: 0x000C1822 File Offset: 0x000BFA22
	public bool InAngleView(Character lookAtCharacter, Character lookingCharacter)
	{
		return lookingCharacter.hasActions || this.InAngleView(lookAtCharacter.tr.position, lookingCharacter);
	}

	// Token: 0x060008F6 RID: 2294 RVA: 0x000C1840 File Offset: 0x000BFA40
	public Character HitCharacter(GraphNode mouseNode)
	{
		int count = this.characters.Count;
		for (int i = 0; i < count; i++)
		{
			Character character = this.characters[i];
			if (character && (mouseNode.ID == character.nodeMovingID || mouseNode.ID == character.nodeStationaryID))
			{
				return character;
			}
		}
		return null;
	}

	// Token: 0x060008F7 RID: 2295 RVA: 0x000C189C File Offset: 0x000BFA9C
	public void AddMP(Character c)
	{
		float num = c.stats.characterRow._Height;
		if (c.stats.characterRow._Flying)
		{
			num = 1f;
		}
		float num2 = Mathf.Round(1f + (float)c.stats.characterRow._Radius / 2f + num / 2f);
		int count = this.party.Count;
		for (int i = 0; i < count; i++)
		{
			Character character = this.party[i];
			if (character && !character.inactive && !character.dead && !character.missing && (c.tr.position - character.tr.position).sqrMagnitude < 6400f)
			{
				character.stats.AddSpiritFromKill(num2);
				if (character.party && character.portrait)
				{
					character.portrait.SetMagicColor();
				}
			}
		}
	}

	// Token: 0x060008F8 RID: 2296 RVA: 0x000C19A8 File Offset: 0x000BFBA8
	public void AddAbilityToSameFaction(Character character, Library.Abilities ability)
	{
		for (int i = 0; i < this.characters.Count; i++)
		{
			if (this.characters[i] && ((this.characters[i].npc && character.npc && !character.stats.IsTargetAnEnemy(this.characters[i].stats.allegiance)) || (!character.npc && !this.characters[i].npc)))
			{
				character.actions.AddEffect(ability._Name, this.linksNPC[i]);
			}
		}
	}

	// Token: 0x060008F9 RID: 2297 RVA: 0x000C1A5C File Offset: 0x000BFC5C
	public void AddAbilityToOtherFaction(Character character, Library.Abilities ability)
	{
		for (int i = 0; i < this.characters.Count; i++)
		{
			if (this.characters[i] && ((character.npc && (!this.characters[i].npc || character.stats.IsTargetAnEnemy(this.characters[i].stats.allegiance))) || (!character.npc && this.characters[i].npc)))
			{
				character.actions.AddEffect(ability._Name, this.linksNPC[i]);
			}
		}
	}

	// Token: 0x060008FA RID: 2298 RVA: 0x000C1B10 File Offset: 0x000BFD10
	public void CheckNewSpell(TileEffects tileEffect)
	{
		int count = this.characters.Count;
		for (int i = 0; i < count; i++)
		{
			Character character = this.characters[i];
			if (character && !character.inactive && character.node != null)
			{
				tileEffect.CheckTile(character.node, character, true);
			}
		}
	}

	// Token: 0x060008FB RID: 2299 RVA: 0x000C1B6C File Offset: 0x000BFD6C
	public void CheckNewSpellNode(TileEffects tileEffect, GraphNode g, string effectName, bool hasAbility, Library.Abilities ability, Character source)
	{
		float num = (tileEffect.influenceRadius + 1f) * Records.x.nodeSize;
		for (int i = 0; i < this.characters.Count; i++)
		{
			Character character = this.characters[i];
			if (character && !character.inactive && !character.dead && (character.currentPosition - tileEffect.mainPosition).sqrMagnitude < num * num && character.node != null)
			{
				tileEffect.CheckTile(character.node, character, false);
			}
		}
	}

	// Token: 0x060008FC RID: 2300 RVA: 0x000C1C04 File Offset: 0x000BFE04
	public bool CheckTileTaken(GraphNode g)
	{
		int count = this.characters.Count;
		Vector3 vector = (Vector3)g.position;
		for (int i = 0; i < count; i++)
		{
			Character character = this.characters[i];
			if (character && !character.inactive && this.SubtractVectors(character.tr.position, vector).sqrMagnitude < 9f && character.node == g)
			{
				return true;
			}
		}
		return false;
	}

	// Token: 0x060008FD RID: 2301 RVA: 0x000C1C84 File Offset: 0x000BFE84
	public void SetUpPause()
	{
		for (int i = 0; i < this.characters.Count; i++)
		{
			if (this.characters[i] && !this.characters[i].inactive)
			{
				this.characters[i].ChangePauseState();
			}
		}
	}

	// Token: 0x060008FE RID: 2302 RVA: 0x000C1CE0 File Offset: 0x000BFEE0
	public void SetUpPocketPause()
	{
		for (int i = 0; i < this.characters.Count; i++)
		{
			if (this.characters[i] && !this.characters[i].inactive)
			{
				this.characters[i].ChangePocketPauseState();
			}
		}
		for (int j = 0; j < this.deads.Count; j++)
		{
			if (this.deads[j] && !this.deads[j].inactive)
			{
				this.deads[j].ChangePocketPauseState();
			}
		}
	}

	// Token: 0x060008FF RID: 2303 RVA: 0x000C1D88 File Offset: 0x000BFF88
	public void StartGrounder()
	{
		int count = this.characters.Count;
		for (int i = 0; i < count; i++)
		{
			Character character = this.characters[i];
			if (character && !character.useGrounder)
			{
				character.body.SetGrounderState(true);
			}
		}
	}

	// Token: 0x06000900 RID: 2304 RVA: 0x000C1DD8 File Offset: 0x000BFFD8
	public void CheckForCharactersInDome(Character firstTarget, Character initiator)
	{
	}

	// Token: 0x06000901 RID: 2305 RVA: 0x000C1DDC File Offset: 0x000BFFDC
	public void LookAtObject(Transform lookAtTransform, float radius, bool useHand, Character lookAtCharacter, float timeAmount, float delay, Character onlyCharacterToLook, int whoLooks)
	{
		if (!lookAtTransform)
		{
			return;
		}
		int count = this.characters.Count;
		float num = radius * radius;
		Vector3 position = lookAtTransform.position;
		for (int i = 0; i < count; i++)
		{
			Character character = this.characters[i];
			if (character && (whoLooks == 0 || (whoLooks == 2 && character.npc) || (whoLooks == 1 && !character.npc) || (whoLooks == 3 && character.npc && !lookAtCharacter.npc) || (!character.npc && lookAtCharacter.npc)) && character.IsSentient() && character != lookAtCharacter && (!onlyCharacterToLook || (onlyCharacterToLook && character == onlyCharacterToLook)) && (this.SubtractVectors(character.tr.position, position).sqrMagnitude < num || character == onlyCharacterToLook))
			{
				float num2 = 0f;
				if (delay > 0f)
				{
					num2 = Random.Range(delay - 0.5f, delay + 0.5f);
				}
				float num3 = 0f;
				if (timeAmount > 0f)
				{
					num3 = Random.Range(timeAmount - 1f, timeAmount + 1f);
				}
				character.body.lookAtController.SetNewTarget(lookAtTransform, num3, num2, useHand);
			}
		}
	}

	// Token: 0x06000902 RID: 2306 RVA: 0x000C1F4C File Offset: 0x000C014C
	public float NoiseRange(string type)
	{
		if (type == "Combat Aggro")
		{
			return 400f;
		}
		if (type == "Death")
		{
			return 16f;
		}
		if (type == "Footsteps")
		{
			return 625f;
		}
		if (type == "Sailing")
		{
			return 1600f;
		}
		if (type == "Attack")
		{
			return 400f;
		}
		if (type == "Hit")
		{
			return 400f;
		}
		if (type == "Item Drop")
		{
			return 100f;
		}
		if (type == "Break")
		{
			return 400f;
		}
		if (type == "RockWall")
		{
			return 625f;
		}
		if (type == "Entangle")
		{
			return 25f;
		}
		if (type == "NPCSpell")
		{
			return 900f;
		}
		return 0f;
	}

	// Token: 0x06000903 RID: 2307 RVA: 0x000C2030 File Offset: 0x000C0230
	public void AddNoise(GameObject go, GraphNode pos, string type, Character character)
	{
		if (pos != null)
		{
			this.noiseCharacter.Add(character);
			this.noiseObj.Add(go);
			this.noiseLocation.Add(pos);
			this.noiseType.Add(type);
			if (type == "Hit" || type == "Combat Aggro" || type == "Death")
			{
				this.noiseFaction.Add(2);
			}
			else
			{
				this.noiseFaction.Add(0);
			}
			if (this.debug && type != "Footsteps")
			{
				Debug.Log("Add noise " + ((go != null) ? go.ToString() : null) + " " + type);
			}
		}
	}

	// Token: 0x06000904 RID: 2308 RVA: 0x000C20EC File Offset: 0x000C02EC
	public void AddFootstep(Character character)
	{
		if (character.stats.Silent() > 0 || character.body.sneaking)
		{
			return;
		}
		if (character.node == null)
		{
			return;
		}
		int num = this.noiseCharacter.IndexOf(character);
		if (num == -1)
		{
			this.AddNoise(character.gameObject, character.node, "Footsteps", character);
			return;
		}
		this.noiseLocation[num] = character.node;
		if (character.sailing)
		{
			this.noiseType[num] = "Sailing";
		}
		else
		{
			this.noiseType[num] = "Footsteps";
		}
		this.noiseFaction[num] = 1;
	}

	// Token: 0x06000905 RID: 2309 RVA: 0x000C2194 File Offset: 0x000C0394
	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: 0x06000906 RID: 2310 RVA: 0x000C21E0 File Offset: 0x000C03E0
	public Vector3 SubtractVectorsNoY(Vector3 a, Vector3 b)
	{
		Vector3 vector;
		vector.x = a.x - b.x;
		vector.y = 0f;
		vector.z = a.z - b.z;
		return vector;
	}

	// Token: 0x04000E01 RID: 3585
	[Header("NOISE")]
	public List<GameObject> noiseObj = new List<GameObject>();

	// Token: 0x04000E02 RID: 3586
	public List<string> noiseType = new List<string>();

	// Token: 0x04000E03 RID: 3587
	public List<int> noiseFaction = new List<int>();

	// Token: 0x04000E04 RID: 3588
	public List<GraphNode> noiseLocation = new List<GraphNode>();

	// Token: 0x04000E05 RID: 3589
	public List<Character> noiseCharacter = new List<Character>();

	// Token: 0x04000E06 RID: 3590
	private List<GameObject> noiseObjTemp = new List<GameObject>();

	// Token: 0x04000E07 RID: 3591
	private List<string> noiseTypeTemp = new List<string>();

	// Token: 0x04000E08 RID: 3592
	private List<int> noiseFactionTemp = new List<int>();

	// Token: 0x04000E09 RID: 3593
	private List<GraphNode> noiseLocationTemp = new List<GraphNode>();

	// Token: 0x04000E0A RID: 3594
	private List<Character> noiseCharacterTemp = new List<Character>();

	// Token: 0x04000E0B RID: 3595
	public List<bool> footsteps = new List<bool>();

	// Token: 0x04000E0C RID: 3596
	private bool footstepAdded;

	// Token: 0x04000E0D RID: 3597
	[Header("MISC")]
	public bool debug;

	// Token: 0x04000E0E RID: 3598
	private Diorama diorama;

	// Token: 0x04000E0F RID: 3599
	private IEnumerator domeCoroutine;

	// Token: 0x04000E10 RID: 3600
	private List<Character> characters;

	// Token: 0x04000E11 RID: 3601
	private List<Character> party;

	// Token: 0x04000E12 RID: 3602
	private List<Character> npcs = new List<Character>();

	// Token: 0x04000E13 RID: 3603
	private List<Character> checkParty = new List<Character>();

	// Token: 0x04000E14 RID: 3604
	private List<PromptActions> promptActions;

	// Token: 0x04000E15 RID: 3605
	private List<Character> deads;

	// Token: 0x04000E16 RID: 3606
	private List<Character> linksNPC;

	// Token: 0x04000E17 RID: 3607
	private List<Character> towerCharacters;

	// Token: 0x04000E18 RID: 3608
	private List<Color32[]> pix = new List<Color32[]>();

	// Token: 0x04000E19 RID: 3609
	private List<int> sourceWidths = new List<int>();

	// Token: 0x04000E1A RID: 3610
	public List<Vector2> terrainDimensions = new List<Vector2>();

	// Token: 0x04000E1B RID: 3611
	private bool checking;

	// Token: 0x04000E1C RID: 3612
	private IEnumerator sensoryCoroutine;

	// Token: 0x04000E1D RID: 3613
	private List<SceneCamera> cams;

	// Token: 0x04000E1E RID: 3614
	private Color32[] currPix;

	// Token: 0x04000E1F RID: 3615
	public int terrainTextureWidthExt;

	// Token: 0x04000E20 RID: 3616
	public int terrainTextureWidthInt;

	// Token: 0x04000E21 RID: 3617
	public int terrainTextureHeightExt;

	// Token: 0x04000E22 RID: 3618
	public int terrainTextureHeightInt;

	// Token: 0x04000E23 RID: 3619
	public int bribeBadgeCount;

	// Token: 0x04000E24 RID: 3620
	private float timeSinceLastCheck;
}
