using System;
using System.Collections;
using System.Collections.Generic;
using cakeslice;
using DarkTonic.MasterAudio;
using MagicaCloth2;
using PixelCrushers.DialogueSystem;
using RootMotion;
using RootMotion.FinalIK;
using UnityEngine;
using UnityEngine.Rendering;

// Token: 0x02000017 RID: 23
public class Body : MonoBehaviour
{
	// Token: 0x06000257 RID: 599 RVA: 0x00030BC4 File Offset: 0x0002EDC4
	private bool IsBiped(string n)
	{
		return n.Contains("Varu") || n.Contains("Yeti") || n.Contains("Pasa") || n.Contains("Ame") || n.Contains("Female") || n.Contains("Male") || n.Contains("Pearl") || n.Contains("female") || n.Contains("Player_") || n.Contains("male") || n.Contains("Child") || n.Contains("Lacho") || n.Contains("Hunter") || n.Contains("Chanter") || n.Contains("Witch") || n.Contains("Dryad");
	}

	// Token: 0x06000258 RID: 600 RVA: 0x00030CB8 File Offset: 0x0002EEB8
	private void Awake()
	{
		this.tr = base.transform;
		this.anim = base.GetComponent<Animator>();
		this.originalScale = this.tr.localScale;
		if (!this.inMenu)
		{
			this.GetHashes();
		}
		if (this.startScale == Vector3.zero)
		{
			this.startScale = this.tr.localScale;
		}
		this.tr.localPosition = new Vector3(0f, 0f, 0f);
		this.grounder = base.gameObject.GetComponent<GrounderFBBIK>();
		this.lookik = base.gameObject.GetComponent<LookAtIK>();
		this.fbbik = base.gameObject.GetComponent<FullBodyBipedIK>();
		string name = base.gameObject.name;
		if (this.IsBiped(name))
		{
			this.originalScale = Vector3.one;
			if (!this.fbbik)
			{
				this.fbbik = base.gameObject.AddComponent<FullBodyBipedIK>();
				this.fbbik.AutoDetectReferences();
			}
			if (!this.lookik)
			{
				this.lookik = base.gameObject.AddComponent<LookAtIK>();
			}
		}
		if (this.lookik && this.fbbik)
		{
			if (!this.grounder)
			{
				this.grounder = base.gameObject.AddComponent<GrounderFBBIK>();
			}
			BipedReferences references = this.fbbik.references;
			Transform head = references.head;
			IKSolverLookAt.LookAtBone lookAtBone = new IKSolverLookAt.LookAtBone();
			lookAtBone.transform = head;
			this.lookik.solver.head = lookAtBone;
			Transform[] spine = references.spine;
			if (spine.Length == 1)
			{
				Transform transform = spine[0];
				lookAtBone = new IKSolverLookAt.LookAtBone();
				IKSolverLookAt.LookAtBone[] array = this.lookik.solver.spine;
				array = new IKSolverLookAt.LookAtBone[2];
				lookAtBone.transform = transform;
				array[0] = lookAtBone;
				array[1] = new IKSolverLookAt.LookAtBone
				{
					transform = this.GetNeck()
				};
				this.lookik.solver.spine = array;
			}
			else if (spine.Length == 2)
			{
				Transform transform2 = spine[0];
				lookAtBone = new IKSolverLookAt.LookAtBone();
				IKSolverLookAt.LookAtBone[] array2 = this.lookik.solver.spine;
				array2 = new IKSolverLookAt.LookAtBone[3];
				lookAtBone.transform = transform2;
				array2[0] = lookAtBone;
				Transform transform3 = spine[1];
				array2[1] = new IKSolverLookAt.LookAtBone
				{
					transform = transform3
				};
				array2[2] = new IKSolverLookAt.LookAtBone
				{
					transform = this.GetNeck()
				};
				this.lookik.solver.spine = array2;
			}
			this.lookik.solver.clampWeightHead = 0.5f;
			this.lookik.solver.clampWeight = 0.25f;
			this.lookik.solver.bodyWeight = 0.25f;
			this.fbbik.solver.SetToReferences(references, null);
			this.fbbik.enabled = false;
			this.fbbik.solver.IKPositionWeight = 0f;
		}
		if (this.grounder)
		{
			this.grounder.enabled = false;
		}
		if (this.lookik)
		{
			this.lookik.enabled = false;
		}
		if (this.grounder)
		{
			this.hasGrounder = true;
		}
		else
		{
			this.hasGrounder = false;
		}
		if (this.hasGrounder)
		{
			this.fbbik.solver.iterations = 4;
			this.grounder.solver.layers = 4194433;
			this.grounder.solver.maxStep = 1.5f;
			this.grounder.solver.footSpeed = 2.5f;
			this.grounder.solver.footRadius = 0.25f;
			this.grounder.solver.quality = Grounding.Quality.Simple;
			this.grounder.ik = this.fbbik;
		}
		if (this.lookik)
		{
			this.headBone = this.lookik.solver.head.transform;
			this.lookik.solver.Initiate(this.tr);
		}
		if (this.headBone == null)
		{
			this.headBone = this.GetHead();
		}
		this.colliders = base.gameObject.GetComponentsInChildren<Collider>();
		foreach (Collider collider in this.colliders)
		{
			collider.gameObject.layer = 31;
			if (!collider.gameObject.GetComponent<SelectionCircle>())
			{
				collider.gameObject.AddComponent<SelectionCircle>();
			}
		}
		if (this.lookik)
		{
			this.lookik.enabled = false;
		}
		if (!this.lookAtController)
		{
			this.lookAtController = base.gameObject.AddComponent<global::LookAtController>();
		}
	}

	// Token: 0x06000259 RID: 601 RVA: 0x00031178 File Offset: 0x0002F378
	public Transform GetFootLower()
	{
		ref Vector3 position = this.fbbik.references.leftFoot.position;
		Vector3 position2 = this.fbbik.references.rightFoot.position;
		if (position.y < position2.y)
		{
			return this.fbbik.references.leftFoot;
		}
		return this.fbbik.references.rightFoot;
	}

	// Token: 0x0600025A RID: 602 RVA: 0x000311DE File Offset: 0x0002F3DE
	private void Start()
	{
		if (this.inMenu)
		{
			this.SetGrounderState(false);
		}
		else
		{
			this.anim.updateMode = AnimatorUpdateMode.Normal;
		}
		this.needToUpdateItemColliders = 1;
	}

	// Token: 0x0600025B RID: 603 RVA: 0x00031204 File Offset: 0x0002F404
	private void OnAnimatorMove()
	{
		if (this.character && !this.dead && !this.inMenu && !this.isPortrait)
		{
			if (this.nextFrameRotateToChild)
			{
				if (!this.character.turning)
				{
					this.character.RotateToChild();
				}
				this.nextFrameRotateToChild = false;
			}
			this.stateInfo = this.anim.GetCurrentAnimatorStateInfo(0);
			this.currentHash = this.stateInfo.shortNameHash;
			if (!this.character.stunned)
			{
				float deltaTime = Time.deltaTime;
				bool flag = false;
				if (Time.timeSinceLevelLoad < this.character.waitingForNewPathTime + 0.2f && this.character.waitingForNewPath && this.character.waitingForNewPathTime > 0f)
				{
					flag = true;
				}
				if (!this.character.tempStop && !this.character.jumping && !this.character.isHit && this.character.IsSentient() && !this.character.pocketPaused && this.character.stats.Stuck() == 0 && !flag && ((this.character.physicsMove && !this.character.turningMain) || (this.character.CanMove() && this.character.moving)) && !this.character.boatNavigator && !this.character.jumpingAreas && deltaTime > 0f)
				{
					if (((this.character.physicsMove && this.character.IsWalking()) || ((this.character.mainSelected || this.character.npc || this.character.hasActions) && this.character.NodesCount() > 1) || (!this.character.npc && !this.character.hasActions && !this.character.mainSelected && this.character.NodesCount() > 0)) && this.character.IsWalking())
					{
						Vector3 rootPosition = this.anim.rootPosition;
						float num = this.character.movePoint.y;
						LayerMask layerMask = Links.x.floor;
						if (this.character.movesOnWater)
						{
							layerMask = 16;
						}
						RaycastHit raycastHit;
						if (Physics.Raycast(this.character.tr.position + new Vector3(0f, 3f, 0f), Vector3.up * -1f, out raycastHit, 6f, layerMask) && Mathf.Abs(raycastHit.point.y - this.character.movePoint.y) < 2f)
						{
							num = raycastHit.point.y;
						}
						rootPosition.y = Mathf.Lerp(this.character.tr.position.y, num, Time.deltaTime * 15f);
						Vector3 vector = this.anim.deltaPosition / deltaTime;
						vector *= deltaTime;
						if (this.character.physicsMove && !this.character.turningMain && this.character.cc)
						{
							Vector3 vector2 = vector;
							Vector3 currentPosition = this.character.currentPosition;
							RaycastHit raycastHit2;
							if (Physics.SphereCast(this.tr.position + new Vector3(0f, 4f, 0f), 0.25f, Vector3.up * -1f, out raycastHit2, 20f, layerMask))
							{
								Vector3 point = raycastHit2.point;
							}
							if (this.character.physicsY.y > 0f)
							{
								vector2.y = this.character.physicsY.y;
								if (raycastHit2.collider)
								{
									vector2 *= Mathf.Clamp(Mathf.Abs(raycastHit2.normal.y), 0.75f, 1f);
								}
							}
							else if (raycastHit2.collider)
							{
								vector2.y = this.character.physicsY.y * 1f;
								vector2 *= Mathf.Clamp(Mathf.Abs(raycastHit2.normal.y * 0.95f), 0.9f, 1f);
							}
							else
							{
								vector2.y = this.character.physicsY.y * 1f;
							}
							vector2.y -= 2f;
							this.character.cc.Move(vector2);
						}
						else
						{
							float num2 = Mathf.Lerp(this.character.tr.position.y, this.character.movePoint.y, Time.deltaTime * 7f);
							Vector3 deltaPosition = this.anim.deltaPosition;
							Vector3 vector3 = vector;
							this.character.SetPosition(this.tr.position + vector3, null);
							this.character.SetPosition(new Vector3(this.tr.position.x, num2, this.tr.position.z), null);
						}
					}
					this.tr.localPosition = Vector3.Lerp(this.tr.localPosition, this.bodyOffset, Time.deltaTime * 50f);
				}
				else
				{
					if (this.character.animID > 0 && this.character.canSwitchBackToIdle && Time.timeSinceLevelLoad > this.waitForCrossFadeTime + 0.3f && (this.currentHash == this.idleHash || this.currentHash == this.combatIdleHash || this.currentHash == this.combatIdle2Hash))
					{
						if (this.character.dodging)
						{
							this.character.PlayAnimation("Defend", 0f);
						}
						if (this.character.IsSentient() && this.character.animID != 53)
						{
							this.character.animID = 0;
							this.character.canSwitchBackToIdle = false;
							this.character.SetAnimatorSpeed(1f);
						}
					}
					if (this.anim.speed > 0f)
					{
						Vector3 deltaPosition2 = this.anim.deltaPosition;
						if (float.IsNaN(deltaPosition2.x) || float.IsNaN(deltaPosition2.y) || float.IsNaN(deltaPosition2.z))
						{
							Debug.Log(this.character.animID.ToString() + " " + this.anim.speed.ToString());
						}
						else if (this.character.Pivoting())
						{
							Vector3 eulerAngles = this.anim.deltaRotation.eulerAngles;
							this.tr.Rotate(eulerAngles);
							this.tr.localPosition = Vector3.Lerp(this.tr.localPosition, this.bodyOffset, Time.deltaTime * 50f);
						}
					}
					if (this.tr.localRotation.eulerAngles != Vector3.zero && !this.character.turning && !this.character.Pivoting())
					{
						this.nextFrameRotateToChild = true;
					}
				}
				if (!this.inMenu)
				{
					if (this.character.IsAttacking(this.currentHash) || this.character.IsCasting(this.currentHash))
					{
						this.attacking = true;
					}
					else if (!Records.x.pocketPause && this.character.animID != 2)
					{
						this.attacking = false;
						if (this.character && this.character.timelineIcon && !this.character.inQueuedAbility)
						{
							this.character.inAction = false;
						}
					}
				}
			}
			if (!this.dithering && this.character.visible == 1 && this.fleshRenderers.Count > 0 && !this.character.isBoro && this.fleshRenderers[0] && !this.fleshRenderers[0].enabled)
			{
				this.MeshOn(true, true);
			}
			if (this.character.visible > 0 || this.character.party || this.turnOnMagicaClothNextFrame > 0)
			{
				float num3 = (float)this.character.stats.HealthCurrent() / (float)this.character.stats.HealthMax();
				this.healthPercent = 0f;
				if (num3 < 0.166f)
				{
					this.healthPercent = 5f;
				}
				if (num3 >= 0.166f && num3 < 0.33f)
				{
					this.healthPercent = 4f;
				}
				if (num3 >= 0.33f && num3 < 0.5f)
				{
					this.healthPercent = 3f;
				}
				if (num3 >= 0.5f && num3 < 0.667f)
				{
					this.healthPercent = 2f;
				}
				if ((double)num3 >= 0.667 && num3 < 0.883f)
				{
					this.healthPercent = 1f;
				}
				for (int i = 0; i < this.fleshRenderers.Count; i++)
				{
					if (this.fleshRenderers[i] && this.fleshRenderers[i].gameObject.activeSelf)
					{
						this.mats = this.fleshRenderers[i].materials;
						Material[] array = this.mats;
						for (int j = 0; j < array.Length; j++)
						{
							array[j].SetFloat("_Damaged", this.healthPercent);
						}
					}
				}
			}
		}
		if (this.turnOnMagicaClothNextFrame > 0)
		{
			this.turnOnMagicaClothNextFrame--;
			if (this.turnOnMagicaClothNextFrame == 0)
			{
				this.SetMagicaClothState(true);
			}
			else
			{
				this.SetMagicaClothState(false);
			}
		}
		if (this.bracket)
		{
			this.BracketPosition();
		}
		this.Dither();
		this.CheckBlink();
		this.CheckBlink2();
	}

	// Token: 0x0600025C RID: 604 RVA: 0x00031C68 File Offset: 0x0002FE68
	public void SetBlood(float healthPercent)
	{
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			if (this.fleshRenderers[i] && this.fleshRenderers[i].gameObject.activeSelf)
			{
				this.mats = this.fleshRenderers[i].materials;
				Material[] array = this.mats;
				for (int j = 0; j < array.Length; j++)
				{
					array[j].SetFloat("_Damaged", healthPercent);
				}
			}
		}
	}

	// Token: 0x0600025D RID: 605 RVA: 0x00031CF0 File Offset: 0x0002FEF0
	public void StartBlink(float totalTimeLength)
	{
		this.blinking = 1;
		this.blinkTime = Time.timeSinceLevelLoad;
		this.blinkInterval = totalTimeLength / 3f;
		this.DoBlink(1f);
	}

	// Token: 0x0600025E RID: 606 RVA: 0x00031D1C File Offset: 0x0002FF1C
	public void CheckBlink()
	{
		if (this.blinking > 0 && Time.timeSinceLevelLoad > this.blinkTime + this.blinkInterval)
		{
			this.blinkTime = Time.timeSinceLevelLoad;
			this.blinking++;
			if (this.blinking == 2)
			{
				this.DoBlink(0f);
			}
			if (this.blinking == 3)
			{
				this.DoBlink(1f);
			}
			if (this.blinking >= 4)
			{
				this.EndBlink();
			}
		}
	}

	// Token: 0x0600025F RID: 607 RVA: 0x00031D98 File Offset: 0x0002FF98
	private void DoBlink(float state)
	{
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			if (this.fleshRenderers[i])
			{
				this.materials = this.fleshRenderers[i].materials;
				Material[] array = this.materials;
				for (int j = 0; j < array.Length; j++)
				{
					array[j].SetFloat("_AttackBlink", state);
				}
			}
		}
	}

	// Token: 0x06000260 RID: 608 RVA: 0x00031E08 File Offset: 0x00030008
	public void EndBlink()
	{
		if (this.blinking > 0)
		{
			this.blinking = 0;
			this.DoBlink(0f);
		}
	}

	// Token: 0x06000261 RID: 609 RVA: 0x00031E28 File Offset: 0x00030028
	public void StartBlink2(int num, string type)
	{
		this.blinking2 = 1;
		this.blink2Type = type;
		if (num > 10)
		{
			this.blinkTime2 = Time.realtimeSinceStartup;
		}
		else
		{
			this.blinkTime2 = Time.timeSinceLevelLoad;
		}
		this.blinkInterval2 = 0.16f;
		this.blinkNumber2 = num;
		this.DoBlink2(1f);
	}

	// Token: 0x06000262 RID: 610 RVA: 0x00031E80 File Offset: 0x00030080
	public void CheckBlink2()
	{
		if (this.blinking2 > 0)
		{
			float timeSinceLevelLoad = Time.timeSinceLevelLoad;
			if (this.blinkNumber2 > 10)
			{
				this.blinkTime2 = Time.realtimeSinceStartup;
			}
			if (timeSinceLevelLoad > this.blinkTime2 + this.blinkInterval2)
			{
				if (this.blinkNumber2 > 10)
				{
					this.blinkTime2 = Time.realtimeSinceStartup;
				}
				else
				{
					this.blinkTime2 = Time.timeSinceLevelLoad;
				}
				this.blinking2++;
				if (this.blinking2 == 2 && this.blinkNumber2 > 2)
				{
					this.DoBlink2(0f);
				}
				if (this.blinking2 == 3 && this.blinkNumber2 > 3)
				{
					this.DoBlink2(1f);
				}
				if (this.blinking2 == 4 && this.blinkNumber2 > 4)
				{
					this.DoBlink2(0f);
				}
				if (this.blinking2 == 5 && this.blinkNumber2 > 5)
				{
					this.DoBlink2(1f);
				}
				if (this.blinking2 == 6 && this.blinkNumber2 > 6)
				{
					this.DoBlink2(0f);
				}
				if (this.blinking2 == 7 && this.blinkNumber2 > 7)
				{
					this.DoBlink2(1f);
				}
				if (this.blinking2 == 8 && this.blinkNumber2 > 8)
				{
					this.DoBlink2(0f);
				}
				if (this.blinking2 == 9 && this.blinkNumber2 > 9)
				{
					this.DoBlink2(1f);
				}
				if (this.blinking2 == 10 && this.blinkNumber2 > 10)
				{
					this.DoBlink2(0f);
				}
				if (this.blinking2 == 11 && this.blinkNumber2 > 11)
				{
					this.DoBlink2(1f);
				}
				if (this.blinking2 >= 12 || this.blinkNumber2 == this.blinking2)
				{
					this.EndBlink2();
				}
			}
		}
	}

	// Token: 0x06000263 RID: 611 RVA: 0x0003203C File Offset: 0x0003023C
	private void DoBlink2(float state)
	{
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			if (this.fleshRenderers[i])
			{
				this.materials = this.fleshRenderers[i].materials;
				foreach (Material material in this.materials)
				{
					if (this.blink2Type == "Stamina")
					{
						material.SetVector("_AttackBlinkColor", new Color(0.9019608f, 0.8235294f, 0f, 1f));
					}
					else if (this.blink2Type == "Swarm")
					{
						material.SetVector("_AttackBlinkColor", new Color(0.9647059f, 0.36862746f, 0f, 1f));
					}
					else
					{
						material.SetVector("_AttackBlinkColor", new Color(1f, 1f, 1f, 1f));
					}
					material.SetFloat("_AttackBlink2", state);
				}
			}
		}
	}

	// Token: 0x06000264 RID: 612 RVA: 0x00032160 File Offset: 0x00030360
	public void EndBlink2()
	{
		if (this.blinking2 > 0)
		{
			this.blinking2 = 0;
			this.DoBlink2(0f);
		}
	}

	// Token: 0x06000265 RID: 613 RVA: 0x00032180 File Offset: 0x00030380
	public void UpdateMenuColliders(bool updateMain)
	{
		if (this.needToUpdateItemColliders > 0)
		{
			this.needToUpdateItemColliders++;
			if (this.needToUpdateItemColliders == 2)
			{
				this.UpdateItemColliders(true, updateMain);
			}
			if (this.needToUpdateItemColliders == 3)
			{
				this.UpdateItemColliders(false, updateMain);
			}
			if (this.needToUpdateItemColliders == 4)
			{
				this.UpdateItemColliders(true, updateMain);
				this.needToUpdateItemColliders = 0;
			}
		}
	}

	// Token: 0x06000266 RID: 614 RVA: 0x000321E0 File Offset: 0x000303E0
	public void AttackEvent()
	{
		this.character.PlaySoundFX(0, 4);
		if (this.character.hasActions && this.character.actions)
		{
			if (this.ignoreAttackEvent)
			{
				this.character.actions.AddBlood();
			}
			else if (this.character.NeedsAmmo())
			{
				this.character.actions.FireRangeWeapon();
				if (this.character.actions)
				{
					this.character.actions.AttackAnimationDone();
				}
			}
			else
			{
				this.character.actions.TriggerHitFromAttackAnimation();
				if (this.character.actions)
				{
					this.character.actions.AttackAnimationDone();
				}
			}
		}
		this.ignoreAttackEvent = false;
	}

	// Token: 0x06000267 RID: 615 RVA: 0x000322B3 File Offset: 0x000304B3
	public void CastEvent()
	{
		if (this.character.hasActions)
		{
			this.character.actions.TriggerCastFromCastAnimation();
		}
	}

	// Token: 0x06000268 RID: 616 RVA: 0x000322D2 File Offset: 0x000304D2
	public void TrinketEvent()
	{
	}

	// Token: 0x06000269 RID: 617 RVA: 0x000322D4 File Offset: 0x000304D4
	public void attack()
	{
		if (this.character)
		{
			if (this.character.oar)
			{
				this.Oar();
				return;
			}
			if (!this.character.IsAttacking(this.currentHash))
			{
				return;
			}
			this.attacking = true;
			this.AttackEvent();
		}
	}

	// Token: 0x0600026A RID: 618 RVA: 0x00032328 File Offset: 0x00030528
	public void cast()
	{
		if (!this.character.IsCasting(this.currentHash))
		{
			return;
		}
		this.attacking = true;
		this.CastEvent();
	}

	// Token: 0x0600026B RID: 619 RVA: 0x0003234B File Offset: 0x0003054B
	public void trinket()
	{
		if (!this.character.IsTrinketing(this.currentHash))
		{
			return;
		}
		this.attacking = true;
		this.TrinketEvent();
	}

	// Token: 0x0600026C RID: 620 RVA: 0x0003236E File Offset: 0x0003056E
	public void hold()
	{
		this.animationHold = true;
		this.anim.speed = 0f;
	}

	// Token: 0x0600026D RID: 621 RVA: 0x00032387 File Offset: 0x00030587
	public void down()
	{
	}

	// Token: 0x0600026E RID: 622 RVA: 0x00032389 File Offset: 0x00030589
	public void EndHold()
	{
		this.animationHold = false;
		this.anim.speed = 1f;
	}

	// Token: 0x0600026F RID: 623 RVA: 0x000323A2 File Offset: 0x000305A2
	public void bounce()
	{
		if (!this.character.dead)
		{
			this.character.animID = 0;
			this.character.Bounce(Links.x.main, "Knockback", 0f);
		}
	}

	// Token: 0x06000270 RID: 624 RVA: 0x000323DC File Offset: 0x000305DC
	public void Oar()
	{
		if (this.character.party)
		{
			Links.x.gaia.boat.PlayOarSplash(this.character);
		}
		if (this.character.boat && !this.character.party)
		{
			this.character.boat.PlayOarSplash(this.character);
		}
	}

	// Token: 0x06000271 RID: 625 RVA: 0x00032445 File Offset: 0x00030645
	public void Attack()
	{
		if (this.character.oar)
		{
			this.Oar();
			return;
		}
		if (!this.character.IsAttacking(this.currentHash))
		{
			return;
		}
		this.attacking = true;
		this.AttackEvent();
	}

	// Token: 0x06000272 RID: 626 RVA: 0x00032481 File Offset: 0x00030681
	public void Cast()
	{
		if (!this.character.IsCasting(this.currentHash))
		{
			return;
		}
		this.attacking = true;
		this.CastEvent();
	}

	// Token: 0x06000273 RID: 627 RVA: 0x000324A4 File Offset: 0x000306A4
	public void Trinket()
	{
		if (!this.character.IsTrinketing(this.currentHash))
		{
			return;
		}
		this.attacking = true;
		this.TrinketEvent();
	}

	// Token: 0x06000274 RID: 628 RVA: 0x000324C7 File Offset: 0x000306C7
	public void special()
	{
	}

	// Token: 0x06000275 RID: 629 RVA: 0x000324C9 File Offset: 0x000306C9
	public void Step()
	{
		this.character.PlaySoundFX(0, 0);
	}

	// Token: 0x06000276 RID: 630 RVA: 0x000324D8 File Offset: 0x000306D8
	public void step()
	{
		if (this.character)
		{
			if (this.character.party)
			{
				this.character.PlaySoundFX(0, 0);
				return;
			}
			this.character.PlaySoundFX(0, 0);
		}
	}

	// Token: 0x06000277 RID: 631 RVA: 0x0003250F File Offset: 0x0003070F
	public void walk()
	{
		if (this.character)
		{
			if (this.character.party)
			{
				this.character.PlaySoundFX(0, 0);
				return;
			}
			this.character.PlaySoundFX(0, 0);
		}
	}

	// Token: 0x06000278 RID: 632 RVA: 0x00032546 File Offset: 0x00030746
	public void Footstep1()
	{
		if (this.character)
		{
			if (this.character.party)
			{
				this.character.PlaySoundFX(0, 0);
				return;
			}
			this.character.PlaySoundFX(0, 0);
		}
	}

	// Token: 0x06000279 RID: 633 RVA: 0x0003257D File Offset: 0x0003077D
	public void Footstep2()
	{
		if (this.character)
		{
			if (this.character.party)
			{
				this.character.PlaySoundFX(0, 0);
				return;
			}
			this.character.PlaySoundFX(0, 0);
		}
	}

	// Token: 0x0600027A RID: 634 RVA: 0x000325B4 File Offset: 0x000307B4
	public void TurnOffIK()
	{
		this.SetGrounderState(false);
	}

	// Token: 0x0600027B RID: 635 RVA: 0x000325C0 File Offset: 0x000307C0
	public void SetGrounderState(bool state)
	{
		if (!this.grounder)
		{
			this.grounderOn = state;
			return;
		}
		if (this.dead && state)
		{
			return;
		}
		if (this.character)
		{
			if (!this.character.party)
			{
				state = false;
			}
			if (this.character.inactive || this.character.stunned || this.character.visible == 0 || this.character.stats.Floating() > 0)
			{
				state = false;
			}
		}
		state = false;
		if (state)
		{
			this.grounder.weight = 1f;
			this.grounder.enabled = true;
			if (this.fbbik)
			{
				this.fbbik.solver.IKPositionWeight = 1f;
				this.fbbik.enabled = true;
			}
			this.grounderOn = true;
			return;
		}
		this.grounder.weight = 0f;
		this.grounder.enabled = false;
		if (this.fbbik)
		{
			this.fbbik.solver.IKPositionWeight = 0f;
			this.fbbik.enabled = false;
		}
		this.grounderOn = false;
	}

	// Token: 0x0600027C RID: 636 RVA: 0x000326F0 File Offset: 0x000308F0
	public void StartDead(Vector3 dir)
	{
		this.CombatSheen(0);
		this.EndBlink();
		this.EndBlink2();
		for (int i = 0; i < this.colliders.Length; i++)
		{
			if (this.colliders[i])
			{
				this.colliders[i].enabled = false;
			}
		}
		if (this.headColl)
		{
			this.headColl.enabled = false;
		}
		for (int j = 0; j < this.fleshRenderers.Count; j++)
		{
			if (this.fleshRenderers[j] && this.fleshRenderers[j].gameObject.activeSelf)
			{
				this.mats = this.fleshRenderers[j].materials;
				foreach (Material material in this.mats)
				{
					if (material)
					{
						material.SetFloat("_Glow", 0f);
					}
				}
			}
		}
		this.goreStart = Links.x.gameplay.seconds;
		if (this.ghost)
		{
			for (int l = 0; l < this.fleshRenderers.Count; l++)
			{
				if (this.fleshRenderers[l] && this.fleshRenderers[l].gameObject.activeSelf)
				{
					Links.x.cameraEffects.AddRemoveGhost(this.fleshRenderers[l], false);
				}
			}
		}
		this.TargetingOutline(false);
		if (this.character)
		{
			this.goreObj = this.character.goreObj;
		}
		if (!this.goreObj)
		{
			this.dead = true;
			this.makeBones = false;
			if (this.character && !this.character.ghost && !this.character.party && !this.character.stats.xmlName.Contains("Fairy"))
			{
				this.makeBones = true;
			}
			for (int m = 0; m < this.colliders.Length; m++)
			{
				if (this.colliders[m])
				{
					this.colliders[m].enabled = false;
				}
			}
			if (this.headColl)
			{
				this.headColl.enabled = false;
			}
			if (this.makeBones)
			{
				int num = Random.Range(1, 3);
				this.deadRenderers.Clear();
				for (int n = 0; n < num; n++)
				{
					GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(67);
					pooledGameObject.gameObject.SetActive(true);
					pooledGameObject.transform.position = this.character.tr.position + new Vector3(0f, 1f, 0f);
					if (pooledGameObject.transform.childCount > 0)
					{
						GameObject gameObject = pooledGameObject.transform.GetChild(0).gameObject;
						gameObject.transform.localPosition = Vector3.zero;
						MeshRenderer component = gameObject.GetComponent<MeshRenderer>();
						if (component)
						{
							component.enabled = true;
							this.deadRenderers.Add(component);
							this.mats = component.materials;
							Material[] array = this.mats;
							for (int k = 0; k < array.Length; k++)
							{
								array[k].SetFloat("_Dither", 0f);
							}
						}
						Rigidbody component2 = pooledGameObject.GetComponent<Rigidbody>();
						component2.position = this.character.tr.position + new Vector3(0f, 1f, 0f);
						this.SetMeshLayer(component.gameObject, false);
						component2.interpolation = RigidbodyInterpolation.Interpolate;
						this.deadRigidbodies.Add(component2);
						component2.isKinematic = false;
					}
					else
					{
						string text = "Wrong cellar object for body bones ";
						GameObject gameObject2 = pooledGameObject;
						Debug.LogWarning(text + ((gameObject2 != null) ? gameObject2.ToString() : null));
					}
				}
				if (this.character)
				{
					for (int num2 = 0; num2 < this.fleshRenderers.Count; num2++)
					{
						if (this.fleshRenderers[num2])
						{
							if (this.character.stats.animal && !this.model.Contains("GraveKeep"))
							{
								this.fleshRenderers[num2].enabled = false;
								this.cannotTurnOn = true;
							}
							else
							{
								this.fleshRenderers[num2].enabled = true;
								this.SetMeshLayer(this.fleshRenderers[num2].gameObject, false);
							}
						}
					}
				}
				this.SetHeadAnim(false);
			}
		}
		else
		{
			this.dead = true;
			this.deadRenderers.Clear();
			this.deadRigidbodies.Clear();
			if (this.character && this.character.goreObj)
			{
				this.goreObj = this.character.goreObj;
			}
			bool flag = false;
			if (this.character)
			{
				flag = this.character.movesOnWater;
			}
			if (this.goreObj)
			{
				SkinnedMeshRenderer[] componentsInChildren = this.goreObj.GetComponentsInChildren<SkinnedMeshRenderer>();
				for (int num3 = 0; num3 < componentsInChildren.Length; num3++)
				{
					this.materials = componentsInChildren[num3].materials;
					for (int num4 = 0; num4 < this.materials.Length; num4++)
					{
						this.materials[num4].SetFloat("_Race", (float)this.raceID);
						this.materials[num4].SetFloat("_Hair", (float)this.hairID);
						this.materials[num4].SetFloat("_Skin", (float)this.skinID);
						this.materials[num4].SetFloat("_Outfit", (float)this.outfitID);
						if (flag)
						{
							this.materials[num4].renderQueue = 2400;
						}
						else
						{
							this.materials[num4].renderQueue = 2454;
						}
					}
					this.deadRenderers.Add(componentsInChildren[num3]);
					componentsInChildren[num3].enabled = true;
					foreach (Material material2 in this.materials)
					{
						if (this.inMenu)
						{
							if (this.CanSwitchMaterial(material2, "Menus"))
							{
								material2.shader = Links.x.characterMenu;
							}
						}
						else if (this.CanSwitchMaterial(material2, "Motion"))
						{
							material2.shader = Links.x.characterGame;
						}
						material2.SetFloat("_Damaged", this.healthPercent);
						material2.SetFloat("_Dither", 0f);
					}
					this.SetMeshLayer(componentsInChildren[num3].gameObject, true);
				}
				MeshRenderer[] componentsInChildren2 = this.goreObj.GetComponentsInChildren<MeshRenderer>();
				for (int num5 = 0; num5 < componentsInChildren2.Length; num5++)
				{
					this.deadRenderers.Add(componentsInChildren2[num5]);
					componentsInChildren2[num5].enabled = true;
					this.mats = componentsInChildren2[num5].materials;
					foreach (Material material3 in this.mats)
					{
						material3.SetFloat("_Dither", 0f);
						material3.SetFloat("_Damaged", this.healthPercent);
						material3.SetFloat("_BodyGone", 1f);
						if (this.inMenu)
						{
							if (this.CanSwitchMaterial(material3, "Menus"))
							{
								material3.shader = Links.x.characterMenu;
							}
						}
						else if (this.CanSwitchMaterial(material3, "Motion"))
						{
							material3.shader = Links.x.characterGame;
						}
						if (flag)
						{
							material3.renderQueue = 2400;
						}
						else
						{
							material3.renderQueue = 2454;
						}
					}
					this.SetMeshLayer(componentsInChildren2[num5].gameObject, true);
				}
				Rigidbody[] componentsInChildren3 = this.goreObj.GetComponentsInChildren<Rigidbody>();
				for (int num6 = 0; num6 < componentsInChildren3.Length; num6++)
				{
					componentsInChildren3[num6].interpolation = RigidbodyInterpolation.Interpolate;
					this.deadRigidbodies.Add(componentsInChildren3[num6]);
					this.SetMeshLayer(this.deadRigidbodies[num6].gameObject, false);
				}
				Collider[] componentsInChildren4 = this.goreObj.GetComponentsInChildren<Collider>();
				for (int num7 = 0; num7 < componentsInChildren4.Length; num7++)
				{
					this.SetMeshLayer(componentsInChildren4[num7].gameObject, false);
				}
				if (this.headColl)
				{
					this.SetMeshLayer(this.headColl.gameObject, false);
				}
				for (int num8 = 0; num8 < this.fleshRenderers.Count; num8++)
				{
					if (this.fleshRenderers[num8])
					{
						this.fleshRenderers[num8].enabled = false;
					}
				}
				for (int num9 = 0; num9 < this.fleshAnimators.Count; num9++)
				{
					this.fleshAnimators[num9].enabled = false;
				}
				this.SetHeadAnim(false);
				this.SetMeshLayer(this.goreObj, false);
			}
		}
		this.dead = true;
	}

	// Token: 0x0600027D RID: 637 RVA: 0x00032FFB File Offset: 0x000311FB
	public void SetGoreKinematic()
	{
		if (this.goreScript && !this.goreScript.setKinematic)
		{
			this.goreScript.SetKinematic();
			this.EndDead(1);
		}
	}

	// Token: 0x0600027E RID: 638 RVA: 0x0003302C File Offset: 0x0003122C
	public void SetDeadRendererLayers(int layer)
	{
		if (this.dead)
		{
			for (int i = 0; i < this.deadRenderers.Count; i++)
			{
				this.deadRenderers[i].gameObject.layer = layer;
			}
			for (int j = 0; j < this.deadRigidbodies.Count; j++)
			{
				this.deadRigidbodies[j].gameObject.layer = layer;
			}
			for (int k = 0; k < this.fleshRenderers.Count; k++)
			{
				if (this.fleshRenderers[k])
				{
					this.fleshRenderers[k].gameObject.layer = layer;
				}
			}
		}
	}

	// Token: 0x0600027F RID: 639 RVA: 0x000330E0 File Offset: 0x000312E0
	public void PocketGore(bool state)
	{
		if (this.bonesRoutine != null)
		{
			return;
		}
		if (this.makeBones)
		{
			return;
		}
		if (this.savedVelocities == null)
		{
			this.savedVelocities = new List<Vector3>();
			this.savedAngularVelocities = new List<Vector3>();
		}
		for (int i = 0; i < this.deadRigidbodies.Count; i++)
		{
			if (state)
			{
				this.deadRigidbodies[i].isKinematic = false;
				this.deadRigidbodies[i].useGravity = true;
				if (i < this.savedVelocities.Count && this.savedVelocities[i].sqrMagnitude > 0.02f && Links.x.gameplay.seconds > this.goreStart + 5f)
				{
					this.deadRigidbodies[i].AddForce(this.savedVelocities[i], ForceMode.VelocityChange);
					this.deadRigidbodies[i].AddTorque(this.deadRigidbodies[i].angularVelocity, ForceMode.VelocityChange);
				}
			}
			else
			{
				if (i < this.savedVelocities.Count)
				{
					this.savedVelocities[i] = this.deadRigidbodies[i].linearVelocity;
					this.savedAngularVelocities[i] = this.deadRigidbodies[i].angularVelocity;
				}
				this.deadRigidbodies[i].isKinematic = true;
				this.deadRigidbodies[i].useGravity = false;
			}
		}
	}

	// Token: 0x06000280 RID: 640 RVA: 0x00033264 File Offset: 0x00031464
	public void AddExplosionDeadForce()
	{
		if (this.bonesRoutine != null)
		{
			return;
		}
		for (int i = 0; i < this.deadRigidbodies.Count; i++)
		{
			this.deadRigidbodies[i].isKinematic = false;
			this.deadRigidbodies[i].useGravity = true;
			this.deadRigidbodies[i].AddForce(new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-1f, 1f)) * 800f, ForceMode.Force);
		}
	}

	// Token: 0x06000281 RID: 641 RVA: 0x000332F8 File Offset: 0x000314F8
	public void AddDeadForce(Vector3 dir, float s)
	{
		if (this.bonesRoutine != null)
		{
			return;
		}
		for (int i = 0; i < this.deadRigidbodies.Count; i++)
		{
			this.deadRigidbodies[i].isKinematic = false;
			this.deadRigidbodies[i].useGravity = true;
			this.deadRigidbodies[i].AddForce(dir * s, ForceMode.Force);
		}
	}

	// Token: 0x06000282 RID: 642 RVA: 0x00033364 File Offset: 0x00031564
	public void Missing()
	{
		this.dead = true;
		for (int i = 0; i < this.colliders.Length; i++)
		{
			this.colliders[i].enabled = false;
		}
		if (this.headColl)
		{
			this.headColl.enabled = false;
		}
	}

	// Token: 0x06000283 RID: 643 RVA: 0x000333B4 File Offset: 0x000315B4
	public void RemoveDeathParts()
	{
		if (this.character)
		{
			if (!this.character.goreObj)
			{
				if (this.makeBones)
				{
					for (int i = 0; i < this.deadRigidbodies.Count; i++)
					{
						this.deadRigidbodies[i].isKinematic = true;
						Links.x.cellar.ReturnPooledGameObject(67, this.deadRigidbodies[i].gameObject);
					}
					return;
				}
			}
			else
			{
				for (int j = 0; j < this.deadRigidbodies.Count; j++)
				{
					this.deadRigidbodies[j].isKinematic = true;
				}
				Links.x.archives.RecycleDeath(this.character.goreObj, this.character.goreType, this.character.stats.characterRow._DeathID);
				this.deadRigidbodies.Clear();
			}
		}
	}

	// Token: 0x06000284 RID: 644 RVA: 0x000334A6 File Offset: 0x000316A6
	public void EndDead(int pass)
	{
		if (this.bonesRoutine == null)
		{
			this.bonesRoutine = this.GoToBones(pass);
			base.StartCoroutine(this.bonesRoutine);
		}
	}

	// Token: 0x06000285 RID: 645 RVA: 0x000334CA File Offset: 0x000316CA
	private IEnumerator GoToBones(int pass)
	{
		if (pass == 2)
		{
			Links.x.ChangeDeadList(this.character, false);
		}
		string state = this.character.stats.state;
		bool flag = false;
		if (this.ghost && this.character.creatures)
		{
			flag = !Links.x.diorama.mapCanResurrect || !this.character.creatures.LeaderAliveOrNoLeader();
		}
		if (state == "Swallowed" || this.character.missing || flag)
		{
			if (pass == 2)
			{
				for (int i = 0; i < this.colliders.Length; i++)
				{
					this.colliders[i].enabled = false;
				}
				if (this.headColl)
				{
					this.headColl.enabled = false;
				}
			}
			float timeToLerp = 36f;
			float percentage = 0f;
			float startTime = Links.x.gameplay.seconds;
			if (pass == 1)
			{
				timeToLerp = 100f;
			}
			bool half = false;
			while (percentage < 0.95f)
			{
				percentage = (Links.x.gameplay.seconds - startTime) / timeToLerp;
				for (int j = 0; j < this.deadRenderers.Count; j++)
				{
					if (this.deadRenderers[j])
					{
						this.mats = this.deadRenderers[j].materials;
						foreach (Material material in this.mats)
						{
							if (percentage > 0.5f && pass == 1)
							{
								material.SetFloat("_BodyGone", 1f - percentage);
							}
							if (pass == 2)
							{
								material.SetFloat("_Dither", 1f);
								material.SetFloat("_DitherAmount", 1f - percentage);
							}
						}
						if (percentage > 0.5f && pass == 2 && !half)
						{
							Vector3 vector = this.deadRenderers[j].bounds.center;
							RaycastHit raycastHit;
							if (Physics.Raycast(vector + new Vector3(0f, 1f, 0f), Vector3.up * -1f, out raycastHit, 20f, 4194321))
							{
								vector = raycastHit.point;
							}
							GameObject gorePile = Links.x.cellar.GetGorePile();
							gorePile.gameObject.SetActive(true);
							gorePile.transform.position = vector;
							Vector3 zero = Vector3.zero;
							zero.x = Random.Range(0f, 360f);
							zero.y = Random.Range(0f, 360f);
							zero.z = Random.Range(0f, 360f);
							gorePile.transform.rotation = Quaternion.Euler(zero);
							this.bones.Add(gorePile);
						}
					}
				}
				if (percentage > 0.5f && !half)
				{
					half = true;
				}
				yield return null;
			}
			if (pass == 2)
			{
				this.SetMeshState(false, false);
				for (int l = 0; l < this.deadRenderers.Count; l++)
				{
					if (this.deadRenderers[l])
					{
						this.mats = this.deadRenderers[l].materials;
						Material[] array = this.mats;
						for (int k = 0; k < array.Length; k++)
						{
							array[k].SetFloat("_BodyGone", 1f);
						}
					}
				}
				if (this.character.goreObj)
				{
					for (int m = 0; m < this.deadRigidbodies.Count; m++)
					{
						this.deadRigidbodies[m].isKinematic = true;
					}
					Links.x.archives.RecycleDeath(this.character.goreObj, this.character.goreType, this.character.stats.characterRow._DeathID);
					this.deadRigidbodies.Clear();
					this.deadRenderers.Clear();
				}
				else
				{
					if (this.makeBones)
					{
						for (int n = 0; n < this.deadRigidbodies.Count; n++)
						{
							this.deadRigidbodies[n].isKinematic = true;
							Links.x.cellar.ReturnPooledGameObject(67, this.deadRigidbodies[n].gameObject);
						}
					}
					GameObject gorePile2 = Links.x.cellar.GetGorePile();
					gorePile2.gameObject.SetActive(true);
					Vector3 vector2 = this.tr.position + new Vector3(Random.Range(-2f, 2f), 0f, Random.Range(-2f, 2f));
					gorePile2.transform.position = vector2;
					gorePile2.transform.rotation = this.character.tr.rotation;
					this.bones.Add(gorePile2);
				}
				if (!this.character.party || (this.character.party && Records.x.banquetIsle))
				{
					this.character.DestroyCharacter();
				}
			}
			this.bonesRoutine = null;
		}
		else if (state == "Gone")
		{
			this.bonesRoutine = null;
		}
		else if (state == "Purgatory" || state == "Purgatory2")
		{
			base.gameObject.transform.parent = null;
			if (this.character.creatures || this.character.party)
			{
				base.gameObject.SetActive(true);
				base.StartCoroutine(this.Resurrecting());
			}
			else
			{
				this.bonesRoutine = null;
			}
		}
		yield break;
	}

	// Token: 0x06000286 RID: 646 RVA: 0x000334E0 File Offset: 0x000316E0
	private IEnumerator Resurrecting()
	{
		for (int i = 0; i < this.colliders.Length; i++)
		{
			this.colliders[i].enabled = true;
		}
		if (this.headColl)
		{
			this.headColl.enabled = false;
		}
		Vector3 currentPos = this.character.tr.position;
		for (int j = 0; j < this.deadRigidbodies.Count; j++)
		{
			this.startDeadPositions.Add(this.deadRigidbodies[j].gameObject.transform.position);
			this.deadRigidbodies[j].isKinematic = true;
			this.deadRigidbodies[j].useGravity = false;
		}
		MasterAudio.PlaySound3DAtVector3AndForget("Guts", this.character.transform.position, 0.7f, new float?(1f), 0.1f, "", null);
		MasterAudio.PlaySound3DAtVector3AndForget("Choking", this.character.transform.position, 0.6f, new float?(1f), 0.1f, "", null);
		this.SetHeadAnim(false);
		if (this.deadRigidbodies.Count > 0)
		{
			float timeToLerp = 20f;
			if (Vector3.Distance(currentPos, this.deadRigidbodies[0].gameObject.transform.position) < 5f)
			{
				timeToLerp = 10f;
			}
			float percentage = 0f;
			float startTime = Links.x.gameplay.seconds;
			while (percentage < 1f)
			{
				percentage = (Links.x.gameplay.seconds - startTime) / timeToLerp;
				for (int k = 0; k < this.fleshRenderers.Count; k++)
				{
					if (this.fleshRenderers[k])
					{
						this.fleshRenderers[k].enabled = false;
					}
				}
				for (int l = 0; l < this.deadRigidbodies.Count; l++)
				{
					this.deadRigidbodies[l].isKinematic = true;
					this.deadRigidbodies[l].useGravity = false;
					this.deadRigidbodies[l].gameObject.transform.position = Vector3.Lerp(this.startDeadPositions[l], currentPos, percentage);
					if (!Records.x.pocketPause)
					{
						this.deadRigidbodies[l].gameObject.transform.Rotate(new Vector3(0f, 0f, 4f));
					}
				}
				yield return null;
			}
			if (this.goreObj)
			{
				Links.x.archives.RecycleDeath(this.goreObj, this.character.goreType, this.character.stats.characterRow._DeathID);
				this.character.goreObj = null;
			}
		}
		for (int m = 0; m < this.bones.Count; m++)
		{
			Links.x.cellar.ReturnGorePile(this.bones[m]);
		}
		for (int n = 0; n < this.fleshRenderers.Count; n++)
		{
			if (this.fleshRenderers[n])
			{
				this.fleshRenderers[n].enabled = false;
			}
		}
		for (int num = 0; num < this.fleshAnimators.Count; num++)
		{
			this.fleshAnimators[num].enabled = false;
		}
		MasterAudio.PlaySound3DAtVector3AndForget("Choking", this.character.transform.position, 0.6f, new float?(1f), 0.1f, "", null);
		GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(7);
		pooledGameObject.gameObject.SetActive(true);
		pooledGameObject.transform.position = this.character.transform.position + new Vector3(Random.Range(-0.5f, 0.5f), 1f, Random.Range(-0.5f, 0.5f));
		yield return new WaitForSeconds(0.25f);
		MasterAudio.StopAllOfSound("Guts");
		MasterAudio.PlaySound3DAtVector3AndForget("Choking", this.character.transform.position, 0.5f, new float?(1f), 0.1f, "", null);
		GameObject pooledGameObject2 = Links.x.cellar.GetPooledGameObject(6);
		pooledGameObject2.gameObject.SetActive(true);
		pooledGameObject2.transform.position = this.character.transform.position + new Vector3(Random.Range(-0.5f, 0.5f), 1f, Random.Range(-0.5f, 0.5f));
		GameObject pooledGameObject3 = Links.x.cellar.GetPooledGameObject(7);
		pooledGameObject3.gameObject.SetActive(true);
		pooledGameObject3.transform.position = this.character.transform.position + new Vector3(Random.Range(-0.5f, 0.5f), 1f, Random.Range(-0.5f, 0.5f));
		MasterAudio.PlaySound3DAtVector3AndForget("Explosion Flesh", this.character.transform.position, 0.5f, new float?(1f), 0.1f, "", null);
		if (this.character.party)
		{
			Links.x.diorama.SetupTemporaryCreatures(this.character.stats.GetName(), 2, "Ghost", Records.x.GetCharacterCreatureIndex("Ghost"), "GhostMap", "", this.tr.position, "Resurrected", this.character.stats.HealthMax() / 2, "", 0, 0f);
		}
		else
		{
			this.character.creatures.SetState(this.character, "Resurrected");
			this.character.creatures.ResurrectCreature(this.character, this.character.tr.position);
		}
		base.gameObject.transform.parent = this.character.gameObject.transform;
		if (this.character.goreObj)
		{
			Links.x.archives.RecycleDeath(this.character.goreObj, this.character.goreType, this.character.stats.characterRow._DeathID);
		}
		base.gameObject.SetActive(false);
		this.character.DestroyCharacter();
		Links.x.combat.undeadCount++;
		yield break;
	}

	// Token: 0x06000287 RID: 647 RVA: 0x000334F0 File Offset: 0x000316F0
	public Transform GetHips()
	{
		Transform transform = null;
		if (!this.tr)
		{
			return base.transform;
		}
		if (this.tr.childCount > 0)
		{
			if (this.points == null)
			{
				this.points = base.gameObject.GetComponentsInChildren<Transform>(true);
			}
			for (int i = 0; i < this.points.Length; i++)
			{
				if (this.points[i].name.Contains("hip") || this.points[i].name.Contains("Hip"))
				{
					transform = this.points[i];
				}
			}
			if (transform == null)
			{
				transform = this.tr;
			}
			return transform;
		}
		return this.tr;
	}

	// Token: 0x06000288 RID: 648 RVA: 0x000335A4 File Offset: 0x000317A4
	public Transform GetHand()
	{
		if (this.hand)
		{
			return this.hand;
		}
		if (!this.tr)
		{
			return base.transform;
		}
		if (this.tr.childCount <= 0)
		{
			return this.tr;
		}
		if (this.points == null)
		{
			this.points = base.gameObject.GetComponentsInChildren<Transform>(true);
		}
		for (int i = 0; i < this.points.Length; i++)
		{
			if (this.points[i] && (this.points[i].name.Contains("R_hand") || this.points[i].name.Contains("lr_hand") || this.points[i].name.Contains("R_Hand")))
			{
				this.hand = this.points[i];
			}
		}
		if (this.hand == null)
		{
			return this.tr;
		}
		return this.hand;
	}

	// Token: 0x06000289 RID: 649 RVA: 0x000336A4 File Offset: 0x000318A4
	public Transform GetHead()
	{
		if (this.headBone)
		{
			return this.headBone;
		}
		if (!this.tr)
		{
			return base.transform;
		}
		if (this.tr.childCount > 0)
		{
			Transform transform = null;
			if (this.points == null)
			{
				this.points = base.gameObject.GetComponentsInChildren<Transform>(true);
			}
			for (int i = 0; i < this.points.Length; i++)
			{
				if (this.points[i].name == "head" || this.points[i].name == "_head" || this.points[i].name == "pasted___head" || this.points[i].name.Contains("HeadHolder"))
				{
					transform = this.points[i];
				}
			}
			if (transform == null)
			{
				this.GetNeck();
				if (this.neck && this.neck != this.tr)
				{
					transform = this.neck;
				}
				else
				{
					transform = this.tr;
				}
			}
			return transform;
		}
		return this.tr;
	}

	// Token: 0x0600028A RID: 650 RVA: 0x000337D4 File Offset: 0x000319D4
	public Vector3 GetAttackBone()
	{
		if (this.attackBone)
		{
			return this.attackBone.position;
		}
		if (this.tr)
		{
			if (this.character.stats.characterRow._AttacksWith == "Hands")
			{
				if (this.GetSlot(0))
				{
					this.attackBone = this.GetSlot(0);
				}
				else
				{
					if (this.points == null)
					{
						this.points = base.gameObject.GetComponentsInChildren<Transform>(true);
					}
					for (int i = 0; i < this.points.Length; i++)
					{
						if (this.points[i].name.Contains("hand") || this.points[i].name.Contains("Hand"))
						{
							this.attackBone = this.points[i];
						}
					}
					if (this.attackBone == null)
					{
						this.GetNeck();
						if (this.neck && this.neck != this.tr)
						{
							this.attackBone = this.neck;
						}
						else
						{
							this.attackBone = this.tr;
						}
					}
				}
				return this.attackBone.position;
			}
			if (this.character.stats.characterRow._AttacksWith == "Head")
			{
				return this.HeadPosition(0f);
			}
		}
		return this.tr.position + new Vector3(0f, 0.5f, 0f);
	}

	// Token: 0x0600028B RID: 651 RVA: 0x00033968 File Offset: 0x00031B68
	public Transform GetHip()
	{
		if (this.hipBone)
		{
			return this.hipBone;
		}
		if (this.tr)
		{
			if (this.points == null)
			{
				this.points = base.gameObject.GetComponentsInChildren<Transform>(true);
			}
			for (int i = 0; i < this.points.Length; i++)
			{
				if (this.points[i] && (this.points[i].name.Contains("hip") || this.points[i].name.Contains("Hip")))
				{
					this.hipBone = this.points[i];
				}
			}
			if (this.hipBone == null)
			{
				this.GetNeck();
				if (this.neck && this.neck != this.tr)
				{
					this.hipBone = this.neck;
				}
				else
				{
					this.hipBone = this.tr;
				}
			}
			return this.hipBone;
		}
		return this.tr;
	}

	// Token: 0x0600028C RID: 652 RVA: 0x00033A74 File Offset: 0x00031C74
	public Vector3 HeadPosition(float add)
	{
		Vector3 vector = this.tr.position;
		if (this.GetNeck() != this.tr)
		{
			vector = this.neck.position + new Vector3(0f, 1f + add, 0f);
		}
		else if (this.headBone != this.tr && this.headBone)
		{
			if (!this.headBone)
			{
				Debug.Log("Head missing " + ((this != null) ? this.ToString() : null));
			}
			vector = this.headBone.position + new Vector3(0f, 0.5f + add, 0f);
		}
		else if (this.character)
		{
			vector = this.tr.position + new Vector3(0f, this.character.characterHeight + add, 0f);
		}
		else
		{
			vector = this.tr.position + new Vector3(0f, 2f + add, 0f);
		}
		return vector;
	}

	// Token: 0x0600028D RID: 653 RVA: 0x00033BA4 File Offset: 0x00031DA4
	public Transform GetNeck()
	{
		if (this.neck)
		{
			return this.neck;
		}
		this.neck = this.headBone;
		if (this.headBone && this.character && this.character.stats.xmlName.Contains("Dobra"))
		{
			this.neck = this.headBone;
			return this.headBone;
		}
		if (this.points == null)
		{
			this.points = base.gameObject.GetComponentsInChildren<Transform>(true);
		}
		for (int i = 0; i < this.points.Length; i++)
		{
			string name = this.points[i].name;
			if (name.Contains("neck") || name.Contains("Neck"))
			{
				this.neck = this.points[i];
				break;
			}
		}
		if (!this.neck && (this.neck = this.headBone))
		{
			return this.headBone;
		}
		return this.neck;
	}

	// Token: 0x0600028E RID: 654 RVA: 0x00033CB0 File Offset: 0x00031EB0
	public Transform GetFoot()
	{
		if (this.points == null)
		{
			this.points = base.gameObject.GetComponentsInChildren<Transform>(true);
		}
		for (int i = 0; i < this.points.Length; i++)
		{
			string name = this.points[i].name;
			if (name.Contains("toe") || name.Contains("Toe"))
			{
				return this.points[i];
			}
		}
		return this.tr;
	}

	// Token: 0x0600028F RID: 655 RVA: 0x00033D24 File Offset: 0x00031F24
	public void SetupTextures(string race, float sex, Library.Characters characterRow, string skinTexture, string hairTexture, bool isNPC)
	{
		if (race == "Yeti" || race == "Ameythevian" || race == "Varuchov" || race == "Pasaaren" || race == "Taratorith" || race == "Lachovinian" || race == "Possessed")
		{
			this.raceID = 0;
			if (race == "Taratorith")
			{
				this.raceID = 3;
				if (this.wings)
				{
					this.wings.SetActive(false);
				}
				if (this.birdFeet)
				{
					this.birdFeet.SetActive(false);
				}
				if (this.toeFeet)
				{
					this.toeFeet.SetActive(true);
				}
			}
			if (race == "Ameythevian")
			{
				this.raceID = 2;
				if (this.wings)
				{
					this.wings.SetActive(false);
				}
				if (this.birdFeet)
				{
					this.birdFeet.SetActive(false);
				}
				if (this.toeFeet)
				{
					this.toeFeet.SetActive(true);
				}
			}
			if (race == "Varuchov")
			{
				this.raceID = 1;
				if (this.wings)
				{
					this.wings.SetActive(true);
				}
				if (this.birdFeet)
				{
					this.birdFeet.SetActive(false);
				}
				if (this.toeFeet)
				{
					this.toeFeet.SetActive(true);
				}
			}
			if (race == "Pasaaren" || race == "Lachovinian")
			{
				this.raceID = 0;
				if (this.wings)
				{
					this.wings.SetActive(false);
				}
				if (this.birdFeet)
				{
					this.birdFeet.SetActive(true);
				}
				if (this.toeFeet)
				{
					this.toeFeet.SetActive(false);
				}
			}
			if (race == "Yeti")
			{
				this.raceID = 4;
				if (this.wings)
				{
					this.wings.SetActive(false);
				}
				if (this.birdFeet)
				{
					this.birdFeet.SetActive(false);
				}
				if (this.toeFeet)
				{
					this.toeFeet.SetActive(true);
				}
			}
			if (race == "Possessed")
			{
				if (this.model.Contains("wings"))
				{
					this.raceID = 1;
				}
				else
				{
					this.raceID = 0;
				}
			}
			string text = "armor1";
			if (characterRow != null)
			{
				text = characterRow._ArmorTexture;
			}
			if (Records.x.banquetIsle && this.model.Contains("Companion"))
			{
				text = "armor3";
			}
			this.savedRace = race;
			this.SetSexScale(sex);
			this.hairID = 0;
			this.skinID = 0;
			if (skinTexture == "s2")
			{
				this.skinID = 1;
			}
			if (skinTexture == "s3")
			{
				this.skinID = 2;
			}
			if (skinTexture == "s4")
			{
				this.skinID = 3;
			}
			if (skinTexture == "s5")
			{
				this.skinID = 4;
			}
			if (hairTexture.Contains("1"))
			{
				this.hairID = 1;
			}
			if (hairTexture.Contains("2"))
			{
				this.hairID = 2;
			}
			if (hairTexture.Contains("3"))
			{
				this.hairID = 3;
			}
			if (hairTexture.Contains("4"))
			{
				this.hairID = 4;
			}
			this.outfitID = 0;
			if (text == "armor2")
			{
				this.outfitID = 1;
			}
			if (text == "armor3")
			{
				this.outfitID = 2;
			}
			if (text == "armor4")
			{
				this.outfitID = 3;
			}
			if (text == "armor5")
			{
				this.outfitID = 4;
			}
			if (base.gameObject.name.Contains("Guard"))
			{
				this.outfitID = -1;
			}
			for (int i = 0; i < this.fleshRenderers.Count; i++)
			{
				if (this.fleshRenderers[i])
				{
					this.materials = this.fleshRenderers[i].materials;
					for (int j = 0; j < this.materials.Length; j++)
					{
						if (!this.materials[j].name.Contains("Item"))
						{
							this.materials[j].SetFloat("_Race", (float)this.raceID);
							this.materials[j].SetFloat("_Hair", (float)this.hairID);
							this.materials[j].SetFloat("_Skin", (float)this.skinID);
							this.materials[j].SetFloat("_Outfit", (float)this.outfitID);
						}
					}
				}
			}
			return;
		}
		if (this.startScale != Vector3.zero)
		{
			this.tr.localScale = this.startScale;
		}
	}

	// Token: 0x06000290 RID: 656 RVA: 0x00034220 File Offset: 0x00032420
	public void SetSexScale(float sex)
	{
		if (this.isPortrait || this.portrait)
		{
			sex = 0f;
		}
		string name = base.gameObject.name;
		if (!this.IsBiped(name))
		{
			if (this.startScale != Vector3.zero)
			{
				this.tr.localScale = this.startScale;
			}
			return;
		}
		this.originalScale = new Vector3(1f, 1f, 1f);
		if (sex > 1.1f)
		{
			this.tr.localScale = this.originalScale * 1.2f;
			return;
		}
		if (sex > 0.75f && sex <= 1.1f)
		{
			this.tr.localScale = this.originalScale * 1.02f;
			return;
		}
		if (sex <= 0.75f && sex > 0.5f)
		{
			this.tr.localScale = this.originalScale * 1.0125f;
			return;
		}
		if (sex <= 0.5f && sex > 0.25f)
		{
			this.tr.localScale = this.originalScale * 1.0075f;
			return;
		}
		this.tr.localScale = this.originalScale * 1f;
	}

	// Token: 0x06000291 RID: 657 RVA: 0x00034360 File Offset: 0x00032560
	public void SetTexture(Texture tex, bool forHead, int matIndex, bool isYeti)
	{
		if (!this.ghost || this.ghost)
		{
			return;
		}
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			if (this.fleshRenderers[i])
			{
				this.materials = this.fleshRenderers[i].materials;
				for (int j = 0; j < this.materials.Length; j++)
				{
					this.materials[j].name.Contains("Item");
				}
			}
		}
	}

	// Token: 0x06000292 RID: 658 RVA: 0x000343EC File Offset: 0x000325EC
	public void SetupHead(string m)
	{
		if (this.headObject)
		{
			string text = "";
			if (Records.x.editor)
			{
				text = base.gameObject.name;
			}
			this.SetMagicaClothHeadCollider(false);
			Links.x.archives.RecycleHead(this.headObject, this.headModel, text);
			this.headObject.SetActive(false);
			this.headObject = null;
			this.headColl = null;
			this.headAnim = null;
			this.magicaCloths = new MagicaCloth[0];
			this.magicaCapsules = new MagicaCapsuleCollider[0];
		}
		this.headModel = m;
		if (this.headModel != "")
		{
			if (!this.headBone)
			{
				this.headBone = this.GetHead();
			}
			this.headObject = Links.x.archives.InstantiateHead(this.headModel, this.headBone);
			this.headObject.transform.localPosition = Vector3.zero;
			this.headObject.transform.localRotation = Quaternion.Euler(Vector3.zero);
			float x = this.headObject.transform.localScale.x;
			float y = this.headObject.transform.localScale.y;
			float z = this.headObject.transform.localScale.z;
			if (x > 1.1f || x < 0.9f || x != y || x != z || z != y)
			{
				this.headObject.transform.localScale = Vector3.one;
			}
			this.headColl = this.headObject.GetComponent<Collider>();
			foreach (object obj in this.headObject.transform)
			{
				Transform transform = (Transform)obj;
				if (transform.gameObject.GetComponent<Collider>())
				{
					this.headColl = transform.gameObject.GetComponent<Collider>();
				}
			}
			if (this.headColl)
			{
				this.headColl.gameObject.layer = 31;
				SelectionCircle selectionCircle = this.headColl.gameObject.GetComponent<SelectionCircle>();
				if (!selectionCircle)
				{
					selectionCircle = this.headColl.gameObject.AddComponent<SelectionCircle>();
				}
				selectionCircle.character = this.character;
			}
			this.newHead = true;
			this.startColliders.Clear();
			this.GetBounds();
		}
	}

	// Token: 0x06000293 RID: 659 RVA: 0x00034674 File Offset: 0x00032874
	public void GetHashes()
	{
		this.idleHash = Animator.StringToHash("Idle");
		this.combatIdleHash = Animator.StringToHash("Combat_Idle_loop");
		this.patrolLeftHash = Animator.StringToHash("Patrol_rotate_left");
		this.patrolRightHash = Animator.StringToHash("Patrol_rotate_right");
		this.patrolLeft45Hash = Animator.StringToHash("Patrol_rotate_left 45");
		this.patrolRight45Hash = Animator.StringToHash("Patrol_rotate_right 45");
		this.combatPivotLeftHash = Animator.StringToHash("Pivot Left 90");
		this.combatPivotRightHash = Animator.StringToHash("Pivot Right 90");
		this.combatPivotLeft45Hash = Animator.StringToHash("Pivot Left 45");
		this.combatPivotRight45Hash = Animator.StringToHash("Pivot Right 45");
		this.combatPivotLeftBackHash = Animator.StringToHash("Pivot Left 90 back");
		this.combatPivotRightBackHash = Animator.StringToHash("Pivot Right 90 back");
		this.combatPivotLeft45BackHash = Animator.StringToHash("Pivot Left 45 back");
		this.combatPivotRight45BackHash = Animator.StringToHash("Pivot Right 45 back");
		this.combatPivotBack180 = Animator.StringToHash("Pivot 180 back");
		this.turnLeftHash = Animator.StringToHash("Turn_left");
		this.turnRightHash = Animator.StringToHash("Turn_right");
		this.combatIdle2Hash = Animator.StringToHash("Combat_idle_paused");
		this.basicAttackHash = Animator.StringToHash("Combat_basic_attack");
		this.defendHash = Animator.StringToHash("Defend");
		this.channelHash = Animator.StringToHash("Cast");
		this.special1Hash = Animator.StringToHash("Combat_synergy_1");
		this.special2Hash = Animator.StringToHash("Combat_synergy_2");
		this.special5Hash = Animator.StringToHash("Combat_synergy_normal_2");
		this.special4Hash = Animator.StringToHash("Combat_synergy_normal_1");
		this.special3Hash = Animator.StringToHash("Combat_skill_race_special_3");
		this.kickHash = Animator.StringToHash("Kick");
		this.useHash = Animator.StringToHash("Combat_use_trinket_or_potion");
		this.walkHash = Animator.StringToHash("Walk");
		this.walkPartyHash = Animator.StringToHash("Walk Party");
		this.walkStartHash = Animator.StringToHash("Walk_start");
		this.combatWalkHash = Animator.StringToHash("Combat_walk");
		this.combatWalkStartHash = Animator.StringToHash("Combat_walk_start");
		this.powerDraw = Animator.StringToHash("Combat_warbook_power_draw");
		this.walkEndHash = Animator.StringToHash("Walk_end");
		this.combatWalkEndHash = Animator.StringToHash("Combat_walk_end");
		this.instrumentHash = Animator.StringToHash("Combat_instrument");
		this.jumpStartHash = Animator.StringToHash("Jump_start");
		this.jumpLoopHash = Animator.StringToHash("Jump_loop");
		this.jumpEndHash = Animator.StringToHash("Jump_end");
		this.creepStartHash = Animator.StringToHash("Creep_start");
		this.creepHash = Animator.StringToHash("Creep");
		this.creepEndHash = Animator.StringToHash("Creep_end");
		this.charmHash = Animator.StringToHash("Combat_charm");
		this.basicAttack2Hash = Animator.StringToHash("Combat_lefthand_attack");
		this.basicAttack3Hash = Animator.StringToHash("Combat_righthand_lower_attack");
		this.basicAttack4Hash = Animator.StringToHash("Combat_lefthand_lower_attack");
		this.hitDownHash = Animator.StringToHash("Hit_down");
		this.runHash = Animator.StringToHash("Run");
		this.runStartHash = Animator.StringToHash("Run_start");
		this.runEndHash = Animator.StringToHash("Run_end");
		this.patrol180 = Animator.StringToHash("Patrol_rotate_180");
		this.combatPivot180 = Animator.StringToHash("Pivot 180");
		this.jumpStartHash = Animator.StringToHash("Jump_start");
		this.quickAttackHash = Animator.StringToHash("Combat_small_attacks");
		this.walkBackHash = Animator.StringToHash("Combat_walk_start_back");
		this.walkBackStartHash = Animator.StringToHash("Combat_walk_back");
		this.walkBackEndHash = Animator.StringToHash("Combat_walk_end_back");
		this.getupHash = Animator.StringToHash("Get_up");
		this.hitHash = Animator.StringToHash("Hit");
		this.downHash = Animator.StringToHash("Hit_down");
		this.downStartHash = Animator.StringToHash("Hit_down_start");
		this.bounceHash = Animator.StringToHash("Hit_bounce");
	}

	// Token: 0x06000294 RID: 660 RVA: 0x00034A74 File Offset: 0x00032C74
	public void GatherRenderers(bool first)
	{
		this.fleshRenderers.Clear();
		this.fleshAnimators.Clear();
		if (!this.inMenu && first)
		{
			this.GetHashes();
		}
		if (first)
		{
			this.slots.Clear();
			this.slotNames.Clear();
			Transform[] componentsInChildren = base.gameObject.GetComponentsInChildren<Transform>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				string name = componentsInChildren[i].gameObject.name;
				if (name.Contains("slot") || name.Contains("Slot"))
				{
					this.slots.Add(componentsInChildren[i]);
					string text = componentsInChildren[i].gameObject.name.ToLower();
					this.slotNames.Add(text);
					if (componentsInChildren[i].childCount > 0)
					{
						Object.Destroy(componentsInChildren[i].GetChild(0).gameObject);
					}
				}
				if (name.Contains("VaruWings"))
				{
					this.wings = componentsInChildren[i].gameObject;
				}
				if (name.Contains("pasa") || name.Contains("Pasa") || name.Contains("boots") || name.Contains("toes") || name.Contains("Toes"))
				{
					if (name.Contains("toes") || name.Contains("Toes") || name.Contains("boots") || name.Contains("Boots"))
					{
						this.toeFeet = componentsInChildren[i].gameObject;
					}
					else
					{
						this.birdFeet = componentsInChildren[i].gameObject;
					}
				}
			}
		}
		if (this.inMenu)
		{
			this.SetupCollider(false);
		}
		if (!this.tr)
		{
			this.tr = base.transform;
		}
		if (this.character && first)
		{
			foreach (Collider collider in this.colliders)
			{
				if (collider)
				{
					collider.gameObject.layer = 31;
					collider.gameObject.GetComponent<SelectionCircle>().character = this.character;
				}
			}
			if (this.colliders.Length == 0)
			{
				this.SetupCollider(true);
				SelectionCircle selectionCircle = base.gameObject.GetComponent<SelectionCircle>();
				if (!selectionCircle)
				{
					selectionCircle = base.gameObject.AddComponent<SelectionCircle>();
				}
				selectionCircle.character = this.character;
			}
		}
		bool flag = false;
		bool flag2 = false;
		if (this.character)
		{
			flag = this.character.movesOnWater;
			if (!this.character.stats.animal)
			{
				flag2 = true;
			}
		}
		SkinnedMeshRenderer[] componentsInChildren2 = base.gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(true);
		for (int k = 0; k < componentsInChildren2.Length; k++)
		{
			this.fleshRenderers.Add(componentsInChildren2[k]);
			componentsInChildren2[k].skinnedMotionVectors = false;
			componentsInChildren2[k].lightProbeUsage = LightProbeUsage.Off;
			componentsInChildren2[k].reflectionProbeUsage = ReflectionProbeUsage.Off;
			if (this.inMenu)
			{
				this.materials = componentsInChildren2[k].materials;
				foreach (Material material in this.materials)
				{
					if (this.CanSwitchMaterial(material, "Menus"))
					{
						material.shader = Links.x.characterMenu;
					}
					material.SetFloat("_BodyGone", 1f);
					material.SetFloat("_Dither", 0f);
					material.SetFloat("_DitherAmount", 0f);
					material.SetFloat("_Glow", 0f);
				}
			}
			else if (this.isPortrait)
			{
				this.materials = componentsInChildren2[k].materials;
				foreach (Material material2 in this.materials)
				{
					if (this.CanSwitchMaterial(material2, "Portrait"))
					{
						material2.shader = Links.x.characterPortrait;
						if (this.portrait)
						{
							material2.SetFloat("_Portrait", 1f);
						}
						else
						{
							material2.SetFloat("_Portrait", 0f);
						}
						material2.SetFloat("_BodyGone", 1f);
						material2.SetFloat("_Dither", 0f);
						material2.SetFloat("_DitherAmount", 0f);
						material2.SetFloat("_Glow", 0f);
					}
				}
			}
			else
			{
				this.materials = componentsInChildren2[k].materials;
				foreach (Material material3 in this.materials)
				{
					if (this.CanSwitchMaterial(material3, "Motion"))
					{
						material3.shader = Links.x.characterGame;
					}
					material3.SetFloat("_BodyGone", 1f);
					material3.SetFloat("_Dither", 0f);
					material3.SetFloat("_DitherAmount", 0f);
					material3.SetFloat("_Glow", 0f);
					if (flag)
					{
						material3.renderQueue = 2400;
					}
					else
					{
						material3.renderQueue = 2454;
					}
				}
			}
			this.SetMeshLayer(componentsInChildren2[k].gameObject, true);
			string name2 = componentsInChildren2[k].gameObject.name;
			if (name2.Contains("Head") || name2.Contains("head"))
			{
				if (!this.headAnim)
				{
					bool flag3 = true;
					if (this.character)
					{
						if (this.character.stats.xmlName.Contains("Dolki"))
						{
							flag3 = false;
						}
					}
					else if (this.model.Contains("Dolki"))
					{
						flag3 = false;
					}
					if (flag3)
					{
						if (!componentsInChildren2[k].gameObject.GetComponent<FaceAnimations>())
						{
							this.headAnim = componentsInChildren2[k].gameObject.AddComponent<FaceAnimations>();
							this.headAnim.body = base.gameObject;
						}
						else
						{
							this.headAnim = componentsInChildren2[k].gameObject.GetComponent<FaceAnimations>();
							this.headAnim.body = base.gameObject;
						}
					}
				}
				if (!flag2 || (flag2 && !name2.Contains("hair") && !name2.Contains("Hair")))
				{
					this.faceRenderer = componentsInChildren2[k];
				}
				else
				{
					this.faceRenderer = componentsInChildren2[k];
				}
				if (Records.x.banquetIsle && this.model.Contains("Companion"))
				{
					if (QuestLog.GetQuestState("F5_BanquetFriend") == QuestState.Complete)
					{
						this.faceRenderer.material.SetTexture("_MainTex", Links.x.cinematicLachoTextureSwap2);
					}
					else
					{
						this.faceRenderer.material.SetTexture("_MainTex", Links.x.cinematicLachoTextureSwap3);
					}
				}
			}
			if (this.inMenu || this.isPortrait || flag2)
			{
				if (name2.Contains("hair") || name2.Contains("Hair"))
				{
					this.hairRenderer = componentsInChildren2[k];
				}
				else if ((name2.Contains("azure") || name2.Contains("armer")) && !name2.Contains("ead") && !name2.Contains("Yeti") && !this.model.Contains("Nude"))
				{
					this.materials = componentsInChildren2[k].materials;
					foreach (Material material4 in this.materials)
					{
						if (name2.Contains("armer"))
						{
							material4.SetFloat("_Brighten", 0.25f);
						}
						else
						{
							material4.SetFloat("_Brighten", 1f);
						}
					}
				}
			}
		}
		MeshRenderer[] componentsInChildren3 = base.gameObject.GetComponentsInChildren<MeshRenderer>(true);
		GameObject gameObject = null;
		if (this.character)
		{
			gameObject = this.character.oar;
		}
		for (int l = 0; l < componentsInChildren3.Length; l++)
		{
			if (componentsInChildren3[l] && componentsInChildren3[l].gameObject != gameObject)
			{
				this.fleshRenderers.Add(componentsInChildren3[l]);
				componentsInChildren3[l].lightProbeUsage = LightProbeUsage.Off;
				componentsInChildren3[l].reflectionProbeUsage = ReflectionProbeUsage.Off;
				string name3 = componentsInChildren3[l].gameObject.name;
				if (this.inMenu)
				{
					this.materials = componentsInChildren3[l].materials;
					foreach (Material material5 in this.materials)
					{
						if (this.CanSwitchMaterial(material5, "Menus"))
						{
							material5.shader = Links.x.characterMenu;
						}
						material5.SetFloat("_BodyGone", 1f);
						material5.SetFloat("_Dither", 0f);
						material5.SetFloat("_DitherAmount", 0f);
						material5.SetFloat("_Glow", 0f);
					}
					if (name3.Contains("Head") || name3.Contains("head"))
					{
						this.faceRenderer = componentsInChildren3[l];
					}
				}
				else if (this.isPortrait)
				{
					this.materials = componentsInChildren3[l].materials;
					foreach (Material material6 in this.materials)
					{
						if (this.CanSwitchMaterial(material6, "Portrait"))
						{
							material6.shader = Links.x.characterPortrait;
						}
						material6.SetFloat("_BodyGone", 1f);
						material6.SetFloat("_Dither", 0f);
						material6.SetFloat("_DitherAmount", 0f);
						material6.SetFloat("_Glow", 0f);
					}
				}
				else
				{
					this.materials = componentsInChildren3[l].materials;
					foreach (Material material7 in this.materials)
					{
						if (this.CanSwitchMaterial(material7, "Motion"))
						{
							material7.shader = Links.x.characterGame;
						}
						material7.SetFloat("_BodyGone", 1f);
						material7.SetFloat("_Dither", 0f);
						material7.SetFloat("_DitherAmount", 0f);
						material7.SetFloat("_Glow", 0f);
						if (flag)
						{
							material7.renderQueue = 2400;
						}
						else
						{
							material7.renderQueue = 2454;
						}
					}
				}
				if (name3.Contains("Head") || name3.Contains("head"))
				{
					this.faceRenderer = componentsInChildren3[l];
					if (Records.x.banquetIsle && this.model.Contains("Companion"))
					{
						if (QuestLog.GetQuestState("F5_BanquetFriend") == QuestState.Complete)
						{
							this.faceRenderer.material.SetTexture("_MainTex", Links.x.cinematicLachoTextureSwap2);
						}
						else
						{
							this.faceRenderer.material.SetTexture("_MainTex", Links.x.cinematicLachoTextureSwap3);
						}
					}
				}
				this.SetMeshLayer(componentsInChildren3[l].gameObject, true);
				if ((this.isPortrait || this.inMenu || flag2) && (name3.Contains("azure") || name3.Contains("armer")) && !name3.Contains("ead") && !name3.Contains("Yeti"))
				{
					this.materials = componentsInChildren3[l].materials;
					foreach (Material material8 in this.materials)
					{
						if (name3.Contains("armer"))
						{
							material8.SetFloat("_Brighten", 0.25f);
						}
						else
						{
							material8.SetFloat("_Brighten", 1f);
						}
					}
				}
			}
		}
		if (this.character && first)
		{
			this.GetBounds();
		}
		if (this.character)
		{
			bool flag4 = this.character.ghost;
		}
		this.magicaCloths = base.gameObject.GetComponentsInChildren<MagicaCloth>(true);
		this.magicaCapsules = base.gameObject.GetComponentsInChildren<MagicaCapsuleCollider>(true);
		this.SetMagicaClothMode();
		this.SetMagicaClothState(true);
		if (this.newHead)
		{
			this.SetMagicaClothHeadCollider(true);
			this.newHead = false;
		}
		this.SetMagicaClothWind();
		if (!this.inMenu && !this.portrait)
		{
			this.CombatSheen(0);
			if (!this.dead)
			{
				base.gameObject.layer = 31;
			}
			else
			{
				base.gameObject.layer = 20;
			}
		}
		if (this.inMenu)
		{
			if (this.character)
			{
				float num = (float)this.character.stats.HealthCurrent() / (float)this.character.stats.HealthMax();
				this.healthPercent = 0f;
				if (num < 0.166f)
				{
					this.healthPercent = 5f;
				}
				if (num >= 0.166f && num < 0.33f)
				{
					this.healthPercent = 4f;
				}
				if (num >= 0.33f && num < 0.5f)
				{
					this.healthPercent = 3f;
				}
				if (num >= 0.5f && num < 0.667f)
				{
					this.healthPercent = 2f;
				}
				if ((double)num >= 0.667 && num < 0.883f)
				{
					this.healthPercent = 1f;
				}
				this.SetBlood(this.healthPercent);
			}
			else
			{
				this.SetBlood(0f);
			}
		}
		if (this.inMenu || this.isPortrait)
		{
			for (int m = 0; m < this.fleshRenderers.Count; m++)
			{
				if (this.fleshRenderers[m])
				{
					this.fleshRenderers[m].enabled = true;
					this.mats = this.fleshRenderers[m].materials;
					foreach (Material material9 in this.mats)
					{
						material9.SetFloat("_Dither", 0f);
						material9.SetFloat("_DitherAmount", 0f);
					}
				}
			}
			return;
		}
		base.transform.localPosition = Vector3.zero;
	}

	// Token: 0x06000295 RID: 661 RVA: 0x000358D8 File Offset: 0x00033AD8
	public void SetMagicaClothMode()
	{
		bool flag = true;
		if (!this.character)
		{
			flag = false;
		}
		for (int i = 0; i < this.magicaCloths.Length; i++)
		{
			if (!flag || this.inMenu || this.isPortrait)
			{
				this.magicaCloths[i].SerializeData.updateMode = ClothUpdateMode.Unscaled;
			}
			else if (this.character.sailing)
			{
				this.magicaCloths[i].SerializeData.updateMode = ClothUpdateMode.Normal;
			}
			else
			{
				this.magicaCloths[i].SerializeData.updateMode = ClothUpdateMode.Normal;
			}
		}
	}

	// Token: 0x06000296 RID: 662 RVA: 0x00035968 File Offset: 0x00033B68
	public void SetMagicaClothHeadCollider(bool adding)
	{
		for (int i = 0; i < this.magicaCapsules.Length; i++)
		{
			for (int j = 0; j < this.magicaCloths.Length; j++)
			{
				MagicaCloth magicaCloth = this.magicaCloths[j];
				if (magicaCloth)
				{
					string name = magicaCloth.gameObject.transform.parent.name;
					if (name.Contains("Head") || name.Contains("head") || name.Contains("Hair") || name.Contains("hair"))
					{
						ClothSerializeData serializeData = magicaCloth.SerializeData;
						if (adding)
						{
							serializeData.colliderCollisionConstraint.colliderList.Add(this.magicaCapsules[i]);
						}
						else
						{
							serializeData.colliderCollisionConstraint.colliderList.Clear();
						}
						if (this.inMenu || this.isPortrait)
						{
							serializeData.inertiaConstraint.movementInertia = 1f;
							serializeData.inertiaConstraint.rotationInertia = 1f;
						}
						else
						{
							serializeData.inertiaConstraint.movementInertia = 0.4f;
							serializeData.inertiaConstraint.rotationInertia = 0.4f;
						}
						magicaCloth.SetParameterChange();
					}
				}
			}
		}
	}

	// Token: 0x06000297 RID: 663 RVA: 0x00035A9C File Offset: 0x00033C9C
	public void SetMagicaClothWind()
	{
		bool flag = true;
		if (this.inMenu || this.isPortrait)
		{
			flag = false;
		}
		if (this.character && this.character.indoorID != "")
		{
			flag = false;
		}
		for (int i = 0; i < this.magicaCloths.Length; i++)
		{
			MagicaCloth magicaCloth = this.magicaCloths[i];
			if (magicaCloth)
			{
				ClothSerializeData serializeData = magicaCloth.SerializeData;
				if (flag)
				{
					WindSettings wind = serializeData.wind;
					wind.influence = 1f;
					serializeData.wind = wind;
				}
				else
				{
					WindSettings wind2 = serializeData.wind;
					wind2.influence = 0f;
					serializeData.wind = wind2;
				}
				magicaCloth.SetParameterChange();
			}
		}
	}

	// Token: 0x06000298 RID: 664 RVA: 0x00035B54 File Offset: 0x00033D54
	public bool CanSwitchMaterial(Material mat, string type)
	{
		return !this.ghost && !mat.shader.name.Contains(type) && !mat.name.Contains("Transparency") && !mat.name.Contains("Crystal") && !mat.shader.name.Contains("LightBeam") && !mat.name.Contains("Hannative") && !mat.shader.name.Contains("WorldClay");
	}

	// Token: 0x06000299 RID: 665 RVA: 0x00035BF0 File Offset: 0x00033DF0
	public void SetGhost()
	{
		if (this.dead)
		{
			return;
		}
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			if (this.fleshRenderers[i] && this.fleshRenderers[i].gameObject.activeSelf && this.fleshRenderers[i].gameObject.activeInHierarchy)
			{
				Links.x.cameraEffects.AddRemoveGhost(this.fleshRenderers[i], true);
			}
		}
		this.anim.cullingMode = AnimatorCullingMode.AlwaysAnimate;
	}

	// Token: 0x0600029A RID: 666 RVA: 0x00035C87 File Offset: 0x00033E87
	private void OnDisable()
	{
		if (this.dithering)
		{
			if (this.endDither == 0f)
			{
				this.MeshOff(true);
				return;
			}
			this.MeshOn(true, true);
		}
	}

	// Token: 0x0600029B RID: 667 RVA: 0x00035CB0 File Offset: 0x00033EB0
	public void SetMeshState(bool on, bool doDither)
	{
		if (this.character)
		{
			this.ghost = this.character.ghost;
		}
		if (!this.character)
		{
			return;
		}
		if (this.character.ambushing && this.character.jumping)
		{
			on = true;
		}
		if (this.character.meshAlwaysOn && !this.character.missing)
		{
			on = true;
		}
		if (this.character.meshAlwaysOff)
		{
			on = false;
		}
		if (this.character.ambushing && !this.character.jumping)
		{
			on = false;
			doDither = false;
		}
		if (this.character.vanished)
		{
			on = false;
		}
		if (this.character.inactive || !base.enabled)
		{
			doDither = false;
		}
		if (this.inMenu || this.isPortrait)
		{
			on = true;
			doDither = false;
		}
		if (this.cannotTurnOn && on)
		{
			return;
		}
		if (this.character.isBoro && Links.x.gaia.boroControls.boroInvisible)
		{
			on = false;
		}
		if (doDither)
		{
			bool flag = false;
			if (this.fleshRenderers.Count > 0 && this.fleshRenderers[0])
			{
				flag = this.fleshRenderers[0].enabled;
			}
			if (this.dithering)
			{
				flag = this.endDither != 0f;
			}
			if (!this.dithering && !on && flag)
			{
				this.currentDither = 1f;
			}
			if (flag != on)
			{
				if (on)
				{
					this.startDither = 0f;
					this.endDither = 1f;
				}
				else
				{
					this.startDither = 1f;
					this.endDither = 0f;
				}
				if (this.dithering)
				{
					this.startDither = this.currentDither;
				}
				this.t = 0f;
				this.dithering = true;
			}
		}
		if (!doDither || (doDither && on))
		{
			if (this.dead && this.character.goreObj && !this.makeBones)
			{
				for (int i = 0; i < this.fleshRenderers.Count; i++)
				{
					if (this.fleshRenderers[i])
					{
						this.fleshRenderers[i].enabled = false;
						this.mats = this.fleshRenderers[i].materials;
						foreach (Material material in this.mats)
						{
							material.SetFloat("_Dither", 0f);
							material.SetFloat("_DitherAmount", 0f);
						}
					}
				}
				for (int k = 0; k < this.deadRenderers.Count; k++)
				{
					this.deadRenderers[k].enabled = on;
				}
				this.SetHeadAnim(false);
			}
			else if (on)
			{
				this.MeshOn(on, false);
			}
			else
			{
				this.MeshOff(true);
			}
		}
		this.Dither();
	}

	// Token: 0x0600029C RID: 668 RVA: 0x00035FA4 File Offset: 0x000341A4
	private void MeshOff(bool setDitherVariables)
	{
		if (this.inMenu || this.isPortrait)
		{
			return;
		}
		if (this.ghost)
		{
			for (int i = 0; i < this.fleshRenderers.Count; i++)
			{
				if (this.fleshRenderers[i])
				{
					this.fleshRenderers[i].enabled = false;
					this.mats = this.fleshRenderers[i].materials;
					foreach (Material material in this.mats)
					{
						if (material)
						{
							material.SetFloat("_Dither", 0f);
							material.SetFloat("_DitherAmount", 0f);
						}
					}
					if (this.fleshRenderers[i].gameObject.activeSelf)
					{
						Links.x.cameraEffects.AddRemoveGhost(this.fleshRenderers[i], false);
					}
				}
			}
		}
		for (int k = 0; k < this.fleshRenderers.Count; k++)
		{
			if (this.fleshRenderers[k] && !this.ghost)
			{
				this.fleshRenderers[k].enabled = false;
				if (setDitherVariables)
				{
					this.mats = this.fleshRenderers[k].materials;
					foreach (Material material2 in this.mats)
					{
						if (material2)
						{
							material2.SetFloat("_Dither", 1f);
							material2.SetFloat("_DitherAmount", 0f);
						}
					}
				}
			}
		}
		for (int l = 0; l < this.fleshAnimators.Count; l++)
		{
			if (this.fleshAnimators[l])
			{
				this.fleshAnimators[l].enabled = false;
			}
		}
		this.SetHeadAnim(false);
		if (this.character && this.character.npc)
		{
			this.SetMagicaClothState(false);
		}
		foreach (Collider collider in this.colliders)
		{
			if (collider)
			{
				collider.enabled = false;
			}
		}
		if (this.character && this.character.isBoro)
		{
			this.character.ToggleBoat(false);
		}
	}

	// Token: 0x0600029D RID: 669 RVA: 0x0003620C File Offset: 0x0003440C
	private void MeshOn(bool on, bool setDitherVariables)
	{
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			if (this.fleshRenderers[i])
			{
				if (!this.ghost)
				{
					this.fleshRenderers[i].enabled = on;
				}
				else
				{
					this.fleshRenderers[i].enabled = on;
					if (on && !this.dead && this.fleshRenderers[i].gameObject.activeSelf)
					{
						Links.x.cameraEffects.AddRemoveGhost(this.fleshRenderers[i], on);
					}
				}
				this.mats = this.fleshRenderers[i].materials;
				foreach (Material material in this.mats)
				{
					material.SetFloat("_Dither", 0f);
					material.SetFloat("_DitherAmount", 0f);
				}
			}
		}
		for (int k = 0; k < this.fleshAnimators.Count; k++)
		{
			this.fleshAnimators[k].enabled = on;
		}
		this.SetHeadAnim(on);
		if (this.character)
		{
			this.SetMagicaClothState(on);
			if (!this.character.party)
			{
				foreach (Collider collider in this.colliders)
				{
					if (collider)
					{
						collider.enabled = true;
					}
				}
			}
		}
		if (this.character && this.character.isBoro)
		{
			this.character.ToggleBoat(true);
		}
	}

	// Token: 0x0600029E RID: 670 RVA: 0x000363AA File Offset: 0x000345AA
	public void SetHeadAnim(bool on)
	{
		if (this.headAnim)
		{
			this.headAnim.enabled = on;
		}
	}

	// Token: 0x0600029F RID: 671 RVA: 0x000363C8 File Offset: 0x000345C8
	public void SetMagicaClothState(bool on)
	{
		if (this.turnOnMagicaClothNextFrame > 0 && on)
		{
			on = false;
		}
		for (int i = 0; i < this.magicaCapsules.Length; i++)
		{
			if (this.magicaCapsules[i])
			{
				this.magicaCapsules[i].enabled = on;
			}
		}
		for (int j = 0; j < this.magicaCloths.Length; j++)
		{
			if (this.magicaCloths[j])
			{
				this.magicaCloths[j].enabled = on;
			}
		}
	}

	// Token: 0x060002A0 RID: 672 RVA: 0x00036448 File Offset: 0x00034648
	public void SetMagicaClothMovingState(bool on)
	{
		for (int i = 0; i < this.magicaCloths.Length; i++)
		{
			this.magicaCloths[i].enabled = on;
		}
	}

	// Token: 0x060002A1 RID: 673 RVA: 0x00036478 File Offset: 0x00034678
	public void Dither()
	{
		if (this.dithering)
		{
			if ((this.endDither == 1f && this.currentDither >= 1f) || (this.endDither == 0f && this.currentDither <= 0f))
			{
				this.dithering = false;
				if (this.endDither == 0f)
				{
					this.MeshOff(true);
					return;
				}
				for (int i = 0; i < this.fleshRenderers.Count; i++)
				{
					if (this.fleshRenderers[i])
					{
						this.mats = this.fleshRenderers[i].materials;
						foreach (Material material in this.mats)
						{
							material.SetFloat("_Dither", 0f);
							material.SetFloat("_DitherAmount", 0f);
						}
					}
				}
				if (this.sneaking)
				{
					this.Sneaking(true);
				}
				return;
			}
			else
			{
				if (Records.x.filming)
				{
					this.t += Time.unscaledDeltaTime * Records.x.filmingAnimatorSpeed;
				}
				else if (!Records.x.paused)
				{
					this.t += Time.deltaTime;
				}
				else
				{
					this.t += Time.unscaledDeltaTime;
				}
				this.currentDither = Mathf.Lerp(this.startDither, this.endDither, this.t * 1.5f);
				for (int k = 0; k < this.fleshRenderers.Count; k++)
				{
					if (this.fleshRenderers[k])
					{
						this.mats = this.fleshRenderers[k].materials;
						foreach (Material material2 in this.mats)
						{
							material2.SetFloat("_Dither", 1f);
							material2.SetFloat("_DitherAmount", this.currentDither);
						}
					}
				}
			}
		}
	}

	// Token: 0x060002A2 RID: 674 RVA: 0x00036668 File Offset: 0x00034868
	public void SetSeeThroughAmount()
	{
		float num = 0.3f;
		if (this.character.hasActions)
		{
			num = 0.5f;
		}
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			if (this.fleshRenderers[i] && this.fleshRenderers[i].gameObject.activeSelf)
			{
				this.mats = this.fleshRenderers[i].materials;
				Material[] array = this.mats;
				for (int j = 0; j < array.Length; j++)
				{
					array[j].SetFloat("_SeeThroughAmount1", num);
				}
			}
		}
	}

	// Token: 0x060002A3 RID: 675 RVA: 0x0003670C File Offset: 0x0003490C
	public void GetBounds()
	{
		if (this.character)
		{
			this.bounds = default(Bounds);
			bool flag = false;
			if (this.startColliders.Count == 0)
			{
				flag = true;
			}
			if (flag)
			{
				if (this.colliders.Length != 0)
				{
					int i = 0;
					int num = this.colliders.Length;
					while (i < num)
					{
						if (this.colliders[i])
						{
							this.startColliders.Add(this.colliders[i]);
						}
						i++;
					}
				}
				if (this.headColl)
				{
					this.startColliders.Add(this.headColl);
				}
			}
			if (this.startColliders.Count > 0)
			{
				if (this.startColliders[0])
				{
					this.bounds = this.startColliders[0].bounds;
					if (this.startColliders.Count > 1)
					{
						int j = 1;
						int count = this.startColliders.Count;
						while (j < count)
						{
							if (this.startColliders[j])
							{
								this.bounds.Encapsulate(this.startColliders[j].bounds);
							}
							j++;
						}
					}
				}
			}
			else
			{
				CapsuleCollider component = base.gameObject.GetComponent<CapsuleCollider>();
				if (component)
				{
					this.bounds = component.bounds;
				}
			}
			this.boundsOffset = this.bounds.center.y - this.character.tr.position.y;
		}
	}

	// Token: 0x060002A4 RID: 676 RVA: 0x0003688D File Offset: 0x00034A8D
	public void BracketPosition()
	{
		this.GetBounds();
		Links.x.cellar.SetBracketSize(this.bounds, this.bracket);
	}

	// Token: 0x060002A5 RID: 677 RVA: 0x000368B0 File Offset: 0x00034AB0
	public void Hover(bool state, bool canDoMulti)
	{
		if (this.character && ((this.dead || (!Records.x.kill && this.character.stunned)) && state))
		{
			return;
		}
		this.GetBounds();
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			if (this.fleshRenderers[i])
			{
				float num = 0f;
				if (state)
				{
					num = 1f;
				}
				this.fleshRenderers[i].material.SetFloat("_Hover", num);
			}
		}
		int num2 = 0;
		if (this.character)
		{
			if (Records.x.pocketPause && Links.x.combat.CanAttackTarget(this.character))
			{
				num2 = 2;
			}
			if (Records.x.pocketPause && Links.x.combat.CanAttackTarget(this.character) && this.character.hostility < 2 && !this.character.attackingUntilBribe && !Links.x.sensory.ProofState(this.character))
			{
				num2 = 1;
			}
			if (this.character.party)
			{
				num2 = 0;
			}
		}
		if (state)
		{
			if (!this.bracket)
			{
				this.bracket = Links.x.cellar.GetBracket(num2, this.bounds);
			}
			else
			{
				Links.x.cellar.SetBracketMaterial(num2, this.bracket);
			}
		}
		else if (this.bracket)
		{
			Links.x.cellar.ReturnPooledGameObject(61, this.bracket);
			this.bracket = null;
		}
		this.hovering = state;
		if (((Records.x.pocketPause && (Links.x.combat.inPocketAttack || Links.x.gameplay.attackingCharacter.CanAttack())) || this.multiHover) && canDoMulti)
		{
			bool npc = this.character.npc;
		}
	}

	// Token: 0x060002A6 RID: 678 RVA: 0x00036AB0 File Offset: 0x00034CB0
	public void MultiHover(bool state)
	{
		if (this.combatCharacters == null)
		{
			this.combatCharacters = Links.x.diorama.characters;
		}
		int count = this.combatCharacters.Count;
		for (int i = 0; i < count; i++)
		{
			if (i < this.combatCharacters.Count)
			{
				Character character = this.combatCharacters[i];
				if (character && character != this.character && character != Links.x.gameplay.gameCardCharacter && character.npc && !character.inactive && character.InAttackShape(this.character, this.character.currentPosition, Links.x.gameplay.attackingCharacter, Links.x.gameplay.attackingCharacter.currentPosition, character.currentPosition, Links.x.gameplay.attackingCharacter.invRow1))
				{
					character.body.multiHit = state;
					if (!state)
					{
						if (!Links.x.combat.InRangeTarget(character))
						{
							character.body.TargetingOutline(false);
						}
						else
						{
							character.body.TargetingOutlineColor(0);
						}
					}
					else
					{
						character.body.TargetingOutline(true);
					}
				}
			}
		}
		Links.x.combat.MultiHitObjects(state, this.character.currentPosition, null, null, null);
	}

	// Token: 0x060002A7 RID: 679 RVA: 0x00036C20 File Offset: 0x00034E20
	public void TargetingOutline(bool state)
	{
		GameObject gameObject = null;
		if (this.character)
		{
			gameObject = this.character.oar;
		}
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			if (this.fleshRenderers[i])
			{
				GameObject gameObject2 = this.fleshRenderers[i].gameObject;
				if (gameObject2.activeSelf && gameObject2 != gameObject)
				{
					Outline outline = gameObject2.GetComponent<Outline>();
					if (state)
					{
						if (!outline)
						{
							outline = gameObject2.AddComponent<Outline>();
						}
						outline.color = 0;
					}
					if (state && this.multiHit && outline)
					{
						outline.color = 1;
					}
					if (!state && outline)
					{
						Object.Destroy(outline);
					}
				}
			}
		}
		this.targetOutline = state;
	}

	// Token: 0x060002A8 RID: 680 RVA: 0x00036CEC File Offset: 0x00034EEC
	public void TargetingOutlineColor(int col)
	{
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			if (this.fleshRenderers[i] && this.fleshRenderers[i].gameObject.activeSelf)
			{
				Outline component = this.fleshRenderers[i].gameObject.GetComponent<Outline>();
				if (component)
				{
					component.color = col;
				}
			}
		}
	}

	// Token: 0x060002A9 RID: 681 RVA: 0x00036D60 File Offset: 0x00034F60
	public Collider GetFirstCollider()
	{
		if (this.colliders.Length == 0)
		{
			return null;
		}
		return this.colliders[0];
	}

	// Token: 0x060002AA RID: 682 RVA: 0x00036D78 File Offset: 0x00034F78
	public void SeeThroughColliders(bool state)
	{
		if (this.character.isBoro)
		{
			state = !Links.x.gaia.boroControls.boroInvisible;
		}
		for (int i = 0; i < this.colliders.Length; i++)
		{
			if (this.colliders[i])
			{
				this.colliders[i].enabled = state;
			}
		}
		if (this.headColl)
		{
			this.headColl.enabled = state;
		}
	}

	// Token: 0x060002AB RID: 683 RVA: 0x00036DFC File Offset: 0x00034FFC
	public void Dodge(bool state)
	{
		if (this.character && ((this.dead || (!Records.x.kill && this.character.stunned)) && state))
		{
			return;
		}
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			Links.x.cameraEffects.Dodging(this.fleshRenderers[i], state);
		}
		this.dodgeTime = 0f;
		if (state)
		{
			this.dodgeTime = Time.timeSinceLevelLoad;
		}
	}

	// Token: 0x060002AC RID: 684 RVA: 0x00036E8C File Offset: 0x0003508C
	public void CombatSheen(int num)
	{
		if (!this.character)
		{
			return;
		}
		if ((this.dead || (!Records.x.kill && this.character.stunned)) && num == 3)
		{
			return;
		}
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			if (this.fleshRenderers[i] && this.fleshRenderers[i].gameObject.activeSelf)
			{
				this.mats = this.fleshRenderers[i].materials;
				foreach (Material material in this.mats)
				{
					float num2 = 0f;
					int num3 = 3;
					if (num == 3)
					{
						num3 = 1;
						if (this.character.party && !Links.x.gameplay.spellTargetingParty)
						{
							num2 = 1f;
						}
						else
						{
							num2 = 2f;
						}
					}
					if (num == 1)
					{
						num3 = 1;
						if (this.character.party && !Links.x.gameplay.spellTargetingParty)
						{
							num2 = 1f;
						}
						else
						{
							num2 = 2f;
						}
					}
					if (this.character.party && !this.character.mainSelected && Records.x.pocketPause && num != 0 && Links.x.combat.CharacterHasSynergy(this.character))
					{
						if (Links.x.combat.pickingRally)
						{
							num2 = 3f;
							num3 = 1;
						}
						else
						{
							num2 = 4f;
							num3 = 1;
						}
					}
					if (this.character.party && this.character.mainSelected && Records.x.pocketPause && num != 0 && !Links.x.gameplay.spellTargetingParty)
					{
						num2 = 0f;
					}
					material.SetFloat("_InCombatBubble", num2);
					if (this.character.mainSelected)
					{
						num3 = 4;
					}
					material.SetFloat("_Stencil", (float)num3);
				}
			}
		}
		if (this.character.mainSelected)
		{
			if (num == 0)
			{
				Links.x.cameraEffects.mainCharacterInSheen = false;
				return;
			}
			Links.x.cameraEffects.mainCharacterInSheen = true;
		}
	}

	// Token: 0x060002AD RID: 685 RVA: 0x000370C0 File Offset: 0x000352C0
	public void Sneaking(bool state)
	{
		if (state)
		{
			this.sneaking = true;
			for (int i = 0; i < this.fleshRenderers.Count; i++)
			{
				if (this.fleshRenderers[i])
				{
					this.mats = this.fleshRenderers[i].materials;
					foreach (Material material in this.mats)
					{
						material.SetFloat("_Dither", 1f);
						material.SetFloat("_DitherAmount", 0.4f);
					}
				}
			}
			return;
		}
		this.sneaking = false;
		for (int k = 0; k < this.fleshRenderers.Count; k++)
		{
			if (this.fleshRenderers[k])
			{
				this.mats = this.fleshRenderers[k].materials;
				foreach (Material material2 in this.mats)
				{
					material2.SetFloat("_Dither", 0f);
					material2.SetFloat("_DitherAmount", 0.4f);
				}
			}
		}
	}

	// Token: 0x060002AE RID: 686 RVA: 0x000371D0 File Offset: 0x000353D0
	public void SetMeshLayer(GameObject m, bool isRenderer)
	{
		if (this.inMenu)
		{
			m.layer = 25;
			return;
		}
		if (this.isPortrait)
		{
			m.layer = 26;
			return;
		}
		if (this.dead)
		{
			m.layer = 20;
		}
		else
		{
			m.layer = 6;
		}
		if (isRenderer && this.character && this.character.movesOnWater)
		{
			m.layer = 0;
			if (this.dead)
			{
				m.layer = 20;
			}
		}
	}

	// Token: 0x060002AF RID: 687 RVA: 0x0003724C File Offset: 0x0003544C
	public void SetLayer(int layer)
	{
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			if (this.fleshRenderers[i])
			{
				this.fleshRenderers[i].gameObject.layer = layer;
			}
		}
	}

	// Token: 0x060002B0 RID: 688 RVA: 0x0003729C File Offset: 0x0003549C
	public void SetupCollider(bool enable)
	{
		if (!base.gameObject.GetComponent<CapsuleCollider>())
		{
			CapsuleCollider capsuleCollider = base.gameObject.AddComponent<CapsuleCollider>();
			capsuleCollider.center = new Vector3(0f, 1.75f, 0f);
			capsuleCollider.radius = 0.6f;
			capsuleCollider.height = 2.15f;
			capsuleCollider.enabled = enable;
		}
	}

	// Token: 0x060002B1 RID: 689 RVA: 0x000372FC File Offset: 0x000354FC
	public void Reset()
	{
		this.EndBlink();
		this.EndBlink2();
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			if (this.fleshRenderers[i])
			{
				this.mats = this.fleshRenderers[i].materials;
				this.fleshRenderers[i].enabled = true;
				foreach (Material material in this.mats)
				{
					if (material)
					{
						material.SetFloat("_Dither", 0f);
						material.SetFloat("_DitherAmount", 0f);
						material.SetFloat("_Glow", 0f);
						material.SetFloat("_BodyGone", 1f);
					}
				}
			}
		}
		for (int k = 0; k < this.colliders.Length; k++)
		{
			if (this.colliders[k])
			{
				Rigidbody component = this.colliders[k].gameObject.GetComponent<Rigidbody>();
				if (component)
				{
					Object.Destroy(component);
				}
			}
		}
		this.fleshRenderers.Clear();
		this.startColliders.Clear();
		if (this.headAnim)
		{
			this.headAnim.emotion = "";
			this.headAnim = null;
		}
		this.faceRenderer = null;
		this.hairRenderer = null;
		this.character = null;
		this.dead = false;
		this.animationHold = false;
		this.ignoreAttackEvent = false;
		this.inMenu = false;
		this.isPortrait = false;
		this.magicaCloths = new MagicaCloth[0];
		this.magicaCapsules = new MagicaCapsuleCollider[0];
		this.bonesRoutine = null;
		this.cannotTurnOn = false;
		this.goreObj = null;
		if (this.anim)
		{
			this.anim.applyRootMotion = false;
		}
		this.bonesRoutine = null;
		if (this.colliders != null)
		{
			for (int l = 0; l < this.colliders.Length; l++)
			{
				this.colliders[l].enabled = true;
			}
		}
	}

	// Token: 0x060002B2 RID: 690 RVA: 0x0003750C File Offset: 0x0003570C
	public bool IsHit()
	{
		return Links.x.gaia.sceneLoaded && this.character && (!this.character.resting || this.character.isHit) && (this.currentHash == this.getupHash || this.currentHash == this.hitHash || this.currentHash == this.downHash || this.currentHash == this.downStartHash || this.currentHash == this.bounceHash);
	}

	// Token: 0x060002B3 RID: 691 RVA: 0x000375A8 File Offset: 0x000357A8
	public void SetMask(bool on)
	{
	}

	// Token: 0x060002B4 RID: 692 RVA: 0x000375AC File Offset: 0x000357AC
	public void SetMaskNumber(float x)
	{
		this.maskNumber = x / 255f;
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			this.fleshRenderers[i].material.SetFloat("_MaskNumber", this.maskNumber);
		}
	}

	// Token: 0x060002B5 RID: 693 RVA: 0x000375FD File Offset: 0x000357FD
	public LookAtIK GetLookIK()
	{
		return this.lookik;
	}

	// Token: 0x060002B6 RID: 694 RVA: 0x00037608 File Offset: 0x00035808
	public Transform GetSlot(int n)
	{
		int num = n / 2;
		Transform transform = null;
		string text = "";
		if (num == 0)
		{
			text = "slot_item_r";
		}
		if (num == 1)
		{
			text = "slot_item_l";
		}
		if (num == 2)
		{
			text = "";
		}
		if (num == 3)
		{
			text = "";
		}
		if (num == 4)
		{
			text = "";
		}
		if (num == 5)
		{
			text = "";
		}
		if (num == 6)
		{
			text = "";
		}
		if (num == 7)
		{
			text = "slot_trinket";
		}
		if (num == 8)
		{
			text = "slot_circlet";
		}
		if (num == 9)
		{
			text = "slot_armor";
		}
		if (num == 10)
		{
			text = "slot_lring_middle";
		}
		if (num == 11)
		{
			text = "slot_rring_middle";
		}
		if (num == 12)
		{
			text = "slot_earring";
		}
		if (num == 13)
		{
			text = "slot_belt1";
		}
		if (num == 14)
		{
			text = "slot_belt2";
		}
		if (num == 15)
		{
			text = "";
		}
		if (num == 16)
		{
			text = "";
		}
		if (num == 17)
		{
			text = "";
		}
		if (num == 18)
		{
			text = "";
		}
		if (text != "")
		{
			for (int i = 0; i < this.slots.Count; i++)
			{
				if (this.slotNames[i].Contains(text))
				{
					transform = this.slots[i];
					break;
				}
			}
		}
		return transform;
	}

	// Token: 0x060002B7 RID: 695 RVA: 0x00037730 File Offset: 0x00035930
	public void ReturnItems()
	{
		this.EndBlink();
		this.EndBlink2();
		this.RemoveDeathParts();
		this.cannotTurnOn = false;
		if (this.bonesRoutine != null)
		{
			base.StopCoroutine(this.bonesRoutine);
			this.bonesRoutine = null;
		}
		for (int i = 0; i < this.fleshRenderers.Count; i++)
		{
			if (this.fleshRenderers[i])
			{
				OutlineGlow component = this.fleshRenderers[i].gameObject.GetComponent<OutlineGlow>();
				if (component)
				{
					Object.Destroy(component);
				}
				this.fleshRenderers[i].enabled = true;
				this.mats = this.fleshRenderers[i].materials;
				foreach (Material material in this.mats)
				{
					material.SetFloat("_Dither", 0f);
					material.SetFloat("_DitherAmount", 0f);
				}
			}
		}
		if (this.headObject)
		{
			string text = "";
			if (Records.x.editor)
			{
				text = base.gameObject.name;
			}
			this.SetMagicaClothHeadCollider(false);
			Links.x.archives.RecycleHead(this.headObject, this.headModel, text);
			this.headObject.SetActive(false);
			this.headObject = null;
			this.headColl = null;
			this.headAnim = null;
		}
		for (int k = 0; k < this.equippedItems.Length; k++)
		{
			if (this.equippedItems[k] && k != 9)
			{
				GameObject gameObject = this.equippedItems[k].gameObject;
				string text2 = this.equippedItems[k].invRow._CharacterModel;
				if (k == 4 || k == 5 || k == 6)
				{
					text2 += "_clump";
				}
				int num = k;
				Equipment component2 = this.equippedItems[num].GetComponent<Equipment>();
				GameObject gameObject2 = null;
				this.equippedItems[num].GetComponent<ItemEquipped>();
				string text3 = "";
				if (component2)
				{
					gameObject2 = component2.ammoObject;
					text3 = component2.ammoObjectName;
					component2.ammoObject = null;
				}
				if (num == 4 || num == 5 || num == 6)
				{
					text2 += "_clump";
				}
				this.equippedItems[num].ReturnToArchives();
				if (num != 9)
				{
					Links.x.archives.RecycleItemBody(gameObject, text2);
				}
				this.equippedItems[num] = null;
				if (gameObject2)
				{
					Links.x.archives.RecycleItemBody(gameObject2, text3);
				}
			}
			else if (this.equippedItems[9])
			{
				this.equippedItems[9].ReturnToArchives();
			}
		}
		this.dead = false;
		this.magicaCloths = new MagicaCloth[0];
		this.magicaCapsules = new MagicaCapsuleCollider[0];
		if (this.lookAtController)
		{
			this.lookAtController.EndLookFast(false);
		}
		this.character = null;
		this.dead = false;
		this.inMenu = false;
		this.isPortrait = false;
		this.Hover(false, false);
	}

	// Token: 0x060002B8 RID: 696 RVA: 0x00037A4B File Offset: 0x00035C4B
	public void UpdateItemColliders(bool state, bool updateMain)
	{
	}

	// Token: 0x060002B9 RID: 697 RVA: 0x00037A50 File Offset: 0x00035C50
	public void CreateMenuItems(int ID, int stackSize, Vector3 socketA, Vector3 socketB, Vector4 itemTime, int slot, Transform slotParent)
	{
		bool flag = true;
		if (ID == 0 && slot == 0)
		{
			ID = 1;
		}
		if (ID == -1)
		{
			return;
		}
		Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(ID);
		int num = -1;
		Vector3 zero = Vector3.zero;
		Vector3 vector = Vector3.zero;
		Vector4 durability = new Vector4(0f, 0f, 0f, 0f);
		if (this.equippedItems[slot])
		{
			Equipment component = this.equippedItems[slot].GetComponent<Equipment>();
			GameObject gameObject = null;
			ItemEquipped component2 = this.equippedItems[slot].GetComponent<ItemEquipped>();
			string text = "";
			if (!component)
			{
				if (!component && component2)
				{
					num = component2.ID;
				}
			}
			else
			{
				num = component.id;
				gameObject = component.ammoObject;
				text = component.ammoObjectName;
				component.ammoObject = null;
			}
			bool flag2 = true;
			if (component2)
			{
				Vector3 socketA2 = component2.socketA;
				vector = component2.socketB;
				durability = component2.durability;
				int stackSize2 = component2.stackSize;
				if (socketA2 != socketA)
				{
					flag2 = false;
				}
				if (vector != socketB)
				{
					flag2 = false;
				}
				if (durability != itemTime)
				{
					flag2 = false;
				}
				if (stackSize2 != stackSize)
				{
					flag2 = false;
				}
			}
			if (num == ID && (!component2 || (component2 && flag2)))
			{
				flag = false;
				if (this.equippedItems[slot])
				{
					GameObject gameObject2 = this.equippedItems[slot].gameObject;
					this.SetMeshLayer(gameObject2.gameObject, false);
					if (!slotParent)
					{
						if (invRowByIndex._Name.Contains("Bow"))
						{
							slotParent = this.GetSlot(2);
						}
						else
						{
							slotParent = this.GetSlot(slot * 2);
						}
					}
					if (num != 9)
					{
						gameObject2.gameObject.transform.SetParent(slotParent, false);
						gameObject2.gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
						gameObject2.gameObject.transform.localRotation = Quaternion.Euler(Vector3.zero);
					}
					if (!this.isPortrait)
					{
						this.equippedItems[slot].socketA = socketA;
						this.equippedItems[slot].socketB = socketB;
						this.equippedItems[slot].stackSize = stackSize;
						this.equippedItems[slot].durability = itemTime;
						this.equippedItems[slot].SetDurabilityVisual();
					}
				}
			}
			if (flag)
			{
				GameObject gameObject3 = this.equippedItems[slot].gameObject;
				if (gameObject3)
				{
					OutlineGlow component3 = gameObject3.gameObject.GetComponent<OutlineGlow>();
					if (component3)
					{
						Object.Destroy(component3);
					}
				}
				string text2 = this.equippedItems[slot].invRow._CharacterModel;
				if (slot == 4 || slot == 5 || slot == 6)
				{
					text2 += "_clump";
				}
				this.equippedItems[slot].ReturnToArchives();
				if (slot != 9)
				{
					Links.x.archives.RecycleItemBody(gameObject3, text2);
				}
				this.equippedItems[slot] = null;
				if (gameObject)
				{
					Links.x.archives.RecycleItemBody(gameObject, text);
				}
			}
		}
		if (flag)
		{
			if (ID > 1 && slot != 9)
			{
				bool flag3 = true;
				bool flag4 = false;
				int num2 = 2;
				string text3 = "slingstone_ammo_clay";
				if (invRowByIndex._MeleeRangeEnd >= 5f)
				{
					flag4 = true;
				}
				if (invRowByIndex._Name.Contains("Bow"))
				{
					num2 = 0;
					text3 = "arrow_tier1";
				}
				if (invRowByIndex._MainSkill == "Elixir" && invRowByIndex._Tag == "Weapon")
				{
					text3 = "item_ammo_projectile_globe1";
				}
				if (!slotParent)
				{
					flag3 = false;
					if (invRowByIndex._Name.Contains("Bow"))
					{
						slotParent = this.GetSlot(2);
					}
					else
					{
						slotParent = this.GetSlot(slot * 2);
					}
				}
				string text4 = invRowByIndex._CharacterModel;
				if (slot == 4 || slot == 5 || slot == 6)
				{
					text4 += "_clump";
				}
				GameObject itemPrefabBody = Links.x.archives.GetItemPrefabBody(text4);
				if (itemPrefabBody)
				{
					itemPrefabBody.gameObject.transform.SetParent(slotParent, false);
					itemPrefabBody.gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
					itemPrefabBody.gameObject.transform.localRotation = Quaternion.Euler(Vector3.zero);
					if (invRowByIndex._Tag == "Weapon")
					{
						itemPrefabBody.name = invRowByIndex._MainSkill;
						if (invRowByIndex._MainSkill == "Whip")
						{
							itemPrefabBody.name = "FlailWhip";
						}
						if (invRowByIndex._MainSkill == "Sling")
						{
							itemPrefabBody.name = "Sling_t-1_a_maya";
						}
					}
					Equipment equipment = itemPrefabBody.GetComponent<Equipment>();
					if (!equipment)
					{
						equipment = itemPrefabBody.AddComponent<Equipment>();
					}
					equipment.id = invRowByIndex._ID;
					this.SetMeshLayer(itemPrefabBody, false);
					if (flag3)
					{
						itemPrefabBody.layer = 25;
					}
					ItemEquipped itemEquipped = itemPrefabBody.GetComponent<ItemEquipped>();
					if (!itemEquipped)
					{
						itemEquipped = itemPrefabBody.AddComponent<ItemEquipped>();
					}
					itemEquipped.inPortrait = this.isPortrait;
					bool flag5 = false;
					if (itemPrefabBody.GetComponent<MeshRenderer>())
					{
						itemPrefabBody.GetComponent<MeshRenderer>().material.shader = Links.x.characterMenu;
						itemEquipped.itemRenderer = itemPrefabBody.GetComponent<MeshRenderer>();
						this.materials = itemEquipped.itemRenderer.materials;
						Material[] array = this.materials;
						for (int i = 0; i < array.Length; i++)
						{
							array[i].shader = Links.x.characterMenu;
						}
						flag5 = true;
					}
					if (!flag5 && invRowByIndex._Tag == "Weapon")
					{
						if (itemPrefabBody.gameObject.GetComponent<SkinnedMeshRenderer>())
						{
							itemPrefabBody.gameObject.GetComponent<SkinnedMeshRenderer>().material.shader = Links.x.characterMenu;
							itemEquipped.itemRenderer = itemPrefabBody.gameObject.GetComponent<SkinnedMeshRenderer>();
							this.materials = itemEquipped.itemRenderer.materials;
							Material[] array = this.materials;
							for (int i = 0; i < array.Length; i++)
							{
								array[i].shader = Links.x.characterMenu;
							}
							this.SetMeshLayer(itemEquipped.itemRenderer.gameObject, false);
							flag5 = true;
						}
						else if (itemPrefabBody.gameObject.transform.childCount >= 1)
						{
							if (itemPrefabBody.gameObject.transform.GetChild(0).GetComponent<SkinnedMeshRenderer>())
							{
								itemPrefabBody.gameObject.transform.GetChild(0).GetComponent<SkinnedMeshRenderer>().material.shader = Links.x.characterMenu;
								itemEquipped.itemRenderer = itemPrefabBody.gameObject.transform.GetChild(0).GetComponent<SkinnedMeshRenderer>();
								this.materials = itemEquipped.itemRenderer.materials;
								Material[] array = this.materials;
								for (int i = 0; i < array.Length; i++)
								{
									array[i].shader = Links.x.characterMenu;
								}
								this.SetMeshLayer(itemEquipped.itemRenderer.gameObject, false);
								flag5 = true;
							}
							if (!flag5 && itemPrefabBody.gameObject.transform.childCount > 1 && itemPrefabBody.gameObject.transform.GetChild(1).GetComponent<SkinnedMeshRenderer>())
							{
								itemPrefabBody.gameObject.transform.GetChild(1).GetComponent<SkinnedMeshRenderer>().material.shader = Links.x.characterMenu;
								itemEquipped.itemRenderer = itemPrefabBody.gameObject.transform.GetChild(1).GetComponent<SkinnedMeshRenderer>();
								this.materials = itemEquipped.itemRenderer.materials;
								Material[] array = this.materials;
								for (int i = 0; i < array.Length; i++)
								{
									array[i].shader = Links.x.characterMenu;
								}
								this.SetMeshLayer(itemEquipped.itemRenderer.gameObject, false);
								flag5 = true;
							}
						}
					}
					if (!flag5 && invRowByIndex._Tag != "Weapon" && itemPrefabBody.gameObject.transform.childCount > 0)
					{
						MeshRenderer component4 = itemPrefabBody.gameObject.transform.GetChild(0).GetComponent<MeshRenderer>();
						if (component4)
						{
							component4.material.shader = Links.x.characterMenu;
							itemEquipped.itemRenderer = component4;
							this.materials = itemEquipped.itemRenderer.materials;
							Material[] array = this.materials;
							for (int i = 0; i < array.Length; i++)
							{
								array[i].shader = Links.x.characterMenu;
							}
							this.SetMeshLayer(component4.gameObject, false);
						}
						else if (itemPrefabBody.gameObject.transform.GetChild(0).GetComponent<SkinnedMeshRenderer>())
						{
							itemPrefabBody.gameObject.transform.GetChild(0).GetComponent<SkinnedMeshRenderer>().material.shader = Links.x.characterMenu;
							itemEquipped.itemRenderer = itemPrefabBody.gameObject.transform.GetChild(0).GetComponent<SkinnedMeshRenderer>();
							this.materials = itemEquipped.itemRenderer.materials;
							Material[] array = this.materials;
							for (int i = 0; i < array.Length; i++)
							{
								array[i].shader = Links.x.characterMenu;
							}
							this.SetMeshLayer(itemEquipped.itemRenderer.gameObject, false);
						}
					}
					itemEquipped.ID = ID;
					itemEquipped.invRow = Links.x.library.GetInvRowByIndex(ID);
					itemEquipped.equipIndex = slot;
					if (!this.isPortrait)
					{
						itemEquipped.socketA = socketA;
						itemEquipped.socketB = socketB;
						itemEquipped.stackSize = stackSize;
						itemEquipped.durability = itemTime;
						itemEquipped.SetDurabilityVisual();
						itemEquipped.Setup();
					}
					this.equippedItems[slot] = itemEquipped;
					if (flag4)
					{
						this.ammoItem = Links.x.archives.GetItemPrefabBody(text3);
						this.ammoItem.gameObject.transform.SetParent(this.GetSlot(num2), false);
						this.ammoItem.gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
						this.ammoItem.gameObject.transform.localRotation = Quaternion.Euler(Vector3.zero);
						equipment.ammoObject = this.ammoItem;
						equipment.ammoObjectName = text3;
					}
					if (flag3)
					{
						itemPrefabBody.gameObject.layer = 25;
						invRowByIndex._MainSkill == "Shield";
						if (invRowByIndex._MainSkill == "Elixir")
						{
							if (invRowByIndex._Name.Contains("Bomb"))
							{
								itemPrefabBody.gameObject.transform.localRotation = Quaternion.Euler(new Vector3(121f, -180f, 0f));
								itemPrefabBody.gameObject.transform.localPosition = new Vector3(-0.003f, 0.009f, -0.175f);
								itemPrefabBody.gameObject.transform.localScale = Vector3.one * 0.8f;
							}
							else
							{
								itemPrefabBody.gameObject.transform.localRotation = Quaternion.Euler(new Vector3(128f, -180f, -360f));
								itemPrefabBody.gameObject.transform.localPosition = new Vector3(-0.003f, 0.071f, -0.14f);
							}
						}
						if (invRowByIndex._MainSkill == "Sling")
						{
							itemPrefabBody.gameObject.transform.localRotation = Quaternion.Euler(new Vector3(-125f, 14f, 0f));
						}
					}
				}
			}
			if (slot == 0 && !Records.x.dialogue)
			{
				Library.Inventory inventory = null;
				Library.Inventory inventory2;
				if (this.equippedItems[0])
				{
					inventory2 = this.equippedItems[0].invRow;
				}
				else
				{
					inventory2 = Links.x.library.GetInvRowFromName("Fist");
				}
				if (this.equippedItems[1])
				{
					inventory = this.equippedItems[1].invRow;
				}
				string weaponControllerPrefix = Records.x.GetWeaponControllerPrefix(inventory2, inventory, this.savedRace, false);
				string text5 = this.animationPrefix + weaponControllerPrefix;
				AnimatorOverrideController overrideController = Links.x.archives.GetOverrideController(text5);
				if (overrideController != null)
				{
					this.anim.runtimeAnimatorController = overrideController;
				}
				this.anim.enabled = false;
				this.anim.enabled = true;
				this.anim.Rebind();
				if (base.gameObject.activeInHierarchy)
				{
					this.anim.Update(0f);
				}
			}
			if (slot == 1 && !Records.x.dialogue)
			{
				Library.Inventory inventory3 = null;
				Library.Inventory inventory4;
				if (this.equippedItems[0])
				{
					inventory4 = this.equippedItems[0].invRow;
				}
				else
				{
					inventory4 = Links.x.library.GetInvRowFromName("Fist");
				}
				if (this.equippedItems[1])
				{
					inventory3 = this.equippedItems[1].invRow;
				}
				string weaponControllerPrefix2 = Records.x.GetWeaponControllerPrefix(inventory4, inventory3, this.savedRace, false);
				string text6 = this.animationPrefix + weaponControllerPrefix2;
				AnimatorOverrideController overrideController2 = Links.x.archives.GetOverrideController(text6);
				if (overrideController2 != null)
				{
					this.anim.runtimeAnimatorController = overrideController2;
				}
				this.anim.enabled = false;
				this.anim.enabled = true;
				this.anim.Rebind();
				if (base.gameObject.activeInHierarchy)
				{
					this.anim.Update(0f);
					return;
				}
			}
		}
		else if (slot == 0 && ID <= 0 && !Records.x.dialogue)
		{
			Library.Inventory inventory5 = null;
			Library.Inventory inventory6;
			if (this.equippedItems[0])
			{
				inventory6 = this.equippedItems[0].invRow;
			}
			else
			{
				inventory6 = Links.x.library.GetInvRowFromName("Fist");
			}
			if (this.equippedItems[1])
			{
				inventory5 = this.equippedItems[1].invRow;
			}
			string weaponControllerPrefix3 = Records.x.GetWeaponControllerPrefix(inventory6, inventory5, this.savedRace, false);
			string text7 = this.animationPrefix + weaponControllerPrefix3;
			AnimatorOverrideController overrideController3 = Links.x.archives.GetOverrideController(text7);
			if (overrideController3 != null)
			{
				this.anim.runtimeAnimatorController = overrideController3;
			}
			this.anim.enabled = false;
			this.anim.enabled = true;
			this.anim.Rebind();
			if (base.gameObject.activeInHierarchy)
			{
				this.anim.Update(0f);
			}
		}
	}

	// Token: 0x060002BA RID: 698 RVA: 0x00038966 File Offset: 0x00036B66
	public void HoverArmor(bool state)
	{
	}

	// Token: 0x060002BB RID: 699 RVA: 0x00038968 File Offset: 0x00036B68
	public void SetupArmorForInventory(int ID, int stackSize, Vector3 socketA, Vector3 socketB, Vector4 itemTime, int slot)
	{
		if (ID > 0)
		{
			CapsuleCollider component = base.gameObject.GetComponent<CapsuleCollider>();
			if (component)
			{
				component.enabled = true;
			}
			ItemEquipped itemEquipped = base.gameObject.GetComponent<ItemEquipped>();
			if (!itemEquipped)
			{
				itemEquipped = base.gameObject.AddComponent<ItemEquipped>();
			}
			itemEquipped.inPortrait = this.isPortrait;
			itemEquipped.ID = ID;
			if (!this.isPortrait)
			{
				itemEquipped.socketA = socketA;
				itemEquipped.socketB = socketB;
				itemEquipped.stackSize = stackSize;
				itemEquipped.durability = itemTime;
				itemEquipped.equipIndex = slot;
				itemEquipped.invRow = Links.x.library.GetInvRowByIndex(ID);
				itemEquipped.SetDurabilityVisual();
				itemEquipped.Setup();
			}
			this.equippedItems[slot] = itemEquipped;
			return;
		}
		CapsuleCollider component2 = base.GetComponent<CapsuleCollider>();
		if (component2)
		{
			component2.enabled = false;
		}
		ItemEquipped component3 = base.gameObject.GetComponent<ItemEquipped>();
		if (component3)
		{
			Object.Destroy(component3);
		}
		this.equippedItems[slot] = null;
	}

	// Token: 0x060002BC RID: 700 RVA: 0x00038A5F File Offset: 0x00036C5F
	public ItemEquipped GetItemEquipped(int index)
	{
		if (index < this.equippedItems.Length && index > -1 && this.equippedItems[index])
		{
			return this.equippedItems[index];
		}
		return null;
	}

	// Token: 0x04000444 RID: 1092
	[Header("Objects")]
	public Transform headBone;

	// Token: 0x04000445 RID: 1093
	public Transform hand;

	// Token: 0x04000446 RID: 1094
	public Animator anim;

	// Token: 0x04000447 RID: 1095
	public FaceAnimations headAnim;

	// Token: 0x04000448 RID: 1096
	public Transform tr;

	// Token: 0x04000449 RID: 1097
	public Character character;

	// Token: 0x0400044A RID: 1098
	private LookAtIK lookik;

	// Token: 0x0400044B RID: 1099
	public GrounderFBBIK grounder;

	// Token: 0x0400044C RID: 1100
	public global::LookAtController lookAtController;

	// Token: 0x0400044D RID: 1101
	private FullBodyBipedIK fbbik;

	// Token: 0x0400044E RID: 1102
	public Vector3 bodyOffset;

	// Token: 0x0400044F RID: 1103
	public Transform neck;

	// Token: 0x04000450 RID: 1104
	public GameObject headObject;

	// Token: 0x04000451 RID: 1105
	public GameObject wings;

	// Token: 0x04000452 RID: 1106
	public GameObject birdFeet;

	// Token: 0x04000453 RID: 1107
	public GameObject toeFeet;

	// Token: 0x04000454 RID: 1108
	private Collider headColl;

	// Token: 0x04000455 RID: 1109
	private Transform attackBone;

	// Token: 0x04000456 RID: 1110
	private Transform hipBone;

	// Token: 0x04000457 RID: 1111
	public GameObject goreObj;

	// Token: 0x04000458 RID: 1112
	public GameObject ammoItem;

	// Token: 0x04000459 RID: 1113
	public Gore goreScript;

	// Token: 0x0400045A RID: 1114
	[Header("Lists")]
	public List<Renderer> fleshRenderers = new List<Renderer>();

	// Token: 0x0400045B RID: 1115
	public List<Collider> startColliders = new List<Collider>();

	// Token: 0x0400045C RID: 1116
	public List<Renderer> deadRenderers = new List<Renderer>();

	// Token: 0x0400045D RID: 1117
	public List<Rigidbody> deadRigidbodies = new List<Rigidbody>();

	// Token: 0x0400045E RID: 1118
	private List<Vector3> savedVelocities;

	// Token: 0x0400045F RID: 1119
	private List<Vector3> savedAngularVelocities;

	// Token: 0x04000460 RID: 1120
	private List<Vector3> startDeadPositions = new List<Vector3>();

	// Token: 0x04000461 RID: 1121
	public List<Animator> fleshAnimators = new List<Animator>();

	// Token: 0x04000462 RID: 1122
	public Collider[] colliders = new Collider[0];

	// Token: 0x04000463 RID: 1123
	private List<GameObject> bones = new List<GameObject>();

	// Token: 0x04000464 RID: 1124
	public List<Transform> slots = new List<Transform>();

	// Token: 0x04000465 RID: 1125
	public List<string> slotNames = new List<string>();

	// Token: 0x04000466 RID: 1126
	public ItemEquipped[] equippedItems = new ItemEquipped[19];

	// Token: 0x04000467 RID: 1127
	private Material[] materials;

	// Token: 0x04000468 RID: 1128
	public MagicaCloth[] magicaCloths = new MagicaCloth[0];

	// Token: 0x04000469 RID: 1129
	public MagicaCapsuleCollider[] magicaCapsules = new MagicaCapsuleCollider[0];

	// Token: 0x0400046A RID: 1130
	public Renderer faceRenderer;

	// Token: 0x0400046B RID: 1131
	public Renderer hairRenderer;

	// Token: 0x0400046C RID: 1132
	private Material[] mats;

	// Token: 0x0400046D RID: 1133
	private List<Character> combatCharacters;

	// Token: 0x0400046E RID: 1134
	public Bounds bounds;

	// Token: 0x0400046F RID: 1135
	private Transform[] points;

	// Token: 0x04000470 RID: 1136
	[Header("Info")]
	public bool inMenu;

	// Token: 0x04000471 RID: 1137
	public bool isPortrait;

	// Token: 0x04000472 RID: 1138
	public bool portrait;

	// Token: 0x04000473 RID: 1139
	public float maskNumber;

	// Token: 0x04000474 RID: 1140
	public AnimatorStateInfo stateInfo;

	// Token: 0x04000475 RID: 1141
	public int currentHash;

	// Token: 0x04000476 RID: 1142
	public int idleHash;

	// Token: 0x04000477 RID: 1143
	public int combatIdleHash;

	// Token: 0x04000478 RID: 1144
	public int combatIdle2Hash;

	// Token: 0x04000479 RID: 1145
	public int patrolLeftHash;

	// Token: 0x0400047A RID: 1146
	public int patrolRightHash;

	// Token: 0x0400047B RID: 1147
	public int turnLeftHash;

	// Token: 0x0400047C RID: 1148
	public int turnRightHash;

	// Token: 0x0400047D RID: 1149
	public int basicAttackHash;

	// Token: 0x0400047E RID: 1150
	public int defendHash;

	// Token: 0x0400047F RID: 1151
	public int channelHash;

	// Token: 0x04000480 RID: 1152
	public int special1Hash;

	// Token: 0x04000481 RID: 1153
	public int special2Hash;

	// Token: 0x04000482 RID: 1154
	public int special5Hash;

	// Token: 0x04000483 RID: 1155
	public int special4Hash;

	// Token: 0x04000484 RID: 1156
	public int special3Hash;

	// Token: 0x04000485 RID: 1157
	public int kickHash;

	// Token: 0x04000486 RID: 1158
	public int useHash;

	// Token: 0x04000487 RID: 1159
	public int walkHash;

	// Token: 0x04000488 RID: 1160
	public int walkStartHash;

	// Token: 0x04000489 RID: 1161
	public int combatWalkHash;

	// Token: 0x0400048A RID: 1162
	public int combatWalkStartHash;

	// Token: 0x0400048B RID: 1163
	public int walkEndHash;

	// Token: 0x0400048C RID: 1164
	public int walkPartyHash;

	// Token: 0x0400048D RID: 1165
	public int combatWalkEndHash;

	// Token: 0x0400048E RID: 1166
	public int powerDraw;

	// Token: 0x0400048F RID: 1167
	public int instrumentHash;

	// Token: 0x04000490 RID: 1168
	public int jumpStartHash;

	// Token: 0x04000491 RID: 1169
	public int creepStartHash;

	// Token: 0x04000492 RID: 1170
	public int creepHash;

	// Token: 0x04000493 RID: 1171
	public int jumpLoopHash;

	// Token: 0x04000494 RID: 1172
	public int jumpEndHash;

	// Token: 0x04000495 RID: 1173
	public int charmHash;

	// Token: 0x04000496 RID: 1174
	public int basicAttack2Hash;

	// Token: 0x04000497 RID: 1175
	public int basicAttack3Hash;

	// Token: 0x04000498 RID: 1176
	public int basicAttack4Hash;

	// Token: 0x04000499 RID: 1177
	public int hitDownHash;

	// Token: 0x0400049A RID: 1178
	public int runHash;

	// Token: 0x0400049B RID: 1179
	public int runStartHash;

	// Token: 0x0400049C RID: 1180
	public int runEndHash;

	// Token: 0x0400049D RID: 1181
	public int patrolLeft45Hash;

	// Token: 0x0400049E RID: 1182
	public int patrolRight45Hash;

	// Token: 0x0400049F RID: 1183
	public int combatPivotLeftHash;

	// Token: 0x040004A0 RID: 1184
	public int combatPivotRightHash;

	// Token: 0x040004A1 RID: 1185
	public int combatPivotLeft45Hash;

	// Token: 0x040004A2 RID: 1186
	public int combatPivotRight45Hash;

	// Token: 0x040004A3 RID: 1187
	public int patrol180;

	// Token: 0x040004A4 RID: 1188
	public int combatPivot180;

	// Token: 0x040004A5 RID: 1189
	public int combatPivotLeftBackHash;

	// Token: 0x040004A6 RID: 1190
	public int combatPivotRightBackHash;

	// Token: 0x040004A7 RID: 1191
	public int combatPivotLeft45BackHash;

	// Token: 0x040004A8 RID: 1192
	public int combatPivotRight45BackHash;

	// Token: 0x040004A9 RID: 1193
	public int combatPivotBack180;

	// Token: 0x040004AA RID: 1194
	public int creepEndHash;

	// Token: 0x040004AB RID: 1195
	public int quickAttackHash;

	// Token: 0x040004AC RID: 1196
	public int walkBackHash;

	// Token: 0x040004AD RID: 1197
	public int walkBackStartHash;

	// Token: 0x040004AE RID: 1198
	public int walkBackEndHash;

	// Token: 0x040004AF RID: 1199
	public int getupHash;

	// Token: 0x040004B0 RID: 1200
	public int hitHash;

	// Token: 0x040004B1 RID: 1201
	public int downHash;

	// Token: 0x040004B2 RID: 1202
	public int downStartHash;

	// Token: 0x040004B3 RID: 1203
	public int bounceHash;

	// Token: 0x040004B4 RID: 1204
	public bool dead;

	// Token: 0x040004B5 RID: 1205
	public string animationPrefix;

	// Token: 0x040004B6 RID: 1206
	public bool grounderOn;

	// Token: 0x040004B7 RID: 1207
	public string model;

	// Token: 0x040004B8 RID: 1208
	public bool attacking;

	// Token: 0x040004B9 RID: 1209
	public bool sneaking;

	// Token: 0x040004BA RID: 1210
	public bool hasGrounder;

	// Token: 0x040004BB RID: 1211
	public bool dithering;

	// Token: 0x040004BC RID: 1212
	public float startDither;

	// Token: 0x040004BD RID: 1213
	public float endDither;

	// Token: 0x040004BE RID: 1214
	public float t;

	// Token: 0x040004BF RID: 1215
	public float currentDither;

	// Token: 0x040004C0 RID: 1216
	private bool evading;

	// Token: 0x040004C1 RID: 1217
	public string headModel;

	// Token: 0x040004C2 RID: 1218
	private bool ghost;

	// Token: 0x040004C3 RID: 1219
	private bool newHead;

	// Token: 0x040004C4 RID: 1220
	private bool setMagicaClothPortraits;

	// Token: 0x040004C5 RID: 1221
	private AngleConstraint.RestorationSerializeData magicaAngle;

	// Token: 0x040004C6 RID: 1222
	private CurveSerializeData magicaCurveDamp;

	// Token: 0x040004C7 RID: 1223
	public int turnOnMagicaClothNextFrame;

	// Token: 0x040004C8 RID: 1224
	public int specID;

	// Token: 0x040004C9 RID: 1225
	public int needToUpdateItemColliders;

	// Token: 0x040004CA RID: 1226
	public float dodgeTime;

	// Token: 0x040004CB RID: 1227
	public Vector3 originalScale;

	// Token: 0x040004CC RID: 1228
	public bool sameNode;

	// Token: 0x040004CD RID: 1229
	public bool nextFrameRotateToChild;

	// Token: 0x040004CE RID: 1230
	private float prevHealth;

	// Token: 0x040004CF RID: 1231
	private float jumpCurrent;

	// Token: 0x040004D0 RID: 1232
	public float waitForCrossFadeTime;

	// Token: 0x040004D1 RID: 1233
	private string savedRace;

	// Token: 0x040004D2 RID: 1234
	private int raceID;

	// Token: 0x040004D3 RID: 1235
	private int hairID;

	// Token: 0x040004D4 RID: 1236
	private int skinID;

	// Token: 0x040004D5 RID: 1237
	private int outfitID;

	// Token: 0x040004D6 RID: 1238
	private bool multiHover;

	// Token: 0x040004D7 RID: 1239
	private bool hovering;

	// Token: 0x040004D8 RID: 1240
	public GameObject bracket;

	// Token: 0x040004D9 RID: 1241
	private float boundsOffset;

	// Token: 0x040004DA RID: 1242
	public bool ignoreAttackEvent;

	// Token: 0x040004DB RID: 1243
	public bool animationHold;

	// Token: 0x040004DC RID: 1244
	public bool targetOutline;

	// Token: 0x040004DD RID: 1245
	public bool multiHit;

	// Token: 0x040004DE RID: 1246
	private IEnumerator bonesRoutine;

	// Token: 0x040004DF RID: 1247
	private float healthPercent;

	// Token: 0x040004E0 RID: 1248
	private float goreStart;

	// Token: 0x040004E1 RID: 1249
	private bool makeBones;

	// Token: 0x040004E2 RID: 1250
	private bool cannotTurnOn;

	// Token: 0x040004E3 RID: 1251
	[Header("Blinking")]
	public int blinking;

	// Token: 0x040004E4 RID: 1252
	private float blinkTime;

	// Token: 0x040004E5 RID: 1253
	private float blinkInterval;

	// Token: 0x040004E6 RID: 1254
	public float recoveryTime;

	// Token: 0x040004E7 RID: 1255
	private string blink2Type;

	// Token: 0x040004E8 RID: 1256
	public int blinking2;

	// Token: 0x040004E9 RID: 1257
	public int blinkNumber2;

	// Token: 0x040004EA RID: 1258
	private float blinkTime2;

	// Token: 0x040004EB RID: 1259
	private float blinkInterval2;

	// Token: 0x040004EC RID: 1260
	public Vector3 startScale;
}
