Files
BepInEx/Projects/BanquetForFools/Source/Assembly-CSharp/Character.cs
2025-05-21 20:40:04 +02:00

21719 lines
577 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using DarkTonic.MasterAudio;
using Pathfinding;
using PixelCrushers.DialogueSystem;
using TMPro;
using UnityEngine;
// Token: 0x0200001B RID: 27
public class Character : MonoBehaviour
{
// Token: 0x060002F0 RID: 752 RVA: 0x00039F18 File Offset: 0x00038118
private void Update()
{
if (!Links.x.gaia.sceneLoaded)
{
return;
}
if (Records.x.inOverworldMap)
{
return;
}
if (this.offMap || !this.body)
{
return;
}
if (this.setupComplete)
{
if (!this.npc && this.mainSelected && !Records.x.pocketPause)
{
Links.x.follow.position = this.tr.position + this.headHeight;
float num = this.attackTime;
if (!this.CanAttack())
{
num = 0f;
}
if (Links.x.combat.bubbleEvent)
{
num = 1f;
}
Shader.SetGlobalFloat("_AttackTime", num);
}
if (Links.x.gaia.sceneLoaded && !this.dead && !this.inactive)
{
if (!this.body)
{
this.SetupBody();
}
if (this.body.tr.parent == Links.x.archives.tr || !this.body.gameObject.activeSelf)
{
this.SetupBody();
if (this.party)
{
this.SetupPartyAfterLoadedVariables2();
}
}
if (this.body.headObject && this.body.headObject.transform.parent == Links.x.archives.tr)
{
this.SetupBody();
if (this.party)
{
this.SetupPartyAfterLoadedVariables2();
}
}
}
if (this.inactive && !this.dayNightVanishing && !this.alwaysOn && !this.dead)
{
this.TurnScriptsOff();
return;
}
if (this.isBoro)
{
if (this.inactive || Links.x.gaia.boroControls.boroInvisible)
{
return;
}
if (!Links.x.gaia.boroControls.BoroNearby())
{
Links.x.gaia.boroControls.StartLeaveWait();
}
}
bool flag = false;
if (this.isHit)
{
if (Links.x.gameplay.seconds > this.hitTime)
{
bool flag2 = true;
if (this.bouncer)
{
flag2 = false;
RaycastHit raycastHit;
if (Physics.SphereCast(this.tr.position + new Vector3(0f, 10f, 0f), 0.25f, -1f * this.upVector, out raycastHit, 100f, 4194433))
{
this.groundPoint = raycastHit.point;
if (Mathf.Abs(this.groundPoint.y - this.tr.position.y) < 0.5f)
{
flag2 = true;
}
}
else
{
flag2 = true;
}
if (this.bouncer.rbody.linearVelocity.magnitude < 0.3f)
{
flag2 = true;
}
if (!this.bouncer.gameObject.activeSelf)
{
this.bouncer.gameObject.SetActive(true);
}
}
if ((!this.bouncer && (this.body.downHash == this.body.currentHash || this.body.downStartHash == this.body.currentHash)) || flag2)
{
this.isHit = false;
this.postHitTime = Links.x.gameplay.seconds;
if ((this.body.bounceHash == this.body.currentHash || this.body.downHash == this.body.currentHash || this.animID == 8) && !this.dead)
{
this.PlayAnimation("GetUp", 0f);
}
this.hitTime = 0f;
this.hitTimeReal = 0f;
if (this.stunned)
{
this.PlayAnimation("Hit Down", 0f);
}
RaycastHit raycastHit2;
if (this.bouncer && this.bouncer.gameObject.activeSelf && Physics.SphereCast(this.tr.position + new Vector3(0f, 10f, 0f), 0.25f, -1f * this.upVector, out raycastHit2, 100f, 4194433))
{
this.groundPoint = raycastHit2.point;
if (this.groundPoint.y > this.tr.position.y)
{
this.SetPosition(this.groundPoint, null);
}
}
if (!this.dead)
{
this.ClaimNode(null, this.tr.position, false);
}
}
if (this.hitTime == 0f)
{
this.PlayFaceAnimation(FaceAnimations.AnimationNames.Blink);
if (this.isHit)
{
this.ClaimNode(null, this.tr.position, false);
}
this.isHit = false;
this.postHitTime = Links.x.gameplay.seconds;
if (this.hasActions)
{
Links.x.combat.GetNextAction(this);
}
flag = true;
if (this.bouncer)
{
this.bouncer.End();
}
if (this.dead && !this.party)
{
base.enabled = false;
}
}
else if (this.NodesCount() > 0)
{
this.ClearNodePath();
}
}
if (this.bouncer && this.hitTime != 0f && this.bouncer.gameObject.activeSelf)
{
if (Time.timeSinceLevelLoad > this.hitTimeReal + 0.4f && Links.x.combat.inPocketAttack && this.pocketPausedOverride)
{
this.pocketPausedOverride = false;
this.animator.speed = 0f;
this.hitTimeReal = 0f;
}
if ((Links.x.combat.inPocketAttack || Records.x.pocketPause) && !this.pocketPausedOverride)
{
if (this.savedBounceVel == this.vectorZero)
{
this.savedBounceVel = this.bouncer.rbody.linearVelocity;
this.savedBounceAngVel = this.bouncer.rbody.angularVelocity;
}
this.bouncer.rbody.useGravity = false;
this.bouncer.rbody.isKinematic = true;
}
else
{
if (this.savedBounceVel != this.vectorZero)
{
this.bouncer.rbody.AddForce(this.savedBounceVel, ForceMode.VelocityChange);
this.bouncer.rbody.AddTorque(this.savedBounceAngVel, ForceMode.VelocityChange);
this.savedBounceVel = this.vectorZero;
this.savedBounceAngVel = this.vectorZero;
this.bouncer.rbody.useGravity = true;
this.bouncer.rbody.isKinematic = false;
}
float num2 = 0f;
RaycastHit raycastHit3;
if (Physics.SphereCast(this.tr.position + new Vector3(0f, 10f, 0f), 0.25f, -1f * this.upVector, out raycastHit3, 100f, 4194433))
{
this.groundPoint = raycastHit3.point;
if (this.groundPoint.y < this.tr.position.y + 0.6f)
{
num2 = this.tr.position.y - this.groundPoint.y;
}
}
if (num2 > 0f)
{
float num3 = -600f;
if (this.dead)
{
num3 = -300f;
}
this.bouncer.rbody.AddForce(Vector3.up * num3, ForceMode.Force);
}
if (num2 < 0.5f || this.bouncer.rbody.linearVelocity.sqrMagnitude < 0.1f)
{
if (this.stunned)
{
this.PlayAnimation("Hit Down", 0f);
}
if (this.body.currentHash == this.body.bounceHash)
{
this.animator.SetBool("Bounce Over", true);
}
}
}
}
}
if (this.dead && !this.party)
{
return;
}
if (this.postHitTime > 0f && (Links.x.gameplay.seconds > this.postHitTime + 15f || this.isHit || this.dead || this.stunned || this.downed || this.stats.pinned))
{
this.postHitTime = 0f;
}
if (this.inActionTime > 0f)
{
if (!this.inAction)
{
this.inActionTime = 0f;
}
else if (Links.x.gameplay.seconds > this.inActionTime + 100f && this.animID != 14)
{
this.inAction = false;
this.inActionTime = 0f;
}
}
if (this.animID == 14 && this.body.currentHash != this.body.channelHash)
{
this.animID = 0;
}
if (this.inRecoveryTime > 0f)
{
if (!this.inRecovery)
{
this.inRecoveryTime = 0f;
}
else if (Links.x.gameplay.seconds > this.inRecoveryTime + 15f)
{
this.inRecovery = false;
this.inRecoveryTime = 0f;
}
}
if (this.inQueuedAbilityTime > 0f)
{
if (!this.inQueuedAbility)
{
this.inQueuedAbilityTime = 0f;
}
else if (Time.timeSinceLevelLoad > this.inQueuedAbilityTime + 2f)
{
this.inQueuedAbility = false;
this.inQueuedAbilityTime = 0f;
}
}
if (this.chargeTime > 0f)
{
if (this.charging)
{
if (Links.x.gameplay.seconds > this.chargeTime + 18f)
{
this.charging = false;
if (Records.x.editor)
{
Debug.Log("setting charge false for " + ((this != null) ? this.ToString() : null));
}
}
}
else
{
this.chargeTime = 0f;
}
}
if (this.listenForPhysicsEnd && !this.rb.isKinematic)
{
Debug.Log(((this != null) ? this.ToString() : null) + " listen for physics end " + this.rb.linearVelocity.magnitude.ToString());
if (this.rb.linearVelocity.magnitude < 0.2f)
{
this.rb.isKinematic = true;
this.ClaimNode(null, Vector3.zero, true);
this.listenForPhysicsEnd = false;
if (!this.moving)
{
this.jumping = false;
}
if (this.node != null)
{
this.SetPosition((Vector3)this.node.position, null);
}
this.SetRotation(Quaternion.identity, false, false);
}
}
bool flag3 = false;
if (Records.x.combat)
{
if (this.npc)
{
}
if (this.npc || Records.x.InCombat(false))
{
}
}
bool flag4 = true;
if (this.IsSentient() && !this.dead && flag4 && !Records.x.removeControls && this.stats.Confuse() == 0 && (flag3 || !Records.x.pocketPause))
{
if (this.attackTime < 1f)
{
if (!this.inAction && !this.inRecovery && !this.inQueuedAbility)
{
this.at += Time.deltaTime / this.currentAttackSpeed;
}
float num4 = this.attackTime;
this.attackTime = Mathf.Lerp(0f, 1f, this.at);
if (this.attackTime >= 1f)
{
this.inventoryTime = 0f;
}
if (this.mainSelected)
{
Links.x.hudControl.UpdateAttackTime(this.attackTime, 1f, this.inventoryTime);
}
if (num4 != this.attackTime && this.portrait)
{
this.portrait.SetActionBar(this.attackTime);
this.portrait.skillBag.SetSelectedState();
}
}
else
{
if (this.mainSelected)
{
Links.x.hudControl.UpdateAttackTime(1f, 1f, this.inventoryTime);
if (Links.x.combat.attackingInteractiveOutsideOfCombat && !Records.x.InCombat(false))
{
Links.x.hudControl.ToggleAttackTimer(false);
Links.x.combat.attackingInteractiveOutsideOfCombat = false;
Links.x.combat.npcsInCombat = false;
}
}
if (!Records.x.pocketPause)
{
float num5 = this.attackTime;
if (!Records.x.removeControls)
{
this.attackTime = 1f;
}
if (!this.inAction && !this.inRecovery)
{
if (num5 != this.attackTime && this.portrait)
{
this.portrait.SetActionBar(this.attackTime);
this.portrait.skillBag.SetSelectedState();
}
}
else if (this.portrait)
{
this.portrait.SetActionBar(0f);
}
}
}
}
else if (!Records.x.pocketPause)
{
float num6 = this.attackTime;
if (!Records.x.removeControls)
{
this.attackTime = 1f;
}
if (num6 != this.attackTime && this.portrait)
{
this.portrait.SetActionBar(this.attackTime);
}
}
else
{
if (this.dead)
{
this.attackTime = 0f;
}
if (this.mainSelected)
{
Links.x.hudControl.UpdateAttackTime(this.attackTime, 1f, 0f);
}
}
if (this.hasActions && this.party && !this.dead && !this.stunned)
{
this.portrait.skillBag.UpdateAbilityTriggers();
}
if (this.party && this.currentAnimatorSpeed != this.animator.speed && !this.body.animationHold)
{
float num7 = 10f;
if (this.IsWalking() && this.stats.moveSpeedMod == 0f)
{
this.animator.speed = Mathf.Lerp(this.animator.speed, this.currentAnimatorSpeed, Time.deltaTime * num7);
}
else
{
this.animator.speed = this.currentAnimatorSpeed;
}
}
if (this.inAction || this.inRecovery)
{
this.body.CheckBlink();
}
if (this.node != null)
{
if (this.slideNode == null)
{
if (!this.node.Walkable)
{
if (Records.x.editor)
{
Debug.Log(((this != null) ? this.ToString() : null) + " node is not walkable, moving to new node");
}
GraphNode graphNode = this.NearNode(this.tr.position, true, 0, 2, 0);
if (graphNode != null)
{
this.ClaimNode(graphNode, this.tr.position, false);
if (!this.moving && !this.sailing)
{
this.SetMoveFollowPosition(this.NodePosition());
this.Slide(this.node, true);
}
}
else if (this.party && !this.mainSelected)
{
this.setArea = (int)Links.x.main.node.Area;
graphNode = this.NearNode(Links.x.main.tr.position, true, 0, 2, 0);
if (graphNode != null)
{
this.ClaimNode(graphNode, (Vector3)graphNode.position, false);
if (!this.moving && !this.sailing)
{
this.tr.position = (Vector3)graphNode.position;
this.SetMoveFollowPosition(this.NodePosition());
}
}
}
}
if (!this.moving && this.nodePath.Count == 0 && !this.dead && !this.stunned && !this.downed && !this.sleeping && (!this.resting || (this.resting && !this.inCircle && this.hasActions)) && !this.mainSelected)
{
this.CheckInTile();
}
}
if (this.ghost && !Records.x.pocketPause)
{
int num8 = 1;
if (this.ghost && !this.ghostVanishing)
{
num8 = 0;
}
if (this.sailing || this.movesOnWater)
{
num8 = 2;
}
if (!this.node.AllConnectionsWalkable(this.ConnectionNumber(), num8) && this.slideNode == null)
{
this.GhostFlee();
}
}
}
if (this.fleeing && !this.moving && this.waitingForPath == 0 && Links.x.gameplay.seconds >= this.fleeStartTime + this.fleeTime)
{
this.CheckFleeEnd();
}
if (this.summoned && this.stats.leaveTime > 0f && (Links.x.gameplay.seconds > this.stats.leaveTime || Links.x.gaia.waitingToRemoveScene))
{
this.Missing();
}
if (this.party)
{
if (Time.timeSinceLevelLoad > this.timeSinceMoveEnded && this.timeSinceMoveEnded != 0f && this.timeSinceMoveEnded != -100f && !Records.x.pocketPause)
{
if (!this.hasActions && this.animID == 0 && this.slideNode == null)
{
this.PlayIdle();
this.timeSinceMoveEnded = 0f;
}
else
{
this.timeSinceMoveEnded = 0f;
}
}
if (this.sailing && this.sporeTime == 0f)
{
this.sporeTime = Links.x.gameplay.seconds;
}
if (this.sporeTime > 0f && (this.inSporeForest || this.sailing))
{
float seconds = Links.x.gameplay.seconds;
if ((seconds > this.sporeTime + 100f && this.inSporeForest) || (seconds > this.sporeTime + (500f - Records.x.boroBonus.z * 250f) && this.sailing))
{
int num9 = 1;
if (this.sailing)
{
num9 = 2;
}
this.stats.AddSpiritFromKill((float)num9);
this.sporeTime = seconds;
}
}
}
if (this.kickUseTime > 0f && Time.timeSinceLevelLoad > this.kickUseTime + 0.75f)
{
this.kickUseTime = 0f;
if (this.animID == 25 || this.animID == 26)
{
this.animID = 0;
}
}
if (this.jumpTime > 0f && ((Links.x.gameplay.seconds > this.jumpTime + 60f && this.body.currentHash != this.body.jumpLoopHash && !this.mainSelected) || Links.x.gameplay.seconds > this.jumpTime + 130f || !this.jumping || this.dead || this.stunned))
{
this.StopEvading();
if (this.jumping && this.IsSentient())
{
this.ForceEndJump();
this.jumping = false;
this.TargetReached();
if (this.actions && !this.mainSelected)
{
Links.x.combat.GetNextAction(this);
}
}
this.jumpTime = 0f;
this.jumping = false;
if (this.isHitFlying)
{
this.isHitFlying = false;
}
}
if (this.slideNode != null && !Records.x.paused && !this.dead && (!this.pocketPaused || (this.pocketPaused && this.pocketPausedOverride && !this.party && this.isHit)))
{
if (this.turning)
{
this.EndTurning(false);
}
if (this.stuckInPlace || this.stats.Stuck() > 0 || this.sailing || this.jumpingAreas || (!this.movesOnWater && this.isHit) || this.jumping || this.jumpingPosition)
{
this.slideNode = null;
this.slideNodePosition = Vector3.zero;
this.ClaimNode(null, this.vectorZero, false);
if (this.node != null && !this.sailing && !this.isHit)
{
this.SetMoveFollowPosition(this.NodePosition());
}
}
else
{
float sqrMagnitude = (this.slideNodePosition - this.tr.position).sqrMagnitude;
float sqrMagnitude2 = (this.prevNodePosition - this.tr.position).sqrMagnitude;
if (sqrMagnitude < 0.0025000002f || (this.body.IsHit() && this.body.animationHold && !this.movesOnWater) || flag || ((sqrMagnitude > 20f || sqrMagnitude2 > 20f) && this.mainSelected))
{
this.ttime = 0f;
if (this.isHitFlying)
{
this.KnockbackEnd(false);
this.isHitFlying = false;
}
if (this.IsWalking() && this.NodesCount() == 0)
{
this.SetIdle(true);
}
if ((Vector3)this.slideNode.position == this.slideNodePosition)
{
this.SetPosition((Vector3)this.slideNode.position, null);
this.ClaimNode(this.slideNode, this.slideNodePosition, false);
}
else
{
this.ClaimNode(null, this.tr.position, false);
}
this.SetMoveFollowPosition(this.slideNodePosition);
this.slideNode = null;
this.slideNodePosition = Vector3.zero;
this.movingOutOfWay = false;
if (this.lookTarget)
{
this.lookTargetTime = Time.timeSinceLevelLoad;
}
if (this.hasActions && !this.body.IsHit() && this.timelineIcon && !this.mainSelected && this.timelineIcon.Nothing())
{
this.actions.CheckIfRunningAI();
this.actions.EndTurn(true);
}
}
else if (this.slideNode != null && this.tr.position != this.vectorZero)
{
if (this.isHit)
{
this.ttime += Time.deltaTime * 1f;
}
else
{
this.ttime += Time.deltaTime * 2f;
}
Vector3 vector = Vector3.MoveTowards(this.tr.position, this.slideNodePosition, 12f * Time.deltaTime);
if (vector != this.tr.position && vector != this.vectorZero)
{
this.SetPosition(vector, null);
this.SetMoveFollowPosition(this.tr.position);
}
if (!this.isHit && (vector - this.tr.position).sqrMagnitude > 0.010000001f)
{
this.SetRotation(Quaternion.LookRotation(vector - this.tr.position), false, false);
}
if (this.isHitFlying)
{
this.tr.Rotate(this.randomRot * 30f * Time.deltaTime);
this.rot = this.tr.rotation;
this.smoothRot = this.tr.rotation;
}
}
else
{
this.ClaimNode(null, this.vectorZero, false);
this.slideNode = null;
this.movingOutOfWay = false;
}
}
}
if (this.jumpingAreas)
{
if (Time.timeSinceLevelLoad > this.jumpingAreasTime + 0.5f)
{
if (this.nodePath.Count > 0)
{
this.SetPosition((Vector3)this.jumpAreasNode.position, this.jumpAreasNode);
this.moveFollow.position = (Vector3)this.jumpAreasNode.position;
this.ClaimNode(this.jumpAreasNode, this.tr.position, true);
this.TurnExit();
}
else
{
this.ClaimNode(this.jumpAreasNode, this.tr.position, true);
this.SetPosition((Vector3)this.jumpAreasNode.position, this.jumpAreasNode);
}
if (this.jumpAreasNode.GraphIndex == 0U)
{
this.indoorID = "";
this.desiredGraph = 0;
}
else
{
this.indoorID = Links.x.diorama.GetIndoorView().GetInteriorBoundsName((Vector3)this.jumpAreasNode.position);
this.desiredGraph = 1;
}
Links.x.sensory.UpdateCharactersIntExt(true);
this.ChangeTorchLight();
this.body.SetMagicaClothState(false);
this.body.turnOnMagicaClothNextFrame = 3;
this.jumpingAreas = false;
this.slideNode = null;
this.tempStop = false;
if (this.animID != 0)
{
this.PlayIdle();
}
}
else
{
this.savedPathTarget = this.jumpAreasNode;
if (this.sphere)
{
this.sphere.transform.position = (Vector3)this.jumpAreasNode.position;
}
this.SetPosition((Vector3)this.jumpAreasNode.position, this.jumpAreasNode);
this.moveFollow.position = (Vector3)this.jumpAreasNode.position;
}
}
if (Time.timeSinceLevelLoad > this.movingOutOfWayTime + 8f)
{
this.movingOutOfWayTime = 0f;
this.movingOutOfWay = false;
}
if (this.attentionTime > 0f && Time.timeSinceLevelLoad > this.attentionTime + 0.25f)
{
if (this.attentionCount < 4)
{
this.attentionTime = Time.timeSinceLevelLoad;
}
else
{
this.attentionTime = 0f;
this.attentionCount = 0;
}
this.attentionCount++;
if (this.attentionCount % 2 != 0)
{
if (!this.hovering)
{
this.body.Hover(false, true);
}
}
else
{
this.body.Hover(true, true);
}
}
this.updateCount--;
if (this.lookTargetTime > 0f && Time.timeSinceLevelLoad > this.lookTargetTime + 2f)
{
if (this.lookTarget && !this.boatNavigator && !this.moving && !this.physicsMove && !this.inAction && !this.inQueuedAbility && !this.inRecovery)
{
if (this.lookTarget.tr.position != this.tr.position)
{
this.SetRotation(Quaternion.LookRotation(this.lookTarget.tr.position - this.tr.position), false, false);
}
this.lookTarget = null;
this.lookTargetTime = 0f;
}
else
{
this.lookTarget = null;
this.lookTargetTime = 0f;
}
}
if (this.attackTargetTime > 0f)
{
if (Links.x.gameplay.seconds > this.attackTargetTime || !this.inAction)
{
this.attackTargetTime = 0f;
this.attackTarget = null;
}
else
{
this.SetRotation(Quaternion.LookRotation(this.attackTarget.tr.position - this.tr.position), false, true);
}
}
if (!this.hasActions && !this.movingOutOfWay && !this.jumpingAreas && !this.jumpingPosition && !this.mainSelected && !Records.x.removeControls && !Records.x.inMenus && Links.x.main.moving && !Links.x.main.body.sneaking && !this.body.sneaking)
{
float sqrMagnitude3 = (Links.x.main.tr.position - this.tr.position).sqrMagnitude;
if (sqrMagnitude3 < 1f && !this.isBoro)
{
Links.x.main.Collide(this, false);
}
else if (sqrMagnitude3 < 12.25f && (this.isBoro || this.npc) && this.hostility < 2 && !this.attackingUntilBribe && !this.fleeing && Links.x.main.physicsMove && !this.resting)
{
Vector3 vector2 = Vector3.Normalize(Links.x.main.tr.forward);
Vector3 vector3 = Vector3.Normalize(this.tr.position - Links.x.main.tr.position);
if (Vector3.Dot(vector2, vector3) > 0f)
{
if (this.collidedTime == 0f)
{
this.collidedTime = Time.timeSinceLevelLoad + 4f;
}
else if (Time.timeSinceLevelLoad > this.collidedTime && !this.movingOutOfWay)
{
Links.x.main.Collide(this, false);
if (this.movingOutOfWayTime > 0f && !this.stats.animal && this.quip == null && !this.stats.xmlName.Contains("Fairy"))
{
if (this.stats.xmlName.Contains("Dryad"))
{
int num10 = Random.Range(0, 5);
if (num10 == 0)
{
this.StartQuip("I will pass");
}
if (num10 == 1)
{
this.StartQuip("You are here");
}
if (num10 == 2)
{
this.StartQuip("Vol knows your step");
}
if (num10 == 3)
{
this.StartQuip("Be gentle");
}
if (num10 == 4)
{
this.StartQuip("I am in the path");
}
}
else
{
int num11 = Random.Range(0, 5);
if (num11 == 0)
{
this.StartQuip("Excuse me");
}
if (num11 == 1)
{
this.StartQuip("Am I in your way?");
}
if (num11 == 2)
{
this.StartQuip("Did you need somewhat?");
}
if (num11 == 3)
{
this.StartQuip("Pardon me");
}
if (num11 == 4)
{
this.StartQuip("I'll let you pass");
}
}
}
}
}
}
if (this.stats.hasNonCombatAI && this.stats.nonCombatAI == "Shy" && this.visible == 1)
{
if (sqrMagnitude3 < 64f)
{
if (!this.fleeing)
{
if (this.stats.xmlName.Contains("Fairy"))
{
this.ignoreNodeIDs = true;
}
this.Flee(Links.x.main.node, false, Links.x.gameplay.seconds, 100f);
}
}
else if (this.stats.xmlName.Contains("Fairy") && sqrMagnitude3 > 100f)
{
this.ignoreNodeIDs = false;
}
}
}
if (this.collidedTime > 0f && Time.timeSinceLevelLoad > this.collidedTime + 3f)
{
this.collidedTime = 0f;
}
if (this.updateCount <= 0)
{
if (!this.outsideBounds && !this.stuckInPlace && !this.moving && !this.dead && !this.stunned)
{
if (this.node == null && Links.x.gaia.sceneLoaded)
{
this.FindCurrentNode(this.inCombat);
}
else
{
this.CheckInTile();
}
}
if (!this.npc || this.node == null || this.sleeping || this.resting)
{
this.updateCount = Random.Range(10, 30);
if (this.resting && this.hasActions)
{
this.updateCount = Random.Range(2, 6);
}
}
else
{
this.updateCount = Random.Range(100, 300);
}
if ((this.resting || this.sleeping) && this.visible == 1 && !this.inactive && (this.body.currentHash == this.body.idleHash || this.body.currentHash == this.body.combatIdleHash))
{
this.animID = 0;
if (this.inCircle && !this.sleeping)
{
this.PlayAnimation("Fatigued", 0f);
}
else
{
this.PlayAnimation("Hit Down", 0f);
}
}
if (!this.dead && (!this.stunned || (this.stunned && this.party)) && ((this.stunned && this.party) || this.downed || (!this.hasActions && this.resting)) && this.body.currentHash != this.body.hitDownHash)
{
this.PlayAnimation("Hit Down", 0f);
}
if (this.party)
{
this.CheckInTown();
}
if (this.sleeping || this.resting || this.stunned || this.dead || this.downed)
{
this.PlayFaceAnimation(FaceAnimations.AnimationNames.Sleep);
}
if (this.isBoro && !this.sailing && Random.Range(0, 100) == 0 && !Records.x.InCombat(false) && this.waitingForPath == 0 && !this.moving && !this.justMoved && !this.movingOutOfWay)
{
this.MakePath(Links.x.main.node, 3, false, true, false);
}
}
if (this.party && (this.moving || this.physicsMove))
{
this.CheckInTown();
}
if (this.summoned)
{
if (this.animator.speed > 1f && !this.IsWalking() && this.animID != 1)
{
this.SetAnimatorSpeed(1f);
}
if (this.missingTime > 0f)
{
if (Time.timeSinceLevelLoad > this.missingTime + 5f && !Records.x.pocketPause)
{
this.SetMeshState(false);
}
if (Time.timeSinceLevelLoad > this.missingTime + 7f && !Records.x.pocketPause && this.visible == 0)
{
this.Missing();
return;
}
}
}
if (!this.CheckControls() || Records.x.dialogue)
{
if (!this.currentlyInDialogue)
{
this.currentlyInDialogue = true;
if (!this.ignoreRemoveControls && Records.x.dialogue && this.nodePath.Count > 0 && !this.fleeing)
{
this.EndPath();
}
}
}
else if (this.currentlyInDialogue)
{
this.currentlyInDialogue = false;
if (this.circleTr && !this.isBoro && !this.stunned && this.usingCircles)
{
this.circle.SetActive(true);
}
if (this.npc && this.ghost && this.hostility == 0)
{
this.circle.SetActive(false);
}
this.GetPatrolHoldTime(true);
}
if (this.npc)
{
if (this.visible == 0)
{
if (!this.inactive && !this.missing && !this.fleeing && !this.dead && this.usingCircles && this.circle.activeSelf)
{
this.circle.SetActive(false);
}
}
else if (!this.inactive && !this.dead && !this.stats.dead && !this.stunned && this.usingCircles && !this.circle.activeSelf && (!this.npc || !this.ghost || this.hostility != 0))
{
this.circle.SetActive(true);
}
}
if (Time.realtimeSinceStartup > this.currentEffectTime + 0.75f && !this.dead)
{
this.RotateEffects();
}
if (this.body.dodgeTime > 0f && Time.timeSinceLevelLoad > this.body.dodgeTime + 0.3f)
{
this.body.dodgeTime = 0f;
this.body.Dodge(false);
}
if (this.quipStartTime > -1f && this.quip && Time.time > this.quipStartTime + 5f)
{
this.quip.End();
this.quip = null;
this.quipStartTime = -1f;
}
if (this.blockedTime > 0f)
{
this.blocked = true;
}
else
{
this.blocked = false;
}
if (Time.timeSinceLevelLoad > this.updateTime + 5f && !this.dayNightVanishing && !this.alwaysOn)
{
this.updateTime = Time.timeSinceLevelLoad + Random.Range(0f, 5f);
if ((this.stats.animal || this.stats.soundID > 0) && ((this.summoned && Random.Range(0, 20) == 0) || (!this.summoned && Random.Range(0, 2) == 0)) && !Records.x.paused && !Records.x.pocketPause && !this.sleeping && !this.resting && !Records.x.InCombat(false))
{
this.PlaySoundFX(0, 6);
}
}
if ((!this.npc || (this.npc && this.inCombat && this.IsSentient())) && !this.stats.pinned && !this.stats.pinning)
{
float num12 = 50f;
if (!this.npc)
{
num12 = 7f;
}
if (Links.x.gameplay.seconds > this.fatigueUpdateTime + num12)
{
this.fatigueUpdateTime = Links.x.gameplay.seconds;
if (this.npc)
{
this.stats.AddStamina(1f);
}
else
{
this.stats.AddStamina(1f);
}
}
}
if (this.DoPatrolRotate() && true && (Time.timeSinceLevelLoad > this.patrolHoldTime || this.alwaysLookAtParty))
{
this.PatrolRotate();
}
if (this.pocketPaused && !this.pocketPausedOverride && !Records.x.pocketPause)
{
this.pocketPaused = false;
if (this.blockedTime == 0f && this.prePausedSpeed < 0.1f)
{
this.prePausedSpeed = 1f;
}
this.SetAnimatorSpeed(this.prePausedSpeed);
}
this.UpdateRotation();
if (this.ambushing)
{
this.jumpingPosition = false;
}
if (this.jumpingPosition)
{
if (Time.timeSinceLevelLoad > this.jumpPositionTime + 0.5f)
{
this.jumpPositionTime = 0f;
this.jumpingPosition = false;
if (this.party)
{
this.animator.enabled = true;
}
this.ClaimNode(this.node, this.tr.position, false);
if (this.party && !this.mainSelected && Links.x.gaia.sceneLoaded && this.makePathAfterJump && Records.x.InCombat(false) && Links.x.main.node != null)
{
this.setArea = (int)Links.x.main.node.Area;
this.MakePath(Links.x.main.node, 3, false, true, true);
}
this.makePathAfterJump = false;
}
else
{
this.TargetReached();
this.ClearPathUpdates();
this.SetPosition(this.jumpPositionVector, null);
this.ClaimNode(this.node, this.tr.position, false);
if (this.party && this.cc)
{
this.cc.enabled = false;
this.cc.transform.position = this.tr.position;
this.cc.transform.rotation = this.tr.rotation;
this.cc.enabled = true;
this.cc.enabled = false;
}
}
}
if (this.party)
{
bool flag5 = false;
if (this.mainSelected && (Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Left")) || Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Right")) || Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Up")) || Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Down"))))
{
flag5 = true;
}
if (this.mainSelected && !Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Commands")) && !this.inAction && !this.turning && !this.jumping && this.slideNode == null && !this.charging && ((Links.x.joy && !Records.x.pocketPause) || (Links.x.pathfind && !Links.x.gameplay.makeCircleMode && Input.GetMouseButton(0) && Links.x.mk && !Links.x.gameplay.ClickingOnInteractable() && !Input.GetMouseButtonDown(0) && (this.waitingForPath == 0 || Links.x.gameplay.holdingMouseButton)) || (Links.x.mk && flag5)))
{
if (this.stats.Stuck() == 0 && this.stats.Confuse() == 0)
{
Vector3 one = Vector3.one;
Quaternion quaternion = this.rot;
bool flag6 = this.physicsMove;
this.movingAreas = false;
this.physicsMove = Links.x.fellowship.GetDirection(this, out quaternion, out one);
if (Links.x.combat.attackingInteractiveOutsideOfCombat && !Records.x.InCombat(false))
{
Links.x.hudControl.ToggleAttackTimer(false);
Links.x.combat.attackingInteractiveOutsideOfCombat = false;
Links.x.combat.npcsInCombat = false;
}
if (this.physicsMove && (!this.CanPhysicsMove(flag5) || this.sailing || this.jumpingPosition))
{
this.ClaimNode(this.node, this.tr.position, false);
this.physicsMove = false;
}
if (this.physicsMove)
{
if (this.dodging)
{
this.EndDodge();
}
bool flag7 = false;
if (Input.GetMouseButton(0) && Links.x.pathfind && Links.x.gameplay.hitInteractable)
{
flag7 = true;
}
if (this.stats.Stuck() > 0 || !this.IsSentient() || this.downed || this.dodging || this.body.currentHash == this.body.useHash || this.body.currentHash == this.body.kickHash || ((this.animID == 25 || this.animID == 26) && this.animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 0.25f) || flag7)
{
this.physicsMove = false;
}
if (((Links.x.mk && ((Input.GetMouseButtonDown(0) && Links.x.pathfind) || (flag5 && !flag6))) || (Links.x.joy && this.prevMoveSpeed == Vector3.zero)) && this.stats.Overburdened())
{
this.StartQuip("I'm overburdened");
}
if (flag5 && Links.x.gameplay.makeCircleMode)
{
Links.x.gameplay.EndCircleMode();
}
}
else if (this.turningMain)
{
this.EndTurning(false);
this.turningMain = false;
}
this.prevMoveSpeed = one;
if (this.physicsMove)
{
if (this.previouslyMovingStartTime == 0f && !flag6)
{
this.previouslyMovingStartTime = Time.timeSinceLevelLoad;
}
if (this.previouslyMovingStartTime > 0f && Time.timeSinceLevelLoad > this.previouslyMovingStartTime + 0.05f)
{
this.previouslyMovingStartTime = 0f;
}
if (this.waypoint && this.waypoint.transform.position.x != Links.x.gameplay.farPosition.x)
{
this.waypoint.transform.position = Links.x.gameplay.farPosition;
if (this.waypointAnimator.enabled)
{
this.waypointAnimator.enabled = false;
}
}
if (!flag6 && (Links.x.gameplay.holdingMouseButton || flag5))
{
this.ClearMoveTargets();
}
if ((this.nodePath.Count > 0 || (flag5 && !flag6)) && (Links.x.gameplay.holdingMouseButton || (flag5 && !flag6)))
{
this.nodePath.Clear();
this.nodeActions.Clear();
this.vectorPath.Clear();
this.justMoved = true;
this.timeSinceLastMove = Time.timeSinceLevelLoad;
this.moving = false;
this.moveNode = null;
this.movePoint = this.vectorZero;
this.waitingForNewPath = true;
this.waitingForPath = 0;
this.waitingForNewPathTime = 0f;
this.tempStop = false;
this.blockedTime = 0f;
}
if (!Records.x.pocketPause && Records.x.combat && Links.x.combat.GetNPCCountHostile() == 0 && !Links.x.combat.npcOnlyCombat && this.attackTime >= 1f)
{
Links.x.combat.EndCombat(false);
}
if (this.actions && this.actions.hasTarget)
{
this.actions.ClearSelectedActionRealTime();
}
this.groundPoint = this.tr.position;
Quaternion quaternion2 = Quaternion.Slerp(this.tr.rotation, quaternion, Time.fixedDeltaTime * 40f);
this.rot = quaternion;
this.tr.position + quaternion2 * Vector3.forward * 1f;
RaycastHit raycastHit4;
if (Physics.SphereCast(this.tr.position + quaternion2 * Vector3.forward * 0.5f + new Vector3(0f, 10f, 0f), 0.25f, -1f * this.upVector, out raycastHit4, 100f, 4194433))
{
this.groundPoint = raycastHit4.point;
}
else
{
this.groundPoint = this.tr.position + quaternion2 * Vector3.forward * 0.5f;
}
if (this.node != null)
{
this.setArea = (int)this.node.Area;
}
GraphNode graphNode2 = this.NearNode(this.groundPoint, false, 0, 2, 0);
if (!this.sailing)
{
Vector3 position = this.tr.position;
if (Physics.SphereCast(this.tr.position + new Vector3(0f, 10f, 0f), 0.25f, -1f * this.upVector, out raycastHit4, 100f, 4194433))
{
Vector3 point = raycastHit4.point;
}
if (Physics.SphereCast(this.tr.position + quaternion2 * Vector3.forward * 1f + new Vector3(0f, 10f, 0f), 0.25f, -1f * this.upVector, out raycastHit4, 100f, 4194433))
{
this.groundPoint = raycastHit4.point;
}
}
Vector3 vector4 = Vector3.Normalize(this.body.tr.forward);
Vector3 vector5 = Vector3.Normalize(this.tr.position + quaternion * Vector3.forward * 5f - this.tr.position);
Vector3.Dot(vector4, vector5);
bool flag8 = this.moving;
float num13 = Quaternion.Angle(quaternion, this.body.tr.rotation);
bool flag9 = false;
if (flag9 && ((this.turning && num13 > 45f) || (flag9 && this.body.currentHash != this.body.walkEndHash && this.body.currentHash != this.body.combatWalkEndHash && this.body.currentHash != this.body.creepEndHash && num13 > 140f)))
{
this.turningMain = true;
}
else
{
if (this.turningMain)
{
this.RotateToChild();
this.turningMain = false;
}
if (this.turning)
{
this.EndTurning(false);
}
this.smoothRot = this.tr.rotation;
this.rot = this.tr.rotation;
}
float num14 = 5f;
if (!this.turningMain && !this.turning)
{
this.moving = true;
if (this.dodging)
{
this.EndDodge();
}
this.SetAnimatorSpeed(1f);
if (this.waitingForPath == 0)
{
this.sphere.transform.position = this.tr.position;
if (graphNode2 != this.node && graphNode2 != null)
{
this.savedPathTarget = graphNode2;
this.ClaimNode(graphNode2, (Vector3)graphNode2.position, false);
Links.x.gameplay.CheckTileEffects(this, this.node, false);
this.mainMovePoint = (Vector3)graphNode2.position;
this.DoFootsteps();
}
else
{
this.ClaimNode(this.node, this.tr.position, false);
}
}
if (Physics.SphereCast(this.groundPoint + new Vector3(0f, 10f, 0f), 0.25f, -1f * this.upVector, out raycastHit4, 100f, 4194433))
{
this.groundPoint = raycastHit4.point;
}
if (this.animID != 1)
{
this.PlayAnimation("Walk", 0f);
}
if (this.groundPoint != Vector3.zero)
{
if (!this.cc)
{
this.AddCC();
}
if (!this.cc.enabled)
{
this.cc.enabled = true;
this.cc.transform.position = this.tr.position;
this.cc.transform.rotation = this.tr.rotation;
}
if (!this.playerBorders.enabled)
{
this.playerBorders.enabled = true;
}
Collider firstCollider = this.body.GetFirstCollider();
if (firstCollider && firstCollider.enabled)
{
this.body.SeeThroughColliders(false);
}
if ((Vector3)this.node.position != this.tr.position)
{
Vector3 vector6 = Quaternion.LookRotation(this.groundPoint - this.tr.position) * Vector3.forward * num14 * Time.deltaTime;
if (Records.x.pocketPause && !this.pocketPaused)
{
num14 = 8f;
}
this.physicsY = vector6;
if (one == Vector3.zero)
{
this.physicsY = Vector3.zero;
}
}
if (this.animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 0.5f)
{
this.animator.SetFloat("Walk End", 1f);
}
else
{
this.animator.SetFloat("Walk End", 0f);
}
}
}
if (flag8 && !this.turningMain)
{
Quaternion quaternion3 = quaternion2;
if (this.tr.position != this.lastFrame)
{
quaternion3 = Quaternion.LookRotation(this.tr.position - this.lastFrame);
}
Vector3 eulerAngles = quaternion3.eulerAngles;
eulerAngles.x = 0f;
eulerAngles.z = 0f;
if (this.nodePath.Count > 0)
{
quaternion3 = Quaternion.Slerp(this.tr.rotation, quaternion2, Time.deltaTime * 50f);
}
else
{
quaternion3 = Quaternion.Slerp(this.tr.rotation, quaternion2, Time.deltaTime * 20f);
}
float num15 = Vector3.Dot(quaternion2 * Vector3.forward, Quaternion.Euler(eulerAngles) * Vector3.forward);
LayerMask layerMask = 70400;
float num16 = 1f;
Vector3 vector7 = new Vector3(0f, 1.25f, 0f);
bool flag10 = Physics.Raycast(this.tr.position + vector7 + this.tr.right * 0.5f, quaternion2 * Vector3.forward, num16, layerMask);
if (!flag10)
{
flag10 = Physics.Raycast(this.tr.position + vector7 + this.tr.right * -0.5f, quaternion2 * Vector3.forward, num16, layerMask);
}
if (!flag10)
{
flag10 = Physics.Raycast(this.tr.position + vector7, quaternion2 * Vector3.forward, num16, layerMask);
}
if (this.previouslyMovingStartTime == 0f)
{
if (this.cc.velocity.magnitude > 0.1f && flag10 && num15 > -0.25f && this.nodePath.Count == 0)
{
this.tr.rotation = Quaternion.Slerp(this.tr.rotation, Quaternion.Euler(eulerAngles), Time.deltaTime * 10f);
}
else
{
this.tr.rotation = quaternion3;
}
}
if (Physics.SphereCast(this.tr.position + this.tr.forward * 2f + new Vector3(0f, 10f, 0f), 0.25f, -1f * this.upVector, out raycastHit4, 100f, 4194305))
{
Vector3 vector8 = Quaternion.LookRotation(raycastHit4.point - this.tr.position) * Vector3.forward * num14 * Time.deltaTime;
this.physicsY = vector8;
if (one == Vector3.zero)
{
this.physicsY = Vector3.zero;
}
}
if (Time.timeSinceLevelLoad > this.lastFrameTime + 0.3f || this.lastFrame == Vector3.zero)
{
this.lastFrame = this.tr.position;
this.lastFrameTime = Time.timeSinceLevelLoad;
}
}
if (!Records.x.InCombat(false) && this.mainSelected)
{
Character character = null;
RaycastHit raycastHit5;
if (Physics.Raycast(this.tr.position + new Vector3(0f, 1.5f, 0f), this.tr.forward, out raycastHit5, 1.5f, 64))
{
Character character2 = raycastHit5.collider.gameObject.GetComponent<Character>();
if (character2)
{
if (!character2.npc && Links.x.fellowship.NearCompanionNode(character2) && raycastHit5.distance > 4f)
{
character2 = null;
}
if (character2 && character2 != character && (!character2.npc || character2.vipFollow) && character2 != this && !character2.isBoro)
{
character = character2;
if (this.party)
{
this.lookTarget = Links.x.main;
}
this.Collide(character2, false);
}
}
}
float num17 = 4f;
if (Records.x.circle)
{
num17 = 2f;
}
if (Physics.SphereCast(this.tr.position + new Vector3(0f, 1.5f, 0f), 2f, quaternion * Vector3.forward, out raycastHit5, num17, 64))
{
Character character3 = raycastHit5.collider.gameObject.GetComponent<Character>();
if (character3)
{
if (!character3.npc && Links.x.fellowship.NearCompanionNode(character3) && raycastHit5.distance > 4f)
{
character3 = null;
}
if (character3 && character3 != character && (!character3.npc || character3.vipFollow) && character3 != this)
{
if (this.party)
{
this.lookTarget = Links.x.main;
}
if (!character3.isBoro)
{
this.Collide(character3, false);
}
}
}
}
}
this.moveFollow.position = this.tr.position;
this.lastRotation = quaternion2;
}
else if (!Records.x.removeControls && this.IsWalking())
{
this.justMoved = true;
this.timeSinceLastMove = Time.timeSinceLevelLoad;
this.StopMove();
}
}
else if (this.IsWalking() && this.nodePath.Count == 0)
{
this.justMoved = true;
this.timeSinceLastMove = Time.timeSinceLevelLoad;
this.StopMove();
}
}
else if (this.party)
{
this.physicsMove = false;
if (this.cc && this.cc.enabled && !this.mainSelected)
{
this.cc.enabled = false;
}
}
}
if (Records.x.editor && Input.GetKeyDown(KeyCode.B) && !Records.x.typing)
{
Debug.Log(string.Concat(new string[]
{
(this != null) ? this.ToString() : null,
" ",
Records.x.pocketPause.ToString(),
" ",
this.pocketPaused.ToString(),
" ",
Records.x.removeControls.ToString(),
" ",
this.CanMove().ToString(),
" ",
this.CheckControls().ToString(),
" ",
Records.x.paused.ToString(),
" ",
Links.x.combat.inRally.ToString(),
" ",
this.IsSentient().ToString(),
" ",
this.isHit.ToString(),
" ",
this.blockedTime.ToString()
}));
}
bool flag11 = false;
if (this.mainSelected && this.actions && this.actions.ai.jumping)
{
flag11 = true;
}
if ((!Records.x.pocketPause || (Records.x.pocketPause && this.party && (this.pocketPausedOverride || !this.pocketPaused) && (flag3 || this.isHitFlying || Links.x.combat.inRally || Links.x.combat.inPocketAttack || flag11) && (!this.inAction || this.jumping) && (!this.inRecovery || this.jumping))) && (!this.isHit || this.jumping) && (this.jumping || this.IsSentient()) && !Records.x.paused && !this.physicsMove && !this.inactive)
{
if (this.waitingForPath == 3 && Time.timeSinceLevelLoad > this.waitForPathTime + 0.5f && !this.jumping)
{
this.DoPath(false);
this.waitForPathTime = Time.timeSinceLevelLoad;
}
if (this.CanMove() && !this.jumpingAreas)
{
bool flag12 = this.AllTilesFree(this.moveNode, false);
if (this.mainSelected)
{
this.playerBorders.enabled = true;
}
if (this.jumping)
{
flag12 = true;
}
if (!flag12)
{
if (this.NodeBlocked(this.moveNode, null))
{
flag12 = true;
}
if (this.fleeing && this.hostility == 1)
{
flag12 = true;
}
if (this.jumping && this.ignoreRemoveControls)
{
flag12 = true;
}
if (this.jumping)
{
flag12 = true;
}
if (this.sailing && this.boatNavigator && this.boat.turning)
{
flag12 = true;
}
if (this.ghostVanishing || this.ambushing)
{
flag12 = true;
}
if (Records.x.pocketPause && this.pocketPausedOverride && this.party)
{
flag12 = true;
}
}
if (this.blockedTime > 0f && flag12)
{
this.tempStop = false;
this.blocked = false;
this.blockedTime = 0f;
this.animID = 0;
if (Records.x.astarDebugging)
{
Debug.Log("Remove blocked time " + ((this != null) ? this.ToString() : null));
}
}
else if (this.blockedTime > 0.2f && !flag12 && !this.jumping)
{
if (!this.boatNavigator)
{
this.SetIdle(true);
}
this.SetAnimatorSpeed(1f);
}
if (Records.x.editor && Input.GetKeyDown(KeyCode.B))
{
string[] array = new string[7];
array[0] = ((this != null) ? this.ToString() : null);
array[1] = " ";
array[2] = flag12.ToString();
array[3] = " ";
int num18 = 4;
GraphNode graphNode3 = this.moveNode;
array[num18] = ((graphNode3 != null) ? graphNode3.ToString() : null);
array[5] = " ";
array[6] = this.AllTilesFree(this.moveNode, false).ToString();
Debug.Log(string.Concat(array));
}
if (this.moveBackward)
{
if (!this.moveBackTarget)
{
this.animator.SetBool("Backward", false);
this.moveBackward = false;
}
else if (!this.animator.GetBool("Backward"))
{
this.animator.SetBool("Backward", true);
}
}
else if (this.moveBackTarget)
{
this.animator.SetBool("Backward", true);
this.moveBackward = true;
}
if (flag12 && (this.moveNode != null || (this.jumping && this.mainSelected)))
{
this.moving = true;
if (this.dodging && !this.evading)
{
this.EndDodge();
}
if (this.waitingForNewPath && Time.timeSinceLevelLoad > this.waitingForNewPathTime + 2f)
{
this.waitingForNewPath = false;
}
if (this.boatNavigator)
{
if (this.boat.node != this.moveNode && !this.boat.turning)
{
this.SetMoveNode();
}
}
else if (this.node != this.moveNode && this.moveNode != null)
{
this.SetMoveNode();
}
this.SetAnimatorSpeed(1f);
float num19 = (this.animator.deltaPosition / Time.deltaTime).magnitude * Time.deltaTime;
this.moveFollowTime += num19;
Transform transform = this.tr;
Transform transform2 = this.moveFollow;
if (this.boatNavigator)
{
transform = this.boat.tr;
transform2 = this.boat.moveFollow;
}
this.totalDist = Vector3.Distance(transform.position, this.movePoint);
this.totalDistNodes = Vector3.Distance(transform2.position, this.movePoint);
float num20 = this.totalDistNodes / this.totalDist;
int shortNameHash = this.body.stateInfo.shortNameHash;
if ((shortNameHash == this.body.walkHash || shortNameHash == this.body.walkStartHash || shortNameHash == this.body.walkEndHash || shortNameHash == this.body.combatWalkHash || shortNameHash == this.body.walkPartyHash || shortNameHash == this.body.combatWalkStartHash || shortNameHash == this.body.combatWalkEndHash || shortNameHash == this.body.creepHash || shortNameHash == this.body.creepStartHash || shortNameHash == this.body.runStartHash || shortNameHash == this.body.runHash || shortNameHash == this.body.runEndHash || shortNameHash == this.body.walkBackHash || shortNameHash == this.body.walkBackStartHash || shortNameHash == this.body.walkBackEndHash) && !float.IsNaN(num19))
{
Vector3 vector9 = Vector3.MoveTowards(transform2.position, new Vector3(this.movePoint.x, transform.position.y, this.movePoint.z), num19 * num20);
this.SetMoveFollowPosition(vector9);
}
float sqrMagnitude4 = (transform.position - new Vector3(this.movePoint.x, transform.position.y, this.movePoint.z)).sqrMagnitude;
float sqrMagnitude5 = (transform2.position - new Vector3(this.movePoint.x, transform2.position.y, this.movePoint.z)).sqrMagnitude;
if (float.IsNaN(num19))
{
this.SetAnimatorSpeed(1E-06f);
}
else
{
this.SetAnimatorSpeed(1f);
if (this.jumping && !this.charging)
{
this.Jumping();
}
else if (this.boatNavigator && this.sailing)
{
this.boat.movePoint = this.movePoint;
if (this.boat.closeToPoint && !this.boat.turning)
{
this.TurnExit();
}
}
else if (this.nodePath.Count <= 1 && (this.npc || this.mainSelected || this.hasActions))
{
float num21 = 2.5f;
Vector3 vector10 = Vector3.MoveTowards(transform.position, this.movePoint, num19);
this.SetPosition(vector10, null);
if ((transform.position.x == this.movePoint.x && transform.position.z == this.movePoint.z) || sqrMagnitude4 < 0.0625f || sqrMagnitude4 > this.totalDist * num21 * (this.totalDist * num21) || sqrMagnitude5 > this.totalDist * num21 * (this.totalDist * num21))
{
if (this.animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 0.5f)
{
this.animator.SetFloat("Walk End", 1f);
}
else
{
this.animator.SetFloat("Walk End", 0f);
}
if (this.charging)
{
this.jumping = false;
}
this.TurnExit();
}
else
{
if ((this.animID != this.moveAnimID || (Random.Range(0, 10) == 0 && !this.IsWalking())) && this.animID != 23 && !this.boatNavigator)
{
this.PlayAnimation("Walk", 0f);
}
if (sqrMagnitude4 <= 0.040000003f)
{
this.turningComplete = true;
}
if (sqrMagnitude4 > 0.040000003f && !this.turningComplete)
{
if (!this.boatNavigator)
{
this.GetLook(false);
}
if (this.usingKeys)
{
if (sqrMagnitude5 > 0.01f)
{
this.SetRotation(this.look, false, false);
}
}
else
{
this.SetRotation(this.look, false, false);
}
}
}
}
else
{
if ((this.animID != this.moveAnimID || (Random.Range(0, 10) == 0 && !this.IsWalking())) && this.animID != 23)
{
this.PlayAnimation("Walk", 0f);
}
if (sqrMagnitude4 <= 0.040000003f)
{
this.turningComplete = true;
}
if (sqrMagnitude4 > 0.040000003f && !this.turningComplete)
{
this.GetLook(this.mainSelected);
if (this.animID == this.moveAnimID)
{
this.SetRotation(this.look, false, false);
}
}
if ((transform2.position.x == this.movePoint.x && transform2.position.z == this.movePoint.z) || sqrMagnitude5 < 0.010000001f || sqrMagnitude4 > this.totalDist * 1.5f * (this.totalDist * 1.5f) || sqrMagnitude5 > this.totalDist * 1.5f * (this.totalDist * 1.5f))
{
this.TurnExit();
}
}
}
}
}
else
{
if (this.moving)
{
this.justMoved = true;
this.timeSinceLastMove = Time.timeSinceLevelLoad;
}
this.moving = false;
if (!this.turning && (this.IsWalking() || this.IsMoveAnim()) && !this.dead && !this.stunned && ((this.waitingForNewPath && this.animator.speed > 0.1f && this.NodesCount() == 0) || !this.waitingForNewPath) && this.waitingForPath == 0 && this.slideNode == null && !this.jumpingAreas)
{
if (!this.boatNavigator)
{
this.SetIdle(true);
}
this.waitingForNewPath = false;
}
if (this.waitingForNewPath && !this.turning && this.slideNode == null && !this.jumpingAreas)
{
if (Time.timeSinceLevelLoad > this.waitingForNewPathTime + 0.2f && this.waitingForNewPathTime > 0f)
{
if (!this.boatNavigator)
{
this.SetIdle(true);
}
this.SetAnimatorSpeed(1f);
this.waitingForNewPath = false;
this.waitingForNewPathTime = 0f;
}
else if (this.IsWalking())
{
this.SetAnimatorSpeed(0.0001f);
}
}
if (this.waitForPathToCharacter && ((Records.x.turnBased && !this.doingAction) || !Records.x.turnBased) && this.slideNode == null)
{
if (this.inCombat && !this.CanChooseActions())
{
this.ClearMoveTargets();
this.waitForPathToCharacter = false;
}
if (this.followingType != "")
{
if (Records.x.astarDebugging)
{
Debug.Log(((this != null) ? this.ToString() : null) + " prepping path from wait, delayPathCoroutine in use");
}
bool flag13 = Links.x.gameplay.CanScatterPartyToMakePath(this.followingType);
if (this.npc || this.hasActions)
{
flag13 = false;
}
this.StartGetPathToTarget(this.followingNode, this.followingCharacter, this.followingItem, this.followingBreakable, this.followingChest, this.followingDoor, this.followingInteractive, this.followingBoat, this, this.followingExit, flag13, false, false, this.followingType, false);
this.waitForPathToCharacter = false;
}
}
if (this.returnToPointTime > 0f && this.slideNode == null && this.body.currentHash == this.body.idleHash && Time.timeSinceLevelLoad > this.returnToPointTime + 2f && Time.timeSinceLevelLoad < this.returnToPointTime + 6f)
{
this.MakePath(this.returnToPoint, 20, false, false, false);
this.returnToPoint = null;
this.returnToPointTime = 0f;
}
if (this.animID == 1 && !this.IsWalking() && (this.body.currentHash == this.body.idleHash || this.body.currentHash == this.body.combatIdleHash))
{
this.animID = 0;
}
}
}
else
{
if (!this.physicsMove)
{
if (this.moving)
{
this.justMoved = true;
this.timeSinceLastMove = Time.timeSinceLevelLoad;
}
this.moving = false;
this.waitingForNewPath = false;
if (this.IsWalking() && !this.dead && !this.stunned && !this.waitingForNewPath && !this.turning && !this.boatNavigator)
{
this.SetIdle(true);
}
}
if (!this.moving && this.movePoint == Vector3.zero && this.IsWalking())
{
this.SetIdle(true);
}
}
if (this.justMoved && Time.timeSinceLevelLoad > this.timeSinceLastMove + 0.5f)
{
this.justMoved = false;
}
if (this.pickupTime > 0f && Time.timeSinceLevelLoad > this.pickupTime + 5f)
{
this.pickupTime = 0f;
}
if (this.party && this.mapIcon)
{
this.mapIcon.transform.position = this.tr.position;
}
if (!this.moving && this.node != null && !this.turning && this.slideNode == null && !this.sailing && !Records.x.paused && this.moveFollow)
{
float sqrMagnitude6 = (this.moveFollow.position - this.NodePosition()).sqrMagnitude;
float sqrMagnitude7 = (this.tr.position - this.NodePosition()).sqrMagnitude;
if (sqrMagnitude6 > 0.25f && sqrMagnitude6 < 100f && sqrMagnitude7 < 4f)
{
this.SetMoveFollowPosition(Vector3.Lerp(this.moveFollow.position, this.NodePosition(), Time.deltaTime * 8f));
}
}
if (this.sailing)
{
Vector3 position2 = this.tr.position;
position2.y = this.nodePoint.y;
this.SetMoveFollowPosition(Vector3.Lerp(this.moveFollow.position, position2, Time.deltaTime * 8f));
}
if (this.usingCircles && this.circleTr)
{
if (this.sailing)
{
this.circleTr.position = Vector3.Lerp(this.circleTr.position, this.AddVectorY(this.tr.position, 0.05f), Time.deltaTime * 40f);
}
else
{
this.circleTr.position = Vector3.Lerp(this.circleTr.position, this.AddVectorY(this.moveFollow.position, 0.05f), Time.deltaTime * 40f);
}
}
RaycastHit raycastHit6;
if (Physics.Raycast(this.tr.position + new Vector3(0f, 3f, 0f), Vector3.up * -1f, out raycastHit6, 6f, 4194449))
{
Vector3 normal = raycastHit6.normal;
normal.y = Mathf.Clamp(normal.y, 0.97f, 1f);
this.circleRot = Quaternion.FromToRotation(Vector3.up, normal);
if (this.usingCircles)
{
this.circleTr.rotation = Quaternion.Slerp(this.circleTr.rotation, this.circleRot, Time.deltaTime * 10f);
}
if (this.party || this.visible == 1)
{
bool flag14 = false;
if (this.hasActions && this.actions.ai && (this.actions.ai.busy || this.actions.ai.jumping))
{
flag14 = true;
}
if (!this.moving && !this.physicsMove && !this.sailing && !this.jumpingAreas && !this.pocketPaused && !this.body.IsHit() && !this.jumping && !flag14 && !this.sailing && !this.movesOnWater)
{
float num22 = Mathf.Abs(this.tr.position.y - raycastHit6.point.y);
if (num22 > 0.25f && num22 < 10f)
{
this.SetPosition(Vector3.Lerp(this.tr.position, new Vector3(this.tr.position.x, raycastHit6.point.y, this.tr.position.z), Time.deltaTime * 25f), null);
}
}
}
if (!this.jumping && !this.jumpingAreas)
{
this.useGrounder = true;
if ((normal.y < 0.95f || this.mainSelected) && !this.body.grounderOn)
{
this.body.SetGrounderState(true);
}
if (!this.sailing)
{
this.terrainNormal = raycastHit6.normal;
}
}
else if (this.jumping)
{
this.useGrounder = false;
if (this.body.grounderOn)
{
this.body.SetGrounderState(false);
}
}
}
if (this.dodging)
{
if (this.moving || this.physicsMove || this.downed || this.stunned || this.sleeping || this.dead || this.inAction || this.inRecovery || this.inQueuedAbility || this.fleeing)
{
this.EndDodge();
}
if (!this.mainSelected && Links.x.gameplay.seconds > this.blockDodgeStartTime + 17f)
{
this.EndDodge();
if (this.actions && !this.inAction && !this.inRecovery && !this.inQueuedAbility && this.timelineIcon && this.timelineIcon.Nothing() && !this.actions.ai.findingAction)
{
Links.x.combat.GetNextAction(this);
}
}
}
if (this.mainSelected)
{
Links.x.partyColliderAdventure.ToggleDefend();
bool flag15 = false;
if (Links.x.mk && Input.GetKeyDown(Links.x.gameplay.keyControl.GetHotkey("DodgePathfind")))
{
flag15 = true;
}
if (Links.x.joy && !Links.x.gameplay.badgeScrolling && Links.x.gameplay.targetDodgeStart)
{
flag15 = true;
}
if (Records.x.typing || Records.x.removeControls)
{
flag15 = false;
}
if (flag15 && !this.evading && this.stats.stamina >= 10f && this.CanDefend() && !Links.x.combat.inPocketAttack && !Records.x.typing && this.slideNode == null && !this.stats.pinned && !this.stats.pinning && this.stats.Stuck() == 0)
{
if (!this.sailing && (!this.inCircle || (this.inCircle && !this.hasCircleBuff)))
{
Vector3 vector11 = this.currentPosition + Quaternion.LookRotation(this.currentPosition - Links.x.gameplay.mousePoint) * Vector3.forward * 2.5f * 1f;
this.nodeConstraint.walkable = true;
this.nodeConstraint.constrainWalkability = true;
this.nodeConstraint.constrainTags = true;
this.nodeConstraint.passID = this.nodeStationaryID;
this.nodeConstraint.passID2 = this.nodeMovingID;
this.nodeConstraint.checkCircleID = this.CheckCircleID();
this.nodeConstraint.checkConnections = this.ConnectionNumber();
this.nodeConstraint.constrainToArea = (int)this.node.Area;
int num23 = 0;
if (this.party)
{
num23 = 2;
}
GraphNode graphNode4 = this.GetSlideNode(vector11, this.node, false, this.CheckCircleID(), num23);
if (graphNode4 == null)
{
graphNode4 = this.node;
}
this.look = Quaternion.LookRotation(this.tr.position - Links.x.gameplay.mousePoint);
if (Physics.Raycast(this.torsoPosition, this.look * Vector3.forward, 2f, Links.x.allObstacles))
{
graphNode4 = null;
}
if (graphNode4 != null && this.stats.Stuck() == 0 && !this.jumping)
{
if (Records.x.pocketPause)
{
Links.x.gameplay.PocketPause(false);
}
if (this.dodging)
{
this.EndDodge();
}
if (this.moving)
{
this.ClearNodePath();
}
this.Jump(graphNode4, (Vector3)graphNode4.position, true, false);
this.evading = true;
this.stats.AddStamina(-10f);
this.blockDodgeStartTime = Links.x.gameplay.seconds;
}
}
if (!this.evading)
{
if (this.dodgeFX)
{
Links.x.cellar.ReturnPooledGameObject(91, this.dodgeFX);
this.dodgeFX.SetActive(false);
this.dodgeFX = null;
this.waitToNextDodge = 0f;
}
if (Records.x.pocketPause)
{
Links.x.gameplay.PocketPause(false);
}
this.animator.SetBool("DefendDone", false);
this.justMoved = false;
this.dodging = true;
this.stats.AddStamina(-10f);
this.PlayAnimation("Defend", 0f);
this.animator.SetBool("Dodging", true);
this.blockDodgeStartTime = Links.x.gameplay.seconds;
MasterAudio.PlaySound3DAtVector3AndForget("Main Dodge", this.tr.position, Random.Range(0.4f, 0.5f), new float?(Random.Range(0.8f, 1f)), 0f, "", null);
if (!this.dodgeFX)
{
this.dodgeFX = Links.x.cellar.GetPooledGameObject(91);
this.dodgeFX.transform.position = this.tr.position + new Vector3(0f, 0.2f, 0f);
this.dodgeFX.SetActive(true);
}
this.dodgeFX.transform.GetChild(0).gameObject.GetComponent<Animator>().enabled = true;
this.dodgeFX.transform.GetChild(0).gameObject.GetComponent<Animator>().Play("DodgeStart", -1, 0f);
this.alwaysTurn = true;
this.SetRotation(Quaternion.LookRotation(Links.x.gameplay.mousePoint - this.tr.position), false, false);
}
}
else if (flag15)
{
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(86);
pooledGameObject.transform.position = this.body.HeadPosition(0.5f);
pooledGameObject.SetActive(true);
MasterAudio.PlaySound3DAtVector3AndForget("Skills", this.tr.position, Random.Range(0.8f, 0.9f), new float?(Random.Range(0.8f, 1f)), 0f, "Fail", null);
}
if (this.dodging && Links.x.gameplay.seconds > this.blockDodgeStartTime + 7f)
{
if (Links.x.gameplay.seconds < this.blockDodgeStartTime + 12f)
{
this.dodgeFX.transform.GetChild(0).gameObject.GetComponent<Animator>().Play("DodgeOut");
}
else
{
this.EndDodge();
this.waitToNextDodge = 0f;
}
}
if ((this.evading || !this.dodging) && Time.timeSinceLevelLoad > this.waitToNextDodge && this.waitToNextDodge > 0f)
{
if (this.dodgeFX)
{
Links.x.cellar.ReturnPooledGameObject(91, this.dodgeFX);
this.dodgeFX.SetActive(false);
this.dodgeFX = null;
}
this.waitToNextDodge = 0f;
}
}
bool flag16 = false;
if ((!this.npc || (this.npc && this.inCircle)) && ((this.inCircle && !this.npc && !this.mainSelected) || (this.inCircle && this.npc)))
{
int num24 = 0;
if (this.hasActions)
{
num24 = this.actions.TargetCount() + this.actions.SpellCount();
}
if (this.actions && this.actions.ai)
{
if (this.actions.ai.findingAction)
{
flag16 = true;
}
if (this.actions.ai.busy)
{
flag16 = true;
}
}
if (!this.stats.pinned && !this.stats.pinning && num24 == 0 && !this.jumping && this.IsSentient() && !this.inAction && !this.charging && !this.fleeing && !this.physicsMove && !flag16 && this.waitingForPath == 0 && !this.moving && this.NodesCount() == 0 && this.stats.Confuse() == 0 && (this.timeSinceLastDirectiveCheck == 0f || Links.x.gameplay.seconds > this.timeSinceLastDirectiveCheck + 20f) && !Links.x.combat.inPocketAttack)
{
GraphNode graphNode5 = this.commandMove;
bool flag17 = false;
if (this.commandMove != null)
{
graphNode5 = this.commandMove;
float sqrMagnitude8 = ((Vector3)graphNode5.position - this.currentPosition).sqrMagnitude;
float sqrMagnitude9 = ((Vector3)graphNode5.position - Links.x.main.tr.position).sqrMagnitude;
if (sqrMagnitude8 < 9f || sqrMagnitude9 > 1600f)
{
this.commandMove = null;
this.timeSinceLastDirectiveCheck = 0f;
}
else if (!this.mainSelected)
{
flag17 = true;
}
}
if (this.inCircle && this.commandMove == null && !this.npc && !this.mainSelected)
{
graphNode5 = Links.x.fellowship.GetFormationPointInCircle(this);
if (graphNode5 != null && graphNode5 != this.node)
{
flag17 = true;
}
}
if (this.inCircle && this.npc && !this.group.InFormationMovement(this) && !this.group.inSwarmWait && !this.group.inSwarm)
{
graphNode5 = this.group.GetFormationPointInCircle(this, false);
if (graphNode5 != null && graphNode5 != this.node)
{
flag17 = true;
}
else if (this.group.defensive)
{
this.ignoreNodeIDs = false;
}
}
if (flag17)
{
this.timeSinceLastDirectiveCheck = Links.x.gameplay.seconds;
this.ClearPathUpdates();
this.ClearCurrentPathNodes();
if (this.dodging)
{
this.EndDodge();
}
this.pathTargPosition = (Vector3)graphNode5.position;
if (this.npc)
{
this.group.JoinCirclePath(graphNode5, this);
}
else
{
this.MakePath(graphNode5, 500, false, false, true);
}
flag16 = true;
}
else
{
this.timeSinceLastDirectiveCheck = 0f;
if (this.inCircle && !this.hasActions && !this.npc)
{
if (this.GetRotationAngle(Links.x.gameplay.circleRotation, this.rot) > 60f)
{
this.SetRotation(Links.x.gameplay.circleRotation, true, false);
}
}
else if (this.npc && !this.group.inFormationMovement && !this.group.inSwarm && this.GetRotationAngle(this.group.targetRotation, this.rot) > 40f)
{
this.SetRotation(this.group.targetRotation, true, false);
}
}
}
}
if (this.hasActions && !this.mainSelected)
{
if (this.actions && this.actions.ai)
{
if (this.actions.ai.findingAction)
{
flag16 = true;
}
if (this.actions.ai.busy || this.actions.spellWaveFX)
{
flag16 = true;
}
}
bool flag18 = true;
if (!this.stats.pinned && !this.stats.pinning && this.IsSentient() && !this.inAction && !this.inRecovery && !this.charging && !this.inQueuedAbility && !this.isHit && (flag3 || !Records.x.pocketPause) && (!this.turning || (this.turning && this.party)) && !this.fleeing && (!this.stats.animal || (this.stats.animal && this.stats.canJumpEvade)) && !flag16 && this.NodesCount() == 0 && !this.evading && !this.jumping && flag18 && this.stats.stamina >= 10f && !Links.x.combat.inPocketAttack && this.slideNode == null)
{
int num25 = 0;
if (this.combatLevel == 0)
{
num25 = 1;
}
if (this.combatLevel == 1)
{
num25 = 1;
}
if (this.combatLevel == 2)
{
num25 = Random.Range(0, 12);
}
if (this.combatLevel == 3)
{
num25 = Random.Range(0, 8);
}
if (this.combatLevel == 4)
{
num25 = Random.Range(0, 5);
}
if (this.combatLevel == 5 || this.stats.canJumpEvade)
{
num25 = Random.Range(0, 3);
}
if (this.combatLevel >= 6)
{
num25 = Random.Range(0, 2);
}
if (this.party || (!this.party && num25 == 0) || this.stats.canJumpEvade)
{
bool flag19 = false;
Character character4 = this.actions.AttackInBound(out flag19);
if (this.party && (this.tr.position - Links.x.main.tr.position).sqrMagnitude > 900f)
{
character4 = null;
if (this.dodging && this.actions.TargetCount() == 0 && this.actions.SpellCount() == 0 && !this.moving)
{
this.actions.ai.MovetoMain();
}
if (this.dodging)
{
this.EndDodge();
}
}
if (!this.sailing)
{
bool flag20 = true;
Vector3 vector12 = this.actions.ai.SpecialAttackInBound(out flag19);
if (vector12 == Vector3.zero)
{
flag20 = false;
if (character4)
{
vector12 = character4.currentPosition;
}
}
if (vector12 != Vector3.zero && this.currentPosition != vector12 && ((flag20 && Links.x.gameplay.seconds > this.timeSinceLastEvade + 5f) || this.timeSinceLastEvade == 0f || Links.x.gameplay.seconds > this.timeSinceLastEvade + 5f))
{
Quaternion quaternion4 = Quaternion.LookRotation(this.currentPosition - vector12);
float num26 = -1f;
Vector3 vector13 = this.currentPosition + quaternion4 * Vector3.forward * 2.5f * 1f;
if (flag19)
{
if (Random.Range(0, 2) == 0)
{
num26 = 1f;
}
vector13 += quaternion4 * Vector3.right * num26 * 2.5f;
}
this.nodeConstraint.walkable = true;
this.nodeConstraint.constrainWalkability = true;
this.nodeConstraint.constrainTags = true;
this.nodeConstraint.passID = this.nodeStationaryID;
this.nodeConstraint.passID2 = this.nodeMovingID;
this.nodeConstraint.checkConnections = this.ConnectionNumber();
this.nodeConstraint.constrainToArea = (int)this.node.Area;
this.nodeConstraint.checkCircleID = this.CheckCircleID();
GraphNode graphNode6 = this.GetSlideNode(vector13, this.node, true, this.CheckCircleID(), 2);
if (this.inCircle && graphNode6 != null)
{
if (this.npc)
{
if (!this.group.InCircle((Vector3)graphNode6.position, true, false, null))
{
graphNode6 = null;
}
}
else if (!Links.x.fellowship.InCircle((Vector3)graphNode6.position, true))
{
graphNode6 = null;
}
}
if (graphNode6 == null && flag19)
{
vector13 += quaternion4 * Vector3.right * num26 * -5f;
graphNode6 = this.GetSlideNode(vector13, this.node, true, this.CheckCircleID(), 2);
}
if (graphNode6 != null && this.stats.Stuck() == 0)
{
float sqrMagnitude10 = ((Vector3)graphNode6.position - this.currentPosition).sqrMagnitude;
if (sqrMagnitude10 < 40f && sqrMagnitude10 > 0.25f && PathUtilities.IsPathPossible(graphNode6, this.node))
{
this.timeSinceLastEvade = Links.x.gameplay.seconds;
if (this.dodging)
{
this.EndDodge();
}
if (this.moving)
{
this.ClearNodePath();
}
this.stats.AddStamina(-10f);
this.blockDodgeStartTime = Links.x.gameplay.seconds;
this.Jump(graphNode6, (Vector3)graphNode6.position, true, false);
}
}
}
}
if (character4 && !this.evading && (!this.dodging || (this.dodging && Links.x.gameplay.seconds > this.blockDodgeStartTime + 10f)) && !this.stats.animal)
{
this.Dodge();
this.stats.AddStamina(-10f);
this.actions.ai.StopLookingForAction();
}
if (this.dodging && character4)
{
if ((this.blockDodgeStartTime == Links.x.gameplay.seconds || Links.x.gameplay.seconds > this.blockDodgeStartTime + 7f) && !this.Pivoting() && Random.Range(0, 5) == 0)
{
if (this.actions)
{
this.actions.ai.TurnToEnemy(false, character4);
}
else
{
this.alwaysTurn = true;
this.SetRotation(Quaternion.LookRotation(character4.tr.position - this.tr.position), true, false);
}
}
}
else if (this.party && this.attackTime < 0.25f && !this.Pivoting() && !this.turning && Random.Range(0, 5) == 0)
{
character4 = this.actions.ai.EnemyToGuardFrom();
if (character4)
{
this.alwaysTurn = true;
this.SetRotation(Quaternion.LookRotation(character4.tr.position - this.tr.position), true, false);
}
}
}
}
}
if (this.dodging || this.mainSelected)
{
if (this.dodging && this.party && this.hasActions && this.stats.formationGroup >= 7 && !this.mainSelected && this.actions && !this.inAction && !this.inRecovery && !this.inQueuedAbility && this.timelineIcon && this.timelineIcon.Nothing() && this.actions && this.actions.ai && !this.actions.ai.IsPointAwayFromEnemies(this.tr.position, false, false))
{
this.EndDodge();
if (!this.actions.ai.findingAction)
{
Links.x.combat.GetNextAction(this);
}
}
if (this.dodgeFX)
{
this.dodgeFX.transform.position = this.tr.position + new Vector3(0f, 0.2f, 0f);
RaycastHit raycastHit7;
if (Physics.Raycast(this.tr.position + new Vector3(0f, 3f, 0f), Vector3.up * -1f, out raycastHit7, 6f, 4194449))
{
Vector3 normal2 = raycastHit7.normal;
normal2.y = Mathf.Clamp(normal2.y, 0.97f, 1f);
this.circleRot = Quaternion.FromToRotation(Vector3.up, normal2);
this.dodgeFX.transform.rotation = Quaternion.Slerp(this.dodgeFX.transform.rotation, this.circleRot, Time.deltaTime * 10f);
}
}
}
if (!this.hasActions)
{
this.inCombat = false;
}
this.torsoPosition = this.tr.position;
if (this.sleeping || this.downed || this.stunned)
{
this.torsoPosition.y = this.torsoPosition.y + 0.5f;
}
else
{
this.torsoPosition.y = this.torsoPosition.y + (this.characterHeight - 0.5f);
}
this.raycastPosition = this.tr.position;
this.raycastPosition.y = this.raycastPosition.y + 3f;
if (this.grassInteraction)
{
this.grassInteraction.position = this.tr.position;
}
if (this.startTurnExit)
{
this.startTurnExit = false;
this.TurnExit();
}
}
if (this.tr)
{
this.currentPosition = this.tr.position;
if (this.movesOnWater && this.waterColliderRigidbody)
{
this.waterColliderRigidbody.position = this.currentPosition;
}
}
if (Records.x.editor && Records.x.testQuests)
{
if (this.stats.dead && !this.dead)
{
this.stats.dead = false;
this.stats.SetHealth(0, false);
this.body.StartDead(Vector3.up);
this.Dead(false, true, false);
}
if (this.stats.stunned && !this.stunned)
{
this.stats.stunned = false;
this.stats.SetHealth(0, false);
this.Stunned(false);
}
}
}
// Token: 0x060002F1 RID: 753 RVA: 0x000404E8 File Offset: 0x0003E6E8
private void Dodge()
{
this.animator.SetBool("DefendDone", false);
this.animator.SetBool("Dodging", true);
if (this.moving)
{
this.TargetReached();
}
this.PlayAnimation("Defend", 0f);
if (!this.dodging)
{
this.blockDodgeStartTime = Links.x.gameplay.seconds;
if (this.hasActions)
{
this.actions.ai.SkipFromDodge();
}
}
if (!this.dodgeFX)
{
this.dodgeFX = Links.x.cellar.GetPooledGameObject(91);
this.dodgeFX.transform.position = this.tr.position + new Vector3(0f, 0.2f, 0f);
this.dodgeFX.SetActive(true);
this.dodgeFX.transform.rotation = this.circleRot;
}
this.dodging = true;
}
// Token: 0x060002F2 RID: 754 RVA: 0x000405EC File Offset: 0x0003E7EC
public void UpdatePositions()
{
this.PositionEffects();
if (this.npc && this.hasActions)
{
this.SetStaminaBarPosition();
}
if (this.party && this.dead && this.revivalGem)
{
this.SetRevivalGemPosition();
}
if (!this.npc)
{
this.SetSelectedPosition();
}
if (this.charmed)
{
this.SetHeartPosition();
}
if (this.seen)
{
if (Time.timeSinceLevelLoad > this.seenTime + 2f && !Records.x.pocketPause)
{
this.seenTime = 0f;
this.seen.SetActive(false);
Links.x.cellar.ReturnPooledGameObject(23, this.seen);
this.seen = null;
}
else
{
this.SetSeenPosition();
}
}
if (this.heard)
{
this.SetHeardPosition();
}
}
// Token: 0x060002F3 RID: 755 RVA: 0x000406D0 File Offset: 0x0003E8D0
public void WorldUI()
{
if (!Links.x.gaia.sceneLoaded || this.inactive)
{
this.SetActiveStateWorldUI(this.visible);
return;
}
if (this.party && this.hasActions && this == Links.x.pocketWheel.selectedRallyCharacter && Links.x.combat.inPocketAttack)
{
this.SetActiveStateWorldUI(this.visible);
return;
}
if (this.visible == 0)
{
this.SetActiveStateWorldUI(this.visible);
return;
}
if (this.worldUIFade == null)
{
this.worldUIFade = this.WorldUIFade();
base.StartCoroutine(this.worldUIFade);
}
}
// Token: 0x060002F4 RID: 756 RVA: 0x0004077E File Offset: 0x0003E97E
private IEnumerator WorldUIFade()
{
yield return new WaitForSeconds(0.001f);
while (this.body.dithering)
{
yield return null;
}
this.SetActiveStateWorldUI(this.visible);
this.worldUIFade = null;
yield break;
}
// Token: 0x060002F5 RID: 757 RVA: 0x00040790 File Offset: 0x0003E990
public void SetActiveStateWorldUI(int vis)
{
if (vis == 1)
{
if (this.seen)
{
this.seen.SetActive(true);
}
if (this.heard)
{
this.heard.SetActive(true);
}
if (this.stamina)
{
this.stamina.Activate();
}
if (this.statusRing)
{
this.statusRing.gameObject.SetActive(true);
}
for (int i = 0; i < this.headEffects.Count; i++)
{
if (this.headEffects[i])
{
this.headEffects[i].SetActive(true);
}
}
if (this.hasActions && this.actions.chargeUpFX)
{
this.actions.chargeUpFX.SetActive(true);
return;
}
}
else
{
if (this.seen)
{
this.seen.SetActive(false);
}
if (this.heard)
{
this.heard.SetActive(false);
}
if (this.stamina)
{
this.stamina.Deactivate();
}
if (this.statusRing)
{
this.statusRing.gameObject.SetActive(false);
}
for (int j = 0; j < this.headEffects.Count; j++)
{
if (this.headEffects[j])
{
this.headEffects[j].SetActive(false);
}
}
if (this.hasActions && this.actions.chargeUpFX)
{
this.actions.chargeUpFX.SetActive(false);
}
}
}
// Token: 0x060002F6 RID: 758 RVA: 0x00040948 File Offset: 0x0003EB48
private void Jumping()
{
if (this.jumpLanding)
{
if (this.moveNode != null)
{
this.SetMoveFollowPosition((Vector3)this.moveNode.position);
}
this.jumping = false;
if (!this.InAttack() && this.IsSentient())
{
this.PlayAnimation("Idle", Random.Range(0f, 1f));
}
if (this.evading && !this.mainSelected && this.actions && this.actions.ai)
{
this.moving = true;
this.Dodge();
if (this.actions)
{
this.actions.ai.TurnToEnemy(true, null);
}
}
this.StopEvading();
if (!this.dodging)
{
this.TurnExit();
return;
}
}
else
{
if (this.currentArcIndex >= 0 && this.currentArcIndex < this.arcPoints.Count)
{
if (this.mainSelected && this.evading && !Links.x.combat.miniEvent)
{
if (Links.x.mk && Input.GetKeyUp(Links.x.gameplay.keyControl.GetHotkey("DodgePathfind")))
{
this.needToEndJump = true;
}
if (Links.x.joy && (Links.x.gameplay.targetDodgeUp || Links.x.gameplay.gameFeedScrolling))
{
this.needToEndJump = true;
}
if (Links.x.combat.miniEvent)
{
this.needToEndJump = true;
}
this.slideNode = null;
this.slideNodePosition = Vector3.zero;
if (!this.cc.enabled)
{
this.cc.enabled = true;
this.cc.transform.position = this.tr.position;
this.cc.transform.rotation = this.tr.rotation;
}
if (!this.playerBorders.enabled)
{
this.playerBorders.enabled = true;
}
if (this.currentArcIndex == 1)
{
this.needToEndJump = false;
this.look = Quaternion.LookRotation(Links.x.gameplay.mousePoint - this.tr.position);
this.SetRotation(Quaternion.LookRotation(Links.x.gameplay.mousePoint - this.tr.position), false, true);
this.jumpSpeed = 50f;
this.currentArcIndex = 2;
this.jumpTime = Links.x.gameplay.seconds;
}
RaycastHit raycastHit;
if (Physics.SphereCast(this.tr.position + new Vector3(0f, 10f, 0f), 0.25f, -1f * this.upVector, out raycastHit, 100f, 4194433))
{
this.groundPoint = raycastHit.point;
}
else
{
this.groundPoint = this.tr.position;
}
if (this.needToEndJump)
{
this.jumpSpeed -= Time.deltaTime * 500f;
}
else
{
this.jumpSpeed -= Time.deltaTime * 130f;
}
Vector3 vector = this.look * Vector3.forward * this.jumpSpeed * Time.deltaTime;
if (this.groundPoint.y < this.tr.position.y)
{
vector.y -= 2f;
}
this.cc.Move(vector);
if (this.node != null)
{
this.setArea = (int)this.node.Area;
}
GraphNode graphNode = this.NearNode(this.groundPoint, false, 0, 2, 0);
this.sphere.transform.position = this.tr.position;
if (graphNode != this.node && graphNode != null)
{
this.savedPathTarget = graphNode;
this.ClaimNode(graphNode, (Vector3)graphNode.position, false);
Links.x.gameplay.CheckTileEffects(this, this.node, false);
}
this.prevNodePosition = this.tr.position;
if (this.jumpSpeed > 8f)
{
bool flag = this.needToEndJump;
}
if (this.jumpSpeed <= 0f)
{
this.jumping = false;
this.jumpLanding = false;
this.jumpSpeed = 0f;
this.StopEvading();
if (!this.InAttack() && this.IsSentient())
{
this.PlayAnimation("Idle", Random.Range(0f, 1f));
}
if (!Links.x.combat.miniEvent)
{
this.TurnExit();
}
this.SetMoveFollowPosition(this.currentPosition);
}
}
else
{
Vector3 vector2 = this.arcPoints[this.currentArcIndex];
bool flag2 = false;
if (this.hasActions && !this.ambushing && this.npc && this.actions && this.actions.ai.jumping)
{
flag2 = true;
}
float num = Vector3.Distance(this.topJumpPoint, this.tr.position);
if (num > 2f)
{
num = 2f;
}
num *= 0.5f;
num = 1f - num;
float num2 = 2.5f * Time.deltaTime * 10f;
if (flag2)
{
num2 = (5f - num) * Time.deltaTime * 10f;
}
if (this.isHitFlying)
{
num *= 3f;
num2 = (5f - num) * Time.deltaTime * 10f;
}
Transform transform = this.tr;
Vector3 vector3 = Vector3.MoveTowards(transform.position, vector2, num2);
this.SetPosition(vector3, null);
if (this.body.stateInfo.shortNameHash == this.body.jumpLoopHash)
{
this.SetMoveFollowPosition(vector2);
}
this.slideNode = null;
this.slideNodePosition = Vector3.zero;
float sqrMagnitude = (transform.position - vector2).sqrMagnitude;
if (this.isHitFlying)
{
int count = this.arcPoints.Count;
if (this.currentArcIndex < 1)
{
this.SetRotation(Quaternion.LookRotation(this.movePoint - this.prevPoint), false, false);
}
if (this.currentArcIndex > count - 3)
{
this.SetRotation(Quaternion.LookRotation(this.movePoint - this.prevPoint), false, false);
this.body.tr.rotation = Quaternion.Slerp(this.body.tr.rotation, Quaternion.Euler(Vector3.zero), Time.deltaTime * 40f);
}
if (this.currentArcIndex <= count - 3 && this.currentArcIndex >= 1)
{
this.tr.Rotate(this.randomRot * 20f * Time.deltaTime);
this.rot = this.tr.rotation;
this.smoothRot = this.tr.rotation;
}
}
if (sqrMagnitude < 0.0001f || (this.currentArcIndex == this.arcPoints.Count - 1 && sqrMagnitude < 0.010000001f) || Links.x.gameplay.seconds > this.jumpTime + 80f)
{
this.currentArcIndex++;
if (this.evading)
{
if (this.currentArcIndex < this.arcPoints.Count + 4)
{
this.currentArcIndex += 3;
}
else
{
this.currentArcIndex = this.arcPoints.Count - 1;
}
}
if (this.currentArcIndex > this.arcPoints.Count - 3 && this.isHitFlying && !this.stats.HasEffect("ImpactStun"))
{
this.KnockbackEnd(false);
}
if (this.currentArcIndex >= this.arcPoints.Count)
{
this.jumpLanding = true;
if (this.hasActions && this.actions && this.actions.ai && this.actions.ai.jumping)
{
this.actions.ai.jumpDone = true;
}
this.currentArcIndex--;
if (this.isHitFlying)
{
this.SetRotation(Quaternion.LookRotation(this.movePoint - this.prevPoint), false, true);
this.isHitFlying = false;
this.PlayAnimation("Hit Down", 0f);
}
}
}
else
{
this.SetRotation(this.look, false, false);
}
}
this.body.tr.localRotation = Quaternion.Euler(Vector3.zero);
return;
}
this.SetMoveFollowPosition((Vector3)this.moveNode.position);
this.jumping = false;
if (this.isHitFlying)
{
this.isHitFlying = false;
}
this.TurnExit();
}
}
// Token: 0x060002F7 RID: 759 RVA: 0x0004124C File Offset: 0x0003F44C
public void KnockbackEnd(bool fromKick)
{
MasterAudio.PlaySound3DAtVector3AndForget("Body Fall", this.currentPosition, 1f, new float?(1f), 0.5f, "", null);
Effects effects = base.gameObject.AddComponent<Effects>();
Links.x.cellar.AddEffects(effects);
effects.gameObject.SetActive(true);
effects.source = null;
effects.target = this;
effects.fromLoad = false;
effects.effectName = "ImpactStun";
effects.sourceLevel = 0f;
effects.Inflicted(true);
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(112);
pooledGameObject.transform.position = this.tr.position;
pooledGameObject.SetActive(true);
if (fromKick)
{
this.isHitFlying = false;
}
this.ignoreNodeIDs = false;
if (!fromKick && this.movePoint != this.prevPoint)
{
this.SetRotation(Quaternion.LookRotation(this.movePoint - this.prevPoint), false, true);
}
}
// Token: 0x060002F8 RID: 760 RVA: 0x0004135C File Offset: 0x0003F55C
public bool NearFriend(out Vector3 testPointLeader, out GraphNode lookFor)
{
Vector3 vector = this.tr.position;
testPointLeader = this.friendLeader.tr.position;
lookFor = this.friendLeader.node;
if (this.NodesCount() > 0)
{
if (this.savedPathTarget != null)
{
vector = (Vector3)this.savedPathTarget.position;
}
else
{
vector = (Vector3)this.GetLastNode().position;
}
}
if (this.friendLeader.NodesCount() > 0 || this.friendLeader.moving)
{
if (this.friendLeader.savedPathTarget != null)
{
testPointLeader = (Vector3)this.friendLeader.savedPathTarget.position;
lookFor = this.friendLeader.savedPathTarget;
}
else if (this.friendLeader.NodesCount() > 0)
{
testPointLeader = (Vector3)this.friendLeader.GetLastNode().position;
lookFor = this.friendLeader.GetLastNode();
}
}
return (vector - testPointLeader).sqrMagnitude <= 36f;
}
// Token: 0x060002F9 RID: 761 RVA: 0x00041474 File Offset: 0x0003F674
public void UpdateCC()
{
if (!this.physicsMove && this.mainSelected)
{
if (this.cc)
{
if (this.party && (!this.mainSelected || (this.mainSelected && !this.cc.enabled)))
{
this.cc.enabled = false;
this.cc.transform.position = this.tr.position;
this.cc.transform.rotation = this.tr.rotation;
this.cc.enabled = true;
this.cc.enabled = false;
return;
}
if (this.mainSelected && !this.physicsMove)
{
if (this.cc.enabled)
{
this.cc.transform.position = this.tr.position;
this.cc.transform.rotation = this.tr.rotation;
return;
}
this.cc.enabled = false;
this.cc.transform.position = this.tr.position;
this.cc.transform.rotation = this.tr.rotation;
this.cc.enabled = true;
this.cc.enabled = false;
return;
}
}
}
else if (!this.mainSelected && this.cc)
{
this.cc.enabled = false;
}
}
// Token: 0x060002FA RID: 762 RVA: 0x00041600 File Offset: 0x0003F800
public bool CanPhysicsMove(bool wasd)
{
if (((!Links.x.mk || Input.GetMouseButtonUp(0)) && (!Links.x.joy || Links.x.gameplay.actionDown || Links.x.gameplay.actionUp || Links.x.gameplay.descWindowOpen || Links.x.gameplay.hudLeftOpen || Links.x.gameplay.hudRightOpen || Links.x.gameplay.spellTargetingGround)) || Records.x.typing || Records.x.removeControls || Records.x.pocketPause || Records.x.paused || Links.x.combat.miniEvent || !Links.x.gaia.sceneLoaded || !Links.x.gaia.pathfindingReady || Records.x.dialogue || this.inAction || this.inRecovery || this.inQueuedAbility || Records.x.inMenus || this.slideNode != null || this.isHit || !this.IsSentient())
{
return false;
}
if (Links.x.mk && Links.x.gameplay.clickStartOnUIHover)
{
return wasd;
}
if (Links.x.mk && this.followingType != "")
{
return wasd;
}
return this.stats.Stuck() <= 0 && this.stats.Confuse() <= 0 && !this.fleeing && (Links.x.joy || !Links.x.gameplay.uiHover || !Links.x.mk || !Links.x.gameplay.uiHover || !Links.x.gameplay.clickStartOnUIHover);
}
// Token: 0x060002FB RID: 763 RVA: 0x0004184C File Offset: 0x0003FA4C
public bool CanDefend()
{
return this.IsSentient() && !this.dead && !this.downed && !this.inAction && !this.inRecovery && !this.inQueuedAbility && !this.dodging && !this.waitingForDodgeUp && !this.fleeing && !Records.x.typing && !this.stats.pinning && !this.stats.pinned && !this.isHit && !Records.x.removeControls && !Links.x.combat.inPocketAttack && !Links.x.combat.miniEvent;
}
// Token: 0x060002FC RID: 764 RVA: 0x0004190C File Offset: 0x0003FB0C
public bool CanAttack()
{
return this.IsSentient() && !this.stats.pinned && !this.stats.pinning && !this.isHit && !this.inAction && !this.fleeing && !this.inQueuedAbility && this.attackTime >= 1f && this.stats.Confuse() == 0 && !this.IsAttacking(this.body.currentHash);
}
// Token: 0x060002FD RID: 765 RVA: 0x0004198C File Offset: 0x0003FB8C
public bool CanStartSpin()
{
if (Records.x.typing || Records.x.removeControls || Records.x.pocketPause || Records.x.paused || !Links.x.gaia.sceneLoaded || !Links.x.gaia.pathfindingReady || Records.x.dialogue || this.inAction || this.inRecovery || this.inQueuedAbility || Records.x.inMenus || this.slideNode != null || !this.IsSentient())
{
return false;
}
if (this.stats.Stuck() > 0)
{
return false;
}
if (this.stats.Confuse() > 0)
{
return false;
}
if (this.fleeing)
{
return false;
}
bool joy = Links.x.joy;
return true;
}
// Token: 0x060002FE RID: 766 RVA: 0x00041A74 File Offset: 0x0003FC74
private void StopMove()
{
int currentHash = this.body.currentHash;
if (currentHash == this.body.walkHash || currentHash == this.body.walkStartHash || currentHash == this.body.walkBackHash || currentHash == this.body.walkBackStartHash || currentHash == this.body.combatWalkHash || currentHash == this.body.walkPartyHash || currentHash == this.body.combatWalkStartHash || currentHash == this.body.runHash || currentHash == this.body.runStartHash)
{
if (this.slideNode == null)
{
this.animator.SetBool("Idle", true);
if (this.animID == 1)
{
this.animID = 0;
}
}
if (Links.x.gaia.sceneLoaded)
{
this.timeSinceMoveEnded = Time.timeSinceLevelLoad + Random.Range(3f, 8f);
}
}
this.lastRotation = this.tr.rotation;
this.moving = false;
if (this.turning)
{
this.EndTurning(false);
}
this.turningMain = false;
this.physicsY = Vector3.zero;
this.physicsMove = false;
this.ClaimNode(this.node, this.tr.position, false);
if (this.IsWalking() || this.turningMain)
{
this.moveFollow.position = this.tr.position;
}
this.mainMovePoint = Vector3.zero;
}
// Token: 0x060002FF RID: 767 RVA: 0x00041BEC File Offset: 0x0003FDEC
public void EndDodge()
{
this.dodging = false;
this.animator.SetBool("Dodging", false);
this.animator.SetBool("DefendDone", true);
if (this.dodgeFX)
{
Links.x.cellar.ReturnPooledGameObject(91, this.dodgeFX);
this.dodgeFX = null;
}
}
// Token: 0x06000300 RID: 768 RVA: 0x00041C4D File Offset: 0x0003FE4D
public bool CanChooseActions()
{
return true;
}
// Token: 0x06000301 RID: 769 RVA: 0x00041C50 File Offset: 0x0003FE50
public bool CanMove()
{
if (this.jumping && !Records.x.paused && this.party && (!this.pocketPaused || this.pocketPausedOverride))
{
return true;
}
if (Links.x.combat.inPocketAttack && !this.pocketPaused && this.party)
{
return true;
}
if (this.body.IsHit())
{
this.SetAnimatorSpeed(1f);
}
return !this.body.IsHit() && !this.stats.pinned && !this.stats.pinning && !this.turning && !this.dodging && this.moveNode != null && this.slideNode == null && this.prevNodePosition != this.vectorZero && this.moveTurns > 0f && !this.inAction && !this.inRecovery && !this.inQueuedAbility && this.CanChooseActions() && !Records.x.paused && !this.pocketPaused && !this.downed;
}
// Token: 0x06000302 RID: 770 RVA: 0x00041D72 File Offset: 0x0003FF72
public bool IsSentient()
{
return !this.dead && !this.downed && !this.stunned && !this.offMap && !this.sleeping;
}
// Token: 0x06000303 RID: 771 RVA: 0x00041DA0 File Offset: 0x0003FFA0
public bool CanMakePath()
{
return !this.offMap && this.slideNode == null && this.CanChooseActions() && ((Records.x.turnBased && !this.doingAction) || !Records.x.turnBased) && this.CheckControls() && !this.downed && !this.dead && !this.sleeping && !this.stunned;
}
// Token: 0x06000304 RID: 772 RVA: 0x00041E10 File Offset: 0x00040010
public bool CheckControls()
{
return !this.offMap && !this.turning && this.IsSentient() && !Records.x.paused && !this.pocketPaused && (!Records.x.dialogue || (Records.x.dialogue && this.ignoreRemoveControls));
}
// Token: 0x06000305 RID: 773 RVA: 0x00041E6C File Offset: 0x0004006C
public void ChangePauseState()
{
if (!Records.x.paused)
{
if (!this.moving)
{
this.prePausedSpeed = 1f;
}
if (this.waitingToUseItem)
{
Links.x.inventory.UseItemFromPause(this.waitingToUseBagItem, this.waitingToUseBeltItemIndex, this.waitingToUseBeltItemID, this);
if (this.portrait)
{
this.portrait.QueueIcon(false);
}
}
this.SetAnimatorSpeed(this.prePausedSpeed);
return;
}
if (!this.pocketPaused)
{
this.prePausedSpeed = this.animator.speed;
}
this.animator.speed = 0f;
}
// Token: 0x06000306 RID: 774 RVA: 0x00041F14 File Offset: 0x00040114
public void ChangePocketPauseState()
{
if (false)
{
return;
}
if (Links.x.combat.bubbleEvent && this == Links.x.combat.bubbleEventTarget)
{
this.pocketPaused = false;
this.pocketPausedOverride = false;
this.prePausedSpeed = 1f;
this.SetAnimatorSpeed(1f);
return;
}
bool flag = false;
if (Links.x.combat.inPocketAttack)
{
if (this == Links.x.pocketWheel.selectedRallyCharacter)
{
flag = true;
}
}
else
{
flag = this.mainSelected;
}
if (!flag || (flag && Links.x.combat.bubbleEvent))
{
this.pocketPausedOverride = false;
if (!Records.x.pocketPause && !Links.x.combat.inPocketAttack)
{
if (this.dead)
{
this.body.PocketGore(true);
}
this.pocketPaused = false;
this.pocketPausedOverride = false;
if (this.blockedTime == 0f && this.prePausedSpeed < 0.1f)
{
this.prePausedSpeed = 1f;
}
this.SetAnimatorSpeed(this.prePausedSpeed);
this.NeedToUpdateSailingAnimator(false);
return;
}
if (!this.pocketPaused)
{
this.prePausedSpeed = this.animator.speed;
}
if (!this.moving)
{
this.prePausedSpeed = 1f;
}
this.SetAnimatorSpeed(0f);
this.animator.speed = 0f;
this.pocketPaused = true;
this.currentAnimatorSpeed = 0f;
if (this.dead)
{
this.body.PocketGore(false);
return;
}
}
else
{
if (this.pocketPaused)
{
this.pocketPaused = false;
this.prePausedSpeed = 1f;
this.SetAnimatorSpeed(1f);
}
this.pocketPaused = false;
this.pocketPausedOverride = false;
}
}
// Token: 0x06000307 RID: 775 RVA: 0x000420E8 File Offset: 0x000402E8
public void OverridePocketPause()
{
bool flag = false;
if (Links.x.combat.inPocketAttack)
{
if (this == Links.x.pocketWheel.selectedRallyCharacter)
{
flag = true;
}
}
else
{
flag = this.mainSelected;
}
if (flag && (this.inAction || this.inQueuedAbility || this.inRecovery) && this.actions && !Links.x.combat.bubbleEvent)
{
return;
}
this.pocketPausedOverride = true;
this.SetAnimatorSpeed(this.prePausedSpeed);
if (this.party && !Links.x.combat.bubbleEvent)
{
this.pocketPaused = false;
}
}
// Token: 0x06000308 RID: 776 RVA: 0x00042198 File Offset: 0x00040398
private void GetPatrolHoldTime(bool addRandom)
{
this.patrolHoldTime = Time.timeSinceLevelLoad;
if (this.stats.isGuard || this.stats.allegiance == 7U)
{
this.patrolHoldTime += 8f;
if (addRandom)
{
this.patrolHoldTime += Random.Range(0f, 5f);
}
}
else if (this.stats.allegiance == 6U || this.stats.allegiance == 5U || this.stats.allegiance == 0U)
{
this.patrolHoldTime += Random.Range(12f, 25f);
}
else if (this.stats.allegiance == 9U)
{
this.patrolHoldTime += Random.Range(10f, 20f);
}
else
{
this.patrolHoldTime += Random.Range(4f, 8f);
if (addRandom)
{
this.patrolHoldTime += Random.Range(0f, 3f);
}
}
if (this.stats.merchant)
{
this.patrolHoldTime = Time.timeSinceLevelLoad + Random.Range(0.1f, 2f);
}
}
// Token: 0x06000309 RID: 777 RVA: 0x000422DC File Offset: 0x000404DC
public bool Pivoting()
{
return this.body.stateInfo.shortNameHash == this.body.patrolLeftHash || this.body.stateInfo.shortNameHash == this.body.patrolRightHash || this.body.stateInfo.shortNameHash == this.body.patrolLeft45Hash || this.body.stateInfo.shortNameHash == this.body.patrolRight45Hash || this.body.stateInfo.shortNameHash == this.body.combatPivotLeftHash || this.body.stateInfo.shortNameHash == this.body.combatPivotRightHash || this.body.stateInfo.shortNameHash == this.body.combatPivotLeft45Hash || this.body.stateInfo.shortNameHash == this.body.combatPivotRight45Hash || this.body.stateInfo.shortNameHash == this.body.combatPivot180 || this.body.stateInfo.shortNameHash == this.body.patrol180 || this.body.stateInfo.shortNameHash == this.body.combatPivotLeftBackHash || this.body.stateInfo.shortNameHash == this.body.combatPivotRightBackHash || this.body.stateInfo.shortNameHash == this.body.combatPivotLeft45BackHash || this.body.stateInfo.shortNameHash == this.body.combatPivotRight45BackHash || this.body.stateInfo.shortNameHash == this.body.combatPivotBack180;
}
// Token: 0x0600030A RID: 778 RVA: 0x000424C0 File Offset: 0x000406C0
public bool HasPivotID()
{
return this.animID == 21 || this.animID == 22 || this.animID == 32 || this.animID == 31 || this.animID == 43 || this.animID == 44 || this.animID == 45 || this.animID == 46 || this.animID == 47 || this.animID == 48;
}
// Token: 0x0600030B RID: 779 RVA: 0x00042534 File Offset: 0x00040734
public float GetRotationAngle(Quaternion r1, Quaternion r2)
{
Vector3 eulerAngles = r1.eulerAngles;
eulerAngles.x = 0f;
eulerAngles.z = 0f;
r1 = Quaternion.Euler(eulerAngles);
Vector3 eulerAngles2 = r2.eulerAngles;
eulerAngles.x = 0f;
eulerAngles.z = 0f;
r2 = Quaternion.Euler(eulerAngles2);
return Quaternion.Angle(r1, r2);
}
// Token: 0x0600030C RID: 780 RVA: 0x00042598 File Offset: 0x00040798
public void UpdateRotation()
{
if (this.mainSelected && !this.fleeing && this.physicsMove && !this.pocketPaused && !Records.x.dialogue && !this.turning && (this.moving || this.physicsMove) && !this.turningMain)
{
this.savedRot = this.body.tr.rotation;
return;
}
if (this.IsSentient() && !this.body.IsHit() && !this.pocketPaused && !this.ambushing && !this.stats.pinned && !this.downed && this.body.currentHash != this.body.downStartHash && this.body.currentHash != this.body.downHash && !this.resting)
{
if (this.Pivoting() && !this.turning)
{
this.rot = this.body.tr.rotation;
this.smoothRot = this.rot;
this.savedRot = this.rot;
if (this.body.lookAtController.hasTarget)
{
this.body.lookAtController.EndLook();
return;
}
}
else
{
Quaternion quaternion = this.rot;
Quaternion quaternion2 = this.smoothRot;
Quaternion quaternion3 = this.body.tr.rotation;
Quaternion quaternion4 = this.tr.rotation;
Vector3 vector = quaternion.eulerAngles;
vector.x = 0f;
vector.z = 0f;
quaternion = Quaternion.Euler(vector);
vector = quaternion2.eulerAngles;
vector.x = 0f;
vector.z = 0f;
quaternion2 = Quaternion.Euler(vector);
vector = quaternion3.eulerAngles;
vector.x = 0f;
vector.z = 0f;
quaternion3 = Quaternion.Euler(vector);
vector = quaternion4.eulerAngles;
vector.x = 0f;
vector.z = 0f;
quaternion4 = Quaternion.Euler(vector);
if (quaternion4 != quaternion || this.turning)
{
Vector3 forward = this.tr.forward;
Vector3 vector2 = this.rot * Vector3.forward;
Vector3.Dot(forward, vector2);
float rotationAngle = this.GetRotationAngle(quaternion, quaternion3);
bool flag = false;
if (!this.physicsMove && this.moving)
{
flag = true;
}
if (this.mainSelected && this.physicsMove && !this.turningMain)
{
flag = true;
}
if (this.blockedTime > 0f)
{
flag = true;
}
if (this.waitingForNewPath || this.jumping)
{
flag = true;
}
if (this.slideNode != null)
{
flag = true;
}
bool alwaysRootMotion = this.stats.characterRow._AlwaysRootMotion;
if (this.NodesCount() > 0 && !alwaysRootMotion)
{
flag = true;
}
if (this.alwaysTurn && !this.ignoreRemoveControls)
{
this.patrolSpeed = 2f;
flag = false;
this.alwaysTurn = false;
}
if ((Records.x.pocketPause && this.pocketPaused) || Records.x.miniGame)
{
flag = true;
}
if (alwaysRootMotion && rotationAngle > 40f)
{
flag = false;
}
if (this.jumping)
{
flag = true;
}
if (this.sailing && this.boatNavigator)
{
flag = true;
}
if (this.IsSentient() && (this.turning || (!flag && rotationAngle > 40f)))
{
bool hasRootMotionTurn = this.stats.characterRow._HasRootMotionTurn;
float num = Quaternion.Angle(quaternion, quaternion2);
float num2 = Quaternion.Angle(this.intervalRot, quaternion2);
float num3 = Quaternion.Angle(quaternion, quaternion3);
bool flag2 = this.mainSelected;
if ((this.turning && this.turnTimeStarted != 0f && Time.timeSinceLevelLoad > this.turnTimeStarted + 2f) || (this.turning && (quaternion == quaternion2 || num < 15f || (this.turning && num3 < 15f && hasRootMotionTurn)) && rotationAngle < 15f))
{
if (this.inAction)
{
if (!this.moving)
{
this.EndTurning(true);
}
else
{
this.EndTurning(false);
}
}
if (this.turning && this.turnTimeStarted != 0f && Time.timeSinceLevelLoad > this.turnTimeStarted + 2f)
{
this.SetRotation(this.rot, false, true);
}
this.turning = false;
this.rot = this.SlopedRotation(this.tr.rotation);
quaternion2 = this.SlopedRotation(this.tr.rotation);
this.animator.SetBool("TurningDone", true);
if (!hasRootMotionTurn)
{
this.SetIdle(true);
}
this.turnTimeStarted = 0f;
this.savedRot = this.tr.rotation;
return;
}
if (rotationAngle > 15f || num2 < 10f || !this.turning)
{
if (!this.turning)
{
bool flag3 = this.mainSelected;
this.SetIdle(false);
}
this.animator.SetBool("TurningDone", false);
this.rotationTime = 0f;
this.startRot = quaternion2;
this.startRotY = this.startRot.eulerAngles.y;
if (!this.turning)
{
this.turnTimeStarted = Time.timeSinceLevelLoad;
}
this.turning = true;
this.savedRot = quaternion;
this.SetAnimatorSpeed(1f);
this.turnDirection = this.AngleDir(quaternion3 * Vector3.forward, quaternion * Vector3.forward, Vector3.up);
float num4 = num;
if (num4 <= 45f)
{
Vector3 eulerAngles = quaternion2.eulerAngles;
this.intervalY = eulerAngles.y + num4 * this.turnDirection;
this.intervalRot = quaternion;
}
else
{
Vector3 eulerAngles2 = quaternion2.eulerAngles;
this.intervalY = eulerAngles2.y + 45f * this.turnDirection;
this.intervalRot = Quaternion.Euler(new Vector3(eulerAngles2.x, this.intervalY, eulerAngles2.z));
}
}
if (this.turning)
{
if (hasRootMotionTurn && !this.stats.pinning)
{
if (!this.Pivoting())
{
float num5 = Vector3.Dot(Vector3.Cross(quaternion3 * Vector3.forward, quaternion * Vector3.forward), Vector3.up);
bool flag4 = this.hasActions;
float num6 = 100f;
float num7 = 60f;
if (this.party)
{
num6 = 100f;
num7 = 60f;
}
if (this.animator.GetBool("Combat"))
{
if (num5 < 0f)
{
if (num > num6)
{
this.PlayAnimation("CombatPivot180", 0f);
}
else if (num > num7 && num <= num6)
{
this.PlayAnimation("CombatPivotLeft90", 0f);
}
else
{
this.PlayAnimation("CombatPivotLeft45", 0f);
}
}
else if (num > num6)
{
this.PlayAnimation("CombatPivot180", 0f);
}
else if (num > num7 && num <= num6)
{
this.PlayAnimation("CombatPivotRight90", 0f);
}
else
{
this.PlayAnimation("CombatPivotRight45", 0f);
}
}
else if (num5 < 0f)
{
if (num > num6)
{
this.PlayAnimation("Patrol180", 0f);
}
else if (num > num7 && num <= num6)
{
this.PlayAnimation("PatrolLeft90", 0f);
}
else
{
this.PlayAnimation("PatrolLeft45", 0f);
}
}
else if (num > num6)
{
this.PlayAnimation("Patrol180", 0f);
}
else if (num > num7 && num <= num6)
{
this.PlayAnimation("PatrolRight90", 0f);
}
else
{
this.PlayAnimation("PatrolRight45", 0f);
}
}
this.SetAnimatorSpeed(1f);
this.smoothRot = this.body.tr.rotation;
}
else
{
this.SetIdle(true);
float num8 = 12f;
this.rotationTime += Time.deltaTime * num8;
float num9 = Mathf.Lerp(this.startRotY, this.intervalY, this.rotationTime);
this.smoothRot = Quaternion.Euler(new Vector3(0f, num9, 0f));
this.tr.rotation = this.smoothRot;
}
}
}
bool flag5 = this.moving;
if (this.IsWalking())
{
flag5 = true;
}
if (this.boatNavigator)
{
flag5 = false;
}
if (!this.turning && !this.stunned && !this.dead && !this.downed && !this.Pivoting() && !this.body.nextFrameRotateToChild)
{
if (this.turning)
{
this.EndTurning(true);
}
if (flag5)
{
float num10 = 30f;
if (Records.x.miniGame)
{
num10 = 100f;
}
this.smoothRot = Quaternion.Slerp(this.smoothRot, this.rot, Time.deltaTime * num10);
}
else
{
float num11 = 35f;
if (this.slowLook)
{
this.smoothRot = this.SlopedRotation(this.tr.rotation);
this.rot = this.SlopedRotation(this.tr.rotation);
if (this.slowLook)
{
Quaternion quaternion5 = this.rot;
vector = quaternion5.eulerAngles;
vector.z = 0f;
vector.x = 0f;
quaternion5 = Quaternion.Euler(vector);
vector2 = quaternion5 * Vector3.forward;
if (this.body.headBone && !Records.x.dialogue)
{
this.lookAtTurnTarget.transform.position = this.body.HeadPosition(0f) + vector2 * 10f + new Vector3(0f, 0f, 0f);
this.body.lookAtController.SetNewTarget(this.lookAtTurnTarget, 0f, 0f, false);
}
}
this.slowLook = false;
}
else
{
float num12 = 1f;
if (this.summoned && this.npc)
{
num12 = 3f;
}
this.smoothRot = Quaternion.Slerp(this.smoothRot, this.rot, Time.deltaTime * num11 * num12);
}
}
this.tr.rotation = this.smoothRot;
this.savedRot = this.smoothRot;
return;
}
}
else if (this.turning)
{
this.EndTurning(true);
}
}
}
}
// Token: 0x0600030D RID: 781 RVA: 0x00043074 File Offset: 0x00041274
public void EndTurning(bool playIdle)
{
this.turning = false;
this.RotateToChild();
this.turnTimeStarted = 0f;
if (playIdle)
{
this.rot = this.SlopedRotation(this.tr.rotation);
this.smoothRot = this.SlopedRotation(this.tr.rotation);
this.SetIdle(true);
}
}
// Token: 0x0600030E RID: 782 RVA: 0x000430D1 File Offset: 0x000412D1
public Quaternion SlopeRotation()
{
return Quaternion.FromToRotation(Vector3.up, this.terrainNormal);
}
// Token: 0x0600030F RID: 783 RVA: 0x000430E4 File Offset: 0x000412E4
public Quaternion FinalSlopedRotation(Quaternion wantedRotation)
{
Quaternion quaternion = wantedRotation;
if (this.rotateToSlope && !this.sailing && !this.movesOnWater)
{
Quaternion quaternion2 = Quaternion.FromToRotation(this.tr.up, this.terrainNormal);
if (this.turning)
{
quaternion = quaternion2 * wantedRotation;
}
}
return quaternion;
}
// Token: 0x06000310 RID: 784 RVA: 0x00043138 File Offset: 0x00041338
public Quaternion SlopedRotation(Quaternion wantedRotation)
{
Quaternion quaternion = wantedRotation;
if (this.rotateToSlope && !this.sailing && !this.movesOnWater)
{
Quaternion quaternion2 = Quaternion.FromToRotation(this.tr.up, this.terrainNormal);
if (this.turning)
{
quaternion = quaternion2 * wantedRotation;
}
else
{
quaternion = Quaternion.Slerp(this.smoothRot, quaternion2 * wantedRotation, 10f * Time.deltaTime);
}
}
return quaternion;
}
// Token: 0x06000311 RID: 785 RVA: 0x000431AC File Offset: 0x000413AC
public void SetPosition(Vector3 pt, GraphNode n)
{
if (this.stats.Stuck() > 0 && this.npc && !this.jumpingAreas && !this.jumpingPosition && !this.jumping)
{
return;
}
if (this.movesOnWater && this.waterCollisions && this.waterCollisions.sliding)
{
return;
}
if (n == null)
{
this.tr.position = pt;
return;
}
this.tr.position = (Vector3)n.position;
}
// Token: 0x06000312 RID: 786 RVA: 0x00043234 File Offset: 0x00041434
public void SetMoveFollowPosition(Vector3 pt)
{
if ((this.tr.position - pt).sqrMagnitude > 36f && !this.jumping && !this.sailing)
{
if (!this.ignoreRemoveControls && !this.jumpingAreas && !this.jumpingPosition && this.npc && !this.ambushing)
{
float num = 36f;
if (!this.npc)
{
num = 225f;
}
if ((this.tr.position - new Vector3(pt.x, this.tr.position.y, pt.z)).sqrMagnitude > num)
{
this.ClaimNode(null, this.tr.position, true);
this.TargetReached();
}
}
if (!this.jumpingAreas && !this.ignoreRemoveControls && Records.x.editor && !this.summoned && !this.body.IsHit())
{
string[] array = new string[13];
array[0] = ((this != null) ? this.ToString() : null);
array[1] = " MOVE FOLLOW TOO FAR ";
int num2 = 2;
Vector3 vector = pt;
array[num2] = vector.ToString();
array[3] = " ";
array[4] = this.tr.position.ToString();
array[5] = " ";
array[6] = this.body.stateInfo.shortNameHash.ToString();
array[7] = " ";
array[8] = this.nodePath.Count.ToString();
array[9] = " ";
array[10] = this.inactive.ToString();
array[11] = " ";
array[12] = this.moving.ToString();
Debug.Log(string.Concat(array));
}
}
if (!float.IsNaN(pt.x) && !float.IsNaN(pt.y) && !float.IsNaN(pt.z) && this.moveFollow)
{
this.moveFollow.position = pt;
}
}
// Token: 0x06000313 RID: 787 RVA: 0x00043461 File Offset: 0x00041661
public void SetAttackTarget(Character c)
{
this.attackTarget = c;
this.attackTargetTime = Links.x.gameplay.seconds;
}
// Token: 0x06000314 RID: 788 RVA: 0x00043480 File Offset: 0x00041680
public void SetRotation(Quaternion newRot, bool ikLook, bool instant)
{
if (this.stats.pinned)
{
return;
}
Vector3 eulerAngles = newRot.eulerAngles;
if (!this.rotateToSlope)
{
eulerAngles.x = 0f;
eulerAngles.z = 0f;
}
newRot = Quaternion.Euler(eulerAngles);
this.rot = this.FinalSlopedRotation(newRot);
this.slowLook = ikLook;
if (this.inCombat || this.hasActions)
{
this.slowLook = false;
}
if (instant)
{
if (this.turning)
{
this.EndTurning(false);
}
this.smoothRot = newRot;
this.rot = this.SlopedRotation(newRot);
this.tr.rotation = newRot;
this.body.tr.localRotation = Quaternion.Euler(Vector3.zero);
this.alwaysTurn = false;
return;
}
if (Quaternion.Angle(newRot, this.body.tr.rotation) > 45f && (this.alwaysTurn || !this.turning))
{
if (this.alwaysTurn && this.turning)
{
this.EndTurning(false);
this.savedRot = this.rot;
}
this.UpdateRotation();
return;
}
this.alwaysTurn = false;
}
// Token: 0x06000315 RID: 789 RVA: 0x000435A8 File Offset: 0x000417A8
public void SetMeshState(bool on)
{
if (this.inactive || this.missing)
{
on = false;
}
if (this.ambushing && !this.jumping)
{
on = false;
}
if (this.meshAlwaysOn && !this.missing)
{
on = true;
}
if (this.isBoro && Links.x.gaia.boroControls.boroInvisible)
{
on = false;
}
if (!on)
{
this.visible = 0;
if (this.grassInteraction && !Records.x.removeControls && !Links.x.combat.inRally && !Links.x.combat.inPocketAttack)
{
Links.x.cellar.ReturnPooledGameObject(89, this.grassInteraction.gameObject);
this.grassInteraction = null;
}
if (this.audioSource)
{
this.audioSource.enabled = false;
}
if (this.movesOnWater && !Links.x.combat.inPocketAttack)
{
if (this.waterColliderRigidbody)
{
this.waterColliderRigidbody.isKinematic = true;
this.waterCollisions.sliding = false;
}
if (this.splash)
{
Links.x.cellar.ReturnPooledGameObject(141, this.splash);
this.splash = null;
}
}
this.WorldUI();
}
else
{
this.visible = 1;
if (!this.grassInteraction)
{
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(89);
if (pooledGameObject)
{
this.grassInteraction = pooledGameObject.transform;
pooledGameObject.SetActive(true);
}
if (this.needsRebind && this.body)
{
this.body.anim.Rebind();
this.body.anim.Update(0f);
}
}
if (this.audioSource)
{
this.audioSource.enabled = true;
}
if (this.movesOnWater)
{
if (this.waterColliderRigidbody)
{
this.waterColliderRigidbody.isKinematic = false;
}
if (!this.splash && !this.stats.flying)
{
this.splash = Links.x.cellar.GetPooledGameObject(141);
this.splash.SetActive(false);
}
}
this.WorldUI();
}
if (this.body)
{
this.body.SetMeshState(on, true);
}
}
// Token: 0x06000316 RID: 790 RVA: 0x00043820 File Offset: 0x00041A20
public float GetAnimatorVariation(int multiple)
{
if (multiple == 2)
{
int num = Random.Range(0, 2);
if (num == 0)
{
return 0f;
}
if (num == 1)
{
return 1f;
}
}
else if (multiple == 3)
{
int num2 = Random.Range(0, 3);
if (num2 == 0)
{
return 0f;
}
if (num2 == 1)
{
return 0.5f;
}
if (num2 == 2)
{
return 1f;
}
}
return 0f;
}
// Token: 0x06000317 RID: 791 RVA: 0x0004387C File Offset: 0x00041A7C
public void RotateToChild()
{
this.body.tr.parent = null;
this.tr.rotation = this.body.tr.rotation;
this.rot = this.SlopedRotation(this.tr.rotation);
this.smoothRot = this.rot;
this.body.tr.parent = this.tr;
this.body.tr.localRotation = Quaternion.Euler(Vector3.zero);
}
// Token: 0x06000318 RID: 792 RVA: 0x00043908 File Offset: 0x00041B08
public bool InAttack()
{
return this.inAction || this.inRecovery || this.inQueuedAbility;
}
// Token: 0x06000319 RID: 793 RVA: 0x00043928 File Offset: 0x00041B28
public bool IsAttacking(int hash)
{
return hash == this.body.basicAttackHash || hash == this.body.basicAttack2Hash || hash == this.body.basicAttack3Hash || hash == this.body.basicAttack4Hash || hash == this.body.special1Hash || hash == this.body.special2Hash || hash == this.body.special3Hash || hash == this.body.special4Hash || hash == this.body.special5Hash || hash == this.body.powerDraw || hash == this.body.quickAttackHash;
}
// Token: 0x0600031A RID: 794 RVA: 0x000439E6 File Offset: 0x00041BE6
public bool IsCasting(int hash)
{
return hash == this.body.channelHash;
}
// Token: 0x0600031B RID: 795 RVA: 0x000439F9 File Offset: 0x00041BF9
public bool IsTrinketing(int hash)
{
return hash == this.body.instrumentHash || hash == this.body.charmHash;
}
// Token: 0x0600031C RID: 796 RVA: 0x00043A1C File Offset: 0x00041C1C
public bool ActionAnimID()
{
return this.body.stateInfo.shortNameHash == this.body.basicAttackHash || this.body.stateInfo.shortNameHash == this.body.basicAttack2Hash || this.body.stateInfo.shortNameHash == this.body.basicAttack3Hash || this.body.stateInfo.shortNameHash == this.body.basicAttack4Hash || this.body.stateInfo.shortNameHash == this.body.quickAttackHash || this.body.stateInfo.shortNameHash == this.body.defendHash || this.body.stateInfo.shortNameHash == this.body.channelHash || this.body.stateInfo.shortNameHash == this.body.special1Hash || this.body.stateInfo.shortNameHash == this.body.special2Hash || this.body.stateInfo.shortNameHash == this.body.special3Hash || this.body.stateInfo.shortNameHash == this.body.kickHash || this.body.stateInfo.shortNameHash == this.body.useHash || this.body.stateInfo.shortNameHash == this.body.powerDraw || this.body.stateInfo.shortNameHash == this.body.instrumentHash || this.body.stateInfo.shortNameHash == this.body.charmHash || this.body.stateInfo.shortNameHash == this.body.channelHash;
}
// Token: 0x0600031D RID: 797 RVA: 0x00043C1C File Offset: 0x00041E1C
public void PlayAnimation(string animName, float animTime)
{
if (this.inactive && !this.hasActions)
{
return;
}
bool flag = false;
bool flag2 = false;
if (this.party)
{
if (Links.x.combat.inPocketAttack)
{
if (this == Links.x.pocketWheel.selectedRallyCharacter)
{
flag2 = true;
}
}
else
{
flag2 = this.mainSelected;
}
}
if (flag2)
{
if (Links.x.combat.miniEvent && !Links.x.combat.bubbleEvent)
{
flag = true;
}
if (Links.x.combat.inPocketAttack && this.NodesCount() == 0)
{
flag = true;
}
}
if (this.dead && !flag && !animName.Contains("Death"))
{
return;
}
if ((this.downed || this.sleeping) && !this.dead && !flag && !animName.Contains("Hit Down") && !animName.Contains("GetUp") && !animName.Contains("Suplex"))
{
if (this.body.currentHash == this.body.hitDownHash)
{
return;
}
animName = "Hit Down";
}
if (this.stunned && !flag)
{
if (this.body.currentHash == this.body.hitDownHash || this.isHit)
{
return;
}
animName = "Hit Down";
}
if (this.isHit && !flag && !this.stunned && !this.dead && !animName.Contains("Hit") && !animName.Contains("Death"))
{
return;
}
if ((this.animID == 25 || this.animID == 26) && !flag && this.animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 0.5f && (animName.Contains("Walk") || animName.Contains("Pivot") || animName.Contains("Idle") || animName.Contains("Patrol")))
{
return;
}
if (flag && !animName.Contains("Attack"))
{
return;
}
if (this.animID == 53)
{
return;
}
bool flag3 = true;
string text = "";
bool flag4 = this.stats.pinned;
if (this.stats.pinning)
{
flag4 = true;
}
this.prevAnimID = this.animID;
if ((this.stats.pinning || this.stats.pinned) && animName != "Pinning" && !animName.Contains("Down") && (!animName.Contains("Hit") || !this.stats.pinning) && !animName.Contains("Death"))
{
if (this.animID == 50)
{
return;
}
animName = "Pinning";
}
if (this.inCombat && this.hasActions && !flag && (this.animID == 14 || this.inAction || this.IsAttacking(this.body.currentHash) || this.IsCasting(this.body.currentHash)) && !this.pocketPaused)
{
bool flag5 = false;
if ((animName.Contains("Pivot") || animName.Contains("Patrol")) && this.hasActions && this.actions.rolling)
{
flag5 = true;
}
if (!animName.Contains("Charm") && !animName.Contains("Excited") && !animName.Contains("Attack") && !animName.Contains("Cast") && !animName.Contains("Channel") && !animName.Contains("Kick") && !animName.Contains("Instrument") && !flag5)
{
if (!animName.Contains("Down") && !animName.Contains("Death") && !animName.Contains("Thrown") && !animName.Contains("Interrupt") && !animName.Contains("Bounce"))
{
return;
}
this.actions.Interrupt();
if (this.animID == 8)
{
return;
}
}
}
if (animName.Contains("Idle"))
{
if (!this.npc && this.hasActions)
{
bool hasTarget = this.actions.hasTarget;
}
if (this.resting && (this.inCircle || !this.hasActions))
{
if (this.inCircle)
{
if (this.stats.hasCircleAnims)
{
text = "Fatigued";
}
else
{
text = "Hit_down";
}
}
else
{
text = "Hit_down";
}
this.animator.SetBool("Idle", false);
this.FinishAnimation(false, text, animTime, 0);
this.SetAnimatorSpeed(1f);
return;
}
if (this.party)
{
if (this.inTown && !this.hasActions)
{
this.animator.SetBool("Combat", false);
}
else
{
this.inTown = false;
}
if (!this.inTown && Time.timeSinceLevelLoad > this.timeSinceMoveEnded && this.timeSinceMoveEnded != 0f && this.timeSinceMoveEnded != -100f)
{
this.timeSinceMoveEnded = -100f;
}
}
if (((this.summoned || this.npc) && (this.inCombat || this.hasActions || this.searching)) || (!this.inTown && this.party && this.timeSinceMoveEnded != -100f) || (this.hasActions && this.party) || (this.summoned && !this.npc && Records.x.InCombat(false)))
{
text = "Combat_Idle_loop";
this.animator.SetBool("Combat", true);
}
else
{
text = "Idle";
this.animator.SetBool("Combat", false);
}
this.animID = 0;
if (this.animID != this.prevAnimID || !Links.x.gaia.sceneLoaded)
{
flag3 = false;
this.SetIdle(true);
}
if (!flag3)
{
float num = this.GetAnimatorVariation(3);
if (this.stats.hasCustomIdle && !this.hasActions)
{
num = 1f;
}
if (!this.sailing)
{
this.animator.SetFloat("Combat Variation", this.GetAnimatorVariation(2));
}
if (this.party && !this.inTown && !this.sailing)
{
if (!this.hasActions)
{
this.animator.SetFloat("Combat Variation", 1f);
}
else
{
this.animator.SetFloat("Combat Variation", 0f);
}
}
if (!this.sailing)
{
this.animator.SetFloat("Idle Variation", num);
}
animTime = Random.Range(0f, 1f);
}
this.animator.SetBool("Was Walking", false);
this.FinishAnimation(flag3, text, animTime, 0);
this.SetAnimatorSpeed(1f);
if (this.sailing)
{
this.NeedToUpdateSailingAnimator(false);
}
return;
}
else
{
if (animName.Contains("Walk"))
{
if (this.stats.Stuck() == 0)
{
this.animator.SetBool("Was Walking", false);
this.animID = 1;
if (this.animID != this.prevAnimID || !this.IsWalking())
{
flag3 = false;
}
if (this.body.sneaking && !this.npc)
{
text = "Walk_start";
this.animator.SetBool("Combat", false);
}
else
{
if (this.inCombat && !this.fleeing)
{
this.animator.SetBool("Combat", true);
text = "Combat_walk_start";
if (this.stats.isFishMonster)
{
bool flag6 = false;
if (this.inCircle && this.group && (this.group.inFormationMovement || this.group.inFormationWait || this.group.inSwarm || this.group.inSwarmWait))
{
flag6 = true;
}
if (this.charging || this.evading || this.moveBackTarget || flag6)
{
this.animator.SetFloat("Combat Variation", 1f);
}
else
{
this.animator.SetFloat("Combat Variation", this.GetAnimatorVariation(2));
}
}
else if (!this.sailing)
{
this.animator.SetFloat("Combat Variation", this.GetAnimatorVariation(2));
}
}
else
{
if (this.party)
{
if (this.inTown && !this.hasActions)
{
this.animator.SetBool("Combat", false);
}
else
{
this.inTown = false;
}
if (!this.inTown && this.timeSinceMoveEnded == -100f)
{
if (this.mainSelected)
{
this.timeSinceMoveEnded = 0f;
flag3 = false;
}
else if (Links.x.main.moving || Links.x.main.physicsMove || (Links.x.main.tr.position - this.tr.position).sqrMagnitude > 625f)
{
this.timeSinceMoveEnded = 0f;
flag3 = false;
}
}
}
if ((this.party && !this.inTown && this.timeSinceMoveEnded != -100f) || (this.party && this.hasActions) || (!Records.x.removeControls && this.running && !this.summoned && !this.inTown))
{
this.animator.SetBool("Combat", true);
text = "Combat_walk_start";
}
else if (this.running && !this.stats.animal && this.ignoreRemoveControls && !this.inTown)
{
text = "Combat_walk_start";
this.animator.SetBool("Combat", true);
}
else
{
text = "Walk_start";
this.animator.SetBool("Combat", false);
}
}
if (this.animator.GetBool("Combat"))
{
if (this.moveBackTarget)
{
text = "Combat_walk_start_back";
this.animator.SetBool("Backward", true);
this.moveBackward = true;
}
else
{
this.animator.SetBool("Backward", false);
this.moveBackward = false;
}
}
}
if (!flag3 && this.body.tr.localRotation.eulerAngles.y != 0f)
{
this.RotateToChild();
}
this.SetIdle(false);
this.FinishAnimation(flag3, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
}
return;
}
if (animName.Contains("Patrol"))
{
if (animName.Contains("Left"))
{
if (animName.Contains("45"))
{
text = "Patrol_rotate_left 45";
this.animID = 21;
}
else
{
text = "Patrol_rotate_left";
this.animID = 22;
}
}
else if (animName.Contains("Right"))
{
if (animName.Contains("45"))
{
text = "Patrol_rotate_right 45";
this.animID = 44;
}
else
{
text = "Patrol_rotate_right";
this.animID = 45;
}
}
else
{
text = "Patrol_rotate_180";
this.animID = 43;
}
if (this.animID != this.prevAnimID || this.t >= 0.95f)
{
flag3 = false;
}
this.FinishAnimation(flag3, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = true;
return;
}
if (animName.Contains("CombatPivot"))
{
if (animName.Contains("Left"))
{
if (animName.Contains("45"))
{
text = "Pivot Left 45";
this.animID = 31;
}
else
{
text = "Pivot Left 90";
this.animID = 30;
}
}
else if (animName.Contains("Right"))
{
if (animName.Contains("45"))
{
text = "Pivot Right 45";
this.animID = 46;
}
else
{
text = "Pivot Right 90";
this.animID = 47;
}
}
else
{
text = "Pivot 180";
this.animID = 48;
}
if (this.moveBackward)
{
text += " back";
}
float normalizedTime = this.animator.GetCurrentAnimatorStateInfo(0).normalizedTime;
if (this.animID != this.prevAnimID || normalizedTime >= 0.95f)
{
flag3 = false;
}
this.FinishAnimation(flag3, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = true;
return;
}
if (animName.Contains("BasicAttack"))
{
this.animID = 2;
if (!this.IsAttacking(this.body.currentHash))
{
if (this.attackSpeed == 0f)
{
this.attackSpeed = 1f;
}
this.animator.SetFloat("Attack Variation", this.GetAnimatorVariation(3));
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
text = "Combat_basic_attack";
this.NeedToUpdateSailingAnimator(false);
if (this.needsRebind && this.body)
{
this.body.anim.Rebind();
this.body.anim.Update(0f);
}
this.FinishAnimation(false, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(this.attackSpeed);
}
this.canSwitchBackToIdle = true;
}
return;
}
if (animName.Contains("SynergyAttack"))
{
if (this.attackSpeed == 0f)
{
this.attackSpeed = 1f;
}
if (animName.Contains("1"))
{
text = "Combat_synergy_normal_1";
this.animID = 15;
}
else if (animName.Contains("2"))
{
if (!Links.x.rallyStage.playing)
{
text = "Combat_synergy_normal_2";
}
else
{
text = "Combat_synergy_2";
}
this.animID = 16;
}
this.NeedToUpdateSailingAnimator(false);
flag3 = false;
this.FinishAnimation(false, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = true;
return;
}
if (animName.Contains("SecondAttack"))
{
this.animID = 2;
this.NeedToUpdateSailingAnimator(false);
if (this.attackSpeed == 0f)
{
this.attackSpeed = 1f;
}
this.animator.SetFloat("Attack Variation", this.GetAnimatorVariation(3));
flag3 = false;
text = "Combat_lefthand_attack";
this.FinishAnimation(false, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(this.attackSpeed);
}
this.canSwitchBackToIdle = true;
this.animator.Update(0f);
return;
}
if (animName.Contains("Instrument"))
{
if (animName.Contains("Horn"))
{
text = "Combat_instrument_horn";
this.animID = 32;
}
else if (animName.Contains("Pipes"))
{
text = "Combat_instrument_pipes";
this.animID = 41;
}
else
{
text = "Combat_instrument_flute";
this.animID = 42;
}
this.NeedToUpdateSailingAnimator(false);
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
this.FinishAnimation(false, text, animTime, -1);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = false;
return;
}
if (animName.Contains("Defend") && !flag4)
{
this.animID = 3;
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
text = "Defend";
this.FinishAnimation(false, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = false;
return;
}
if (animName == "Hype" && !flag4)
{
if (this.animator.GetBool("Hyped"))
{
this.animID = 51;
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
text = "Hype";
this.FinishAnimation(false, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = false;
return;
}
return;
}
else
{
if (animName == "Fatigued" && !flag4)
{
this.animID = 52;
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
text = "Fatigued";
if (!this.stats.hasCircleAnims)
{
text = "Hit_down";
}
this.FinishAnimation(false, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = false;
return;
}
if (animName.Contains("Block") && !flag4)
{
if (animName.Contains("armor"))
{
text = "Block_armor";
this.animID = 4;
}
else
{
text = "Block_dodge";
this.animID = 5;
}
flag3 = false;
this.FinishAnimation(flag3, text, animTime, -1);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = true;
return;
}
if (animName.Contains("Death"))
{
this.NeedToUpdateSailingAnimator(true);
if (animName.Contains("1"))
{
text = "Death_1";
this.animID = 6;
}
else
{
text = "Death_1";
this.animID = 7;
}
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
this.FinishAnimation(flag3, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = false;
return;
}
if (animName.Contains("JumpStart"))
{
this.animID = 33;
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
text = "Jump_start";
this.FinishAnimation(false, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = false;
return;
}
if (animName.Contains("JumpDown"))
{
this.animID = 34;
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
text = "Jump_end";
this.FinishAnimation(false, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = true;
return;
}
if (animName.Contains("Hit"))
{
if (animName.Contains("Down"))
{
if (!this.animator.GetCurrentAnimatorStateInfo(0).IsName("Hit_down"))
{
text = "Hit_down_start";
}
else
{
text = "Hit_down";
}
this.animID = 8;
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
this.canSwitchBackToIdle = false;
this.PlayFaceAnimation(FaceAnimations.AnimationNames.Sleep);
}
else if (animName.Contains("Bounce") && !flag4)
{
text = "Hit_bounce";
this.animID = 9;
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
this.canSwitchBackToIdle = false;
if (this.hasActions)
{
this.actions.Interrupt();
}
}
else if (animName.Contains("Suplex") && !flag4)
{
text = "Hit_suplex";
this.animID = 53;
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
this.canSwitchBackToIdle = false;
}
else if (this.animID != 9)
{
if (animName.Contains("Interrupt") && this.actions && !this.jumping)
{
this.actions.Interrupt();
}
if (!this.jumping && !this.stats.pinned)
{
if (this.turning)
{
this.EndTurning(false);
}
this.animID = 10;
text = "Hit";
animTime = 0f;
flag3 = false;
this.SetAnimatorSpeed(1f);
this.canSwitchBackToIdle = true;
}
}
this.FinishAnimation(flag3, text, animTime, -1);
return;
}
if (animName.Contains("CombatStart") && !flag4)
{
this.animID = 11;
this.animator.SetBool("Combat", true);
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
text = "Combat_start";
this.FinishAnimation(flag3, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
this.RotateToChild();
}
return;
}
if (animName.Contains("CombatEnd") && !flag4)
{
this.animID = 12;
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
text = "Combat_end";
this.FinishAnimation(flag3, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = true;
return;
}
if (animName.Contains("Cast") && !flag4)
{
text = "Cast";
this.animID = 14;
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
this.FinishAnimation(false, text, animTime, -1);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = true;
return;
}
if (animName.Contains("GetUp"))
{
this.animID = 24;
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
text = "Get_up";
this.FinishAnimation(flag3, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = true;
this.PlayFaceAnimation(FaceAnimations.AnimationNames.Blink);
return;
}
if (animName.Contains("Kick"))
{
this.animID = 25;
if (this.animID != this.prevAnimID)
{
}
text = "Kick";
this.FinishAnimation(false, text, animTime, -1);
if (!false)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = true;
this.kickUseTime = Time.timeSinceLevelLoad;
return;
}
if (animName.Contains("Use"))
{
this.animID = 26;
text = "Combat_use_trinket_or_potion";
this.FinishAnimation(false, text, animTime, -1);
if (!false)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = true;
this.kickUseTime = Time.timeSinceLevelLoad;
return;
}
if (animName.Contains("Pinning"))
{
this.animID = 50;
if (this.stats.pinning)
{
text = "Combat_pins";
bool flag7 = false;
if (this.hasActions && this.actions.ai.pinLow)
{
flag7 = true;
}
if (flag7)
{
this.animator.SetFloat("Pins", 0.5f);
}
else
{
this.animator.SetFloat("Pins", 0f);
}
}
else
{
text = "Combat_pins";
this.animator.SetFloat("Pins", 1f);
}
this.FinishAnimation(false, text, animTime, -1);
if (!false)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = true;
return;
}
if (animName.Contains("Talk"))
{
if (animName.Contains("1"))
{
text = "Talk_1";
this.animID = 18;
}
else if (animName.Contains("2"))
{
text = "Talk_2";
this.animID = 19;
}
else if (animName.Contains("3"))
{
text = "Talk_3";
this.animID = 20;
}
else if (animName.Contains("Arms"))
{
text = "Talk_1";
this.animID = 37;
}
else if (animName.Contains("Beseech"))
{
text = "Talk_1";
this.animID = 38;
}
else if (animName.Contains("Explain"))
{
text = "Talk_1";
this.animID = 39;
}
else if (animName.Contains("Grateful"))
{
text = "Talk_1";
this.animID = 40;
}
this.animator.SetBool("Idle", false);
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
this.FinishAnimation(flag3, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = false;
return;
}
if (animName.Contains("Heard") && !flag4)
{
text = "Heard";
this.animID = 27;
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
this.FinishAnimation(flag3, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = true;
return;
}
if (animName.Contains("Stop"))
{
text = "Walk_end";
this.animID = 23;
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
this.FinishAnimation(flag3, text, animTime, 0);
this.SetAnimatorSpeed(1f);
this.canSwitchBackToIdle = true;
return;
}
if (animName.Contains("Excited"))
{
text = "Excited";
this.animID = 1;
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
this.animator.SetFloat("Excited Variation", this.GetAnimatorVariation(3));
this.FinishAnimation(flag3, text, animTime, 0);
this.SetAnimatorSpeed(1f);
this.canSwitchBackToIdle = true;
return;
}
if (animName.Contains("Charm"))
{
this.animID = 36;
text = "Combat_charm";
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
this.FinishAnimation(false, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = true;
return;
}
if (animName.Contains("Distress"))
{
this.animID = 49;
text = "Distress";
if (this.animID != this.prevAnimID)
{
flag3 = false;
}
this.FinishAnimation(false, text, animTime, 0);
if (!flag3)
{
this.SetAnimatorSpeed(1f);
}
this.canSwitchBackToIdle = true;
return;
}
return;
}
}
}
// Token: 0x0600031E RID: 798 RVA: 0x00045440 File Offset: 0x00043640
public void FinishAnimation(bool same, string mecanimName, float animTime, int restart)
{
if (!same && mecanimName != "" && !this.inactive && this.animator.runtimeAnimatorController != null)
{
if (mecanimName.Contains("Idle") && !this.hasActions)
{
animTime = Random.Range(0f, 1f);
}
if (this.canSwitchBackToIdle)
{
this.body.waitForCrossFadeTime = Time.timeSinceLevelLoad;
}
if (this.animID != 43 && this.animID != 44 && this.animID != 45 && this.animID != 46 && this.animID != 47 && this.animID != 48 && this.animID != 21 && this.animID != 22 && this.animID != 30 && this.animID != 31 && this.animID != 8 && this.animID != 32 && this.animID != 41 && this.animID != 42 && this.animID != 2)
{
float num = 0.03f;
if (this.stats.hasCustomIdle && this.animID == 0)
{
num = 0.1f;
}
this.animator.CrossFadeInFixedTime(mecanimName, num, restart, animTime);
return;
}
this.animator.Play(mecanimName, restart, animTime);
}
}
// Token: 0x0600031F RID: 799 RVA: 0x000455AC File Offset: 0x000437AC
public void PlayFaceAnimation(FaceAnimations.AnimationNames faceAnimName)
{
if (this.body.headAnim && (this.visible == 1 || this.sleeping || this.stunned))
{
if ((this.stunned || this.sleeping) && faceAnimName != FaceAnimations.AnimationNames.Sleep)
{
return;
}
if (this.dead && faceAnimName != FaceAnimations.AnimationNames.Dead)
{
return;
}
this.body.headAnim.PlayAnimation(faceAnimName);
}
}
// Token: 0x06000320 RID: 800 RVA: 0x00045619 File Offset: 0x00043819
public void PlayFaceAnimation(string n)
{
if (this.body.headAnim && this.visible == 1)
{
this.body.headAnim.PlayAnimation(n);
}
}
// Token: 0x06000321 RID: 801 RVA: 0x00045647 File Offset: 0x00043847
public void SetHeadEmotion(string type)
{
if (this.body.headAnim)
{
this.body.headAnim.emotion = type;
}
}
// Token: 0x06000322 RID: 802 RVA: 0x0004566C File Offset: 0x0004386C
public void CircleAnimation(string animationToPlay)
{
if (this.dead)
{
return;
}
if (this.inactive)
{
return;
}
if (this.visible == 0 && (this.npc || Records.x.inOverworldMap))
{
return;
}
if (!this.usingCircles)
{
return;
}
if (!this.circleTr)
{
return;
}
if (this.stunned || (this.isBoro && Records.x.InCombat(false)) || (this.ghost && this.hostility == 0) || !this.usingCircles)
{
if (this.circle.activeSelf)
{
this.circle.SetActive(false);
}
return;
}
if (this.isBoro && this.sailing)
{
return;
}
if (!this.circle.activeSelf && !this.stunned && this.usingCircles)
{
this.circle.SetActive(true);
}
if (this.circle.activeSelf && !this.stunned)
{
if (!this.hovering)
{
this.circleAnimator.SetBool("Hover", false);
}
else
{
this.circleAnimator.SetBool("Hover", true);
}
if (this.npc && Records.x.kill)
{
this.circleAnimator.SetBool("Kill", true);
}
else
{
this.circleAnimator.SetBool("Kill", false);
}
if (this.hovering && !this.centerOfAttention && !this.isTarget && !this.stunned)
{
this.circleAnimator.enabled = true;
this.circleAnimator.Play("Hover");
this.circleAnimator.SetBool("Hover", true);
this.circleAnimator.SetBool("Target", false);
}
else if (this.centerOfAttention && this.hovering && !this.mainSelected && !this.stunned)
{
this.circleAnimator.enabled = true;
this.circleAnimator.Play("Center of Attention");
this.circleAnimator.SetBool("Hover", true);
this.circleAnimator.SetBool("Target", false);
}
else if (this.isTarget && this.hovering && !this.mainSelected && !this.stunned)
{
this.circleAnimator.enabled = true;
this.circleAnimator.Play("Center of Attention");
this.circleAnimator.SetBool("Hover", true);
this.circleAnimator.SetBool("Target", false);
}
else if (this.centerOfAttention && !this.hovering && !this.stunned)
{
this.circleAnimator.enabled = true;
this.circleAnimator.Play("Hover");
this.circleAnimator.SetBool("Hover", false);
this.circleAnimator.SetBool("Target", false);
}
else if (this.isTarget && !this.hovering && !this.stunned)
{
this.circleAnimator.SetBool("Hover", false);
this.circleAnimator.SetBool("Target", true);
this.circleAnimator.enabled = true;
}
else if (this.stunned && !this.isTarget && !this.hovering)
{
this.circleAnimator.enabled = true;
this.circleAnimator.Play("Idle");
if (this.circleAnimator.GetBool("Target"))
{
this.circleAnimator.SetBool("Target", false);
this.circleAnimator.enabled = true;
}
else
{
this.circleAnimator.enabled = false;
}
}
if (animationToPlay != "")
{
this.circleAnimator.enabled = true;
this.circleAnimator.Play(animationToPlay);
}
this.CircleColor(this.fleeing);
}
if (this.npc && this.hostility < 2 && !this.attackingUntilBribe)
{
if (!this.inCombat && !this.hasActions && !this.hovering)
{
this.circleAnimator.enabled = false;
this.circleRenderers[2].enabled = false;
return;
}
this.circleRenderers[2].enabled = true;
}
}
// Token: 0x06000323 RID: 803 RVA: 0x00045A98 File Offset: 0x00043C98
public void CircleColor(bool kiting)
{
int num = this.partyColorID;
for (int i = 0; i < this.circleRenderers.Count - 1; i++)
{
if (this.fleeing || kiting)
{
if (this.isTarget || this.centerOfAttention || this.hovering)
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleFleeTarget;
}
else
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleFlee;
}
}
else if (this.npc)
{
if (this.hostility < 2 && !this.attackingUntilBribe)
{
if (this.hovering)
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleNeutralHover;
}
else if (this.isTarget)
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleNeutralTarget;
}
else if (this.centerOfAttention)
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleNeutralTarget;
}
else
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleNeutral;
}
}
else if (this.radius > 3f)
{
if (this.hovering)
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleLargeEnemyHover;
}
else if (this.isTarget)
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleLargeEnemyTarget;
}
else if (this.centerOfAttention)
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleLargeEnemyTarget;
}
else
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleLargeEnemy;
}
}
else if (this.hovering)
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleEnemyHover;
}
else if (this.isTarget)
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleEnemyTarget;
}
else if (this.centerOfAttention)
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleEnemyAction;
}
else
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleEnemy;
}
}
else if (this.radius > 3f)
{
if (this.selected)
{
if (this.hovering)
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleLargePartyHover;
}
else
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleLargePartySelected;
}
}
else if (this.hovering)
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleLargePartyUnseletedHover;
}
else
{
this.circleRenderers[i].sharedMaterial = Links.x.selectionCircleLargeParty;
}
}
else if (this.selected)
{
if (this.hovering)
{
this.circleRenderers[i].sharedMaterial = Links.x.GetPartyMaterial(num, 3);
}
else if (this.centerOfAttention)
{
this.circleRenderers[i].sharedMaterial = Links.x.GetPartyMaterial(num, 3);
}
else
{
this.circleRenderers[i].sharedMaterial = Links.x.GetPartyMaterial(num, 2);
}
}
else if (this.hovering)
{
this.circleRenderers[i].sharedMaterial = Links.x.GetPartyMaterial(num, 3);
}
else if (this.centerOfAttention)
{
this.circleRenderers[i].sharedMaterial = Links.x.GetPartyMaterial(num, 1);
}
else
{
this.circleRenderers[i].sharedMaterial = Links.x.GetPartyMaterial(num, 0);
}
}
if (this.circleRenderers.Count > 1)
{
if (this.npc && this.hostility < 2 && !this.attackingUntilBribe)
{
if (!this.inCombat && !this.hasActions && !this.hovering)
{
this.circleRenderers[3].enabled = false;
return;
}
}
else
{
this.circleRenderers[3].material.SetFloat("opacity", 0.05f);
this.circleRenderers[3].enabled = true;
this.circleRenderers[3].material.SetColor("_Color", this.circleRenderers[2].sharedMaterial.GetColor("_Color"));
}
}
}
// Token: 0x06000324 RID: 804 RVA: 0x00045F78 File Offset: 0x00044178
public void PlaySoundFX(int fxID, int clipNum)
{
if (clipNum <= 2 && (this.inactive || this.visible == 0))
{
return;
}
float soundVolume = Links.x.options.soundVolume;
if (fxID > 0)
{
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(fxID);
if (pooledGameObject)
{
pooledGameObject.transform.position = this.body.GetFootLower().position - new Vector3(0f, 0.7f, 0f);
if (!pooledGameObject.activeSelf)
{
pooledGameObject.SetActive(true);
}
}
}
if (clipNum < 2 && !this.mainSelected && Time.timeSinceLevelLoad < this.soundTime + 0.25f)
{
clipNum = -1;
}
if (!this.audioSource)
{
return;
}
if (!this.party && (this.visible == 0 || this.inactive))
{
return;
}
if (clipNum > -1)
{
this.soundTime = Time.timeSinceLevelLoad;
string text = "Human";
if (this.stats.animal)
{
text = "Animal";
}
if (clipNum == 7)
{
this.audioSource.clip = Links.x.allSounds.PlaySound(text, this.stats.soundID, clipNum, "");
}
if (clipNum >= 10)
{
if (text == "Human")
{
this.audioSource.clip = Links.x.allSounds.PlaySound("Talking", this.stats.characterRow._VoiceID, clipNum, "");
}
else
{
this.audioSource.clip = Links.x.allSounds.PlaySound(text, this.stats.soundID, 7, "");
}
}
else
{
string text2 = "";
if (clipNum == 0)
{
text2 = this.terrain;
}
this.audioSource.clip = Links.x.allSounds.PlaySound(text, this.stats.soundID, clipNum, text2);
}
if (this.audioSource.clip != null)
{
if (clipNum >= 2)
{
if (!this.npc || clipNum >= 10)
{
this.audioSource.priority = 1;
}
else
{
this.audioSource.priority = 100;
}
if (this.summoned)
{
this.audioSource.volume = Links.x.options.soundVolume / 2f;
}
else if (this.stats.xmlName.Contains("Bakka") || this.stats.xmlName.Contains("Shroomer"))
{
this.audioSource.volume = Links.x.options.soundVolume * 1.5f;
}
else
{
this.audioSource.volume = Links.x.options.soundVolume;
}
}
else
{
if (this.mainSelected)
{
this.audioSource.priority = 1;
}
else
{
this.audioSource.priority = 200;
}
float num = 0.18f;
if (this.party && this.terrain == "Rocks")
{
num = 0.4f;
}
if (this.npc)
{
num *= 1.5f;
}
if (this.stats.Silent() > 0)
{
this.audioSource.volume = Links.x.options.soundVolume * (num / 3f);
}
else
{
this.audioSource.volume = Links.x.options.soundVolume * num;
}
}
if (this.audioSource.enabled && base.gameObject.activeSelf)
{
this.audioSource.Play();
}
}
}
}
// Token: 0x06000325 RID: 805 RVA: 0x00046310 File Offset: 0x00044510
private bool HasPartyAsEnemy()
{
using (List<Character>.Enumerator enumerator = this.lkPlayer.GetEnumerator())
{
while (enumerator.MoveNext())
{
if (enumerator.Current.party)
{
return true;
}
}
}
return false;
}
// Token: 0x06000326 RID: 806 RVA: 0x0004636C File Offset: 0x0004456C
public void SetHealthBarMaterial(bool isKiting)
{
if (!this.healthBar)
{
return;
}
bool flag = this.npc;
}
// Token: 0x06000327 RID: 807 RVA: 0x00046384 File Offset: 0x00044584
public void GetStaminaBar()
{
if (this.npc)
{
bool flag = false;
if (!this.staminaBar && flag)
{
this.staminaBar = Links.x.cellar.GetPooledGameObject(122);
this.staminaBar.SetActive(true);
this.staminaBarTr = this.staminaBar.transform.GetChild(1);
this.staminaBar.transform.localScale = new Vector3(0.4f, 0.4f, 0.4f);
this.staminaBarScale = this.staminaBarTr.localScale;
this.staminaBarScale.z = 0.34f;
this.staminaBarTr.localScale = this.staminaBarScale;
this.staminaBar.transform.GetChild(0).gameObject.SetActive(true);
this.staminaBar.transform.GetChild(1).gameObject.SetActive(true);
this.SetStaminaBarPosition();
this.GetHealthBar();
return;
}
this.CreateStamina();
}
}
// Token: 0x06000328 RID: 808 RVA: 0x00046490 File Offset: 0x00044690
public void GetHealthBar()
{
bool flag = false;
if (this.npc && flag && !this.healthBar)
{
this.healthBar = Links.x.cellar.GetPooledGameObject(65);
this.healthBar.SetActive(true);
this.healthBarTr = this.healthBar.transform.GetChild(1);
this.healthBar.transform.localScale = new Vector3(0.4f, 0.4f, 0.4f);
this.SetHealthBarMaterial(this.fleeing);
this.healthBarScale = this.healthBarTr.localScale;
this.healthBarScale.z = 0.34f;
this.healthBarTr.localScale = this.healthBarScale;
this.healthBar.transform.GetChild(0).gameObject.SetActive(true);
this.healthBar.transform.GetChild(1).gameObject.SetActive(true);
this.SetHealthBarPosition();
}
}
// Token: 0x06000329 RID: 809 RVA: 0x00046598 File Offset: 0x00044798
private void SetDazedPosition()
{
if (!this.dazed)
{
return;
}
if (this.neck == this.body.tr)
{
this.dazed.transform.parent.gameObject.transform.position = this.neck.position + new Vector3(0f, 1.1f, 0f);
}
else
{
this.dazed.transform.parent.gameObject.transform.position = this.neck.position + new Vector3(0f, 1.1f, 0f);
}
if (!this.dazed.transform.parent.gameObject.activeSelf)
{
this.dazed.transform.parent.gameObject.SetActive(true);
}
}
// Token: 0x0600032A RID: 810 RVA: 0x0004668C File Offset: 0x0004488C
private void SetHealthBarPosition()
{
if (!this.healthBar)
{
return;
}
float num = 1.35f;
if (this.neck == this.body.tr)
{
this.healthBar.transform.position = this.body.headBone.position + new Vector3(0f, num, 0f);
return;
}
this.healthBar.transform.position = this.neck.position + new Vector3(0f, num, 0f);
}
// Token: 0x0600032B RID: 811 RVA: 0x0004672C File Offset: 0x0004492C
private void SetRevivalGemPosition()
{
Transform transform = this.revivalGem.gameObject.transform;
transform.position = this.body.headBone.position + new Vector3(0f, 1.5f, 0f);
RaycastHit raycastHit;
if (Physics.Raycast(transform.position + new Vector3(0f, 3f, 0f), Vector3.up * -1f, out raycastHit, 12f, Links.x.floor) && raycastHit.point.y > transform.position.y - 1f)
{
Vector3 position = transform.position;
position.y = raycastHit.point.y + 1.5f;
transform.position = position;
}
}
// Token: 0x0600032C RID: 812 RVA: 0x0004680C File Offset: 0x00044A0C
private void SetSeenPosition()
{
if (this.neck == this.body.tr)
{
this.seen.transform.position = this.body.HeadPosition(0f);
return;
}
this.seen.transform.position = this.neck.position;
}
// Token: 0x0600032D RID: 813 RVA: 0x00046870 File Offset: 0x00044A70
private void SetHeardPosition()
{
if (this.neck == this.body.tr)
{
this.heard.transform.position = this.body.HeadPosition(0f);
return;
}
this.heard.transform.position = this.neck.position;
}
// Token: 0x0600032E RID: 814 RVA: 0x000468D4 File Offset: 0x00044AD4
private void SetStaminaBarPosition()
{
if (!this.staminaBar)
{
return;
}
float num = 1.24f;
if (this.neck == this.body.tr)
{
this.staminaBar.transform.position = this.body.headBone.position + new Vector3(0f, num, 0f);
}
else
{
this.staminaBar.transform.position = this.neck.position + new Vector3(0f, num, 0f);
}
this.SetHealthBarPosition();
}
// Token: 0x0600032F RID: 815 RVA: 0x0004697C File Offset: 0x00044B7C
private void SetHeartPosition()
{
if (!this.heart)
{
return;
}
if (this.neck == this.body.tr)
{
this.heart.transform.position = this.body.headBone.position + new Vector3(0f, 1.75f, 0f);
return;
}
this.heart.transform.position = this.neck.position + new Vector3(0f, 1.75f, 0f);
}
// Token: 0x06000330 RID: 816 RVA: 0x00046A20 File Offset: 0x00044C20
private void SetSelectedPosition()
{
if (!this.bracket)
{
return;
}
if (!this.usingCircles)
{
this.bracket.transform.position = this.tr.position + new Vector3(0f, 0.2f, 0f);
RaycastHit raycastHit;
if (Physics.Raycast(this.tr.position + new Vector3(0f, 3f, 0f), Vector3.up * -1f, out raycastHit, 10f, 4194449))
{
Vector3 normal = raycastHit.normal;
normal.y = Mathf.Clamp(normal.y, 0.97f, 1f);
Quaternion quaternion = Quaternion.FromToRotation(Vector3.up, normal);
this.bracket.transform.rotation = Quaternion.Slerp(this.bracket.transform.rotation, quaternion, Time.deltaTime * 10f);
return;
}
}
else
{
if (this.neck == this.body.tr)
{
this.bracket.transform.position = this.body.HeadPosition(0f) + new Vector3(0f, 1.35f, 0f);
}
else
{
this.bracket.transform.position = this.neck.position + new Vector3(0f, 1.35f, 0f);
}
if (this.selected && !this.bracket.activeSelf)
{
this.bracket.SetActive(true);
}
}
}
// Token: 0x06000331 RID: 817 RVA: 0x00046BD0 File Offset: 0x00044DD0
public void UpdateHealth()
{
if (this.healthBar)
{
float num = (float)this.stats.HealthCurrent() / (float)this.stats.HealthMax();
this.healthBarTr.localScale = new Vector3(this.healthBarScale.x, this.healthBarScale.y, this.healthBarScale.z * num);
float num2 = 0f;
if (this.healthBarTr.localScale.z > 0f)
{
num2 = (this.healthBarTr.localScale.z - this.healthBarScale.x) / 2f * 3.4f;
}
this.healthBarTr.localPosition = new Vector3(num2, this.healthBarTr.localPosition.y, this.healthBarTr.localPosition.z);
}
}
// Token: 0x06000332 RID: 818 RVA: 0x00046CB4 File Offset: 0x00044EB4
public void UpdateStamina()
{
if (this.stamina)
{
this.stamina.UpdateStamina();
}
if (this.staminaBar)
{
float num = this.stats.stamina / this.stats.maxStamina;
this.staminaBarTr.localScale = new Vector3(this.staminaBarScale.x, this.staminaBarScale.y, this.staminaBarScale.z * num);
float num2 = 0f;
if (this.staminaBarTr.localScale.z > 0f)
{
num2 = (this.staminaBarTr.localScale.z - this.staminaBarScale.x) / 2f * 3.4f;
}
this.staminaBarTr.localPosition = new Vector3(num2, this.staminaBarTr.localPosition.y, this.staminaBarTr.localPosition.z);
}
}
// Token: 0x06000333 RID: 819 RVA: 0x00046DAD File Offset: 0x00044FAD
public void ReturnHealthBar()
{
if (this.healthBar)
{
this.healthBar.SetActive(false);
Links.x.cellar.ReturnPooledGameObject(65, this.healthBar);
this.healthBar = null;
}
}
// Token: 0x06000334 RID: 820 RVA: 0x00046DE8 File Offset: 0x00044FE8
public void ReturnStaminaBar()
{
if (this.staminaBar)
{
this.staminaBar.SetActive(false);
Links.x.cellar.ReturnPooledGameObject(122, this.staminaBar);
this.staminaBar = null;
}
if (this.stamina)
{
this.stamina.End();
this.stamina = null;
}
}
// Token: 0x06000335 RID: 821 RVA: 0x00046E4C File Offset: 0x0004504C
public void StartCombat(Character lookAtTarget, bool midAction)
{
this.actionPicked = false;
if (Records.x.turnBased && !midAction)
{
this.ClearMoveTargets();
}
bool flag = false;
if (lookAtTarget)
{
if (lookAtTarget.npc && this.party)
{
flag = true;
}
if (!lookAtTarget.npc && this.npc)
{
flag = true;
}
}
if (Records.x.InCombat(false) && (flag || Links.x.combat.GetNPCCountHostile() > 0) && this.party)
{
if (!Records.x.pocketPause && this.mainSelected && (!Records.x.banquetIsle || (Records.x.banquetIsle && this.stats.partyID > 0)))
{
this.ZeroAttackTime(this.stats.Initiative());
}
else if (!this.mainSelected)
{
this.ZeroAttackTime(this.stats.Initiative());
}
}
if (this.npc)
{
if (this.stats.isLeader && this.creatures)
{
this.creatures.SparkleFriends(this);
}
if (this.bag[18] > 1 && this.stamina && !this.stamina.hasArmor)
{
Library.Inventory invRow = Links.x.library.GetInvRow(this.bag[18]);
this.stamina.SetupArmor(this, Mathf.RoundToInt((float)invRow._DurabilityMax), (int)this.durability[9].x);
}
}
this.walkUsed = 0;
this.overlapping = false;
if (this.hostility < 2 && this.hostility > -1 && this.HasPartyAsEnemy() && !this.attackingUntilBribe && !this.vipFollow)
{
if (this.stats.isGuard && !this.attackingUntilBribe)
{
this.GuardQuip();
}
if (this.stats.animal)
{
this.hostility = 2;
}
else if (!Links.x.sensory.CheckProof(this))
{
this.attackingUntilBribe = true;
}
else
{
this.hostility = 2;
}
}
this.CircleColor(false);
if (lookAtTarget != this)
{
this.lookTarget = lookAtTarget;
}
this.PlayFaceAnimation(FaceAnimations.AnimationNames.Angry);
this.doingAction = false;
if (this.creatures && this.creatures.creatures.mobility == Creatures.mobilityState.IdlesOffGridUntilAttacked)
{
this.stuckInPlace = false;
}
if (this.portrait && this.portrait.skillBag)
{
this.portrait.skillBag.SetSelectedState();
}
if (!this.outsideDome)
{
this.actionNumber = 1f;
}
else
{
this.actionNumber = 0f;
}
if (!this.searching)
{
this.CircleAnimation("");
}
if (!this.searching && Records.x.turnBased)
{
this.StopMoveToRoutine();
}
}
// Token: 0x06000336 RID: 822 RVA: 0x00047130 File Offset: 0x00045330
public void GuardQuip()
{
int num = Random.Range(0, 6);
if (num == 0)
{
this.StartQuip("Lawbreaker!");
}
if (num == 1)
{
this.StartQuip("Knave!");
}
if (num == 2)
{
this.StartQuip("Scoundrel!");
}
if (num == 3)
{
this.StartQuip("Get out!");
}
if (num == 4)
{
this.StartQuip("You're not wanted here!");
}
if (num == 5)
{
this.StartQuip("Felon!");
}
}
// Token: 0x06000337 RID: 823 RVA: 0x0004719C File Offset: 0x0004539C
public void HostileQuip()
{
int num = Random.Range(0, 6);
if (num == 0)
{
this.StartQuip("You'll regret that!");
}
if (num == 1)
{
this.StartQuip("I'll teach you a lesson!");
}
if (num == 2)
{
this.StartQuip("You've a bold face!");
}
if (num == 3)
{
this.StartQuip("What is this?");
}
if (num == 4)
{
this.StartQuip("An outrage!");
}
if (num == 5)
{
this.StartQuip("Unbelievable!");
}
}
// Token: 0x06000338 RID: 824 RVA: 0x00047208 File Offset: 0x00045408
public void GuiltyQuip()
{
int num = Random.Range(0, 2);
if (num == 0)
{
this.StartQuip("Mercy!");
}
if (num == 1)
{
this.StartQuip("I meant no harm!");
}
}
// Token: 0x06000339 RID: 825 RVA: 0x0004722D File Offset: 0x0004542D
public void EndTurn()
{
this.body.lookAtController.EndLook();
this.actionPicked = false;
this.CircleAnimation("");
this.StopMoveToRoutine();
this.doingAction = false;
this.walkUsed = 0;
this.SetNodeID(true, false);
}
// Token: 0x0600033A RID: 826 RVA: 0x00047270 File Offset: 0x00045470
public void StartTurn()
{
this.StopMoveToRoutine();
this.walkUsed = 0;
this.actionPicked = false;
this.CheckInTile();
if (Records.x.turnBased)
{
this.outsideDome = false;
}
if (!this.outsideDome)
{
this.actionNumber = 1f;
}
else
{
this.actionNumber = 0f;
}
this.CircleAnimation("");
}
// Token: 0x0600033B RID: 827 RVA: 0x000472D5 File Offset: 0x000454D5
public void SetMoveBack(Character c)
{
if (this.mainSelected)
{
return;
}
this.moveBackTarget = c;
this.moveBackward = true;
this.animator.SetBool("Backward", true);
}
// Token: 0x0600033C RID: 828 RVA: 0x000472FF File Offset: 0x000454FF
public void MoveBackEmpty()
{
this.moveBackTarget = null;
this.animator.SetBool("Backward", false);
this.moveBackward = false;
}
// Token: 0x0600033D RID: 829 RVA: 0x00047320 File Offset: 0x00045520
public void StopEvading()
{
this.evading = false;
if (this.mainSelected)
{
this.ForceEndJump();
}
}
// Token: 0x0600033E RID: 830 RVA: 0x00047338 File Offset: 0x00045538
public bool InSpecialAttack()
{
bool flag = false;
if (!this.stats)
{
return false;
}
if (this.stats.hasCustomAI && this.hasActions)
{
if (!this.ambushing && this.npc && this.actions && this.actions.ai.jumping)
{
flag = true;
}
if (this.actions && this.actions.chargeUpFX && this.IsCasting(this.body.currentHash))
{
flag = true;
}
if (this.body.currentHash == this.body.special1Hash || this.body.currentHash == this.body.special2Hash)
{
flag = true;
}
}
return flag;
}
// Token: 0x0600033F RID: 831 RVA: 0x0004740C File Offset: 0x0004560C
public bool SpecialAttackTypeNearby(out Vector3 attackNode, Character potentialTarget, out bool dodgeSideways)
{
attackNode = Vector3.zero;
dodgeSideways = false;
if (this.actions.ai.jumping)
{
if (this.actions.ai.jumpNode != null)
{
if (this.actions.chargeUpFX || this.charging)
{
Vector3 closestPointOnFiniteLine = this.actions.ai.GetClosestPointOnFiniteLine(potentialTarget.currentPosition, this.currentPosition, (Vector3)this.actions.ai.jumpNode.position);
if ((closestPointOnFiniteLine - potentialTarget.currentPosition).sqrMagnitude < (this.attackRadius + potentialTarget.attackRadius) * 0.9f * ((this.attackRadius + potentialTarget.attackRadius) * 0.9f))
{
attackNode = closestPointOnFiniteLine;
return true;
}
}
else if (potentialTarget.mainSelected)
{
if (((Vector3)this.actions.ai.jumpNode.position - potentialTarget.currentPosition).sqrMagnitude < 16f)
{
attackNode = (Vector3)this.actions.ai.jumpNode.position;
return true;
}
}
else if (((Vector3)this.actions.ai.jumpNode.position - (Vector3)potentialTarget.node.position).sqrMagnitude < 16f)
{
attackNode = (Vector3)this.actions.ai.jumpNode.position;
return true;
}
}
return false;
}
if (this.actions.chargeUpFX && this.IsCasting(this.body.currentHash) && this.actions.spell != null && this.actions.spell._Name.Contains("Beam"))
{
float num = 9f;
if (this.actions.spell._Name.Contains("FishPoison"))
{
num = 6f;
}
if ((this.currentPosition - potentialTarget.currentPosition).sqrMagnitude < num * Records.x.nodeSize + num * Records.x.nodeSize)
{
Vector3 forward = this.tr.forward;
float num2 = Vector3.Angle(potentialTarget.currentPosition - this.currentPosition, forward);
float num3 = 15f;
if (this.actions.spell._Name.Contains("FishPoison"))
{
num3 = 20f;
}
if (num2 <= num3 && num2 >= num3 * -1f)
{
attackNode = (Vector3)this.node.position;
dodgeSideways = true;
return true;
}
}
}
if ((this.stats.animal || this.npc) && (this.body.currentHash == this.body.special1Hash || this.body.currentHash == this.body.special2Hash))
{
Character target = this.actions.GetTarget();
GraphNode graphNode = null;
if (this.actions.ProjectileCount() == 0 && target)
{
graphNode = target.node;
}
else
{
Projectile firstProjectile = this.actions.GetFirstProjectile();
if (firstProjectile)
{
graphNode = firstProjectile.targetNode;
}
}
if (this.invRow1._MeleeRangeEnd >= 5f && graphNode != null)
{
int ammoIndex = this.GetAmmoIndex(this.invRow1);
if (ammoIndex > -1)
{
Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(this.GetInvNum(ammoIndex));
if (invRowByIndex._DmgMax <= 0 && invRowByIndex._Effect != "")
{
float num4 = 2f;
if (invRowByIndex._Effect == "FishPoison")
{
num4 = 2f;
}
if (((Vector3)graphNode.position - potentialTarget.currentPosition).sqrMagnitude < num4 * Records.x.nodeSize + num4 * Records.x.nodeSize)
{
attackNode = (Vector3)graphNode.position;
return true;
}
}
}
}
}
return false;
}
// Token: 0x06000340 RID: 832 RVA: 0x0004785C File Offset: 0x00045A5C
public void EndCombat()
{
this.actionPicked = false;
this.MoveBackEmpty();
this.PlayFaceAnimation(FaceAnimations.AnimationNames.Smile);
this.body.Dodge(false);
if (this.animID != 50)
{
this.stats.pinned = false;
this.stats.pinning = false;
}
this.SetStagger(0);
if (this.party)
{
this.stats.ClearSynergies();
}
if (this.raycastModifier)
{
Links.x.gameplay.RemoveAbilityInfo();
}
if (this.creatures)
{
this.creatures.ReturnFromCombat();
}
this.walkUsed = 0;
if (this.npc)
{
this.animator.SetBool("Combat", false);
}
this.animator.SetFloat("Combat Variation", 1f);
this.outsideDome = false;
this.inQueuedAbility = false;
this.moveOnTiles = false;
this.overlapping = false;
this.doingAction = false;
this.inAction = false;
this.inRecovery = false;
this.centerOfAttention = false;
this.CircleAnimation("");
this.waitingToJoinDome = false;
this.ReturnStaminaBar();
this.stats.attackCount = 0;
if (this.party)
{
this.stats.ClearSynergies();
}
if (this.portrait && this.portrait.skillBag)
{
this.portrait.skillBag.SetSelectedState();
}
if (this.dodging)
{
this.EndDodge();
}
if (this.stats.pinning)
{
this.stats.HealEffect("Pinning");
this.stats.pinning = false;
}
if (this.party && this.portrait)
{
this.portrait.skillBag.SetTrinketGrid(false);
}
}
// Token: 0x06000341 RID: 833 RVA: 0x00047A2C File Offset: 0x00045C2C
public void HoverIn()
{
if (!this.hovering)
{
if (this.dead || (this.party && this.stunned))
{
return;
}
this.hovering = true;
this.CircleAnimation("");
Links.x.GetCharacterTextColor(this);
if (!Links.x.fellowship.drawingSquare)
{
Links.x.tooltip.character = this;
}
if (this.timelineIcon)
{
this.timelineIcon.Hover(true);
}
if (this.portrait)
{
this.portrait.HoverFromCharacter(true);
}
}
}
// Token: 0x06000342 RID: 834 RVA: 0x00047AD0 File Offset: 0x00045CD0
public void HoverOut(bool useDelay)
{
this.hovering = false;
this.CircleAnimation("");
if (this.portrait)
{
this.portrait.HoverFromCharacter(false);
}
if (this.timelineIcon)
{
this.timelineIcon.Hover(false);
}
}
// Token: 0x06000343 RID: 835 RVA: 0x00047B24 File Offset: 0x00045D24
public void OutOfAmmoMessage()
{
if (Time.timeSinceLevelLoad > this.ammoMessageTime + 30f)
{
this.ammoMessageTime = Time.timeSinceLevelLoad;
string ammo = this.invRow1._Ammo1;
string text = "";
this.str.Clear();
if (ammo.Contains("Arrow"))
{
text = "arrows";
}
else if (ammo.Contains("Dart"))
{
text = "stones";
}
else if (ammo.Contains("Vial"))
{
text = "elyxirs";
}
if (text.Contains("dart"))
{
text = "stones";
}
if (text != "")
{
this.str.Append(Links.x.gameFeed.GetPartyColorText(this));
this.str.Append(this.stats.GetName());
this.str.Append("</color>");
this.str.Append(" is ");
this.str.Append(" out of ");
this.str.Append(text);
this.StartQuip("Out of " + text + "!");
}
}
}
// Token: 0x06000344 RID: 836 RVA: 0x00047C59 File Offset: 0x00045E59
public void EndQuip()
{
if (!this.quip)
{
return;
}
this.quip.End();
this.quip = null;
this.quipStartTime = -1f;
}
// Token: 0x06000345 RID: 837 RVA: 0x00047C86 File Offset: 0x00045E86
public void StartQuipAlways(string text)
{
this.Quip(text);
}
// Token: 0x06000346 RID: 838 RVA: 0x00047C90 File Offset: 0x00045E90
public void StartQuip(string text)
{
if (Records.x.paused || (Records.x.pocketPause && !this.mainSelected) || !Links.x.hasMain)
{
return;
}
if (Links.x.rtsCamera.currentBoundsName != "" && this.indoorID != Links.x.rtsCamera.currentBoundsName)
{
return;
}
if (text == "" || this.sleeping || this.inactive || (!this.ignoreRemoveControls && Links.x.gaia.loadingCharacterCreation) || (!this.mainSelected && this.indoorID != Links.x.main.indoorID))
{
return;
}
if (!this.setupComplete)
{
return;
}
if (!this.IsSentient())
{
return;
}
this.Quip(text);
}
// Token: 0x06000347 RID: 839 RVA: 0x00047D78 File Offset: 0x00045F78
private void Quip(string text)
{
if (text == "NPC Heard")
{
if (!Links.x.AllDead() && !Records.x.miniGame && !this.seen && (!Records.x.combat || (Records.x.combat && !Links.x.combat.npcOnlyCombat)))
{
if (!this.heard)
{
this.heard = Links.x.cellar.GetPooledGameObject(22);
this.heard.SetActive(true);
this.SetHeardPosition();
this.RotateEffects();
}
if (Time.timeSinceLevelLoad < this.timeSinceHeardTime + 10f && this.timeSinceHeardTime > 0f)
{
return;
}
this.PlaySoundFX(0, 7);
this.timeSinceHeardTime = Time.timeSinceLevelLoad;
text = Links.x.quips.GetQuip("Heard", this.quipIndex);
}
return;
}
if (text == "NPC Seen")
{
if (!this.seen && !Records.x.miniGame && (!Records.x.combat || (Records.x.combat && !Links.x.combat.npcOnlyCombat)) && !Links.x.AllDead())
{
this.seen = Links.x.cellar.GetPooledGameObject(23);
this.seen.SetActive(true);
this.SetSeenPosition();
this.seenTime = Time.timeSinceLevelLoad;
this.RotateEffects();
}
if (Time.timeSinceLevelLoad < this.timeSinceSeenTime + 10f && this.timeSinceSeenTime > 0f)
{
return;
}
if (!Records.x.miniGame)
{
if (this.heard)
{
Links.x.cellar.ReturnPooledGameObject(22, this.heard);
this.heard.SetActive(false);
this.heard = null;
}
this.PlaySoundFX(0, 7);
this.timeSinceSeenTime = Time.timeSinceLevelLoad;
text = Links.x.quips.GetQuip("Seen", this.quipIndex);
}
return;
}
else
{
if (this.ghost || this.stats.animal)
{
return;
}
if (text == "Scared")
{
text = Links.x.quips.GetQuip("Scared", this.quipIndex);
if (text == "")
{
this.PlaySoundFX(0, 7);
return;
}
}
if (text == "Found Item")
{
text = Links.x.quips.GetQuip("Found Item", this.quipIndex);
if (text == "")
{
this.PlaySoundFX(0, 7);
return;
}
}
if (this.quip)
{
this.quip.gameObject.SetActive(false);
this.quip.End();
this.quip = null;
this.quipStartTime = -1f;
}
this.quip = Links.x.cellar.GetQuip();
if (!this.quip)
{
return;
}
if (text == "")
{
return;
}
if (this.quip)
{
this.quip.menu = false;
TextMeshProUGUI component = this.quip.gameObject.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>();
component.text = "";
Vector3 localPosition = this.quip.transform.transform.localPosition;
int length = text.Length;
component.text = text;
string text2 = "";
int num = 0;
int length2 = text.Length;
int num2 = 24;
foreach (char c in text)
{
if (num > num2 && c.ToString() == " ")
{
num = 0;
text2 += "\n";
}
num++;
text2 += c.ToString();
}
component.text = text2;
if (this.quipSound == -1)
{
this.quipSound = 11;
}
Links.x.sensory.LookAtObject(this.body.headBone, 15f, false, this, 3f, 1f, null, 0);
component.enabled = true;
if (Records.x.removeControls || (Records.x.dialogue && this.party) || (Records.x.miniGame && this.party) || this.party)
{
if (this.quip.transform.parent != Links.x.hudControl.quipHolderCinematic)
{
this.quip.transform.SetParent(Links.x.hudControl.quipHolderCinematic, true);
}
}
else if (this.quip.transform.parent != Links.x.hudControl.miscFolderQuipsTransform)
{
this.quip.transform.SetParent(Links.x.hudControl.miscFolderQuipsTransform, true);
}
this.quip.emphasize = this.emphasizeQuip;
this.quip.Setup(this.body);
component.text = text2;
this.quipStartTime = Time.time;
TextMeshProTypewriterEffect textMeshProTypewriterEffect = this.quip.transform.GetChild(0).gameObject.GetComponent<TextMeshProTypewriterEffect>();
if (!textMeshProTypewriterEffect)
{
textMeshProTypewriterEffect = this.quip.transform.GetChild(0).gameObject.AddComponent<TextMeshProTypewriterEffect>();
}
if (textMeshProTypewriterEffect)
{
this.quip.typewriter = textMeshProTypewriterEffect;
textMeshProTypewriterEffect.headAnimator = this.body.headAnim;
if (this.body.lookAtController.thisTarget)
{
textMeshProTypewriterEffect.lookAt = this.body.lookAtController.thisTarget.gameObject;
}
textMeshProTypewriterEffect.soundVolume = Links.x.options.soundVolume;
if (Records.x.removeControls)
{
textMeshProTypewriterEffect.soundVolume *= 2f;
}
textMeshProTypewriterEffect.audioIndex = this.stats.voiceID;
}
this.quip.gameObject.SetActive(true);
this.quip.textSize = new Vector2(component.preferredWidth, component.preferredHeight);
if (this.party)
{
this.str.Clear();
this.str.Append(Links.x.gameFeed.GetPartyColorText(this));
this.str.Append(this.stats.GetName());
this.str.Append("</color>");
this.str.Append(": '");
this.str.Append(text);
this.str.Append("'");
Links.x.gameFeed.AddFeed(this.str.ToString());
}
this.emphasizeQuip = false;
}
return;
}
}
// Token: 0x06000348 RID: 840 RVA: 0x00048494 File Offset: 0x00046694
public bool DoPatrolRotate()
{
return !this.vipFollow && !this.sailing && !Records.x.miniGame && !this.summoned && this.npc && this.nodePath.Count == 0 && !this.moving && !this.isHit && !this.downed && !this.resting && !this.dead && !this.turning && !this.stunned && !this.sleeping && !this.missing && this.CheckControls() && ((Records.x.turnBased && !this.doingAction) || !Records.x.turnBased) && !Records.x.dialogue && !this.inCombat && !Records.x.dialogue && !Links.x.gaia.loadingCharacterCreation && (!Records.x.removeControls || (Records.x.removeControls && this.ignoreRemoveControls)) && (!this.creatures || !this.creatures.creatures.neverRotate);
}
// Token: 0x06000349 RID: 841 RVA: 0x000485F0 File Offset: 0x000467F0
public void PatrolRotate()
{
this.justMoved = false;
if (this.stats.merchant && !Links.x.main.body.sneaking)
{
this.SetRotation(Quaternion.LookRotation(Links.x.main.currentPosition - this.tr.position), false, false);
}
else if (this.rotLeft)
{
this.rotLeft = false;
Quaternion quaternion = Quaternion.LookRotation(this.tr.position + this.tr.right * -3f - this.tr.position);
Quaternion quaternion2 = Quaternion.LookRotation(this.tr.position + this.tr.forward * 3f - this.tr.position);
Quaternion.Slerp(quaternion, quaternion2, 0.3f);
Random.Range(0, 2);
if (this.alwaysLookAtParty)
{
Quaternion quaternion3 = Quaternion.LookRotation(Links.x.main.tr.position - this.tr.position);
this.SetRotation(quaternion3, true, false);
}
else
{
this.SetRotation(Quaternion.LookRotation(this.tr.position + this.tr.right * -3f - this.tr.position), false, false);
}
}
else
{
this.rotLeft = true;
Quaternion quaternion4 = Quaternion.Euler(this.tr.right);
Quaternion quaternion5 = Quaternion.Euler(this.tr.forward);
Quaternion.Slerp(quaternion4, quaternion5, 0.25f);
Random.Range(0, 2);
if (this.alwaysLookAtParty)
{
Quaternion quaternion6 = Quaternion.LookRotation(Links.x.main.tr.position - this.tr.position);
this.SetRotation(quaternion6, true, false);
}
else
{
this.SetRotation(Quaternion.LookRotation(this.tr.position + this.tr.right * 3f - this.tr.position), false, false);
}
}
this.patrolSpeed = Random.Range(0.5f, 0.8f);
this.GetPatrolHoldTime(false);
}
// Token: 0x0600034A RID: 842 RVA: 0x0004885C File Offset: 0x00046A5C
public bool Knockback(Vector3 attackPosition, int tileDistance, bool predictOnly, bool fromHit, bool flyback)
{
if (this.sailing)
{
return false;
}
if (this.node == null || this.dead || this.stunned || this.slideNode != null)
{
return true;
}
if (this.jumping || this.isHit)
{
return false;
}
Vector3 vector = this.tr.position + Quaternion.LookRotation(this.tr.position - attackPosition) * Vector3.forward * 2.5f * 1f;
this.nodeConstraint.checkConnections = this.ConnectionNumber();
bool flag = false;
if (this.ghost)
{
this.nodeConstraint.constrainToEnvironment = 0;
tileDistance = 6;
flag = true;
}
bool flag2 = true;
if (this.ignoreNodeIDs)
{
flag2 = false;
}
GraphNode graphNode = this.GetSlideNode(vector, this.node, flag2, this.CheckCircleID(), 0);
if (graphNode != null && tileDistance > 1)
{
Vector3 vector2 = Quaternion.LookRotation(this.tr.position - attackPosition) * Vector3.forward;
vector = (Vector3)graphNode.position + vector2 * 2.5f * 2f;
GraphNode graphNode2 = this.GetSlideNode(vector, graphNode, flag2, this.CheckCircleID(), 0);
if (graphNode2 != null && !flag)
{
graphNode = graphNode2;
if (tileDistance > 2 && !flag)
{
vector = this.tr.position + vector2 * 2.5f * 3f;
GraphNode graphNode3 = this.GetSlideNode(vector, graphNode2, flag2, this.CheckCircleID(), 0);
if (graphNode3 != null)
{
graphNode = graphNode3;
if (tileDistance > 3 && !flag)
{
vector = this.tr.position + vector2 * 2.5f * 4f;
GraphNode graphNode4 = this.GetSlideNode(vector, graphNode3, flag2, this.CheckCircleID(), 0);
if (graphNode4 != null)
{
graphNode = graphNode4;
if (tileDistance > 4 && !flag)
{
vector = this.tr.position + vector2 * 2.5f * 5f;
GraphNode graphNode5 = this.GetSlideNode(vector, graphNode4, flag2, this.CheckCircleID(), 0);
if (graphNode5 != null)
{
graphNode = graphNode5;
if (tileDistance > 5 && !flag)
{
vector = this.tr.position + vector2 * 2.5f * 6f;
GraphNode graphNode6 = this.GetSlideNode(vector, graphNode5, flag2, this.CheckCircleID(), 0);
if (graphNode6 != null)
{
graphNode = graphNode6;
}
}
}
}
}
}
}
}
}
}
if (graphNode == null || this.stats.Stuck() != 0 || this.jumping || this.stats.pinning || this.stats.pinning || (((Vector3)graphNode.position - this.tr.position).sqrMagnitude >= 25f && tileDistance <= 1) || !PathUtilities.IsPathPossible(graphNode, this.node))
{
return false;
}
if (predictOnly)
{
return true;
}
this.randomRot = Vector3.zero;
this.randomRot.x = Random.Range(5f, 6f);
if (Random.Range(0, 2) == 0)
{
this.randomRot.x = this.randomRot.x * -1f;
}
this.randomRot.y = Random.Range(5f, 6f);
if (Random.Range(0, 2) == 0)
{
this.randomRot.y = this.randomRot.y * -1f;
}
this.randomRot.z = Random.Range(5f, 6f);
if (Random.Range(0, 2) == 0)
{
this.randomRot.z = this.randomRot.z * -1f;
}
this.slideNode = graphNode;
if (Records.x.editor)
{
Debug.Log(((this != null) ? this.ToString() : null) + " sliding " + ((Vector3)this.slideNode.position).ToString());
}
this.slideNodePosition = (Vector3)this.slideNode.position;
this.ttime = 0f;
this.prevPoint = this.tr.position;
this.prevNodePosition = this.tr.position;
this.sphere.transform.position = (Vector3)this.slideNode.position;
this.ClearNodePath();
this.ClaimNode(graphNode, (Vector3)graphNode.position, false);
if (fromHit)
{
Vector3 vector3 = (Vector3)graphNode.position;
if (this.tr.position != (Vector3)graphNode.position)
{
this.SetRotation(Quaternion.LookRotation(this.tr.position - new Vector3(vector3.x, this.tr.position.y, vector3.z)), true, false);
}
this.PlayAnimation("Hit", 0f);
this.SetAnimatorSpeed(1f);
}
else
{
if (!this.isHit)
{
this.PlayAnimation("Stop", 0f);
}
this.SetAnimatorSpeed(1f);
}
return true;
}
// Token: 0x0600034B RID: 843 RVA: 0x00048DA4 File Offset: 0x00046FA4
public void Sleep(Quaternion sleepRotation)
{
if (this.NodesCount() > 0)
{
this.TargetReached();
}
this.sleeping = true;
if (this.turning)
{
this.EndTurning(false);
}
this.AddEffect(40, "");
this.PlayAnimation("Hit Down", 0f);
this.updateCount = 10;
this.SetRotation(sleepRotation, false, true);
this.PlayFaceAnimation(FaceAnimations.AnimationNames.Sleep);
}
// Token: 0x0600034C RID: 844 RVA: 0x00048E10 File Offset: 0x00047010
public void WakeUp()
{
this.sleeping = false;
if (this.body.currentHash == this.body.hitDownHash || this.animator.GetCurrentAnimatorStateInfo(0).IsName("Hit_down_start"))
{
this.PlayAnimation("GetUp", 0f);
}
this.PlaySoundFX(1, 0);
this.PlayFaceAnimation(FaceAnimations.AnimationNames.Blink);
this.RemoveEffect(40, "", true);
}
// Token: 0x0600034D RID: 845 RVA: 0x00048E84 File Offset: 0x00047084
public void Fall(int totalFallTime)
{
this.downed = true;
if (this.turning)
{
this.EndTurning(false);
}
if (!this.jumping)
{
this.PlayAnimation("Hit Down", 0f);
}
if (!this.stats.animal)
{
this.PlaySoundFX(1, 4);
}
else
{
this.PlaySoundFX(1, 8);
}
if (!this.stunGauge && !this.dead)
{
if ((float)totalFallTime > 50f)
{
this.stunGauge = Links.x.cellar.GetGauge();
if (this.stunGauge)
{
this.stunGauge.Setup("Stun", this, (float)totalFallTime);
}
}
}
else if (this.stunGauge)
{
this.stunGauge.UpdateTime((float)totalFallTime);
}
if (this.quip)
{
this.quip.EndFinal();
this.quip = null;
}
if (this.actions)
{
this.actions.Interrupt();
}
this.PlayFaceAnimation(FaceAnimations.AnimationNames.Sleep);
if (!this.dead)
{
bool flag = this.stunned;
}
if (this.moving)
{
this.TargetReached();
}
}
// Token: 0x0600034E RID: 846 RVA: 0x00048FAC File Offset: 0x000471AC
public void GetUp()
{
this.downed = false;
if (this.animID == 8 || this.body.currentHash == this.body.downHash || this.body.currentHash == this.body.downStartHash)
{
this.PlayAnimation("GetUp", 0f);
}
this.PlaySoundFX(1, 0);
this.RemoveStun();
this.PlayFaceAnimation(FaceAnimations.AnimationNames.Blink);
if (this.hasActions)
{
this.actions.EndTurn(true);
}
}
// Token: 0x0600034F RID: 847 RVA: 0x00049034 File Offset: 0x00047234
public void SetStagger(int t)
{
if (t > 0)
{
if (!this.dead)
{
if (!this.dazedGauge)
{
this.dazedGauge = Links.x.cellar.GetGauge();
this.dazedGauge.Setup("Dazed", this, (float)t);
return;
}
this.dazedGauge.UpdateTime((float)t);
return;
}
}
else if (this.dazedGauge)
{
this.EndGauge("Dazed");
}
}
// Token: 0x06000350 RID: 848 RVA: 0x000490AC File Offset: 0x000472AC
public void RemoveStun()
{
if (this.stunGauge)
{
Links.x.cellar.ReturnGauge(this.stunGauge);
this.stunGauge = null;
}
if (this.party && this.portrait)
{
this.portrait.skillBag.SetTrinketGrid(false);
}
}
// Token: 0x06000351 RID: 849 RVA: 0x00049108 File Offset: 0x00047308
public void SetupSneakGauge(int duration)
{
if (!this.sneakGauge && !this.dead && !this.stunned)
{
this.sneakGauge = Links.x.cellar.GetGauge();
this.sneakGauge.Setup("Sneak", this, (float)duration);
}
}
// Token: 0x06000352 RID: 850 RVA: 0x0004915A File Offset: 0x0004735A
public bool CheckLights(bool checkOnly)
{
return false;
}
// Token: 0x06000353 RID: 851 RVA: 0x00049160 File Offset: 0x00047360
public void EndSneak(bool showMessage, bool fromLight)
{
this.EndGauge("Sneak");
if (showMessage)
{
this.str.Clear();
if (!this.npc)
{
this.str.Append(Links.x.gameFeed.GetPartyColorText(this));
}
this.str.Append(this.stats.GetName());
if (!this.npc)
{
this.str.Append("</color>");
}
if (fromLight)
{
this.str.Append(" revealed by light");
}
else
{
this.str.Append(" revealed");
}
Links.x.gameFeed.AddFeed(this.str.ToString());
Animator animatedText = Links.x.cellar.GetAnimatedText("", "Revealed", false);
animatedText.gameObject.transform.position = this.body.headBone.position + new Vector3(Random.Range(0f, 2f), Random.Range(0f, 2f), 0f);
animatedText.gameObject.SetActive(true);
}
}
// Token: 0x06000354 RID: 852 RVA: 0x00049294 File Offset: 0x00047494
public void EndGauge(string gaugeType)
{
if (gaugeType == "Stun")
{
if (this.stunGauge)
{
Links.x.cellar.ReturnGauge(this.stunGauge);
this.stunGauge = null;
return;
}
}
else
{
if (gaugeType == "Dazed")
{
Links.x.cellar.ReturnGauge(this.dazedGauge);
this.dazedGauge = null;
return;
}
if (gaugeType == "Item")
{
Links.x.cellar.ReturnGauge(this.itemGauge);
this.itemGauge = null;
if (this.hasActions)
{
this.actions.cannotInterrupt = false;
if (Records.x.ai == 1)
{
Links.x.combat.GetNextAction(this);
}
}
this.inventoryTime = 0f;
return;
}
Links.x.cellar.ReturnGauge(this.sneakGauge);
this.sneakGauge = null;
this.body.Sneaking(false);
}
}
// Token: 0x06000355 RID: 853 RVA: 0x00049394 File Offset: 0x00047594
public void PartyResurrect(int healing)
{
this.dead = false;
this.stunned = false;
this.body.dead = false;
this.body.SetLayer(6);
this.thisCollider.enabled = true;
this.CreateObjects();
Links.x.ChangeDeadList(this, false);
base.gameObject.layer = 6;
base.enabled = true;
if (healing == -1)
{
healing = Random.Range(Mathf.RoundToInt((float)this.stats.HealthMax() / 20f), Mathf.RoundToInt((float)this.stats.HealthMax() / 10f));
}
this.stats.SetHealth(healing, true);
this.PlayAnimation("GetUp", 0f);
if ((Links.x.main.tr.position - this.tr.position).sqrMagnitude > 900f)
{
Links.x.fellowship.JumpPosition(Links.x.main, Links.x.GetPartyID(this), this);
}
else
{
GraphNode graphNode = this.NearNode(this.tr.position, true, 0, -1, 0);
this.FirstPosition(graphNode);
}
this.inAction = false;
this.inRecovery = false;
this.inQueuedAbility = false;
this.portrait.SetHealthColor();
this.CircleAnimation("");
this.RemoveEffect(9, "", true);
if (this.party)
{
this.portrait.skillBag.SetTrinketGrid(false);
}
if (this.revivalGem)
{
Links.x.cellar.ReturnPooledGameObject(123, this.revivalGem.gameObject);
this.revivalGem = null;
}
if (Records.x.combat)
{
Links.x.combat.GivePartyActions(this, false);
}
}
// Token: 0x06000356 RID: 854 RVA: 0x00049564 File Offset: 0x00047764
public void DropEverything()
{
int count = this.bag.Count;
for (int i = 0; i < count; i++)
{
if (i % 2 == 0 && this.bag[i] > 1 && Links.x.library.GetInvRow(this.bag[i])._ArmorID != -1)
{
int num = -1;
if (this.node != null)
{
num = (int)this.node.Area;
}
global::Item item = Links.x.inventory.groundBag.DropLoot(this.bag[i], this.bag[i + 1], this.sockets[i], this.sockets[i + 1], this.durability[i / 2], this, this.tr.position + new Vector3(Random.Range(-4f, 4f), 0f, Random.Range(-4f, 4f)), true, false, num);
if (item)
{
Vector3 vector = this.tr.position + new Vector3(Random.Range(-4f, 4f), 0f, Random.Range(-4f, 4f));
RaycastHit raycastHit;
if (Physics.Linecast(vector + new Vector3(0f, 10f, 0f), vector - new Vector3(0f, 20f, 0f), out raycastHit, 4194305))
{
item.tr.position = raycastHit.point;
}
else
{
item.tr.position = new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-1f, 1f));
}
}
}
}
this.inventoryBag.EmptyItems();
}
// Token: 0x06000357 RID: 855 RVA: 0x00049754 File Offset: 0x00047954
private void DropLoot()
{
if (this.ghost || this.droppedItems)
{
if (this.stats.animal)
{
return;
}
if (!this.stats.xmlName.Contains("RobberBaron"))
{
return;
}
}
if (this.movesOnWater)
{
return;
}
this.droppedItems = true;
for (int i = 0; i < 18; i++)
{
if (this.equippedItems[i])
{
Object.Destroy(this.equippedItems[i]);
this.equippedItems[i] = null;
}
}
CreatureActions creatureActions = null;
if (this.sailing && this.npc && this.creatures.creatureBoat && this.creatures.creatureBoat.leadCreature)
{
creatureActions = this.creatures.creatureBoat.leadCreature.gameObject.GetComponent<CreatureActions>();
}
int count = this.bag.Count;
for (int j = 0; j < count; j++)
{
if (j % 2 == 0 && this.bag[j] > 1 && this.durability[j / 2].x >= 0f)
{
Library.Inventory invRow = Links.x.library.GetInvRow(this.bag[j]);
if (invRow._ArmorID != -1)
{
bool flag = this.IsSpecialItem(invRow, j);
if (this.bag[j] == 2)
{
flag = true;
}
bool flag2 = true;
int num = 3;
if (this.stats.animal)
{
num = 7;
}
if (Random.Range(0, num) != 0)
{
flag2 = false;
}
if (flag)
{
flag2 = true;
}
if (invRow._DisplayName == "Severed Head")
{
flag2 = this.dead;
}
if (flag2)
{
if ((float)this.bag[j + 1] > 5f && this.npc)
{
int num2 = this.bag[j + 1];
this.bag[j + 1] = 5 + (int)Mathf.Round((float)num2 / 20f);
}
int num3 = this.bag[j + 1];
if (j == 8 || j == 10 || j == 12 || j == 14 || j == 26 || j == 28)
{
num3 = Random.Range(1, invRow._MaxStackSize / 4);
}
if (this.sailing && this.npc)
{
creatureActions.AddDroppedItemToList(this.bag[j], num3, (int)this.sockets[j].x, (int)this.sockets[j].y, (int)this.sockets[j].z, (int)this.sockets[j + 1].x, (int)this.sockets[j + 1].y, (int)this.sockets[j + 1].z, (int)this.durability[j / 2].x, (int)this.durability[j / 2].y);
}
else
{
Vector4 vector = this.durability[j / 2];
if (j == 18)
{
vector.x *= 2f;
}
int num4 = -1;
if (this.node != null)
{
num4 = (int)this.node.Area;
}
global::Item item = Links.x.inventory.groundBag.DropLoot(this.bag[j], num3, this.sockets[j], this.sockets[j + 1], vector, this, this.tr.position + new Vector3(Random.Range(-4f, 4f), 0f, Random.Range(-4f, 4f)), true, false, num4);
if (item)
{
Vector3 vector2 = this.tr.position + new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-1f, 1f));
RaycastHit raycastHit;
if (Physics.Linecast(vector2 + new Vector3(0f, 10f, 0f), vector2 - new Vector3(0f, 20f, 0f), out raycastHit, 4194305))
{
item.tr.position = raycastHit.point;
}
else
{
item.tr.position += new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-1f, 1f));
}
}
}
this.bag[j] = 0;
this.bag[j + 1] = 0;
this.sockets[j] = Vector3.zero;
this.sockets[j + 1] = Vector3.zero;
this.durability[j / 2] = Vector4.zero;
}
}
}
}
}
// Token: 0x06000358 RID: 856 RVA: 0x00049C58 File Offset: 0x00047E58
private bool IsSpecialItem(Library.Inventory row, int rowNum)
{
bool flag = true;
if (row._Tag.Contains("Component"))
{
flag = false;
}
return flag;
}
// Token: 0x06000359 RID: 857 RVA: 0x00049C7C File Offset: 0x00047E7C
public int SellPriceOfDrops()
{
int count = this.bag.Count;
int num = 0;
for (int i = 0; i < count; i++)
{
if (i % 2 == 0 && this.bag[i] > 1 && this.durability[i / 2].x >= 0f)
{
Library.Inventory invRow = Links.x.library.GetInvRow(this.bag[i]);
if (invRow._ArmorID != -1 && (this.IsSpecialItem(invRow, i) || Random.Range(0, 3) == 0))
{
int num2 = this.bag[i + 1];
if (num2 == 0)
{
num2 = 1;
}
if (i == 8 || i == 10 || i == 12 || i == 14 || i == 26 || i == 28)
{
num2 = Random.Range(1, invRow._MaxStackSize / 4);
}
if (!invRow._Stackable)
{
num2 = 1;
}
if (invRow._NeedFullStack)
{
num2 = 0;
}
int num3 = invRow._SellPrice * num2;
num += num3;
Debug.Log(string.Concat(new string[]
{
(this != null) ? this.ToString() : null,
" sell ",
invRow._Name,
" amount ",
num2.ToString(),
" for ",
num3.ToString()
}));
}
}
}
return num;
}
// Token: 0x0600035A RID: 858 RVA: 0x00049DE0 File Offset: 0x00047FE0
public void EndStun()
{
this.stunned = false;
this.ignoreNodeIDs = false;
if (!this.tr)
{
this.tr = base.transform;
}
if (this.sailing && this.npc)
{
Debug.Log(this.boat);
if (this.boat && !this.boat.navigator)
{
this.boat.SetBoatNavigator(this, false);
}
}
this.FirstPosition(null);
this.PlayAnimation("GetUp", 0f);
this.stats.state = "NormalDazed";
this.PlaySoundFX(0, 0);
this.stats.SetHealth(this.stats.HealthMax(), false);
if (this.creatures)
{
this.creatures.UpdateCharacter(this);
}
this.CircleAnimation("Idle");
this.wasStunned = true;
if (this.thisCollider)
{
this.thisCollider.enabled = true;
}
if (this.party)
{
this.stats.SetHealth((int)((float)this.stats.HealthMax() / 2f), false);
}
if (this.npc)
{
if (this.creatures)
{
this.creatures.CheckQuestSwap();
}
this.EndStunLoot();
this.SetupNPCAfterLoadedVariables();
Links.x.diorama.HasForSaleGroundItems(this.creatures.creatures);
}
this.droppedItems = false;
}
// Token: 0x0600035B RID: 859 RVA: 0x00049F5C File Offset: 0x0004815C
public void EndStunLoot()
{
if (this.ghost)
{
return;
}
if (this.sailing)
{
return;
}
List<int> savedBag = this.stats.savedBag;
List<Vector4> savedDur = this.stats.savedDur;
for (int i = 0; i < savedBag.Count; i++)
{
if (i % 2 == 0 && savedBag[i] > 1 && savedDur[i / 2].x >= 0f && !this.sailing)
{
int num = savedBag[i];
global::Item item = Links.x.diorama.CheckGroundForItem(this.creatures.creatures, this.creatures.GetCharacterIndex(this), num, this.tr.position, this, i);
if (item)
{
this.bag[i] = item.ID;
this.bag[i + 1] = item.stackSize;
this.durability[i / 2] = item.durability;
this.sockets[i] = item.socketA;
this.sockets[i + 1] = item.socketB;
item.DestroyItem(false, false);
}
else
{
if (i == 0 || i == 32)
{
this.bag[i] = 1;
this.durability[i / 2] = new Vector4(100f, 0f, 0f, 0f);
}
else
{
this.bag[i] = 0;
this.durability[i / 2] = Vector4.zero;
}
this.sockets[i] = Vector3.zero;
this.sockets[i + 1] = Vector3.zero;
this.bag[i + 1] = 0;
}
}
}
}
// Token: 0x0600035C RID: 860 RVA: 0x0004A130 File Offset: 0x00048330
public void Stunned(bool fromSave)
{
this.stunned = true;
if (this.hasActions)
{
this.EndCombat();
this.actions.EndActions();
}
if (this.moving)
{
this.TargetReached();
}
if (this.turning)
{
this.EndTurning(false);
}
this.ignoreNodeIDs = false;
if (this.party)
{
if (this.selected)
{
this.RemoveFromSelected(false);
}
if (Links.x.AllStunned() && Links.x.gaia.sceneLoaded)
{
Links.x.fellowship.StartDeathSequence();
}
}
if (this.dodgeFX)
{
this.dodging = false;
Links.x.cellar.ReturnPooledGameObject(91, this.dodgeFX);
this.dodgeFX = null;
}
if (this.waypoint)
{
this.waypoint.transform.position = Links.x.gameplay.farPosition;
if (this.waypointAnimator.enabled)
{
this.waypointAnimator.enabled = false;
}
}
this.moving = false;
if (this.sleeping)
{
this.RemoveEffect(40, "", true);
}
this.sleeping = false;
this.stats.SetHealth(0, false);
this.doingHit = false;
this.centerOfAttention = false;
this.overlapping = false;
this.body.EndBlink();
this.orbitTarget = null;
if (this.isHit)
{
this.hitTime += 50f;
}
this.stats.state = "Stunned";
bool flag = Links.x.sensory.CheckProof(this);
if (!fromSave)
{
this.numberOfTimesKilled += 1f;
}
if (flag && this.npc)
{
this.stats.state = "StunnedExile";
if (!fromSave)
{
QuestLog.SetQuestState(this.stats.characterRow._Quest, QuestState.WaitingForExileIsland);
Records.x.AddStunned(this, false);
if (Records.x.CanTurnInExile(this.stats.characterRow._Quest, this.stats.xmlName))
{
Links.x.combat.exileCharacter = this;
}
}
}
Records.x.CheckStunnedStates();
this.PlayFaceAnimation("Sleep");
if (!fromSave)
{
int num = 24;
if (this.creatures)
{
this.creatures.AddTimeOfDeath(Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours()) + (float)num, this);
}
else
{
this.timeOfDeath = Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours()) + (float)num;
}
if (this.sailing && this.boatNavigator)
{
this.boat.SetBoatNavigator(null, false);
}
if (this.creatures && this.creatures.creatures.pickOneLeader && !this.stats.defendMainInCombat)
{
this.creatures.LeaderDied(this);
}
}
if (this.thisCollider)
{
this.thisCollider.enabled = false;
}
if (!fromSave)
{
this.PlaySoundFX(0, 3);
}
this.hovering = false;
if (this.hovering)
{
this.HoverOut(false);
}
this.body.Hover(false, false);
if (this.creatures && !fromSave)
{
this.creatures.UpdateCharacter(this);
}
if (!fromSave)
{
this.PlayFaceAnimation(FaceAnimations.AnimationNames.Sleep);
}
if (!this.isHit)
{
this.PlayAnimation("Hit Down", 0f);
}
if (Links.x.gaia.sceneLoaded && Links.x.gameCard.hoverCharacter == this)
{
Links.x.gameCard.EndHover(this, false);
}
if (this.inCircle && this.npc)
{
this.group.LeaveCircle(this);
}
bool flag2 = true;
if (this.sailing && this.npc)
{
if (this.creatures.creatureBoat)
{
if (this.creatures.creatureBoat.leadCreature)
{
this.creatures.creatureBoat.leadCreature.gameObject.GetComponent<CreatureActions>();
}
else
{
flag2 = false;
}
}
else
{
flag2 = false;
}
}
if (this.party)
{
flag2 = false;
}
if (this.sailing)
{
flag2 = false;
}
if (flag2 && !fromSave)
{
this.DropLoot();
}
else if (flag2)
{
int count = this.bag.Count;
for (int i = 0; i < count; i++)
{
if (i % 2 == 0 && this.bag[i] > 1 && this.durability[i / 2].x >= 0f)
{
this.bag[i] = 0;
this.bag[i + 1] = 0;
this.sockets[i] = Vector3.zero;
this.sockets[i + 1] = Vector3.zero;
this.durability[i / 2] = Vector4.zero;
}
}
}
if (this.party)
{
Effects effects = base.gameObject.AddComponent<Effects>();
Links.x.cellar.AddEffects(effects);
effects.source = this;
effects.target = this;
effects.fromLoad = false;
effects.effectName = "Stunned";
effects.sourceLevel = 0f;
effects.Inflicted(false);
this.node.ID = this.nodeStationaryID;
this.stats.SetHealth(0, false);
this.portrait.SetHealthColor();
if (this.portrait)
{
this.portrait.skillBag.SetTrinketGrid(false);
}
}
else
{
if (this.stats.xmlName == "RenazinSpy")
{
Records.x.AddQuestToTimer("D6_RenazinInformant", 28f, "any", "activePart2", false);
}
if (this.stats.xmlName == "RozafirStoreKeep")
{
Links.x.dialogue.HealRozafirFarmers();
}
if (this.circle)
{
this.circle.SetActive(false);
}
this.RemoveLastNode(false);
this.lastNode = null;
List<Effects> list = new List<Effects>();
foreach (Effects effects2 in this.stats.effects)
{
list.Add(effects2);
}
for (int j = 0; j < list.Count; j++)
{
list[j].Healed(true, false);
}
this.stats.ClearAilments();
Links.x.diorama.CheckLinkedCharacters(this);
}
this.droppedItems = true;
}
// Token: 0x0600035D RID: 861 RVA: 0x0004A7F8 File Offset: 0x000489F8
public void AddDead()
{
Records.x.AddDead(this);
this.dead = true;
}
// Token: 0x0600035E RID: 862 RVA: 0x0004A80C File Offset: 0x00048A0C
public void Dead(bool fromSave, bool fromCombat, bool permanent)
{
this.dead = true;
if (this.turning)
{
this.EndTurning(false);
}
this.moving = false;
if (this.sleeping)
{
this.sleeping = false;
this.RemoveEffect(40, "", true);
}
this.doingHit = false;
this.centerOfAttention = false;
this.overlapping = false;
this.jumpingAreas = false;
this.meshAlwaysOff = false;
this.inAction = false;
this.inRecovery = false;
this.inQueuedAbility = false;
if (this.hasActions)
{
this.EndCombat();
this.actions.EndActions();
}
if (this.statusRing)
{
this.statusRing.End();
this.statusRing = null;
}
if (this.inCircle && this.npc)
{
this.group.LeaveCircle(this);
}
this.body.EndBlink();
this.orbitTarget = null;
bool flag = false;
if (Records.x.dialogue && Links.x.dialogue.diaFile.Contains("PostingMaster"))
{
flag = true;
}
if (!this.party || (this.party && flag))
{
this.stats.state = "Dead";
this.RemoveLastNode(false);
this.lastNode = null;
}
else
{
this.node.ID = this.nodeStationaryID;
}
if (this.isHit)
{
this.hitTime += 50f;
}
if (this.dodgeFX)
{
this.dodging = false;
Links.x.cellar.ReturnPooledGameObject(91, this.dodgeFX);
this.dodgeFX = null;
}
if (Links.x.gaia.sceneLoaded && Links.x.gameCard.hoverCharacter == this)
{
Links.x.gameCard.EndHover(this, false);
}
this.PlayFaceAnimation(FaceAnimations.AnimationNames.Dead);
if (!fromSave)
{
this.numberOfTimesKilled += 1f;
}
if (!fromSave && !this.missing)
{
if (this.stats.characterRow._Quest != "")
{
bool flag2 = false;
if (this.stats.characterRow._QuestProofState != "")
{
if (Links.x.sensory.CheckProof(this) || Records.x.IsFelon(this.stats.xmlName))
{
flag2 = true;
QuestLog.SetQuestState(this.stats.characterRow._Quest, QuestState.PerpIsDead);
if (this.stats.xmlName == "RenazinSpy")
{
Records.x.AddQuestToTimer("D6_RenazinInformant", 28f, "any", "activePart2", false);
}
}
if (this.stats.xmlName == "RozafirStoreKeep")
{
Records.x.AddQuestToTimer("D6_NewStoreKeep", 24f, "unassigned", "active", false);
Links.x.dialogue.HealRozafirFarmers();
}
}
if (this.stats.characterRow._SetQuestStateOnDeath != "" && !flag2)
{
QuestState questState = Records.x.StringToQuestState(this.stats.characterRow._SetQuestStateOnDeath);
Debug.Log(string.Concat(new string[]
{
"Setting death state ",
this.stats.characterRow._Quest,
" ",
questState.ToString(),
" ",
this.stats.characterRow._SetQuestStateOnDeath
}));
QuestLog.SetQuestState(this.stats.characterRow._Quest, questState);
if (this.stats.xmlName == "RozafirStoreKeep")
{
Records.x.AddQuestToTimer("D6_LicechGuardsLeave", 2f, "unassigned", "active", false);
Links.x.dialogue.HealRozafirFarmers();
}
if (this.stats.xmlName == "RenazinSpy")
{
Records.x.AddQuestToTimer("D6_RenazinInformant", 28f, "any", "activePart2", false);
}
Links.x.diorama.CheckQuestActivations();
}
Records.x.CheckStunnedStates();
Records.x.KilledStunnedFelon(this.stats.xmlName);
}
else if (this.stats.xmlName.Contains("FishMonsterWhite") && Links.x.gameplay.IsDay() && this.node.GraphIndex == 0U)
{
if (QuestLog.GetQuestState("Sela_Quest") != QuestState.Unassigned)
{
Links.x.main.StartQuip("Sela will be pleased");
}
if (QuestLog.GetQuestState("Sela_Quest") != QuestState.Complete)
{
Debug.Log("Killed fish monster in sunlight");
QuestLog.SetQuestState("Sela_Quest", QuestState.Success);
MasterAudio.PlaySoundAndForget("Feedback", 0.5f, new float?(1f), 0f, "Song Learned", null);
this.str.Clear();
this.str.Append("<color=#FFFFFF>Sela is pleased</color>");
Links.x.gameFeed.AddFeed(this.str.ToString());
}
}
if (!this.summoned)
{
Records.x.KilledStunnedVictim(this.stats.xmlName);
}
if (this.creatures && this.creatures.creatures.pickOneLeader && !this.stats.defendMainInCombat)
{
this.creatures.LeaderDied(this);
}
if (this.npc && !this.summoned)
{
Links.x.diorama.CheckCampCleared();
Links.x.diorama.CheckLinkedCharacters(this);
}
}
else if (!fromSave && this.stats.characterRow._Quest != "")
{
Records.x.KilledStunnedFelon(this.stats.xmlName);
}
if (!this.party)
{
if (this.sailing && this.boatNavigator)
{
this.boat.SetBoatNavigator(null, false);
}
this.ZeroPreviousNode();
this.lastNode = null;
if (!this.sailing)
{
if (this.node != null && this.radius == 1f && (this.node.ID == this.nodeStationaryID || this.node.ID == this.nodeMovingID))
{
this.node.ID = 0;
this.node.Tag = 0U;
}
if (this.radius > 1f && this.node != null)
{
this.node.SetFlowerConnections(0, this.nodeMovingID, this.ConnectionNumber());
this.node.SetFlowerConnections(0, this.nodeStationaryID, this.ConnectionNumber());
}
}
this.timeOfDeath = float.PositiveInfinity;
if (this.creatures)
{
this.timeOfDeath = Links.x.gameplay.seconds + Random.Range(70f, 90f);
float num = Random.Range(24f, 48f);
if (this.creatures.sailing)
{
num = 26f;
}
this.creatures.AddTimeOfDeath((float)Links.x.gameplay.GetCurrentGameTimeHours() + num, this);
}
if (!fromSave)
{
float num2 = Random.Range(45f, 80f);
if (!this.creatures.creatures.hasLeader)
{
num2 = Random.Range(45f, 80f) * 7f;
}
if (!this.ghost)
{
if (this.stats.characterRow._DeathType == "None" || permanent)
{
this.stats.state = "Swallowed";
if (!this.goreObj)
{
this.PlayAnimation("Death", 0f);
}
Links.x.sensory.AddMP(this);
}
else if (this.creatures.temporary)
{
this.stats.state = "Gone";
this.PlayAnimation("Death", 0f);
Links.x.sensory.AddMP(this);
}
else if (Links.x.diorama.InResurrectionFog(this.tr.position) && (this.stats.characterRow._DeathType == "Volling" || this.stats.characterRow._DeathType == "Animal" || this.stats.characterRow._DeathType == "Resurrect"))
{
this.stats.state = "Purgatory";
if (!this.goreObj)
{
this.PlayAnimation("Death", 0f);
}
this.timeOfDeath = Links.x.gameplay.seconds + num2;
this.creatures.AddTimeOfDeath(this.timeOfDeath, this);
if (!this.ghost)
{
Links.x.sensory.AddMP(this);
}
}
else
{
this.stats.state = "Swallowed";
if (!this.goreObj)
{
this.PlayAnimation("Death", 0f);
}
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(63);
pooledGameObject.transform.position = this.tr.position;
pooledGameObject.SetActive(true);
Links.x.cameraEffects.AddRemoveGhost(pooledGameObject.transform.GetChild(0).gameObject.GetComponent<MeshRenderer>(), true);
Links.x.sensory.AddMP(this);
}
if (this.stats.characterRow._DeathType == "Bat")
{
base.StartCoroutine(this.SpawnDeathCreature());
}
}
else
{
if (Links.x.diorama.mapCanResurrect)
{
this.stats.state = "Purgatory";
}
else
{
this.stats.state = "Swallowed";
Links.x.sensory.AddMP(this);
}
this.PlayAnimation("Dead", 0f);
this.timeOfDeath = Links.x.gameplay.seconds + num2;
this.creatures.AddTimeOfDeath(this.timeOfDeath, this);
}
}
this.gos.Remove(this);
this.ReturnPooledObjects();
}
else if (flag)
{
if (Links.x.diorama.InResurrectionFog(this.tr.position))
{
this.stats.state = "Purgatory";
}
else
{
this.stats.state = "Swallowed";
}
this.timeOfDeath = Links.x.gameplay.seconds + Random.Range(45f, 80f);
}
else if (!this.revivalGem)
{
GameObject pooledGameObject2 = Links.x.cellar.GetPooledGameObject(123);
this.revivalGem = pooledGameObject2.GetComponent<PuzzleActions>();
pooledGameObject2.transform.SetParent(this.tr, false);
this.SetRevivalGemPosition();
pooledGameObject2.SetActive(true);
this.revivalGem.interactCharacter = this;
this.revivalGem.LoadPuzzleInfo();
}
if (this.body.dodgeTime > 0f)
{
this.body.Dodge(false);
}
if (this.thisCollider)
{
this.thisCollider.enabled = false;
}
if (!this.party)
{
List<Effects> list = new List<Effects>();
foreach (Effects effects in this.stats.effects)
{
list.Add(effects);
}
for (int i = 0; i < list.Count; i++)
{
list[i].Healed(true, false);
}
this.stats.ClearAilments();
}
if (fromCombat)
{
this.PlaySoundFX(0, 3);
}
this.hovering = false;
if (!fromCombat)
{
this.HoverOut(false);
}
if (this.party)
{
if (this.portrait)
{
this.portrait.skillBag.SetTrinketGrid(false);
}
this.PlayAnimation("Death", 0f);
if (Links.x.AllDead())
{
Links.x.fellowship.StartDeathSequence();
}
else if (Links.x.main == this)
{
base.StartCoroutine(this.WaitToChangeLeader());
}
if (flag)
{
this.ReturnPartyPooledObjects();
this.ReturnPooledObjects();
}
}
this.body.Hover(false, false);
if (!this.missing && (this.npc || (this.party && flag) || (this.summoned && this.charmed) || (this.npc && this.body.goreObj)))
{
Links.x.ChangeDeadList(this, true);
}
if (fromCombat)
{
this.PlayAnimation("Death", 0f);
this.PlayFaceAnimation("Sleep");
}
if (this.missing)
{
this.body.SetMeshState(false, true);
this.visible = 0;
this.stats.state = "Fled";
}
if ((!this.party || (this.party && flag)) && this.gos != null)
{
int num3 = this.gos.IndexOf(this);
if (num3 > -1)
{
this.gos.RemoveAt(num3);
}
}
if (this.npc)
{
Links.x.ChangeNPCList(this, false);
}
else if ((this.party && flag) || !this.party)
{
Links.x.ChangePartyList(this, false, this.party);
}
this.dead = true;
if (this.creatures && !fromSave)
{
this.creatures.UpdateCharacter(this);
}
if (!this.missing)
{
if (!fromSave && this.npc)
{
Links.x.combat.allDeadCount++;
}
bool flag3 = true;
if (this.sailing && this.npc)
{
if (this.creatures.creatureBoat)
{
if (this.creatures.creatureBoat.leadCreature)
{
this.creatures.creatureBoat.leadCreature.gameObject.GetComponent<CreatureActions>();
}
else
{
flag3 = false;
}
}
else
{
flag3 = false;
}
}
if (flag3 && fromCombat && (this.npc || flag))
{
this.DropLoot();
}
}
if (this.party && flag)
{
Links.x.inventory.ClearBag(this);
Links.x.fellowship.CompanionDied();
}
base.gameObject.layer = 0;
if (!this.party && !this.isHit)
{
base.enabled = false;
}
this.deadInactive = false;
if (this.summoned)
{
if (!this.creatures.GetTileEffect())
{
this.creatures.Unsummon(false);
if (!this.pipeSummons && fromCombat)
{
GameObject pooledGameObject3 = Links.x.cellar.GetPooledGameObject(32);
pooledGameObject3.transform.position = this.tr.position;
pooledGameObject3.SetActive(true);
}
}
else
{
this.creatures.GetTileEffect().RemoveSummons(this.creatures, this.tr.position);
}
}
if (this.party && !fromSave && flag)
{
if (Records.x.combat && Links.x.diorama.InResurrectionFog(this.tr.position))
{
Records.x.AddTemporaryCreature(this.stats.GetName(), "Ghost", "GhostMap", Links.x.diorama.sceneName, 2, this.tr.position, "Resurrected", this.stats.GetName(), this.stats.HealthMax() / 2, "", 0, 0f, "GhostMap", this.tr.position, false);
}
this.stats.SetHealth(0, false);
this.TurnScriptsOff();
}
this.droppedItems = true;
}
// Token: 0x0600035F RID: 863 RVA: 0x0004B85C File Offset: 0x00049A5C
private IEnumerator WaitToChangeLeader()
{
yield return new WaitForSeconds(0.5f);
if (this == Links.x.main && this.dead && (Links.x.creation || (Records.x.InCombat(false) && !Records.x.dialogue && !Records.x.inMenus)))
{
Character nearestParty = Links.x.GetNearestParty(this.tr.position);
if (nearestParty)
{
nearestParty.SetAsLeader();
Links.x.fellowship.SingleSelected(nearestParty);
nearestParty.AddToSelected(false, true);
nearestParty.SetAsLeader();
Links.x.rtsCamera.Follow(nearestParty.tr, nearestParty, false);
}
}
yield break;
}
// Token: 0x06000360 RID: 864 RVA: 0x0004B86B File Offset: 0x00049A6B
private IEnumerator SpawnDeathCreature()
{
yield return new WaitForSeconds(0.0001f);
CreatureActions creatureActions = this.creatures;
Vector3 position = this.tr.position;
string text = "SummonBatSpawn";
Quaternion rotation = this.tr.rotation;
bool flag = false;
Character firstCharacter = Links.x.gaia.CreateCreature(position, rotation, text, flag, 0f, 1).GetFirstCharacter();
firstCharacter.TransferLKP(this);
firstCharacter.SetPosition(position, null);
firstCharacter.SetRotation(rotation, false, false);
firstCharacter.hostility = 2;
firstCharacter.OverridePocketPause();
firstCharacter.SetAnimatorSpeed(1f);
firstCharacter.UpdateLKP(Links.x.main, Links.x.main.node, "Attack", true);
firstCharacter.jumpingPosition = false;
if (!Records.x.InCombat(false))
{
Links.x.combat.StartCombat(Links.x.main, firstCharacter, false, true);
}
Links.x.combat.AddParty(firstCharacter, false, null, true);
yield break;
}
// Token: 0x06000361 RID: 865 RVA: 0x0004B87C File Offset: 0x00049A7C
public void AddBlood(Character actionTarget)
{
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(5);
pooledGameObject.gameObject.SetActive(true);
pooledGameObject.transform.position = actionTarget.body.HeadPosition(0f);
Quaternion quaternion = this.tr.rotation;
if (actionTarget != this.tr && this.tr.position != actionTarget.tr.position)
{
quaternion = Quaternion.LookRotation(this.tr.position - actionTarget.tr.position);
}
pooledGameObject.transform.rotation = quaternion;
actionTarget.PlayAnimation("Hit", 0f);
}
// Token: 0x06000362 RID: 866 RVA: 0x0004B933 File Offset: 0x00049B33
public void Explode()
{
if (!this.exploded)
{
this.exploded = true;
Links.x.diorama.BombBomb(this.currentPosition, this);
}
}
// Token: 0x06000363 RID: 867 RVA: 0x0004B95C File Offset: 0x00049B5C
public void AddDamage(Character actionTarget, float damage, bool canShowDeath, bool interrupt, bool isMainTarget, string hitType, float hitTimeAdd, float staminaReduction)
{
if (actionTarget.isBoro)
{
return;
}
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(5);
pooledGameObject.gameObject.SetActive(true);
pooledGameObject.transform.position = actionTarget.body.HeadPosition(0f);
Quaternion quaternion = this.tr.rotation;
if (actionTarget != this.tr && this.tr.position != actionTarget.tr.position)
{
quaternion = Quaternion.LookRotation(this.tr.position - actionTarget.tr.position);
}
pooledGameObject.transform.rotation = quaternion;
actionTarget.PlaySoundFX(0, 2);
if (!actionTarget.summoned && Records.x.InCombat(false))
{
Links.x.cellar.DropPickup(true, this.torsoPosition, actionTarget);
}
bool flag = false;
if (actionTarget.stats.xmlName.Contains("Stack") && actionTarget.body.model.Contains("Stack"))
{
flag = true;
}
if (isMainTarget)
{
MasterAudio.PlaySound3DAtVector3AndForget("Blood Hit", actionTarget.tr.position, 1f, new float?(1f), 0.1f, "", null);
Animator animator = Links.x.cellar.GetBlood();
animator.gameObject.SetActive(true);
animator.transform.position = actionTarget.body.HeadPosition(0f);
animator.transform.rotation = quaternion;
int num = Random.Range(0, 5);
if (num == 1)
{
animator.Play("Blood_animation_B");
}
if (num == 2)
{
animator.Play("Blood_animation_C");
}
if (num == 3)
{
animator.Play("Blood_animation_D");
}
if (num == 4)
{
animator.Play("Blood_animation_E");
}
animator = Links.x.cellar.GetBlood();
animator.gameObject.SetActive(true);
animator.transform.position = actionTarget.body.HeadPosition(0f) - new Vector3(0f, 0.5f, 0f);
animator.transform.rotation = quaternion;
int num2 = Random.Range(0, 5);
if (num2 == 1)
{
animator.Play("Blood_animation_B");
}
if (num2 == 2)
{
animator.Play("Blood_animation_C");
}
if (num2 == 3)
{
animator.Play("Blood_animation_D");
}
if (num2 == 4)
{
animator.Play("Blood_animation_E");
}
}
bool flag2 = Records.x.noDamage;
if (!Records.x.editor)
{
flag2 = false;
}
if ((!actionTarget.party || (actionTarget.party && !flag2)) && damage != 0f && !Records.x.miniGame && !flag)
{
actionTarget.stats.AddHealth((int)Mathf.Ceil(-1f * damage));
}
bool flag3 = true;
bool flag4 = false;
if (damage != 0f)
{
actionTarget.stats.hitCount++;
if (actionTarget.npc)
{
actionTarget.stats.AddStamina(-3f - staminaReduction);
}
if (actionTarget.stats.pinning)
{
actionTarget.stats.pinHitCount++;
}
bool flag5 = true;
bool flag6 = false;
bool flag7 = false;
bool flag8 = false;
bool flag9 = false;
if (flag)
{
flag5 = false;
flag9 = true;
if (actionTarget.body.model.Contains("Stack"))
{
flag3 = false;
actionTarget.stats.SetHealth(actionTarget.stats.HealthMax(), false);
actionTarget.UpdateModel("CropGoblinGrunt");
actionTarget.animator.runtimeAnimatorController = Links.x.archives.GetOverrideController("_CropGoblinGrunt_Unarmed");
CreatureActions creatureActions = actionTarget.creatures;
Vector3 vector = actionTarget.tr.position + Quaternion.LookRotation(actionTarget.currentPosition - this.currentPosition) * Vector3.forward;
if (actionTarget.node != null)
{
GraphNode graphNode = actionTarget.node.ClosestConnection(actionTarget.node, 0, 0, 25f, vector, 0, 0, actionTarget.nodeConstraint, 0);
if (graphNode != null)
{
vector = (Vector3)graphNode.position;
}
}
string text = "CropGoblin";
Quaternion rotation = actionTarget.tr.rotation;
Character firstCharacter = Links.x.gaia.CreateCreature(vector, rotation, text, false, 0f, 1).GetFirstCharacter();
firstCharacter.TransferLKP(actionTarget);
firstCharacter.SetPosition(vector, null);
actionTarget.PlayAnimation("Idle", 0f);
firstCharacter.SetRotation(rotation, false, false);
if (this.npc)
{
firstCharacter.hostility = 2;
}
actionTarget.stats.SetHealth(actionTarget.stats.HealthMax(), false);
Links.x.combat.AddParty(firstCharacter, false, null, true);
}
}
float num3 = 8f;
float num4 = 15f;
if (actionTarget.party)
{
num4 = num3;
}
if (hitType.Contains("Bounce") && this.stats.Stuck() == 0 && !this.ambushing && !actionTarget.stats.pinned)
{
flag4 = true;
Quaternion quaternion2 = Quaternion.LookRotation(this.currentPosition - actionTarget.currentPosition);
actionTarget.SetRotation(quaternion2, false, true);
if ((float)this.stats.weightBase < 20f)
{
flag8 = true;
}
bool flag10 = false;
if (actionTarget.hasActions && actionTarget.actions.ai.jumping)
{
flag10 = true;
}
if (this.party && actionTarget.stats.Level() > this.stats.Level() && !flag10)
{
flag9 = true;
}
if (actionTarget.mainSelected || Links.x.combat.miniEvent)
{
if (Links.x.combat.miniEvent && !Links.x.combat.bubbleEvent && actionTarget.mainSelected)
{
flag5 = false;
}
if (Links.x.combat.miniEvent && Links.x.combat.bubbleEvent && actionTarget == Links.x.combat.bubbleEventTarget)
{
flag5 = false;
}
if (actionTarget.mainSelected && Links.x.combat.bubbleEvent)
{
flag6 = true;
}
}
if (actionTarget.npc && actionTarget.stats.animal && actionTarget.stamina)
{
flag7 = actionTarget.stamina.hasArmor;
}
if (flag10)
{
flag6 = true;
}
bool flag11 = false;
if (Links.x.combat.inPocketAttack && this.party)
{
if (actionTarget == Links.x.combat.rallyTarget)
{
flag11 = true;
}
if (Links.x.rallyStage.playing && Links.x.rallyStage.stage == "Bow")
{
flag11 = false;
}
}
bool flag12 = false;
if ((!actionTarget.party || flag6) && actionTarget.stats.characterRow._Height < 4f && actionTarget.animID != 53 && (!flag7 || flag11) && !flag8 && !flag9)
{
flag12 = true;
}
if (flag12 && (this.sailing || this.movesOnWater))
{
flag12 = false;
flag5 = true;
}
if (flag12)
{
if (hitType.Contains("Small"))
{
actionTarget.Bounce(this, "Small Hit", hitTimeAdd);
}
else
{
actionTarget.Bounce(this, "Normal Hit", hitTimeAdd);
}
}
else if (flag5 && !flag7 && !flag8 && !flag9)
{
actionTarget.isHit = true;
if (actionTarget.actions)
{
actionTarget.actions.Interrupt();
}
actionTarget.hitTime = Links.x.gameplay.seconds + num4 + hitTimeAdd;
actionTarget.hitTimeReal = Time.timeSinceLevelLoad;
actionTarget.PlayAnimation("Hit Down", 0f);
}
else
{
flag4 = false;
}
}
else if (!actionTarget.jumping && hitType == "Down" && !this.ambushing && !actionTarget.stats.pinned)
{
actionTarget.isHit = true;
if (actionTarget.actions)
{
actionTarget.actions.Interrupt();
}
actionTarget.hitTime = Links.x.gameplay.seconds + num4 + hitTimeAdd;
actionTarget.hitTimeReal = Time.timeSinceLevelLoad;
actionTarget.PlayAnimation("Hit Down", 0f);
if (Links.x.combat.inPocketAttack)
{
actionTarget.OverridePocketPause();
}
flag4 = true;
}
}
if (!flag4)
{
if (actionTarget.animID != 53)
{
if (!interrupt)
{
actionTarget.PlayAnimation("Hit", 0f);
}
else
{
actionTarget.PlayAnimation("HitInterrupt", 0f);
}
if (Links.x.combat.inPocketAttack)
{
actionTarget.OverridePocketPause();
}
}
}
else if (interrupt && this.actions && !this.jumping)
{
this.actions.Interrupt();
}
if (actionTarget.stats.hasHitAI)
{
actionTarget.stats.DoHitAI(this);
}
if (damage == 0f)
{
return;
}
if (actionTarget.stats.HealthCurrent() < 0)
{
actionTarget.stats.SetHealth(0, false);
}
if (actionTarget.stats.HealthCurrent() <= 0 && !actionTarget.dead && canShowDeath && flag3)
{
bool flag13 = this.stats.ShouldStun(actionTarget);
if (actionTarget.summoned)
{
flag13 = false;
}
if (actionTarget.ghost)
{
flag13 = false;
}
if (actionTarget.movesOnWater)
{
flag13 = false;
}
if (actionTarget.stats.hasEveryAttackAI && actionTarget.stats.xmlName.Contains("Bomb"))
{
flag13 = false;
actionTarget.Explode();
}
if (actionTarget.stats.xmlName.Contains("GraveKeeper"))
{
if (actionTarget.stats.xmlName.Contains("LocalGraveKeeper") && Links.x.diorama.mapCanResurrect)
{
flag13 = true;
}
if (!actionTarget.stats.xmlName.Contains("Local"))
{
flag13 = false;
}
}
if (this.ghost)
{
flag13 = false;
}
if (actionTarget.stats.xmlName.Contains("Acorn"))
{
flag13 = false;
}
if (actionTarget.npc)
{
int xp = actionTarget.stats.characterRow._XP;
Links.x.fellowship.AddXP(xp, actionTarget, false);
}
if (this.party)
{
this.stats.killCount++;
}
if (!flag13 || actionTarget.party)
{
this.str.Clear();
if (!actionTarget.npc)
{
this.str.Append(Links.x.gameFeed.GetPartyColorText(actionTarget));
}
this.str.Append(actionTarget.stats.GetName());
if (!actionTarget.npc)
{
this.str.Append("</color>");
}
if (!actionTarget.party)
{
this.str.Append(" is dead");
}
else
{
this.str.Append(" is knocked out");
}
Links.x.gameFeed.AddFeed(this.str.ToString());
actionTarget.body.lookAtController.EndLook();
MasterAudio.PlaySound3DAtVector3AndForget("Body Fall", this.tr.position, 1f, new float?(1f), 0.5f, "", null);
MasterAudio.PlaySound3DAtVector3AndForget("Death", this.tr.position, 1f, new float?(1f), 0f, "", null);
if (this.party && this.stats.HasSpellbook())
{
this.stats.AddSpiritFromKill(3f);
}
if (!actionTarget.party)
{
GameObject gameObject = Links.x.archives.CheckRecycledDeaths(actionTarget.stats.characterRow._DeathID, "Random");
if (gameObject == null)
{
int num5 = Random.Range(0, 3);
string text2 = "";
if (num5 == 0)
{
text2 = "Random";
}
if (num5 == 1)
{
text2 = "Head";
}
if (num5 == 2)
{
text2 = "Critical";
}
gameObject = Links.x.library.GetDeath(actionTarget.stats.characterRow._DeathID, text2);
if (gameObject)
{
GameObject gameObject2 = Object.Instantiate<GameObject>(gameObject, actionTarget.tr.position, actionTarget.tr.rotation, Links.x.cellar.tr);
gameObject2.SetActive(false);
gameObject = gameObject2;
Gore gore = gameObject2.AddComponent<Gore>();
actionTarget.body.goreScript = gore;
gore.Setup();
}
}
if (!actionTarget.goreObj)
{
actionTarget.goreObj = gameObject;
actionTarget.goreType = "Random";
if (gameObject)
{
Vector3 position = actionTarget.tr.position;
position.y -= 1f;
gameObject.transform.parent = null;
gameObject.transform.position = actionTarget.tr.position + new Vector3(0f, 0.5f, 0f);
gameObject.transform.rotation = actionTarget.tr.rotation;
actionTarget.body.StartDead(position);
Links.x.combat.preDome = false;
Gore gore2 = gameObject.GetComponent<Gore>();
if (gore2)
{
actionTarget.body.goreScript = gore2;
gore2.DoReset();
}
else
{
gore2 = gameObject.AddComponent<Gore>();
actionTarget.body.goreScript = gore2;
gore2.Setup();
}
gore2.character = actionTarget;
gore2.startTime = Links.x.gameplay.seconds;
gameObject.SetActive(true);
float num6 = 600f;
if (actionTarget.stats.xmlName.Contains("Bomb"))
{
actionTarget.body.AddExplosionDeadForce();
}
else
{
actionTarget.body.AddDeadForce(Quaternion.LookRotation(position - this.tr.position) * Vector3.forward, num6);
}
if (Links.x.combat.inPocketAttack && Links.x.rallyStage.playing)
{
actionTarget.body.PocketGore(false);
}
}
else
{
Vector3 position2 = actionTarget.tr.position;
position2.y -= 1f;
actionTarget.body.StartDead(position2);
}
}
}
bool flag14 = false;
if (!actionTarget.dead)
{
actionTarget.Dead(false, true, flag14);
}
if (actionTarget.npc)
{
Links.x.combat.Enraged();
}
if (!actionTarget.summoned && Records.x.InCombat(false) && !actionTarget.ghost)
{
Links.x.cellar.DropPickup(false, this.torsoPosition, actionTarget);
return;
}
}
else
{
this.str.Clear();
if (!actionTarget.npc)
{
this.str.Append(Links.x.gameFeed.GetPartyColorText(actionTarget));
}
this.str.Append(actionTarget.stats.GetName());
if (!actionTarget.npc)
{
this.str.Append("</color>");
}
if (this.stats.xmlName.Contains("LocalGraveKeeper"))
{
this.str.Append(" is dormant");
}
else
{
this.str.Append(" is stunned");
}
Links.x.gameFeed.AddFeed(this.str.ToString());
actionTarget.body.lookAtController.EndLook();
MasterAudio.PlaySound3DAtVector3AndForget("Body Fall", actionTarget.tr.position, 1f, new float?(1f), 0.5f, "", null);
actionTarget.Stunned(false);
}
}
}
// Token: 0x06000364 RID: 868 RVA: 0x0004C97C File Offset: 0x0004AB7C
public void Bounce(Character attacker, string type, float hitTimeAdd)
{
if (this.sailing || this.movesOnWater)
{
this.isHit = true;
if (this.actions)
{
this.actions.Interrupt();
}
float num = 8f;
float num2 = 15f;
if (this.party)
{
num2 = num;
}
this.hitTime = Links.x.gameplay.seconds + num2 + hitTimeAdd;
this.hitTimeReal = Time.timeSinceLevelLoad;
this.PlayAnimation("Hit Down", 0f);
if (Links.x.combat.inPocketAttack)
{
this.OverridePocketPause();
return;
}
}
else
{
this.isHit = true;
if (this.stats.characterRow._Height > 4f)
{
this.isHit = true;
this.hitTime = Links.x.gameplay.seconds + 10f;
this.hitTimeReal = Time.timeSinceLevelLoad;
this.PlayAnimation("Hit", 0f);
return;
}
if (type == "Small Hit")
{
this.hitTime = Links.x.gameplay.seconds + 5f;
}
this.hitTime = Links.x.gameplay.seconds + 15f;
this.hitTime += hitTimeAdd;
if (this.sleeping)
{
this.WakeUp();
}
this.slideNode = null;
this.slideNodePosition = Vector3.zero;
if (!this.bouncer)
{
GameObject gameObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
gameObject.transform.localScale = Vector3.one * 1f;
this.bouncer = gameObject.AddComponent<CollisionListener>();
this.bouncer.rbody = gameObject.AddComponent<Rigidbody>();
this.bouncer.rbody.mass = 7f;
gameObject.GetComponent<BoxCollider>().material = Links.x.bounceFriction;
gameObject.layer = 20;
if (Records.x.editor)
{
gameObject.transform.SetParent(Links.x.cellar.tr);
}
gameObject.GetComponent<MeshRenderer>().enabled = false;
}
this.bouncer.gameObject.SetActive(true);
this.bouncer.c = this;
this.bouncer.StartLisening("Hit");
if (this.jumping)
{
this.jumping = false;
this.jumpLanding = false;
this.ClearNodePath();
}
this.EndDodge();
this.bouncer.gameObject.transform.position = this.tr.position + new Vector3(0f, this.characterHeight / 2f, 0f);
float num3 = 1300f;
if (type == "Knockback")
{
num3 += 3000f;
}
this.savedBounceVel = Vector3.zero;
Vector3 vector = this.currentPosition;
if (attacker)
{
vector = attacker.currentPosition;
}
if (vector == this.currentPosition)
{
vector.x += Random.Range(-1f, 1f);
vector.z += Random.Range(-1f, 1f);
}
this.bouncer.rbody.AddForce(Quaternion.LookRotation(this.currentPosition - new Vector3(vector.x, this.currentPosition.y, vector.z)) * Vector3.forward * num3, ForceMode.Force);
float num4 = 6000f;
if (type == "Knockback")
{
num4 += 4000f;
}
if (type == "Small Hit")
{
num4 = 1000f;
}
this.bouncer.rbody.AddForce(Vector3.up * num4, ForceMode.Force);
this.animator.SetBool("Bounce Over", false);
this.PlayAnimation("Hit Bounce", 0f);
this.hitTimeReal = Time.timeSinceLevelLoad;
if (type == "Knockback")
{
this.hitTime += 25f;
this.hitTimeReal += 0.5f;
}
if (attacker && attacker.mainSelected && !Links.x.rallyStage.playing)
{
this.OverridePocketPause();
}
this.SetPosition(this.bouncer.rbody.transform.position, null);
}
}
// Token: 0x06000365 RID: 869 RVA: 0x0004CDF8 File Offset: 0x0004AFF8
public bool CheckForCharm(Character target)
{
if (this.npc || this.summoned)
{
return false;
}
string text = target.stats.characterRow._Race;
if (text == "Forest" || text == "Fish" || text == "Shroom" || text == "Shroomer")
{
int num = this.HasRosary();
if (num > -1)
{
if (text == "Shroom")
{
text = "Shroomer";
}
text = "Charm" + text;
Library.Abilities abilityRow = Links.x.library.GetAbilityRow(text);
bool flag = false;
float num2 = this.stats.Charming(abilityRow._Name, true);
string text2 = this.stats.CharmingCalculation(abilityRow._Name);
if (Records.x.showRuleset)
{
string[] array = new string[5];
array[0] = ((this != null) ? this.ToString() : null);
array[1] = " charming, charming roll: ";
array[2] = num2.ToString();
array[3] = ", charm skill ";
int num3 = 4;
Library.Abilities abilities = abilityRow;
array[num3] = ((abilities != null) ? abilities.ToString() : null);
Debug.Log(string.Concat(array));
}
float num4 = target.stats.CharmResistance(false, (float)target.stats.HealthCurrent());
float num5 = this.stats.SummonModCharm();
num4 += this.stats.SummonModCharm();
string text3 = this.stats.CharmResist(num5, (float)target.stats.HealthCurrent());
if (num2 >= num4)
{
flag = true;
}
bool flag2 = false;
if (num2 - 2f >= num4)
{
if (Random.Range(0, 5) == 0)
{
flag = true;
flag2 = true;
}
else
{
flag = false;
}
}
float num6 = num2 - num4;
if (flag)
{
float num7 = target.stats.GetStatOnly("Sensory") / 5f + target.stats.GetStatOnly("Aura") / 3f;
if (text.Contains("Fish"))
{
this.stats.AddSkillProgress(23, num7, null);
}
if (text.Contains("Forest"))
{
this.stats.AddSkillProgress(24, num7, null);
}
if (text.Contains("Shroom"))
{
this.stats.AddSkillProgress(25, num7, null);
}
if (this.mainSelected)
{
Links.x.cellar.GetAnimatedText("PocketDmg", "Charmed", Records.x.IsTextLeft(this, target)).gameObject.transform.position = target.body.HeadPosition(0f) + new Vector3(Random.Range(0f, 0.5f), Random.Range(-0.5f, 0.5f), 0f);
}
MasterAudio.PlaySoundAndForget("Feedback", 0.5f, new float?(1f), 0f, "Song Learned", null);
if (target.downed)
{
target.PlayAnimation("GetUp", 0f);
}
else
{
target.PlayAnimation("Idle", 0f);
}
target.downed = true;
if (target.actions && target.actions.ai.findingAction)
{
target.actions.ai.StopLookingForAction();
target.actions.EndActions();
}
Library.Abilities abilities2 = abilityRow;
Links.x.library.GetEffectRow(abilities2._Name);
CreatureActions creatureActions = target.creatures;
Vector3 position = target.tr.position;
string xmlName = creatureActions.xmlName;
Quaternion rotation = target.tr.rotation;
bool flag3 = true;
if (this.npc)
{
flag3 = false;
}
Character firstCharacter = Links.x.gaia.CreateCreature(position, rotation, xmlName, flag3, 0f, 1).GetFirstCharacter();
firstCharacter.TransferLKP(this);
firstCharacter.SetPosition(position, null);
target.PlayAnimation("Idle", 0f);
firstCharacter.SetRotation(rotation, false, false);
if (this.npc)
{
firstCharacter.hostility = 2;
}
target.stats.SetHealth(Mathf.RoundToInt((float)target.stats.HealthCurrent() + (float)target.stats.HealthMax() / 2f), false);
Links.x.combat.AddParty(firstCharacter, false, null, true);
creatureActions.Charmed(target);
target.DestroyCharacter();
num *= 2;
int num8 = this.bag[num + 1];
num8--;
this.bag[num + 1] = num8;
if (this.party)
{
Links.x.inventory.SetBagAmt(num / 2, num8, this);
this.portrait.skillBag.SetTrinketGrid(false);
}
if (this.bag[num + 1] <= 0)
{
if (this.party)
{
this.bag[num] = 0;
this.bag[num + 1] = 0;
Links.x.inventory.RemoveBagItem(num / 2, this);
this.portrait.skillBag.SetTrinketGrid(false);
}
else
{
this.bag[num] = 0;
this.bag[num + 1] = 0;
}
}
if (this.party)
{
this.portrait.skillBag.UpdateAmmoNumbers();
}
Links.x.gameFeed.AddFeed(this.str.ToString());
base.StartCoroutine(this.CharmWait(firstCharacter, target, num4, num2, text2, text3, flag2));
Effects effects = firstCharacter.gameObject.AddComponent<Effects>();
Links.x.cellar.AddEffects(effects);
effects.source = this;
effects.target = firstCharacter;
effects.targetInteractive = null;
effects.fromLoad = false;
effects.effectName = "CharmPotency";
effects.sourceLevel = 1f + num6 / 2f;
effects.Inflicted(true);
this.stats.AddSpirit(15);
return true;
}
if (this.mainSelected)
{
Links.x.cellar.GetAnimatedText("NPCDmg", "Failed", Records.x.IsTextLeft(this, target)).gameObject.transform.position = target.body.HeadPosition(0f) + new Vector3(Random.Range(0f, 0.5f), Random.Range(-0.5f, 0.5f), 0f);
}
Library.Effects effectRow = Links.x.library.GetEffectRow(abilityRow._Name);
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(57);
if (pooledGameObject)
{
pooledGameObject.transform.position = target.body.HeadPosition(0f) + new Vector3(0f, effectRow._FXOffset, 0f);
pooledGameObject.SetActive(true);
}
this.str.Clear();
if (!this.npc)
{
this.str.Append(Links.x.gameFeed.GetPartyColorText(this));
}
this.str.Append(this.stats.GetName());
if (!this.npc)
{
this.str.Append("</color>");
}
this.str.Append(" failed to bind ");
if (!target.npc)
{
this.str.Append(Links.x.gameFeed.GetPartyColorText(target));
}
this.str.Append(target.stats.GetName());
if (!target.npc)
{
this.str.Append("</color>");
}
if (Records.x.showRulesetInfo)
{
this.str.Append(" <color #857C6C>... ");
this.str.Append(text2);
this.str.Append(" vs. ");
this.str.Append(text3);
this.str.Append("</color>");
}
Links.x.gameFeed.AddFeed(this.str.ToString());
MasterAudio.PlaySound3DAtVector3AndForget("Skills", this.tr.position, Random.Range(0.4f, 0.6f), new float?(Random.Range(0.7f, 1f)), 0f, "Fail", null);
}
}
return false;
}
// Token: 0x06000366 RID: 870 RVA: 0x0004D648 File Offset: 0x0004B848
private IEnumerator CharmWait(Character summon, Character target, float difficulty, float charmRoll, string charmRollString, string charmDifficulty, bool didRoll)
{
if (summon)
{
yield return new WaitForEndOfFrame();
while (summon.turning)
{
yield return null;
}
summon.Charmed(this);
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(56);
if (pooledGameObject)
{
pooledGameObject.transform.position = summon.body.HeadPosition(0f) + new Vector3(0f, 1f, 0f);
pooledGameObject.SetActive(true);
}
MasterAudio.PlaySound3DAtVector3AndForget("Skills", this.tr.position, 1f, new float?(1f), 0f, "Charm", null);
this.str.Clear();
if (!this.npc)
{
this.str.Append(Links.x.gameFeed.GetPartyColorText(this));
}
this.str.Append(this.stats.GetName());
if (!this.npc)
{
this.str.Append("</color>");
}
if (didRoll)
{
this.str.Append(" passed roll and bound ");
}
else
{
this.str.Append(" bound ");
}
if (!target.npc)
{
this.str.Append(Links.x.gameFeed.GetPartyColorText(target));
}
this.str.Append(target.stats.GetName());
if (!target.npc)
{
this.str.Append("</color>");
}
if (Records.x.showRulesetInfo)
{
this.str.Append(" <color #857C6C>... ");
this.str.Append(charmRollString);
this.str.Append(" vs. ");
this.str.Append(charmDifficulty);
this.str.Append("</color>");
}
Links.x.gameFeed.AddFeed(this.str.ToString());
}
if (this.actions)
{
this.actions.EndAttackTime(0f);
this.actions.EndTurn(true);
}
yield break;
}
// Token: 0x06000367 RID: 871 RVA: 0x0004D698 File Offset: 0x0004B898
public void SetMoveNode()
{
int num = 1;
if (this.sailing || this.movesOnWater)
{
num = 2;
}
if (this.boatNavigator)
{
if (this.moveNode.AllConnectionsFreeParty(this.boat.nodeStationaryID, this.boat.nodeMovingID, this.boat.ConnectionNumber(), num) == 0)
{
this.boat.ClaimNode(this.moveNode, (Vector3)this.moveNode.position, false);
return;
}
}
else if (this.moveNode.AllConnectionsFreeParty(this.nodeStationaryID, this.nodeMovingID, this.ConnectionNumber(), num) == 0)
{
this.ClaimNode(this.moveNode, (Vector3)this.moveNode.position, false);
}
}
// Token: 0x06000368 RID: 872 RVA: 0x0004D750 File Offset: 0x0004B950
public void TurnEnter(bool ignoreControls)
{
if (this.dead || this.stunned)
{
return;
}
this.startTurnExit = false;
if (this.nodePath.Count > 0 && !this.dead && this.setupComplete && !this.downed && Links.x.gaia.sceneLoaded)
{
this.stepReady = true;
this.tempStop = false;
this.moveTurn = false;
this.SetMoveFollowPosition(this.tr.position);
if (this.nodePath.Count <= 0)
{
this.TargetReached();
return;
}
if (this.moveIndex == -1)
{
if (this.nodePath.Count > 0)
{
this.ChangeNodes();
}
this.moveIndex = 0;
}
if (this.nodePath.Count > 1 && this.animID == 23)
{
this.animID = 0;
}
this.DoFootsteps();
if (this.moveNode != this.node && !this.jumping)
{
bool flag = this.boatNavigator;
}
if (this.moveNode != null && !Records.x.paused && !this.turning)
{
this.SetMoveNode();
return;
}
}
else
{
this.justMoved = true;
this.timeSinceLastMove = Time.timeSinceLevelLoad;
this.moveNode = null;
this.moving = false;
this.movePoint = this.vectorZero;
this.stepReady = false;
if (this.isHit && this.IsMoveAnim() && this.downed)
{
this.PlayAnimation("Hit Down", 0f);
}
if (this.resting && (!this.inCombat || this.inCircle) && this.animID != 8 && !this.IsWalking() && !this.moving && this.waitingForPath == 0 && !this.isHit && !this.dead && !this.stunned && !this.stats.pinned && !this.stats.pinning && !this.inAction && !this.inRecovery && !this.inQueuedAbility)
{
if (this.inCircle)
{
this.PlayAnimation("Fatigued", 0f);
}
else
{
this.PlayAnimation("Hit Down", 0f);
}
}
if (!this.dead && this.IsMoveAnim() && !this.boatNavigator && !this.stunned)
{
this.SetIdle(true);
}
this.TargetReached();
if ((this.missing || (!this.hasActions && this.fleeing)) && this.nodePath.Count == 0 && !this.moving)
{
this.fleeing = true;
this.CheckFleeEnd();
if (this.fleeing)
{
return;
}
}
if (this.swarm)
{
if (this.lkBool.Count == 0 && this.canLeave)
{
if (!this.actions && !this.hasActions)
{
this.Leave(true);
return;
}
}
else if (!this.canLeave && this.lkPlayer.Count > 0)
{
for (int i = 0; i < this.lkPlayer.Count; i++)
{
if (!this.canLeave)
{
Character component = this.lkPlayer[i].GetComponent<Character>();
if (component && component.stats.xmlName != this.stats.xmlName)
{
this.canLeave = true;
}
}
}
}
}
}
}
// Token: 0x06000369 RID: 873 RVA: 0x0004DAC4 File Offset: 0x0004BCC4
public void RemoveLastNode(bool setNull)
{
this.ZeroPreviousNode();
this.lastNode = null;
if (this.node != null)
{
this.node.SetFlowerConnections(0, this.nodeMovingID, this.ConnectionNumber());
this.node.SetFlowerConnections(0, this.nodeStationaryID, this.ConnectionNumber());
}
if (setNull)
{
this.node = null;
}
if (this.party)
{
if (this.mainNode2 != null)
{
this.mainNode2.SetFlowerConnections(0, this.nodeMovingID, this.ConnectionNumber());
this.mainNode2.SetFlowerConnections(0, this.nodeStationaryID, this.ConnectionNumber());
}
if (this.mainNode3 != null)
{
this.mainNode3.SetFlowerConnections(0, this.nodeMovingID, this.ConnectionNumber());
this.mainNode3.SetFlowerConnections(0, this.nodeStationaryID, this.ConnectionNumber());
}
if (this.mainNode4 != null)
{
this.mainNode4.SetFlowerConnections(0, this.nodeMovingID, this.ConnectionNumber());
this.mainNode4.SetFlowerConnections(0, this.nodeStationaryID, this.ConnectionNumber());
}
this.mainNode2 = null;
this.mainNode3 = null;
this.mainNode4 = null;
}
}
// Token: 0x0600036A RID: 874 RVA: 0x0004DBE8 File Offset: 0x0004BDE8
public void ClearNodeIDs()
{
if (this.node != null)
{
this.node.SetFlowerConnections(0, this.nodeMovingID, this.ConnectionNumber());
this.node.SetFlowerConnections(0, this.nodeStationaryID, this.ConnectionNumber());
}
}
// Token: 0x0600036B RID: 875 RVA: 0x0004DC22 File Offset: 0x0004BE22
public bool IsMoveAnim()
{
return this.animID == 1;
}
// Token: 0x0600036C RID: 876 RVA: 0x0004DC30 File Offset: 0x0004BE30
public void ChangeNodes()
{
if (this.dead || this.stunned || !this.moveFollow)
{
return;
}
if (!this.tr)
{
return;
}
if (this.nodeActions.Count == 0 || !Links.x.gaia.sceneLoaded)
{
return;
}
if (!this.boatNavigator)
{
this.prevNodePosition = this.tr.position;
this.prevNode = this.node;
}
else
{
this.prevNodePosition = this.boat.tr.position;
this.prevNode = this.boat.node;
}
this.prevFollowPosition = this.moveFollow.position;
this.moveNode = null;
this.movePoint = this.vectorZero;
this.moveCount = 1;
this.moveTurns = 1f;
this.moveTurnSpeed = 1f;
bool flag = false;
for (int i = 1; i < this.nodeActions.Count; i++)
{
if (!flag)
{
if (this.nodeActions[i].Contains("Switch"))
{
flag = true;
}
else
{
this.moveTurns += 1f;
}
}
}
this.moveTurnSpeed = this.moveTurns;
if (!this.npc && this.raycastModifier && this.raycastModifier.enabled)
{
this.setArea = (int)this.node.Area;
GraphNode graphNode = this.NearNode(this.vectorPath[0], false, 0, -1, 0);
if (graphNode != null)
{
if (graphNode.Area != this.node.Area)
{
this.nodePath[0] = graphNode;
}
Vector3 vector = (Vector3)graphNode.position;
if (Mathf.Abs(vector.y - this.vectorPath[0].y) > 1.5f)
{
this.vectorPath[0] = new Vector3(this.vectorPath[0].x, vector.y, this.vectorPath[0].z);
}
}
}
this.nextNode = this.nodePath[0];
this.moveNode = this.nextNode;
this.movePoint = this.vectorPath[0];
this.totalDist = Vector3.Distance(this.prevNodePosition, this.movePoint);
this.totalDistNodes = Vector3.Distance(this.moveFollow.position, this.movePoint);
if (this.node != null)
{
Vector3 vector2 = (Vector3)this.node.position;
Vector3 vector3 = (Vector3)this.moveNode.position;
vector2.y = vector3.y;
Vector3.Distance(vector2, vector3);
}
this.jumping = false;
this.jumpLanding = false;
Vector3 vector4 = (Vector3)this.nextNode.position;
Vector3 vector5 = this.prevNodePosition;
bool flag2 = true;
if (this.node != null && this.moveNode != null && !this.boatNavigator && (((this.node.environment == 0 || this.node.environment == 1) && this.moveNode.environment == 2) || (this.node.environment == 2 && (this.moveNode.environment == 0 || this.moveNode.environment == 1))))
{
flag2 = false;
}
bool flag3 = false;
if (this.hasActions && !this.ambushing && this.actions && this.actions.ai.jumping && !this.charging)
{
flag3 = true;
}
bool flag4 = false;
if (!flag2 || (this.totalDist > 4f && Records.x.pocketPause && this.party && flag4) || this.evading || this.isHitFlying || this.charging || this.ambushing || flag3 || this.alwaysJump)
{
this.jumping = true;
this.alwaysJump = false;
this.jumpLanding = false;
this.jumpTime = Links.x.gameplay.seconds;
this.currentArcIndex = 0;
int num = 0;
if (flag3 && !this.charging && !this.evading)
{
if (this.stats.xmlName.Contains("Bakka"))
{
num = 15;
}
else if (this.stats.xmlName.Contains("Jump"))
{
num = 20;
}
}
if (this.isHitFlying)
{
num = 5;
}
if (this.charging)
{
this.chargeTime = Links.x.gameplay.seconds;
if (this.mainSelected)
{
this.setArea = (int)this.node.Area;
GraphNode graphNode2 = this.NearNode(this.movePoint, false, 0, -1, 0);
if (graphNode2 == null && this.actions)
{
graphNode2 = this.actions.ai.chargeTarget.node;
}
if (graphNode2 != null && graphNode2.Area != this.node.Area && this.actions)
{
graphNode2 = this.actions.ai.chargeTarget.node;
}
if (graphNode2 != null)
{
if (((Vector3)graphNode2.position - this.movePoint).sqrMagnitude < 2.25f)
{
if (!Physics.Raycast(this.movePoint + new Vector3(0f, 5f, 0f), Vector3.up * -1f, 10f, 1) || Physics.Linecast(this.torsoPosition, this.movePoint + new Vector3(0f, 3f, 0f), 99072))
{
this.movePoint = (Vector3)graphNode2.position;
}
}
else
{
this.movePoint = (Vector3)graphNode2.position;
}
}
}
}
else
{
if (this.sailing)
{
this.DrawArc(this.movePoint, num);
}
else
{
this.DrawArc(this.movePoint, num);
if (!this.InAttack() && !this.downed)
{
this.PlayAnimation("JumpStart", 0f);
}
}
if (this.isHitFlying && this.arcPoints.Count >= 4)
{
this.currentArcIndex = 3;
}
if (this.evading && this.arcPoints.Count >= 2)
{
this.currentArcIndex = 1;
}
}
if (!this.evading && !this.isHitFlying)
{
this.SetRotation(Quaternion.LookRotation(this.movePoint - this.tr.position), false, false);
}
else if (this.evading)
{
this.look = Quaternion.LookRotation(this.tr.position - this.movePoint);
this.SetRotation(this.look, false, false);
}
else
{
bool flag5 = this.isHitFlying;
}
}
if (this.moveNode != null && !this.moveNode.Walkable)
{
this.TargetReached();
return;
}
if (false && this.nodePath.Count > 1)
{
this.moveCount = 2;
this.moveTurns = 1f;
this.moveTurnSpeed = 1f;
this.moveNode = this.nodePath[1];
this.movePoint = this.vectorPath[1];
this.nextNode = this.moveNode;
}
this.turningComplete = false;
this.moveFollowTime = 0f;
this.moveAnimID = 1;
if (this.boatNavigator && this.boat)
{
this.boat.NewPoint(this.movePoint, this.savedPathTarget);
}
if (this.nextNode != null && this.node != null)
{
bool flag6 = false;
if (this.nextNode.HasLinkNode() && this.node.HasLinkNode() && !this.mainSelected)
{
flag6 = true;
}
if (this.nextNode.Area != this.node.Area || (this.totalDist > 50f && !this.jumping) || flag6)
{
bool flag7 = this.AllTilesFree(this.nextNode, false);
if (!flag7 && this.collisionCharacter)
{
if (Records.x.editor)
{
Character character = this.collisionCharacter;
Debug.Log(((character != null) ? character.ToString() : null) + " blocking " + ((this != null) ? this.ToString() : null) + " day night move");
}
if (this.collisionCharacter.visible == 0)
{
flag7 = true;
}
if (this.collisionCharacter.dayNightVanishing)
{
flag7 = true;
}
}
if (!flag7 && (this.ghostVanishing || this.ambushing))
{
flag7 = true;
}
if (!flag7 && this.dayNightVanishing && this.collisionCharacter && this.collisionCharacter.npc && this.collisionCharacter.dayNightVanishing)
{
flag7 = true;
}
if (flag7)
{
this.body.SetGrounderState(false);
this.SetPosition((Vector3)this.nextNode.position, this.jumpAreasNode);
this.moveFollow.position = (Vector3)this.nextNode.position;
this.tempStop = true;
if (this.nextNode.GraphIndex == 0U)
{
this.indoorID = "";
this.desiredGraph = 0;
}
else
{
this.indoorID = Links.x.diorama.GetIndoorView().GetInteriorBoundsName((Vector3)this.nextNode.position);
this.desiredGraph = 1;
}
Links.x.sensory.UpdateCharactersIntExt(true);
this.jumpedAreas = false;
this.jumpingAreasRotation = this.smoothRot;
this.jumpingAreas = true;
this.meshAlwaysOff = false;
this.body.SetMeshState(false, true);
this.jumpingAreasTime = Time.timeSinceLevelLoad;
this.jumpAreasNode = this.nextNode;
}
else
{
this.TargetReached();
}
}
}
if (this.NodesCount() > 0 && this.movePoint != this.tr.position && !this.boatNavigator)
{
if (!this.evading && !this.isHitFlying)
{
this.GetLook(true);
}
if ((!this.body.sameNode || !this.usingKeys) && (this.AllTilesFree(this.moveNode, false) || this.jumping || this.charging))
{
this.SetRotation(this.look, false, false);
}
}
}
// Token: 0x0600036D RID: 877 RVA: 0x0004E6B4 File Offset: 0x0004C8B4
public void GetLook(bool always)
{
if (this.tr.position == this.movePoint)
{
return;
}
if (this.moveBackTarget)
{
if (this.rotateToSlope)
{
this.look = Quaternion.LookRotation(this.tr.position - new Vector3(this.movePoint.x, this.movePoint.y, this.movePoint.z));
return;
}
this.look = Quaternion.LookRotation(this.tr.position - new Vector3(this.movePoint.x, this.tr.position.y, this.movePoint.z));
return;
}
else
{
if (this.rotateToSlope)
{
this.look = Quaternion.LookRotation(new Vector3(this.movePoint.x, this.movePoint.y, this.movePoint.z) - this.tr.position);
return;
}
this.look = Quaternion.LookRotation(new Vector3(this.movePoint.x, this.tr.position.y, this.movePoint.z) - this.tr.position);
return;
}
}
// Token: 0x0600036E RID: 878 RVA: 0x0004E80C File Offset: 0x0004CA0C
public void TurnExit()
{
if (this.dead || this.stunned || !Links.x.gaia.sceneLoaded)
{
return;
}
bool flag = false;
this.turningComplete = false;
if (this.charging)
{
this.jumping = false;
this.charging = false;
}
if (this.isHitFlying)
{
this.isHitFlying = false;
}
if (this.stats.Stuck() > 0 && !this.boatNavigator)
{
this.sphere.transform.position = this.tr.position;
this.TargetReached();
return;
}
if (this.hasActions && (this.followingType == "" || this.followingType.Contains("Attack")))
{
bool flag2 = true;
if (this.sailing && this.boatNavigator && this.boat.turning)
{
flag2 = false;
}
if (this.fleeing)
{
flag2 = false;
}
if (flag2 && this.attackTime >= 1f && !this.mainSelected)
{
bool flag3 = this.actions.CheckIfMoveComplete();
if (this.actions && flag3 && !this.actions.castingSpell && !this.actions.cannotInterrupt)
{
return;
}
}
}
bool flag4 = this.CheckEarlyIfInRange();
if (this.stepReady && !this.dead && !this.stunned && !this.moveTurn && this.setupComplete && !this.downed && this.nodePath.Count > 0 && !flag4)
{
this.stepReady = false;
if (this.usingKeys && this.CheckControls() && this.nodeActions.Count == 1 && this.mainSelected)
{
flag = Links.x.fellowship.MakeDirectionalWaypoint(true);
if (!flag)
{
this.SetIdle(true);
}
}
if (!this.moveTurn && !flag)
{
this.GetNextNode();
}
if (this.nodePath.Count < 1 && this.waypoint)
{
this.waypoint.transform.position = Links.x.gameplay.farPosition;
}
if (this.nodePath.Count > 0 && !this.boatNavigator)
{
Links.x.gameplay.CheckTileEffects(this, this.node, false);
}
}
else
{
this.stepReady = false;
}
if (this.nodeActions.Count == 0)
{
this.justMoved = true;
this.timeSinceLastMove = Time.timeSinceLevelLoad;
this.moveNode = null;
this.movePoint = this.vectorZero;
this.moving = false;
}
if (this.nodeActions.Count <= 1 && !this.npc && !this.inCombat && !this.inCircle && !this.hasActions && !this.mainSelected && !Links.x.combat.inPocketAttack && this.waitingForPath == 0 && Links.x.main)
{
if (Links.x.main.physicsMove)
{
Links.x.fellowship.GetNewPath(this, Links.x.main.node);
}
else if ((Links.x.main.currentPosition - this.currentPosition).sqrMagnitude < 36f)
{
this.TargetReached();
return;
}
}
if (flag4 && !this.jumpingAreas)
{
this.TargetReached();
return;
}
if (this.nodeActions.Count > 0 && !flag && !this.jumpingAreas)
{
this.TurnEnter(false);
}
}
// Token: 0x0600036F RID: 879 RVA: 0x0004EBB3 File Offset: 0x0004CDB3
public int GetNodeCount()
{
return this.nodePath.Count;
}
// Token: 0x06000370 RID: 880 RVA: 0x0004EBC0 File Offset: 0x0004CDC0
public void GetNextNode()
{
if (this.nodeActions.Count == 1)
{
if (this.nodePath.Count > 0)
{
for (int i = 0; i < this.moveCount; i++)
{
if (this.nodePath.Count > 0)
{
this.nodePath.RemoveAt(0);
this.vectorPath.RemoveAt(0);
}
}
}
this.nodeActions.Clear();
this.TargetReached();
return;
}
if (this.nodeActions.Count > 1)
{
if (this.nodeActions.Count > this.moveCount)
{
for (int j = 0; j < this.moveCount; j++)
{
this.nodeActions.RemoveAt(0);
}
}
if (this.nodePath.Count > 0 && ((this.nodeActions[0].Contains("TileSwitch") && this.moveTurns == 1f) || (this.nodeActions[0].Contains("TileSwitch") && this.moveTurns == 2f)))
{
for (int k = 0; k < this.moveCount; k++)
{
if (this.nodePath.Count > 0)
{
this.nodePath.RemoveAt(0);
this.vectorPath.RemoveAt(0);
}
}
this.prevNodePosition = this.tr.position;
if (this.nodePath.Count > 0)
{
this.ChangeNodes();
return;
}
if (this.nodeActions.Count == 0)
{
this.TargetReached();
return;
}
}
}
else
{
this.TargetReached();
}
}
// Token: 0x06000371 RID: 881 RVA: 0x0004ED48 File Offset: 0x0004CF48
public int NodesCount()
{
return this.nodePath.Count;
}
// Token: 0x06000372 RID: 882 RVA: 0x0004ED55 File Offset: 0x0004CF55
public GraphNode LastNode()
{
return this.nodePath[this.nodePath.Count - 1];
}
// Token: 0x06000373 RID: 883 RVA: 0x0004ED70 File Offset: 0x0004CF70
public void Collide(Character collidedCharacter, bool hit)
{
if (collidedCharacter && this.mainSelected)
{
bool flag = true;
if (collidedCharacter.hasActions)
{
flag = false;
}
bool flag2 = collidedCharacter.npc;
if (collidedCharacter.physicsMove)
{
flag = false;
}
if (collidedCharacter.npc && (collidedCharacter.attackingUntilBribe || collidedCharacter.hostility >= 2))
{
flag = false;
}
if (Time.timeSinceLevelLoad < collidedCharacter.movingOutOfWayTime + 2f)
{
flag = false;
}
if (collidedCharacter.stats.Stuck() > 0 || collidedCharacter.jumping)
{
flag = false;
}
if (collidedCharacter.turning || collidedCharacter.sleeping || collidedCharacter.resting || collidedCharacter.inQueuedAbility)
{
flag = false;
}
if (collidedCharacter.node == null)
{
flag = false;
}
if (collidedCharacter.party && Records.x.partyWait && flag)
{
flag = false;
if ((collidedCharacter.tr.position - this.tr.position).sqrMagnitude < 0.25f)
{
flag = true;
}
}
if (Links.x.main.body.sneaking)
{
flag = false;
}
if (flag)
{
if (collidedCharacter.party && !this.mainSelected)
{
collidedCharacter.lookTarget = Links.x.main;
}
Vector3 vector = this.tr.right;
if (!this.npc && Links.x.GetPartyID(this) % 2 == 0)
{
vector *= -1f;
}
Vector3 vector2 = collidedCharacter.tr.position + this.tr.forward * 5f + vector * 2f;
if (hit)
{
vector2 = collidedCharacter.tr.position + Quaternion.LookRotation(collidedCharacter.tr.position - Links.x.main.tr.position) * Vector3.forward * 3f;
}
collidedCharacter.nodeConstraint.walkable = true;
collidedCharacter.nodeConstraint.constrainWalkability = true;
collidedCharacter.nodeConstraint.constrainTags = true;
if (collidedCharacter.inCircle && this.party)
{
collidedCharacter.nodeConstraint.checkCircleID = collidedCharacter.CheckCircleID();
}
else
{
collidedCharacter.nodeConstraint.checkCircleID = 0;
}
collidedCharacter.nodeConstraint.passID = collidedCharacter.nodeStationaryID;
collidedCharacter.nodeConstraint.passID2 = collidedCharacter.nodeMovingID;
collidedCharacter.nodeConstraint.checkConnections = collidedCharacter.ConnectionNumber();
collidedCharacter.nodeConstraint.constrainToArea = (int)collidedCharacter.node.Area;
int num = 2;
int num2 = collidedCharacter.CheckCircleID();
if (collidedCharacter.inCircle && collidedCharacter.hasCircleBuff)
{
num = 1;
num2 = 2;
}
GraphNode graphNode = collidedCharacter.GetSlideNode(vector2, collidedCharacter.node, true, num2, num);
if (graphNode != null)
{
collidedCharacter.lookTarget = Links.x.main;
collidedCharacter.movingOutOfWayTime = Time.timeSinceLevelLoad;
collidedCharacter.movingOutOfWay = true;
if (collidedCharacter.turning)
{
collidedCharacter.EndTurning(false);
}
int num3 = 4;
if (collidedCharacter.inCircle)
{
num3 = 2;
}
if (collidedCharacter.party && Records.x.friends)
{
num3 = 1;
}
if (collidedCharacter.hasCircleBuff)
{
collidedCharacter.MakePath(graphNode, 1, false, false, true);
return;
}
collidedCharacter.MakePath(Links.x.main.node, num3, false, true, true);
}
}
}
}
// Token: 0x06000374 RID: 884 RVA: 0x0004F0BC File Offset: 0x0004D2BC
public GraphNode GetSlideNode(Vector3 direction, GraphNode n, bool constrainTags, int circleID, int constrainPenalty)
{
this.nodeConstraint.constrainToArea = (int)n.Area;
this.nodeConstraint.walkable = true;
this.nodeConstraint.constrainWalkability = true;
this.nodeConstraint.constrainTags = constrainTags;
if (constrainTags)
{
this.nodeConstraint.passID = this.nodeStationaryID;
this.nodeConstraint.passID2 = this.nodeMovingID;
this.nodeConstraint.checkCircleID = circleID;
}
else
{
this.nodeConstraint.passID = 0;
this.nodeConstraint.passID2 = 0;
this.nodeConstraint.checkCircleID = 0;
}
if (this.npc)
{
this.nodeConstraint.constrainPenalty = 0;
}
else
{
this.nodeConstraint.constrainPenalty = constrainPenalty;
}
this.nodeConstraint.checkConnections = this.ConnectionNumber();
if (!constrainTags)
{
this.nodeConstraint.checkConnections = 0;
}
if (this.ghost)
{
this.nodeConstraint.constrainToEnvironment = 0;
}
if (this.movesOnWater)
{
this.nodeConstraint.constrainToEnvironment = 2;
}
float num = 49f;
if (this.hasCircleBuff)
{
num = 100f;
}
return n.ClosestConnection(n, this.nodeStationaryID, this.nodeMovingID, num, direction, (int)this.radius, this.ConnectionNumber(), this.nodeConstraint, 0);
}
// Token: 0x06000375 RID: 885 RVA: 0x0004F200 File Offset: 0x0004D400
public GraphNode FindSlideNode(Character movingCharacter, Vector3 fromPoint, bool self, bool straightBack)
{
Quaternion quaternion = this.tr.rotation;
if (movingCharacter.tr.position != this.tr.position && !self)
{
quaternion = Quaternion.LookRotation(movingCharacter.tr.position - this.tr.position);
}
else
{
quaternion = Quaternion.LookRotation(fromPoint - this.tr.position);
}
float num = 1f;
Vector3 position = movingCharacter.tr.position;
if (straightBack)
{
num = -0.5f;
}
Vector3 vector = position + quaternion * Vector3.forward * num;
if (!movingCharacter.stunned && !straightBack)
{
if (Random.Range(0, 2) == 0)
{
vector += quaternion * Vector3.right * 1.5f;
}
else
{
vector += quaternion * Vector3.right * -1.5f;
}
}
this.nodeConstraint.constrainToArea = (int)movingCharacter.node.Area;
this.nodeConstraint.walkable = true;
this.nodeConstraint.constrainWalkability = true;
this.nodeConstraint.constrainTags = true;
this.nodeConstraint.checkCircleID = 0;
this.nodeConstraint.passID = movingCharacter.nodeStationaryID;
this.nodeConstraint.passID2 = movingCharacter.nodeMovingID;
if (this.npc)
{
this.nodeConstraint.constrainPenalty = 0;
}
else
{
this.nodeConstraint.constrainPenalty = 2;
}
this.nodeConstraint.checkConnections = movingCharacter.ConnectionNumber();
if (this.movesOnWater)
{
this.nodeConstraint.constrainToEnvironment = 2;
}
GraphNode graphNode = movingCharacter.node.ClosestConnection(movingCharacter.node, movingCharacter.nodeStationaryID, movingCharacter.nodeMovingID, 25f, vector, (int)this.radius, movingCharacter.ConnectionNumber(), this.nodeConstraint, 0);
GraphNode graphNode2 = graphNode;
if (graphNode != null)
{
GraphNode graphNode3 = graphNode.ClosestConnection(graphNode, movingCharacter.nodeStationaryID, movingCharacter.nodeMovingID, 25f, vector, (int)this.radius, movingCharacter.ConnectionNumber(), this.nodeConstraint, 0);
if (graphNode3 != null)
{
graphNode2 = graphNode3;
}
}
return graphNode2;
}
// Token: 0x06000376 RID: 886 RVA: 0x0004F424 File Offset: 0x0004D624
public bool NodeBlocked(GraphNode blockedNode, GameObject blockedObj)
{
if (!Links.x.gaia.sceneLoaded)
{
this.SetAnimatorSpeed(1f);
return true;
}
if (this.jumping)
{
return false;
}
this.tempStop = true;
this.stepReady = false;
this.moveTurn = false;
if (Records.x.astarDebugging && this.blockedTime == 0f)
{
string[] array = new string[13];
array[0] = ((this != null) ? this.ToString() : null);
array[1] = " NODE BLOCKED ";
int num = 2;
Character character = this.collisionCharacter;
array[num] = ((character != null) ? character.ToString() : null);
array[3] = " ";
array[4] = this.node.ID.ToString();
array[5] = " ";
array[6] = this.pushCount.ToString();
array[7] = " ";
array[8] = this.blockedTime.ToString();
array[9] = " ";
int num2 = 10;
GraphNode graphNode = this.targetNode;
array[num2] = ((graphNode != null) ? graphNode.ToString() : null);
array[11] = " ";
array[12] = this.pushCount.ToString();
Debug.Log(string.Concat(array));
}
if ((this.isBoro || this.party) && this.ignoreRemoveControls && Records.x.removeControls && this.jumping)
{
this.tempStop = false;
this.stepReady = true;
this.blockedTime = 0f;
this.SetAnimatorSpeed(1f);
return true;
}
if (this.ghostVanishing || this.ambushing)
{
this.tempStop = false;
this.stepReady = true;
this.blockedTime = 0f;
this.SetAnimatorSpeed(1f);
return true;
}
if (this.inCircle && this.npc && this.collisionCharacter && this.collisionCharacter.group == this.group)
{
this.tempStop = false;
this.stepReady = true;
this.blockedTime = 0f;
this.SetAnimatorSpeed(1f);
return true;
}
bool flag = true;
if (flag && this.pushCount >= Links.x.fellowship.pushCountMax)
{
flag = false;
}
if (this.isBoro)
{
flag = true;
}
if (this.party && !this.mainSelected && this.collisionCharacter && !this.collisionCharacter.npc)
{
flag = false;
}
if (this.boatNavigator || this.inCombat || this.hasActions)
{
flag = false;
}
if (flag && !this.sailing && this.collisionCharacter)
{
if (this.collisionCharacter.movingOutOfWay && (this.ignoreRemoveControls || this.isBoro || this.mainSelected))
{
this.tempStop = false;
this.stepReady = true;
this.blockedTime = 0f;
this.SetAnimatorSpeed(1f);
return true;
}
flag = true;
if (this.collisionCharacter.mainSelected)
{
flag = false;
}
if (this.collisionCharacter.node == null)
{
flag = false;
}
if (this.collisionCharacter.resting || this.collisionCharacter.stunned || this.collisionCharacter.sleeping || this.collisionCharacter.downed)
{
flag = false;
}
if ((this.collisionCharacter.moving || this.collisionCharacter.NodesCount() > 0) && !this.mainSelected)
{
flag = false;
}
if (this.collisionCharacter.hasActions && this.collisionCharacter.npc)
{
flag = false;
}
if (this.isBoro && this.collisionCharacter.party)
{
flag = true;
}
if (this.collisionCharacter.isBoro)
{
flag = true;
}
if (this.collisionCharacter.sailing)
{
flag = false;
}
if (Records.x.astarDebugging)
{
string[] array2 = new string[9];
array2[0] = flag.ToString();
array2[1] = " ";
int num3 = 2;
Character character2 = this.collisionCharacter;
array2[num3] = ((character2 != null) ? character2.ToString() : null);
array2[3] = " ";
array2[4] = this.collisionCharacter.waitingForPath.ToString();
array2[5] = " ";
int num4 = 6;
GraphNode graphNode2 = this.collisionCharacter.node;
array2[num4] = ((graphNode2 != null) ? graphNode2.ToString() : null);
array2[7] = " ";
array2[8] = this.collisionCharacter.NodesCount().ToString();
Debug.Log(string.Concat(array2));
}
if (flag)
{
if (Records.x.astarDebugging)
{
string text = "pushing ";
Character character3 = this.collisionCharacter;
Debug.Log(text + ((character3 != null) ? character3.ToString() : null));
}
GraphNode graphNode3 = this.FindSlideNode(this.collisionCharacter, this.movePoint, false, false);
if (graphNode3 != null && graphNode3 != this.collisionCharacter.node && this.collisionCharacter.stats.Stuck() == 0 && ((Vector3)graphNode3.position - this.collisionCharacter.tr.position).sqrMagnitude < 16f && PathUtilities.IsPathPossible(graphNode3, this.collisionCharacter.node))
{
if (this.canPush && !this.stats.animal)
{
this.pushCount = 0;
}
this.tempStop = false;
if (Records.x.astarDebugging && this.blockedTime == 0f)
{
string text2 = ((this != null) ? this.ToString() : null);
string text3 = " shoving ";
Character character4 = this.collisionCharacter;
Debug.Log(text2 + text3 + ((character4 != null) ? character4.ToString() : null));
}
if (this.collisionCharacter.returnToPointTime == 0f && this.collisionCharacter.npc)
{
this.collisionCharacter.returnToPoint = this.collisionCharacter.node;
}
this.collisionCharacter.returnToPointTime = Time.timeSinceLevelLoad;
this.collisionCharacter.Slide(graphNode3, false);
this.waitingForNewPath = false;
this.collisionCharacter.body.lookAtController.SetNewTarget(this.body.headBone, 0f, 0f, false);
this.blockedTime = 0f;
this.stepReady = true;
if (this.collisionCharacter.body.sneaking)
{
this.collisionCharacter.EndSneak(true, false);
}
if (this.npc && !this.stats.animal && !this.ghost && !this.ghost && !this.summoned && this.collisionCharacter.party && Time.timeSinceLevelLoad > this.lastExcuseTime + 5f)
{
this.StartQuip("Excuse me");
this.lastExcuseTime = Time.timeSinceLevelLoad;
}
this.SetAnimatorSpeed(1f);
return false;
}
}
this.pushCount++;
this.collisionCharacter = null;
}
if (this.blockedTime == 0f)
{
if (this.npc || this.summoned)
{
this.blockedTime = Time.timeSinceLevelLoad + Random.Range(0.1f, 0.4f);
}
else
{
int num5 = Links.x.fellowship.CharacterIndex(this);
this.blockedTime = Time.timeSinceLevelLoad + ((float)num5 * 0.05f + 0.05f);
if (this.mainSelected || Links.x.fellowship.OnlyOneMoving(this))
{
this.blockedTime = Time.timeSinceLevelLoad;
}
}
this.waitingForNewPath = true;
this.waitingForNewPathTime = Time.timeSinceLevelLoad;
}
if (!this.stats.flying)
{
this.SetAnimatorSpeed(0.0001f);
}
bool flag2 = false;
if (this.inFriendGroup && !this.isFriendGroupLeader && !this.friendLeader.moving && !this.friendLeader.physicsMove && this.collisionCharacter == this.friendLeader)
{
flag2 = true;
this.TargetReached();
}
if (this.blockedTime != 0f && Time.timeSinceLevelLoad > this.blockedTime && !flag2)
{
this.nodePath.Clear();
this.nodeActions.Clear();
this.vectorPath.Clear();
this.justMoved = true;
this.timeSinceLastMove = Time.timeSinceLevelLoad;
this.moving = false;
this.moveNode = null;
this.movePoint = this.vectorZero;
this.waitingForNewPath = true;
this.waitingForNewPathTime = Time.timeSinceLevelLoad;
this.tempStop = false;
this.blockedTime = 0f;
this.blockPathCount++;
if (this.blockPathCount > 2)
{
this.SetAnimatorSpeed(1f);
this.PlayIdle();
this.blockPathCount = 0;
}
if (this.targetNode != null && !this.hasActions && this.npc)
{
this.nodeConstraint.walkable = true;
this.nodeConstraint.constrainWalkability = true;
this.nodeConstraint.constrainTags = true;
this.nodeConstraint.checkCircleID = this.CheckCircleID();
if (!this.npc && this.targetNode.circle == 1)
{
this.nodeConstraint.checkCircleID = 1;
}
if (!this.boatNavigator)
{
this.nodeConstraint.passID = this.nodeStationaryID;
this.nodeConstraint.passID2 = this.nodeMovingID;
this.nodeConstraint.checkConnections = this.ConnectionNumber();
}
else
{
this.nodeConstraint.passID = this.boat.nodeStationaryID;
this.nodeConstraint.passID2 = this.boat.nodeMovingID;
this.nodeConstraint.checkConnections = this.boat.ConnectionNumber();
}
this.nodeConstraint.constrainToArea = -1;
if (!this.nodeConstraint.Suitable(this.targetNode))
{
int id = this.targetNode.ID;
if (Records.x.astarDebugging)
{
Debug.Log(((this != null) ? this.ToString() : null) + " repath node id is " + id.ToString());
}
bool flag3 = false;
if (!this.npc)
{
int count = this.gos.Count;
for (int i = 0; i < count; i++)
{
Character character5 = this.gos[i];
if (character5.nodeStationaryID == id)
{
break;
}
if (character5.nodeMovingID == id)
{
flag3 = true;
break;
}
}
}
if (!flag3)
{
if (this.boatNavigator)
{
this.targetNode = this.boat.NearNode((Vector3)this.targetNode.position, true, 0, -1);
}
else
{
this.targetNode = this.NearNode((Vector3)this.targetNode.position, true, 0, -1, this.CheckCircleID());
if (Records.x.astarDebugging)
{
Debug.Log(((this != null) ? this.ToString() : null) + " had to repath but node was not longer available");
}
}
}
}
if (this.inCombat && this.hasActions)
{
this.actions.targetMovePosition = this.targetNode;
}
if (this.party || (this.boatNavigator && this.sailing && this.isBoro))
{
this.showWaypoint = true;
}
if (this.party)
{
this.pushCount = Links.x.fellowship.pushCountMax + 1;
}
this.MakePath(this.targetNode, 200, false, false, this.party);
}
else
{
this.TargetReached();
}
}
return false;
}
// Token: 0x06000377 RID: 887 RVA: 0x0004FF50 File Offset: 0x0004E150
public bool IsWalking()
{
int currentHash = this.body.currentHash;
return currentHash == this.body.walkHash || currentHash == this.body.walkStartHash || currentHash == this.body.combatWalkHash || currentHash == this.body.walkPartyHash || currentHash == this.body.combatWalkStartHash || currentHash == this.body.walkEndHash || currentHash == this.body.combatWalkEndHash || currentHash == this.body.creepStartHash || currentHash == this.body.creepEndHash || currentHash == this.body.creepHash || currentHash == this.body.walkBackHash || currentHash == this.body.walkBackStartHash || currentHash == this.body.walkBackEndHash;
}
// Token: 0x06000378 RID: 888 RVA: 0x0005002C File Offset: 0x0004E22C
public void SetAnimatorSpeed(float speed)
{
if (this.body.animationHold)
{
return;
}
if (this.pocketPaused && !this.pocketPausedOverride && Records.x.pocketPause && (!Links.x.combat.inPocketAttack || !this.party || !Links.x.pocketWheel.rallyWheelOpen))
{
return;
}
if (this.turning)
{
if (this.party)
{
speed = 1.5f;
if (this.hasActions)
{
speed *= 1.25f;
}
}
else if (!this.dodging && (this.moving || this.movingOutOfWay))
{
speed = 1.4f;
}
else
{
if (this.patrolSpeed == 0f)
{
this.patrolSpeed = 1f;
}
if (this.hasActions)
{
if (this.moving)
{
this.patrolSpeed = 0.75f;
}
else
{
this.patrolSpeed = 0.75f;
}
}
speed = this.patrolSpeed;
}
}
else
{
bool @bool = this.animator.GetBool("Idle");
if ((this.animID == 1 || (!@bool && this.IsWalking())) && !Links.x.combat.combatCinematics && !this.tempStop && !this.blocked && !this.turning && !this.isHit && speed > 0.1f)
{
float num;
if (!this.party && !this.isBoro)
{
if (this.npc && !this.stats.animal && !this.hasActions && !Records.x.banquetIsle && !this.vipFollow)
{
num = this.stats.MoveSpeed(false) * 0.75f;
}
else
{
num = this.stats.MoveSpeed(false);
}
if (this.inCircle && this.group && (this.group.inFormationMovement || this.group.inSwarm || this.group.inSwarmWait))
{
num *= this.group.FormationSpeed(this);
}
if (this.summoned && !this.npc)
{
float sqrMagnitude = (this.currentPosition - Links.x.main.currentPosition).sqrMagnitude;
if (sqrMagnitude > 625f && sqrMagnitude <= 1225f && !this.hasActions)
{
num *= 1.3f;
}
if (sqrMagnitude > 1225f)
{
num *= 2f;
}
}
}
else if (this.body.sneaking)
{
num = this.stats.MoveSpeed(false) - 0.25f;
}
else if (this.inCombat || (Records.x.InCombat(false) && (this.vipFollow || this.summoned)))
{
num = this.stats.MoveSpeed(false);
}
else
{
num = Links.x.main.stats.PartyAdventureMoveSpeed();
RaycastHit raycastHit;
if (this.mainSelected && Physics.SphereCast(this.currentPosition + new Vector3(0f, 4f, 0f), 0.25f, Vector3.up * -1f, out raycastHit, 20f, Links.x.floor))
{
num *= Mathf.Clamp(Mathf.Abs(raycastHit.normal.y), 0.85f, 1f);
}
if (this.inTown && !this.fleeing)
{
num *= 1.2f;
}
if (this.movingOutOfWay)
{
num *= 1.1f;
}
if (this.followingType != "" && !this.physicsMove)
{
num *= 1.1f;
}
if (!this.mainSelected && !Links.x.combat.inPocketAttack && !this.isBoro)
{
float sqrMagnitude2 = (this.currentPosition - Links.x.main.currentPosition).sqrMagnitude;
if (sqrMagnitude2 < 64f)
{
num *= 0.9f - Mathf.Clamp(this.portraitID / 20f, 0f, 0.4f);
}
if (sqrMagnitude2 >= 64f && sqrMagnitude2 <= 144f && !this.hasActions)
{
num *= 0.95f - Mathf.Clamp(this.portraitID / 20f, 0f, 0.4f);
}
if (sqrMagnitude2 > 144f && sqrMagnitude2 <= 625f && !this.hasActions)
{
num *= 1.05f - Mathf.Clamp(this.portraitID / 20f, 0f, 0.4f);
}
if (sqrMagnitude2 > 625f && sqrMagnitude2 <= 1225f && !this.hasActions)
{
num *= 1.3f - Mathf.Clamp(this.portraitID / 20f, 0f, 0.4f);
}
if (sqrMagnitude2 > 1225f)
{
num *= 2f;
}
}
if (this.isBoro && !this.sailing)
{
num = 0.6f;
}
}
if (this.running)
{
speed *= 1.5f;
}
speed *= Mathf.Clamp(num, 0f, 20f);
if (this.fleeing && !Records.x.removeControls && !this.summoned)
{
speed *= 2f;
}
if (this.moveBackward)
{
speed *= this.stats.characterRow._MoveBackSpeed;
}
if (this.stats.race == "Yeti")
{
if (this.inTown)
{
speed *= 0.9f;
}
else if (this.mainSelected || this.hasActions)
{
speed *= 0.8f;
}
else
{
speed *= 0.72f;
}
}
if (this.charging)
{
if (this.stats.animal)
{
speed *= 3f;
}
else
{
speed *= 3.5f;
}
}
}
else if (this.IsAttacking(this.body.currentHash))
{
if (speed > 0.1f)
{
speed = 1f;
}
}
else if (speed > 0.1f)
{
speed = 1f;
}
}
if ((!this.IsWalking() || !this.party) && speed != this.animator.speed)
{
this.animator.speed = speed;
}
this.currentAnimatorSpeed = speed;
}
// Token: 0x06000379 RID: 889 RVA: 0x000506A8 File Offset: 0x0004E8A8
public void DoPath(bool skipPool)
{
if (this.waitingForPath == -1)
{
this.waitingForPath = 0;
}
this.MakePath(this.savedPathTarget, this.maxNodesSave, this.estimatedPathSave, this.toDirectionSave, skipPool);
}
// Token: 0x0600037A RID: 890 RVA: 0x000506DC File Offset: 0x0004E8DC
public void UpdateSizeRadius(float n)
{
this.radius = n;
if (this.radius <= 1f)
{
this.attackRadius = Records.x.nodeSize / 2f;
}
if (this.radius == 3f)
{
this.attackRadius = Records.x.nodeSize * 2f / 2f;
}
if (this.radius == 4f)
{
this.attackRadius = Records.x.nodeSize * 3f / 2f;
}
if (this.radius == 8f)
{
this.attackRadius = Records.x.nodeSize * 3f / 2f;
}
if (this.thisCollider)
{
if (this.radius <= 3f)
{
this.thisCollider.radius = 0.7f;
}
else
{
this.thisCollider.radius = 2.5f;
}
}
if (this.playerBorders)
{
this.playerBorders.UpdateSize(n);
if (this.radius == 1f)
{
this.cc.radius = 0.7f;
return;
}
if (this.radius == 8f)
{
this.cc.radius = 2.5f;
}
}
}
// Token: 0x0600037B RID: 891 RVA: 0x00050820 File Offset: 0x0004EA20
public Vector3 BoundsMin()
{
return this.thisCollider.bounds.min;
}
// Token: 0x0600037C RID: 892 RVA: 0x00050840 File Offset: 0x0004EA40
public Vector3 BoundsMax()
{
return this.thisCollider.bounds.max - new Vector3(0f, 0.5f, 0f);
}
// Token: 0x0600037D RID: 893 RVA: 0x00050879 File Offset: 0x0004EA79
public int ConnectionNumber()
{
if (this.radius == 1f)
{
return 0;
}
if (this.radius == 3f)
{
return 3;
}
if (this.radius == 4f)
{
return 4;
}
if (this.radius >= 8f)
{
return 8;
}
return 0;
}
// Token: 0x0600037E RID: 894 RVA: 0x000508B8 File Offset: 0x0004EAB8
public float RealRadius()
{
if (this.radius == 1f)
{
return 1f;
}
if (this.radius == 3f)
{
return 1.5f;
}
if (this.radius == 4f)
{
return 2f;
}
if (this.radius >= 8f)
{
return 3f;
}
return 1f;
}
// Token: 0x0600037F RID: 895 RVA: 0x00050918 File Offset: 0x0004EB18
public void CheckPath(GraphNode pathTarg, bool toDirection)
{
if (!Links.x.gaia.sceneLoaded)
{
return;
}
if (this.NodesCount() == 0)
{
this.charging = false;
}
if (!this.npc)
{
if (Random.Range(0, 2) == 0 && this.hasActions)
{
this.walkConstraint.constrainPenalty = 2;
}
else
{
this.walkConstraint.constrainPenalty = 3;
}
}
else if ((!this.hasActions && Random.Range(0, 10) == 0 && (this.deactivating || this.dayNightVanishing || this.alwaysOn)) || this.missing || this.waitingForNewPath)
{
this.walkConstraint.constrainPenalty = 0;
}
else
{
this.walkConstraint.constrainPenalty = 1;
}
this.walkConstraint.constrainWalkability = true;
this.walkConstraint.walkable = true;
if ((this.stats.animal && !this.ignoreNodeIDs) || (this.party && !this.mainSelected && !this.boatNavigator && (this.hasActions || !Links.x.main.moving || (!this.hasActions && Random.Range(0, 4) != 0))) || (this.fleeing || (Records.x.removeControls && !this.ignoreNodeIDs)) || (this.npc && !this.dayNightVanishing) || this.boatNavigator)
{
this.pushCount = Links.x.fellowship.pushCountMax + 100;
}
else if (this.npc && this.dayNightVanishing)
{
if (Random.Range(0, 2) == 0)
{
this.pushCount = 0;
}
else
{
this.pushCount = Links.x.fellowship.pushCountMax + 100;
}
}
if (this.ignoreNodeIDs || (this.isBoro && Records.x.removeControls) || (!this.hasActions && this.pushCount < Links.x.fellowship.pushCountMax && this.returnToPointTime == 0f && !this.boatNavigator) || (this.ghostVanishing || this.ambushing || (this.dayNightVanishing && this.visible == 0 && !this.waitingForNewPath && !this.boatNavigator)) || (this.mainSelected && Records.x.pocketPause && !this.pocketPaused))
{
this.walkConstraint.constrainTags = false;
}
else
{
this.walkConstraint.constrainTags = true;
}
this.walkConstraint.checkCircleID = this.CheckCircleID();
if (this.boatNavigator)
{
if (this.sailing && !this.npc)
{
if (!this.raycastModifier)
{
this.raycastModifier = base.gameObject.AddComponent<RaycastModifier>();
}
}
else if (this.isBoro && this.raycastModifier)
{
Object.Destroy(this.raycastModifier);
}
}
bool flag = false;
if (this.raycastModifier)
{
if (this.mainSelected && !this.waitingForNewPath && this.radius < 3f)
{
flag = true;
}
if (Links.x.combat.inPocketAttack && this.party)
{
flag = true;
}
if (this.boatNavigator && !this.npc)
{
if (this.boat)
{
flag = true;
this.raycastModifier.sailing = true;
this.raycastModifier.excludeObject = this.boat.gameObject;
}
}
else
{
this.raycastModifier.sailing = false;
}
if (!flag)
{
this.raycastModifier.enabled = false;
if (this.simpleSmoothModifier)
{
this.simpleSmoothModifier.enabled = true;
}
}
else
{
if (this.simpleSmoothModifier)
{
this.simpleSmoothModifier.enabled = false;
}
this.raycastModifier.enabled = true;
}
}
else if (this.simpleSmoothModifier)
{
this.simpleSmoothModifier.enabled = true;
}
this.simpleSmoothModifier.radius = (int)this.radius;
if (this.walkConstraint.constrainTags)
{
this.walkConstraint.passID = this.nodeMovingID;
this.walkConstraint.passID2 = this.nodeStationaryID;
}
else
{
this.walkConstraint.passID = 0;
this.walkConstraint.passID2 = 0;
}
this.walkConstraint.checkConnections = this.ConnectionNumber();
this.walkConstraint.constrainDistance = false;
this.walkConstraint.constrainToArea = -1;
if (!this.npc && Links.x.hasMain && this.node != null && Links.x.main.node != null && this.node != null && this.node.Area == Links.x.main.node.Area && !this.inCircle)
{
this.walkConstraint.constrainToArea = (int)this.node.Area;
}
if (this.ghost && !this.ghostVanishing)
{
this.walkConstraint.constrainToEnvironment = 0;
}
if (this.sailing && this.boatNavigator)
{
this.walkConstraint.passID = this.boat.nodeMovingID;
this.walkConstraint.passID2 = this.boat.nodeStationaryID;
this.walkConstraint.constrainToEnvironment = 2;
this.walkConstraint.checkConnections = 4;
this.boat.SetNodeID(true, true);
if (this.boat.node == null)
{
return;
}
if (this.simpleSmoothModifier && !flag)
{
this.simpleSmoothModifier.enabled = true;
}
}
else if (this.movesOnWater)
{
this.walkConstraint.constrainToEnvironment = 2;
}
else
{
this.SetNodeID(true, true);
if (this.node == null)
{
return;
}
}
if (!toDirection)
{
if (this.raycastModifier && (pathTarg.Area != this.node.Area || pathTarg.GraphIndex != this.node.GraphIndex))
{
this.raycastModifier.enabled = false;
if (this.simpleSmoothModifier)
{
this.simpleSmoothModifier.enabled = true;
}
}
this.seeker.pathConstraint = this.walkConstraint;
if (this.mainSelected || (this.isBoro && this.sailing))
{
this.seeker.clickPoint = this.clickedPoint;
this.seeker.StartPath(this.tr.position, (Vector3)pathTarg.position, null);
this.waitingForPath = 1;
}
else
{
if (this.party)
{
if (!this.raycastModifier.enabled)
{
this.seeker.clickPoint = Vector3.zero;
}
}
else
{
this.seeker.clickPoint = Vector3.zero;
}
GraphNode graphNode = this.CastPoint();
if (graphNode != null)
{
this.seeker.StartPath(graphNode, pathTarg, null);
this.waitingForPath = 1;
}
}
}
if (toDirection)
{
if (this.fleeing || this.movingOutOfWay)
{
if (this.fleeingAroundPoint)
{
this.seeker.clickPoint = Vector3.zero;
this.seeker.pathConstraint = this.walkConstraint;
pathTarg = this.NearNode((Vector3)pathTarg.position + new Vector3(Random.Range(-2f, 2f), 0f, Random.Range(-2f, 2f)), true, 0, -1, 0);
if (pathTarg != null)
{
this.seeker.StartPath(this.CastPoint(), pathTarg, null);
}
else
{
this.seeker.StartFleePath(this.CastPoint(), this.savedPathTarget, 40000, new OnPathDelegate(this.PathFinished), 5f, 1000);
}
}
else
{
this.seeker.clickPoint = Vector3.zero;
this.seeker.pathConstraint = this.walkConstraint;
int num = this.maxNodesSave;
if (num > 40)
{
num = 40;
}
Vector3 vector = new Vector3(Random.Range(-2f, 2f), 0f, Random.Range(-2f, 2f));
if (this.savedPathTarget != null)
{
vector = (Vector3)this.savedPathTarget.position;
}
Quaternion quaternion = Quaternion.LookRotation(this.currentPosition - vector);
if (!this.npc || this.hasActions)
{
this.setArea = (int)this.node.Area;
}
if (this.radius < 3f)
{
pathTarg = this.NearNode(this.currentPosition + quaternion * Vector3.forward * (float)num + new Vector3(Random.Range(-4f, 4f), 0f, Random.Range(-4f, 4f)), true, 0, -1, 0);
}
if (pathTarg != null && this.radius < 3f && Random.Range(0, 3) == 0)
{
this.seeker.StartPath(this.CastPoint(), pathTarg, null);
}
else
{
if (this.radius < 3f)
{
pathTarg = this.NearNode(this.currentPosition + quaternion * Vector3.forward * 3f + new Vector3(Random.Range(-4f, 4f), 0f, Random.Range(-4f, 4f)), true, 0, -1, 0);
}
if (pathTarg != null && this.radius < 3f)
{
this.seeker.StartPath(this.CastPoint(), pathTarg, null);
}
else
{
this.seeker.StartFleePath(this.CastPoint(), this.savedPathTarget, 40000, new OnPathDelegate(this.PathFinished), 1f, 1000);
}
}
}
this.waitingForPath = 1;
}
else
{
this.seeker.clickPoint = Vector3.zero;
this.seeker.pathConstraint = this.walkConstraint;
this.seeker.StartRandomPath(this.CastPoint(), 40000, new OnPathDelegate(this.PathFinished), 10f, 1000, (Vector3)this.savedPathTarget.position);
this.waitingForPath = 1;
}
}
if (Records.x.astarDebugging)
{
Debug.Log("Submitting path finished to seeker " + ((this != null) ? this.ToString() : null) + " " + this.waitingForPath.ToString());
}
}
// Token: 0x06000380 RID: 896 RVA: 0x00051358 File Offset: 0x0004F558
public void TakePath(Character takeFrom, GraphNode destination)
{
Debug.Log("take path " + ((takeFrom != null) ? takeFrom.ToString() : null) + " " + ((this != null) ? this.ToString() : null));
this.ClearNodePath();
this.prepPath.Clear();
this.prepVectorPath.Clear();
this.prepPathTemp = takeFrom.prepPath;
this.prepVectorPathTemp = takeFrom.prepVectorPath;
for (int i = 0; i < this.prepPathTemp.Count; i++)
{
this.prepPath.Add(this.prepPathTemp[i]);
this.prepVectorPath.Add(this.prepVectorPathTemp[i]);
}
this.savedPathTarget = destination;
this.maxNodesSave = 100;
this.estimatedPathSave = false;
this.toDirectionSave = false;
}
// Token: 0x06000381 RID: 897 RVA: 0x00051428 File Offset: 0x0004F628
public void Jump(GraphNode destination, Vector3 point, bool evade, bool isFlyBack)
{
this.ClearNodePath();
this.prepPath.Clear();
this.prepVectorPath.Clear();
this.prepVectorPath.Add(point);
this.prepPath.Add(destination);
this.waitingForPath = 2;
this.savedPathTarget = destination;
this.maxNodesSave = 100;
this.estimatedPathSave = false;
this.toDirectionSave = false;
this.evading = evade;
this.isHitFlying = isFlyBack;
this.slideNode = null;
this.DoPath(true);
}
// Token: 0x06000382 RID: 898 RVA: 0x000514AC File Offset: 0x0004F6AC
public void PathFinished(Path p)
{
if (!Links.x.gaia.sceneLoaded || this.waitingForPath == 0)
{
if (Records.x.astarDebugging && Links.x.gaia.sceneLoaded)
{
Debug.Log(((this != null) ? this.ToString() : null) + " Path canceled - waiting for path = 0");
}
return;
}
p.Claim(this);
if (this.sailing && this.boatNavigator)
{
this.boat.SetNodeID(true, false);
}
else
{
this.SetNodeID(true, false);
}
if (Records.x.astarDebugging)
{
Debug.Log(string.Concat(new string[]
{
"Path finished ",
(this != null) ? this.ToString() : null,
" ",
p.error.ToString(),
" ",
p.path.Count.ToString(),
" ",
p.vectorPath.Count.ToString()
}));
}
bool flag = false;
if (!p.error && !this.jumpingAreas)
{
this.tempPath = p.path;
this.pathpointVectors = p.vectorPath;
bool flag2 = false;
if (this.raycastModifier && this.raycastModifier.enabled)
{
flag2 = true;
}
if (flag2)
{
if (!this.mainSelected && !this.hasActions && !this.inCircle && !this.inCombat && !this.npc && !this.isBoro && !this.sailing)
{
if (this.tempPath.Count > 15 && (Links.x.main.tr.position - this.currentPosition).sqrMagnitude < 400f)
{
flag = true;
}
if (this.tempPath.Count > 9 && (Links.x.main.tr.position - this.currentPosition).sqrMagnitude < 100f)
{
flag = true;
}
}
this.prepVectorPath.Clear();
this.prepPath.Clear();
int count = this.pathpointVectors.Count;
this.pointsTemp.Clear();
this.nodesTemp.Clear();
this.prevPoint = this.tr.position;
if (this.pathpointVectors.Count > 0)
{
this.prevPoint = this.pathpointVectors[0];
}
if (!flag)
{
for (int i = 1; i < count; i++)
{
float num = Vector3.Distance(this.pathpointVectors[i], this.prevPoint);
int num2 = Mathf.RoundToInt(num) / 2 + 1;
if (this.sailing)
{
num2 = Mathf.RoundToInt(num) / 4 + 1;
}
if (num == 0f)
{
num = 0.2f;
}
for (int j = 0; j < num2; j++)
{
float num3 = 2f * (float)j / num;
if (this.sailing)
{
num3 = (float)(j + 1) / (float)num2;
}
if (num3 > 1f)
{
num3 = 1f;
}
if (num3 < 0f)
{
num3 = 0f;
}
Vector3 vector = Vector3.Lerp(this.prevPoint, this.pathpointVectors[i], num3);
RaycastHit raycastHit;
if (this.boatNavigator)
{
if (Physics.Raycast(vector + new Vector3(0f, 10f, 0f), Vector3.up * -1f, out raycastHit, 20f, 16) && !this.pointsTemp.Contains(raycastHit.point))
{
this.pointsTemp.Add(raycastHit.point);
this.nodesTemp.Add(this.tempPath[0]);
}
}
else if (Physics.Raycast(vector + new Vector3(0f, 3f, 0f), Vector3.up * -1f, out raycastHit, 12f, 4194305) && Vector3.Distance(this.tr.position, vector) > 0.1f && !this.pointsTemp.Contains(raycastHit.point))
{
this.pointsTemp.Add(raycastHit.point);
this.nodesTemp.Add(this.tempPath[0]);
}
if (j == num2 - 1)
{
this.prevPoint = vector;
}
}
}
if (this.pointsTemp.Count > 0)
{
this.pointsTemp[this.pointsTemp.Count - 1] = this.pathpointVectors[this.pathpointVectors.Count - 1];
}
else if (this.pathpointVectors.Count > 0)
{
this.pointsTemp.Add(this.pathpointVectors[this.pathpointVectors.Count - 1]);
this.nodesTemp.Add(this.tempPath[0]);
}
if (this.pointsTemp.Count > 0)
{
GraphNode graphNode = this.NearNode(this.pointsTemp[this.pointsTemp.Count - 1], false, 0, (int)this.node.GraphIndex, 0);
if (graphNode != null && this.nodesTemp.Count > 0)
{
this.nodesTemp[this.nodesTemp.Count - 1] = graphNode;
}
}
for (int k = 0; k < this.pointsTemp.Count; k++)
{
if (k > 0)
{
this.prepVectorPath.Add(this.pointsTemp[k]);
this.prepPath.Add(this.nodesTemp[k]);
}
else if ((this.pointsTemp[k] - this.tr.position).sqrMagnitude > 0.040000003f || this.boatNavigator)
{
this.prepVectorPath.Add(this.pointsTemp[k]);
this.prepPath.Add(this.nodesTemp[k]);
}
}
}
}
this.movingAreas = false;
if (!flag2)
{
int count2 = this.tempPath.Count;
this.prepPath.Clear();
this.prepVectorPath.Clear();
if (this.maxNodesSave == 0)
{
this.maxNodesSave = 100;
}
if (this.party && !this.mainSelected && this.maxNodesSave > 20)
{
this.maxNodesSave = 20;
}
uint num4 = 0U;
if (this.node != null)
{
num4 = this.node.Area;
}
float nodeSize = Records.x.nodeSize;
float nodeSize2 = Records.x.nodeSize;
bool flag3 = false;
Vector3 vector2 = this.tr.position;
bool flag4 = false;
bool flag5 = false;
if (!this.mainSelected && !this.hasActions && !this.inCircle && !this.inCombat && !this.npc && !this.isBoro)
{
flag4 = false;
if (this.tempPath.Count > 20 && (Links.x.main.tr.position - this.currentPosition).sqrMagnitude < 225f)
{
flag = true;
flag3 = true;
}
if (this.tempPath.Count > 9 && (Links.x.main.tr.position - this.currentPosition).sqrMagnitude < 100f)
{
flag = true;
flag3 = true;
}
}
for (int l = 0; l < count2; l++)
{
if (this.prepPath.Count < this.maxNodesSave && this.tempPath[l] != null)
{
if (l == 0)
{
bool flag6 = false;
if (this.tempPath[l].Area != num4)
{
flag6 = true;
}
GraphNode graphNode2 = this.node;
if (this.boatNavigator)
{
GraphNode graphNode3 = this.boat.node;
}
if (flag6 && this.movingOutOfWay)
{
flag3 = true;
}
if (this.party && !this.mainSelected && flag6 && !this.inCircle)
{
flag3 = true;
}
if (this.forceNodePath)
{
flag6 = true;
}
float num5 = 6f;
if (this.pathpointVectors.Count > 0)
{
num5 = (this.pathpointVectors[0] - this.tr.position).sqrMagnitude;
}
if (num5 > 36f && this.tempPath[0].HasLinkNode())
{
flag6 = true;
}
if ((this.tempPath.Count <= 1 || (!this.sailing && num5 >= 6f)) && !flag3)
{
if (l < this.tempPath.Count)
{
if (flag6 || this.tempPath.Count == 1)
{
this.prepVectorPath.Add(this.GetNodeCenter(this.tempPath[l]));
vector2 = this.prepVectorPath[0];
}
else
{
if (l < this.pathpointVectors.Count)
{
this.prepVectorPath.Add(this.pathpointVectors[l]);
}
else
{
this.prepVectorPath.Add(this.GetNodeCenter(this.tempPath[l]));
}
vector2 = this.prepVectorPath[0];
}
this.prepPath.Add(this.tempPath[l]);
}
else
{
if (flag6)
{
this.prepVectorPath.Add(this.GetNodeCenter(this.tempPath[this.tempPath.Count - 1]));
}
else
{
this.prepVectorPath.Add(this.pathpointVectors[this.pathpointVectors.Count - 1]);
}
this.prepPath.Add(this.tempPath[this.tempPath.Count - 1]);
vector2 = this.prepVectorPath[0];
}
}
if (flag6)
{
this.movingAreas = true;
}
}
else
{
int count3 = this.tempPath.Count;
int count4 = this.pathpointVectors.Count;
bool flag7 = false;
if (l < count3 && l - 1 < count3)
{
if (this.tempPath[l].Area != this.tempPath[l - 1].Area)
{
flag7 = true;
}
if (((Vector3)this.tempPath[l].position - (Vector3)this.tempPath[l - 1].position).sqrMagnitude > 36f && (this.tempPath[l].HasLinkNode() || this.tempPath[l - 1].HasLinkNode()))
{
flag7 = true;
}
}
if (l < count4 && l - 1 < count4)
{
float sqrMagnitude = (this.pathpointVectors[l] - this.pathpointVectors[l - 1]).sqrMagnitude;
}
if (l < count3 && l + 1 < count3 && this.tempPath[l].Area != this.tempPath[l + 1].Area)
{
flag7 = true;
}
if (l - 1 < count3 && l - 2 < count3 && l - 1 >= 0 && l - 2 >= 0 && this.tempPath[l - 1].Area != this.tempPath[l - 2].Area)
{
flag7 = true;
}
if (l - 2 < count3 && l - 3 < count3 && l - 3 >= 0 && l - 2 >= 0 && this.tempPath[l - 2].Area != this.tempPath[l - 3].Area)
{
flag7 = true;
}
if (l + 1 < count3 && l + 2 < count3 && this.tempPath[l + 1].Area != this.tempPath[l + 2].Area)
{
flag7 = true;
}
if (l + 2 < count3 && l + 3 < count3 && this.tempPath[l + 2].Area != this.tempPath[l + 3].Area)
{
flag7 = true;
}
if (flag7 && this.movingOutOfWay && this.party)
{
flag3 = true;
}
if (this.party && !this.mainSelected && flag7 && !this.missing && !this.inCircle)
{
flag3 = true;
}
if (this.forceNodePath)
{
flag7 = true;
}
if (flag4)
{
flag5 = false;
if (l % 2 == 0)
{
flag5 = true;
Vector3 vector3 = new Vector3(0f, 1f, 0f);
Vector3 up = Vector3.up;
LayerMask layerMask = 6357760;
Vector3 vector4 = vector2;
Vector3 vector5 = this.pathpointVectors[l];
Vector3 vector6 = Quaternion.LookRotation(vector5 - vector4) * Vector3.right;
if (flag7)
{
flag5 = false;
}
if (flag5 && Physics.Linecast(vector4 + vector3, vector5 + vector3, layerMask))
{
flag5 = false;
}
if (flag5 && Physics.Linecast(vector4 + vector3 + vector6 * 0.5f, vector5 + vector3 + vector6 * 0.5f, layerMask))
{
flag5 = false;
}
if (flag5 && Physics.Linecast(vector4 + vector3 - vector6 * 0.5f, vector5 + vector3 - vector6 * 0.5f, layerMask))
{
flag5 = false;
}
if (flag5)
{
float num6 = Vector3.Distance(vector5, vector4);
int num7 = 1;
int num8 = Mathf.RoundToInt(num6) * num7;
for (int m = 0; m < num8; m++)
{
float num9 = (float)m / (float)num8;
if (num9 > 1f)
{
num9 = 1f;
}
if (num9 < 0f)
{
num9 = 0f;
}
Vector3 vector7 = Vector3.Lerp(vector4, vector5, num9);
if (flag5 && flag5)
{
if (!Physics.Raycast(vector7 + vector3, up * -1f, 2f, 4194305))
{
flag5 = false;
}
RaycastHit raycastHit2;
if (flag5 && Physics.Raycast(vector7 + vector3, up * -1f, out raycastHit2, 8f, 4194321) && raycastHit2.collider.gameObject.layer == 4)
{
flag5 = false;
}
}
}
}
}
}
if (((this.boatNavigator && l % 3 == 0) || (!this.boatNavigator && !flag4) || (!this.boatNavigator && flag4 && !flag5) || (l == count2 - 1 && this.boatNavigator && this.hasActions) || (l == this.maxNodesSave - 1 && this.boatNavigator && this.hasActions)) && !flag3 && l < this.pathpointVectors.Count)
{
if (flag7)
{
this.prepVectorPath.Add(this.GetNodeCenter(this.tempPath[l]));
vector2 = this.GetNodeCenter(this.tempPath[l]);
}
else
{
this.prepVectorPath.Add(this.pathpointVectors[l]);
vector2 = this.pathpointVectors[l];
}
this.prepPath.Add(this.tempPath[l]);
}
if (l < this.tempPath.Count)
{
num4 = this.tempPath[l].Area;
}
if (flag7)
{
this.movingAreas = true;
}
}
}
}
if (((this.isBoro && this.sailing) || this.mainSelected) && this.clickedPoint != Vector3.zero && !this.usingCircles && Vector3.Distance(this.clickedPoint, this.pathpointVectors[this.pathpointVectors.Count - 1]) < 1f && !Physics.CheckSphere(this.clickedPoint, 1f, -2147417280))
{
this.pathpointVectors[this.pathpointVectors.Count - 1] = this.clickedPoint;
}
this.forceNodePath = false;
}
if (this.prepPath.Count > 0)
{
this.waitingForPath = 2;
if (this.toDirectionSave && this.prepPath[this.prepPath.Count - 1] != null)
{
this.savedPathTarget = this.prepPath[this.prepPath.Count - 1];
}
if (Records.x.astarDebugging)
{
string[] array = new string[6];
array[0] = "Do path ";
array[1] = ((this != null) ? this.ToString() : null);
array[2] = " node path count ";
array[3] = this.prepPath.Count.ToString();
array[4] = " ";
int num10 = 5;
GraphNode graphNode4 = this.prepPath[this.prepPath.Count - 1];
array[num10] = ((graphNode4 != null) ? graphNode4.ToString() : null);
Debug.Log(string.Concat(array));
}
if (this.savedPathTarget == null)
{
this.savedPathTarget = this.prepPath[this.prepPath.Count - 1];
}
this.blockedTime = 0f;
this.justMoved = false;
this.tempStop = false;
this.blocked = false;
this.vectorPath.Clear();
this.nodePath.Clear();
this.nodeActions.Clear();
this.timeSinceFollowPath = Time.timeSinceLevelLoad;
this.DoPath(true);
}
else
{
flag = true;
}
}
else
{
flag = true;
}
if (flag)
{
if (Records.x.astarDebugging)
{
Debug.Log(string.Concat(new string[]
{
(this != null) ? this.ToString() : null,
" path failed, error: ",
p.error.ToString(),
" ",
this.maxNodesSave.ToString(),
" ",
this.node.environment.ToString()
}));
if (this.tempPath != null)
{
Debug.Log(string.Concat(new string[]
{
(this != null) ? this.ToString() : null,
" temp path count ",
this.tempPath.Count.ToString(),
" push count ",
this.pushCount.ToString()
}));
}
}
this.movingOutOfWay = false;
if (this.npc)
{
this.waitingForPath = 3;
this.waitForPathTime = Time.timeSinceLevelLoad;
if (this.hasActions)
{
if (!p.error && this.tempPath.Count == 1)
{
this.TargetReached();
}
else
{
this.CheckIfClearPathEfforts();
}
}
else
{
this.CheckIfClearPathEfforts();
}
}
else if (this.hasActions && !this.jumpingAreas)
{
this.waitingForPath = 3;
this.waitForPathTime = Time.timeSinceLevelLoad;
if (!p.error && this.tempPath.Count == 1)
{
this.TargetReached();
return;
}
this.CheckIfClearPathEfforts();
return;
}
else
{
this.waitingForPath = 0;
}
}
if (this.prepPath.Count == 0 && this.hasActions && this.creatures)
{
this.patrolNode--;
}
p.Release(this, false);
}
// Token: 0x06000383 RID: 899 RVA: 0x0005288C File Offset: 0x00050A8C
public void AddKeyNode(GraphNode n, Vector3 pt)
{
if (n == this.node)
{
this.body.sameNode = true;
}
else
{
this.body.sameNode = false;
}
this.prepVectorPath.Clear();
this.prepPath.Clear();
this.prepPath.Add(n);
this.prepVectorPath.Add(pt);
this.waitingForPath = 2;
this.savedPathTarget = n;
this.maxNodesSave = 1;
this.estimatedPathSave = false;
this.toDirectionSave = false;
this.DoPath(true);
this.usingKeys = true;
this.waypoint.transform.position = Links.x.gameplay.farPosition;
if (this.waypointAnimator.enabled)
{
this.waypointAnimator.enabled = false;
}
}
// Token: 0x06000384 RID: 900 RVA: 0x00052954 File Offset: 0x00050B54
public GraphNode GetLastPrepNode()
{
if (this.nodePath.Count == 0)
{
return null;
}
if (!this.CheckControls())
{
return null;
}
if (!Records.x.InCombat(false))
{
return this.nodePath[this.nodePath.Count - 1];
}
if (this.nodePath[this.nodePath.Count - 1] == null)
{
return null;
}
return this.nodePath[this.nodePath.Count - 1];
}
// Token: 0x06000385 RID: 901 RVA: 0x000529D4 File Offset: 0x00050BD4
public void FindCurrentNodeAnytime(bool snap)
{
if (Links.x.gaia.noAstar || !this.tr)
{
return;
}
GraphNode graphNode = this.NearNode(this.tr.position, true, 0, -1, 0);
if (graphNode != null)
{
this.nodePoint = (Vector3)graphNode.position;
if (Mathf.Abs(this.nodePoint.y - this.tr.position.y) < 2f && (this.nodePoint - this.tr.position).sqrMagnitude < 16f)
{
if (!this.stuckInPlace && !this.moving && snap && !this.mainSelected)
{
this.Slide(graphNode, false);
}
this.ClaimNode(graphNode, this.nodePoint, false);
}
}
}
// Token: 0x06000386 RID: 902 RVA: 0x00052AB0 File Offset: 0x00050CB0
public void FindCurrentNode(bool snap)
{
if (this.tr && !this.offMap)
{
GraphNode graphNode = this.NearNode(this.tr.position, true, 0, -1, 0);
if (graphNode != null && Mathf.Abs(this.nodePoint.y - this.tr.position.y) < 2f && (this.nodePoint - this.tr.position).sqrMagnitude < 16f)
{
this.nodePoint = (Vector3)graphNode.position;
this.ClaimNode(graphNode, this.nodePoint, false);
if (!this.stuckInPlace && !this.moving && snap && !this.mainSelected)
{
this.Slide(graphNode, false);
}
}
}
}
// Token: 0x06000387 RID: 903 RVA: 0x00052B88 File Offset: 0x00050D88
public void SetWaypoint(Vector3 pt)
{
if ((this.vectorPath.Count > 2 || pt != Vector3.zero) && (this.mainSelected || this.showWaypoint) && this.waypoint)
{
if (!this.waypoint.activeSelf)
{
this.waypoint.SetActive(true);
}
if (!this.waypointAnimator.enabled)
{
this.waypointAnimator.enabled = true;
this.waypointAnimator.Play("waypointArrowStart");
}
if (pt == Vector3.zero)
{
pt = this.vectorPath[this.vectorPath.Count - 1];
}
this.waypoint.transform.position = pt + new Vector3(0f, -0.5f, 0f);
}
}
// Token: 0x06000388 RID: 904 RVA: 0x00052C6C File Offset: 0x00050E6C
private bool CanEndJump()
{
RaycastHit raycastHit;
return Physics.Raycast(this.tr.position + new Vector3(0f, 3f, 0f), Vector3.up * -1f, out raycastHit, 30f, 4194449) && Vector3.Distance(raycastHit.point, this.tr.position) < 0.5f;
}
// Token: 0x06000389 RID: 905 RVA: 0x00052CE0 File Offset: 0x00050EE0
public void ForceEndJump()
{
RaycastHit raycastHit;
if (this.jumping && Physics.Raycast(this.tr.position + new Vector3(0f, 3f, 0f), Vector3.up * -1f, out raycastHit, 30f, 4194449))
{
this.SetPosition(raycastHit.point, null);
}
this.jumping = false;
this.jumpLanding = false;
}
// Token: 0x0600038A RID: 906 RVA: 0x00052D58 File Offset: 0x00050F58
public void ClearNodePath()
{
if (this.jumping && !this.CanEndJump())
{
return;
}
this.jumpLanding = false;
this.vectorPath.Clear();
this.nodePath.Clear();
this.nodeActions.Clear();
this.moving = false;
this.moveNode = null;
this.movePoint = Vector3.zero;
if (!this.npc && !this.isBoro && this.waypoint && this.waypointAnimator)
{
this.waypoint.transform.position = Links.x.gameplay.farPosition;
if (this.waypointAnimator.enabled)
{
this.waypointAnimator.enabled = false;
}
}
if (this.sphere)
{
this.sphere.transform.position = this.tr.position;
}
this.waitingForPath = 0;
this.savedPathTarget = null;
this.jumping = false;
if (this.isHitFlying)
{
this.isHitFlying = false;
}
this.waitingForNewPath = false;
this.StopEvading();
this.MoveBackEmpty();
if (Records.x.astarDebugging)
{
Debug.Log(((this != null) ? this.ToString() : null) + " is clearning node path");
}
this.SetIdle(true);
}
// Token: 0x0600038B RID: 907 RVA: 0x00052EA8 File Offset: 0x000510A8
public void EndPath()
{
if (this.sailing)
{
return;
}
if (this.jumping)
{
return;
}
if (Records.x.astarDebugging)
{
Debug.Log(string.Concat(new string[]
{
(this != null) ? this.ToString() : null,
" end path ",
this.nodePath.Count.ToString(),
" ",
this.vectorPath.Count.ToString(),
" ",
this.animator.speed.ToString(),
" ",
this.animID.ToString(),
" ",
this.moveOnTiles.ToString()
}));
}
if (this.moving && this.movePoint != this.vectorZero)
{
this.sphere.transform.position = this.movePoint;
}
else if (this.sphere)
{
if (this.node != null && !this.mainSelected)
{
this.sphere.transform.position = this.NodePosition();
}
else
{
this.sphere.transform.position = this.tr.position;
}
}
if (Records.x.dialogue || Records.x.turnBased)
{
this.currentlyInDialogue = true;
}
if (this.node == null || Records.x.turnBased)
{
this.FindCurrentNode(false);
}
this.returnToPointTime = 0f;
this.StopEvading();
if (this.nodePath.Count == 0 && this.node != null && !Records.x.dialogue)
{
if ((this.NodePosition() - this.tr.position).sqrMagnitude > 0.5625f)
{
this.vectorPath.Clear();
this.nodePath.Clear();
this.nodeActions.Clear();
this.nodeActions.Add("TileSwitch");
this.nodePath.Add(this.node);
this.vectorPath.Add(this.NodePosition());
this.moveIndex = -1;
this.waitingForPath = 0;
if (this.sphere && this.node != null)
{
this.sphere.transform.position = this.NodePosition();
}
if (this.waypoint)
{
this.waypoint.transform.position = Links.x.gameplay.farPosition;
if (this.waypointAnimator.enabled)
{
this.waypointAnimator.enabled = false;
}
}
if (this.hasActions)
{
this.actions.targetMovePosition = this.nodePath[this.nodePath.Count - 1];
if (this.actions.TargetCount() > 0 && this.waypoint)
{
this.waypoint.transform.position = Links.x.gameplay.farPosition;
if (this.waypointAnimator.enabled)
{
this.waypointAnimator.enabled = false;
}
}
}
this.blockedTime = 0f;
this.targetNode = this.node;
this.tempStop = false;
this.TurnEnter(true);
}
return;
}
this.savedPathTarget = null;
this.waitingForPath = 0;
int num = this.nodePath.Count - 1;
if (this.nodePath.Count > 0)
{
this.tempStop = false;
for (int i = 0; i < this.nodePath.Count; i++)
{
if (i != num)
{
this.nodePath[i] = null;
this.nodeActions[i] = "";
this.vectorPath[i] = Vector3.zero;
}
else if (this.node != null)
{
this.nodePath[i] = this.node;
this.vectorPath[i] = this.NodePosition();
this.moveNode = this.node;
this.movePoint = this.NodePosition();
}
}
this.nodePath.RemoveAll((GraphNode item) => item == null);
this.nodeActions.RemoveAll((string item) => item == "");
this.vectorPath.RemoveAll((Vector3 item) => item == Vector3.zero);
if (this.sphere && this.node != null)
{
this.sphere.transform.position = this.NodePosition();
}
if (this.waypoint)
{
this.waypoint.transform.position = Links.x.gameplay.farPosition;
if (this.waypointAnimator.enabled)
{
this.waypointAnimator.enabled = false;
}
}
if (this.hasActions)
{
this.actions.targetMovePosition = this.nodePath[this.nodePath.Count - 1];
}
this.GetLook(true);
this.targetNode = this.node;
}
this.waitingForNewPath = false;
this.StopMoveToRoutine();
this.ClearMoveTargets();
}
// Token: 0x0600038C RID: 908 RVA: 0x0005342C File Offset: 0x0005162C
public void StartDelayedPath(GraphNode pathTarg, float t, float delay)
{
if (!this)
{
return;
}
if (this.dead)
{
return;
}
if (this.inactive)
{
return;
}
if (this.delayPathCoroutine != null)
{
base.StopCoroutine(this.delayPathCoroutine);
this.delayPathCoroutine = null;
}
this.delayPathCoroutine = this.DelayedPath(pathTarg, t, delay);
base.StartCoroutine(this.delayPathCoroutine);
}
// Token: 0x0600038D RID: 909 RVA: 0x0005348B File Offset: 0x0005168B
private IEnumerator DelayedPath(GraphNode pathTarg, float t, float delay)
{
if (delay > 0f)
{
if (delay == 100f)
{
yield return new WaitForSeconds(1f);
while (!Links.x.fellowship.EveryoneInPosition(this))
{
yield return null;
}
}
else
{
while (this.inRecovery && this.hasActions)
{
yield return null;
}
yield return new WaitForSeconds(delay);
}
}
else
{
yield return new WaitForSeconds(0.02f * t);
}
this.MakePath(pathTarg, 100, false, false, true);
yield break;
}
// Token: 0x0600038E RID: 910 RVA: 0x000534B0 File Offset: 0x000516B0
public void ClearPathUpdatesAll()
{
Links.x.gameplay.RemoveNeedsPath(this);
this.savedPathTarget = null;
this.waitingForPath = 0;
this.MoveBackEmpty();
this.blockedTime = 0f;
this.stepReady = false;
this.justMoved = false;
this.tempStop = false;
this.blocked = false;
if (this.turning)
{
this.EndTurning(false);
}
}
// Token: 0x0600038F RID: 911 RVA: 0x00053518 File Offset: 0x00051718
public void ClearCurrentPathNodes()
{
Links.x.gameplay.RemoveNeedsPath(this);
this.savedPathTarget = null;
this.waitingForPath = 0;
this.MoveBackEmpty();
this.blockedTime = 0f;
this.stepReady = false;
this.justMoved = false;
this.tempStop = false;
this.blocked = false;
if (this.turning)
{
this.EndTurning(false);
}
this.vectorPath.Clear();
this.nodePath.Clear();
this.nodeActions.Clear();
}
// Token: 0x06000390 RID: 912 RVA: 0x000535A0 File Offset: 0x000517A0
public void ClearPathUpdates()
{
this.waitingForPath = 0;
}
// Token: 0x06000391 RID: 913 RVA: 0x000535AC File Offset: 0x000517AC
public void MakePath(GraphNode pathTarg, int maxNodes, bool estimatePath, bool toDirection, bool skipPool)
{
if (Records.x.astarDebugging)
{
Debug.Log(string.Concat(new string[]
{
(this != null) ? this.ToString() : null,
" making path ",
(pathTarg != null) ? pathTarg.ToString() : null,
" ",
this.waitingForPath.ToString()
}));
}
if (this.dead || this.stunned || this.offMap || this.sleeping || (this.party && Records.x.partyCamping))
{
return;
}
if (Records.x.removeControls && !this.ignoreRemoveControls && !Links.x.combat.inPocketAttack && !Links.x.combat.inRally)
{
return;
}
if (Records.x.dialogue && !this.ignoreRemoveControls)
{
return;
}
if (this.sailing && !this.ignoreRemoveControls && !this.boatNavigator)
{
return;
}
if (this.ambushing && this.waitingForPath == 0)
{
return;
}
if (!Links.x.gaia.sceneLoaded)
{
return;
}
if (Links.x.combat.combatCinematics && !this.waitingToJoinDome)
{
this.waitingForPath = 0;
return;
}
if (this.stuckInPlace && !this.boatNavigator)
{
this.waitingForPath = 0;
return;
}
if (this.stats.Stuck() > 0 && !this.sailing)
{
if (this.hasActions)
{
this.actions.EndTurn(true);
}
this.waitingForPath = 0;
return;
}
if (!this.tr || this.dead || this.stunned)
{
this.waitingForPath = 0;
return;
}
if (this.inactive && this.npc)
{
this.waitingForPath = 0;
return;
}
if (this.node == null && !this.boatNavigator)
{
this.FindCurrentNode(true);
}
if (this.boatNavigator && this.boat.node == null)
{
this.boat.ClaimNode(null, this.boat.tr.position, false);
}
if (pathTarg == null)
{
this.waitingForPath = 0;
return;
}
if (this.jumpingAreas)
{
return;
}
if (Records.x.astarDebugging)
{
string[] array = new string[22];
array[0] = ((this != null) ? this.ToString() : null);
array[1] = " ";
array[2] = ((Vector3)pathTarg.position).ToString();
array[3] = " ";
array[4] = this.waitingForPath.ToString();
array[5] = " skip: ";
array[6] = skipPool.ToString();
array[7] = " max: ";
array[8] = maxNodes.ToString();
array[9] = " prep count: ";
array[10] = this.prepPath.Count.ToString();
array[11] = " searching: ";
array[12] = this.searching.ToString();
array[13] = " to direction: ";
array[14] = toDirection.ToString();
array[15] = this.fleeingAroundPoint.ToString();
array[16] = " move target ";
int num = 17;
Character character = this.followingCharacter;
array[num] = ((character != null) ? character.ToString() : null);
array[18] = " ignore node ids ";
array[19] = this.ignoreNodeIDs.ToString();
array[20] = " running ";
array[21] = this.running.ToString();
Debug.Log(string.Concat(array));
}
if (this.jumping && this.waitingForPath == 0)
{
return;
}
if (!Links.x.gaia.pathfindingReady)
{
this.waitingForPath = 0;
return;
}
if (this.party && this.inRecovery && this.hasActions)
{
this.StartDelayedPath(pathTarg, 0f, 0.0001f);
}
if (!this.npc || this.inCombat)
{
skipPool = true;
}
if (!this.usingKeys)
{
this.body.sameNode = false;
}
this.usingKeys = false;
this.maxNodesSave = maxNodes;
this.blockedTime = 0f;
this.tempStop = false;
this.blocked = false;
if (this.sphere)
{
this.sphere.transform.position = (Vector3)pathTarg.position;
}
this.savedPathTarget = pathTarg;
if (this.body.lookAtController.hasTarget && !Records.x.dialogue)
{
this.body.lookAtController.hasTarget = false;
}
if (!skipPool)
{
this.estimatedPathSave = estimatePath;
this.toDirectionSave = toDirection;
Links.x.gameplay.AddNeedsPath(this, false);
this.waitingForPath = -1;
return;
}
if (this.waitingForPath == 3)
{
this.waitingForPath = 0;
}
if (this.waitingForPath <= 0 && !this.outsideBounds)
{
if (this.charging)
{
this.jumping = false;
this.charging = false;
}
this.savedPathTarget = pathTarg;
this.estimatedPathSave = estimatePath;
this.toDirectionSave = toDirection;
this.CheckPath(pathTarg, toDirection);
return;
}
if (this.waitingForPath != 1)
{
this.waitingForPath = 0;
if (!estimatePath && !this.estimatedPathSave)
{
this.OnMovePathComplete();
if (!this.npc)
{
if (this.nodePath.Count > 0)
{
if (this.canPush && !this.stats.animal)
{
this.pushCount = 0;
}
if ((!this.usingKeys && this.showWaypoint && this.mainSelected) || (this.isBoro && this.sailing))
{
if (this.waypoint)
{
if (!this.waypoint.activeSelf)
{
this.waypoint.SetActive(true);
}
if (!this.waypointAnimator.enabled)
{
this.waypointAnimator.enabled = true;
this.waypointAnimator.Play("waypointArrowStart");
}
this.waypoint.transform.position = this.vectorPath[this.vectorPath.Count - 1] + new Vector3(0f, -0.5f, 0f);
}
}
else if (this.waypoint && !this.showWaypoint)
{
this.waypoint.transform.position = Links.x.gameplay.farPosition;
}
this.showWaypoint = false;
if (this.hasActions)
{
this.actions.targetMovePosition = this.nodePath[this.nodePath.Count - 1];
if (this.actions.TargetCount() > 0 && this.waypoint)
{
if (this.waypointAnimator.enabled)
{
this.waypointAnimator.enabled = false;
}
this.waypoint.transform.position = Links.x.gameplay.farPosition;
}
}
}
}
else if (this.hasActions && this.nodePath.Count > 0)
{
this.actions.targetMovePosition = this.nodePath[this.nodePath.Count - 1];
}
else if (this.nodePath.Count == 0)
{
if (Records.x.astarDebugging)
{
Debug.Log(((this != null) ? this.ToString() : null) + " doesn't have enough nodes to make path");
}
this.TargetReached();
}
}
else if (this.npc)
{
this.prepPath.Clear();
this.prepVectorPath.Clear();
}
else
{
Records.x.InCombat(false);
}
this.clickedPoint = Vector3.zero;
}
}
// Token: 0x06000392 RID: 914 RVA: 0x00053D2C File Offset: 0x00051F2C
public void CheckIfClearPathEfforts()
{
this.pathTries++;
if (this.pathTries > 2)
{
this.pathTries = 0;
this.attackRadiusTries = 0;
if (this.inCombat)
{
this.ClearMoveTargets();
this.waitingForPath = 0;
this.sphere.transform.position = this.tr.position;
this.TargetReached();
if (this.hasActions)
{
this.actions.EndTurn(true);
return;
}
}
else
{
this.ClearMoveTargets();
this.waitingForPath = 0;
if (this.sphere)
{
this.sphere.transform.position = this.tr.position;
}
this.TargetReached();
this.patrolNode++;
}
}
}
// Token: 0x06000393 RID: 915 RVA: 0x00053DF8 File Offset: 0x00051FF8
public void StopMoveToRoutine()
{
if (!this)
{
return;
}
if (base.gameObject.activeSelf)
{
if (this.pathToCharacterCoroutine != null)
{
base.StopCoroutine(this.pathToCharacterCoroutine);
}
if (this.delayPathCoroutine != null)
{
base.StopCoroutine(this.delayPathCoroutine);
}
this.delayPathCoroutine = null;
this.pathToCharacterCoroutine = null;
}
}
// Token: 0x06000394 RID: 916 RVA: 0x00053E54 File Offset: 0x00052054
public bool CheckEarlyIfInRange()
{
if (this.followingType == "Dialogue")
{
float sqrMagnitude = (this.followingCharacter.tr.position - this.tr.position).sqrMagnitude;
float num = this.InteractionDistanceCheck(this.followingType);
return sqrMagnitude <= num;
}
return false;
}
// Token: 0x06000395 RID: 917 RVA: 0x00053EB0 File Offset: 0x000520B0
public void FinishMoveTo()
{
if (!Links.x.gaia.sceneLoaded)
{
this.ClearMoveTargets();
return;
}
if (this.followingCharacter)
{
this.targetPosition = this.followingCharacter.tr.position;
}
if (this.followingItem)
{
this.targetPosition = this.followingItem.tr.position;
}
if (this.followingType == "Dialogue")
{
Links.x.gameplay.FollowCharacterPathFinished(this.followingCharacter, this);
}
this.followingType.Contains("Charm");
if (this.followingType == "Attack")
{
if (this.inCombat && Records.x.turnBased)
{
this.actionPicked = true;
}
Links.x.gameplay.FollowCharacterPathFinished(this.followingCharacter, this);
}
if (this.followingType == "Item")
{
this.TargetReached();
if (this.inCombat && Records.x.turnBased)
{
this.actionPicked = true;
}
Links.x.gameplay.ItemPathFinished(this.followingItem, this);
}
if (this.followingType == "Exit")
{
if (this.turning)
{
this.EndTurning(true);
}
Links.x.gameplay.MapExitFinished(this.followingExit, this, false);
}
if (this.followingType == "Boat")
{
Links.x.gameplay.BoatFollowFinished(this.followingBoat);
}
if (this.followingType == "Breakable")
{
this.TargetReached();
if (this.inCombat && Records.x.turnBased)
{
this.actionPicked = true;
}
Links.x.gameplay.BreakableFinished(this.followingBreakable, this);
}
if (this.followingType == "Chest")
{
this.TargetReached();
if (this.inCombat && Records.x.turnBased)
{
this.actionPicked = true;
}
Links.x.gameplay.ChestFinished(this.followingChest, this);
}
if (this.followingType == "Door")
{
this.TargetReached();
if (this.inCombat && Records.x.turnBased)
{
this.actionPicked = true;
}
Links.x.gameplay.DoorFinished(this.followingDoor, this);
}
if (this.followingType == "Puzzle")
{
this.TargetReached();
if (this.inCombat && Records.x.turnBased)
{
this.actionPicked = true;
}
Links.x.gameplay.PuzzleFinished(this.followingInteractive, this);
}
if (this.followingCharacter || this.followingItem)
{
Quaternion quaternion = Quaternion.Euler(this.vectorZero);
if (this.followingItem)
{
quaternion = Quaternion.LookRotation(this.followingItem.tr.position - this.tr.position);
}
else if (this.followingCharacter.transform.position != this.tr.position)
{
quaternion = Quaternion.LookRotation(this.followingCharacter.tr.position - this.tr.position);
}
this.rot = quaternion;
Vector3 eulerAngles = this.rot.eulerAngles;
eulerAngles.z = 0f;
eulerAngles.x = 0f;
this.rot = Quaternion.Euler(eulerAngles);
}
this.ClearMoveTargets();
}
// Token: 0x06000396 RID: 918 RVA: 0x00054248 File Offset: 0x00052448
public void ClearMoveTargets()
{
if (Records.x.astarDebugging && !this.npc)
{
Debug.Log(((this != null) ? this.ToString() : null) + " clearing targets");
}
this.followingCharacter = null;
if (this.followingItem)
{
this.followingItem.StopMovingTo();
}
this.followingItem = null;
this.followingType = "";
this.followingNode = null;
this.followingInteractive = null;
this.followingBreakable = null;
this.followingChest = null;
this.followingDoor = null;
this.followingBoat = null;
this.followingExit = null;
this.followingTime = 0f;
if (this.pathToCharacterCoroutine != null)
{
base.StopCoroutine(this.pathToCharacterCoroutine);
this.pathToCharacterCoroutine = null;
}
if (this.party)
{
this.waitingForNewPath = false;
this.vectorPath.Clear();
this.nodePath.Clear();
this.nodeActions.Clear();
if (!this.npc && !this.isBoro && this.waypoint)
{
this.waypoint.transform.position = Links.x.gameplay.farPosition;
if (this.waypointAnimator.enabled)
{
this.waypointAnimator.enabled = false;
}
}
if (this.sphere)
{
this.sphere.transform.position = this.tr.position;
}
this.waitingForPath = 0;
this.savedPathTarget = null;
}
}
// Token: 0x06000397 RID: 919 RVA: 0x000543CC File Offset: 0x000525CC
public float InteractionDistanceCheck(string moveType)
{
float num = 4f;
if (moveType == "Dialogue")
{
num = Links.x.fellowship.dialogueMaxDistance * Links.x.fellowship.dialogueMaxDistance;
}
if (moveType == "DialogueLong")
{
num = 100f;
}
if (moveType == "Searching")
{
float num2 = 15f;
num = num2 * num2;
}
if (moveType.Contains("Charm"))
{
float num3 = 10f;
num = num3 * num3;
}
if (moveType == "Item")
{
float num4 = 4f;
num = num4 * num4;
}
if (moveType == "Boat")
{
float num5 = 20f;
num = num5 * num5;
}
if (moveType == "Exit")
{
float num6 = 3f;
if (this.followingExit.mapExit.exitTo != MapExit.exitToNames.Interiors && this.followingExit.mapExit.exitTo != MapExit.exitToNames.Exterior)
{
num6 = 4f;
}
num = num6 * num6;
}
if (moveType == "Breakable")
{
float num7 = 4f;
if (this.followingBreakable.resourceLocation >= 0 && (this.followingBreakable.breakable.component == Breakable.ComponentTypes.Berry || this.followingBreakable.breakable.component == Breakable.ComponentTypes.Rock))
{
num7 = 6f;
}
num = num7 * num7;
}
if (moveType == "Puzzle")
{
float num8 = 6f;
num = num8 * num8;
}
if (moveType == "Chest")
{
float num9 = 4f;
num = num9 * num9;
}
if (moveType == "Door")
{
float num10 = 4f;
num = num10 * num10;
}
return num;
}
// Token: 0x06000398 RID: 920 RVA: 0x00054548 File Offset: 0x00052748
public void StartGetPathToTarget(GraphNode moveToNode, Character moveToCharacter, global::Item moveToItem, BreakableActions moveToBreakable, ChestActions moveToChest, DoorActions moveToDoor, PuzzleActions moveToInteractive, Boat moveToBoat, Character partyCharacter, MapExitActions moveToExit, bool unblockPath, bool showFeed, bool moveWithoutPoint, string moveType, bool distanceCheckOnly)
{
if (this.hasActions && this.actions.cannotInterrupt)
{
this.actions.TryingToInterruptInventoryWait();
return;
}
if (Records.x.astarDebugging && this.moveNode != null)
{
Debug.Log(((this != null) ? this.ToString() : null) + " is making target path for: " + ((Vector3)moveToNode.position).ToString());
}
if (!Links.x.gaia.sceneLoaded || moveToNode == null)
{
return;
}
if (partyCharacter.node == null)
{
partyCharacter.FindCurrentNode(false);
}
if (partyCharacter.node == null)
{
return;
}
if (moveToCharacter)
{
if (moveToCharacter.dead || (moveToCharacter.stunned && !Records.x.kill))
{
this.ClearMoveTargets();
return;
}
if (moveToCharacter.node == null)
{
this.ClearMoveTargets();
return;
}
}
if (moveType == "Searching" && this.stats.formationGroup == 0)
{
return;
}
if (this.npc && this.inCircle)
{
return;
}
if (this.followingTime == 0f)
{
this.followingTime = Time.timeSinceLevelLoad;
}
else if (Time.timeSinceLevelLoad > this.followingTime + 10f)
{
this.ClearMoveTargets();
return;
}
this.followingCharacter = moveToCharacter;
this.followingType = moveType;
this.followingNode = moveToNode;
if (this.followingItem && this.followingItem != moveToItem)
{
this.followingItem.StopMovingTo();
if (moveToItem)
{
moveToItem.MovingTo();
}
}
this.followingItem = moveToItem;
this.followingBreakable = moveToBreakable;
this.followingChest = moveToChest;
this.followingDoor = moveToDoor;
this.followingInteractive = moveToInteractive;
this.followingBoat = moveToBoat;
this.followingExit = moveToExit;
if (Records.x.astarDebugging)
{
Debug.Log(string.Concat(new string[]
{
(this != null) ? this.ToString() : null,
" is making target path for: ",
moveType,
" distance only ",
distanceCheckOnly.ToString(),
" move node: ",
(moveToNode != null) ? moveToNode.ToString() : null,
" for character: ",
(moveToCharacter != null) ? moveToCharacter.ToString() : null
}));
}
if (this.pathToCharacterCoroutine == null && !this.doingAction && this.followingType != "")
{
this.pathToCharacterCoroutine = this.GetPathToTarget(moveToNode, moveToCharacter, moveToItem, moveToBreakable, moveToChest, moveToDoor, moveToInteractive, moveToBoat, partyCharacter, moveToExit, unblockPath, showFeed, moveWithoutPoint, moveType, 0f);
base.StartCoroutine(this.pathToCharacterCoroutine);
this.waitForPathToCharacter = false;
return;
}
this.waitForPathToCharacter = true;
}
// Token: 0x06000399 RID: 921 RVA: 0x000547F0 File Offset: 0x000529F0
private IEnumerator GetPathToTarget(GraphNode moveToNode, Character moveToCharacter, global::Item moveToItem, BreakableActions moveToBreakable, ChestActions moveToChest, DoorActions moveToDoor, PuzzleActions moveToInteractive, Boat moveToBoat, Character partyCharacter, MapExitActions moveToExit, bool unblockPath, bool showFeed, bool moveWithoutPoint, string moveType, float maxDistance)
{
if (Records.x.paused)
{
yield return null;
}
float num = ((Vector3)moveToNode.position - (Vector3)partyCharacter.node.position).sqrMagnitude;
float num2 = 100f;
Vector3 realPosition = (Vector3)moveToNode.position;
float maxY = 2.5f;
if (moveType.Contains("Item"))
{
moveToNode = this.NearNode(moveToItem.transform.position, false, 0, 2, 0);
Vector3 vector = (Vector3)moveToNode.position;
Vector3 vector2 = this.NodePosition();
num = (vector - new Vector3(vector2.x, vector.y, vector2.z)).sqrMagnitude;
num2 = (moveToItem.tr.position - new Vector3(this.tr.position.x, moveToItem.tr.position.y, this.tr.position.z)).sqrMagnitude;
realPosition = moveToItem.tr.position;
maxY = 4f;
}
if (moveType.Contains("Attacking") || moveType.Contains("Dialogue") || moveType.Contains("Charm"))
{
num = ((Vector3)moveToCharacter.node.position - (Vector3)partyCharacter.node.position).sqrMagnitude;
num2 = (moveToCharacter.tr.position - this.tr.position).sqrMagnitude;
realPosition = moveToCharacter.tr.position;
maxY = 4f;
}
if (moveToBreakable)
{
num2 = (moveToBreakable.gameObject.transform.position - this.tr.position).sqrMagnitude;
realPosition = moveToBreakable.gameObject.transform.position;
}
if (moveToChest)
{
num2 = (moveToChest.gameObject.transform.position - this.tr.position).sqrMagnitude;
realPosition = moveToChest.gameObject.transform.position;
}
if (moveToDoor)
{
num2 = (moveToDoor.lockColliderPosition - this.tr.position).sqrMagnitude;
realPosition = moveToDoor.lockColliderPosition;
}
if (moveToInteractive)
{
num2 = (moveToInteractive.gameObject.transform.position - this.tr.position).sqrMagnitude;
realPosition = moveToInteractive.gameObject.transform.position;
if (moveToInteractive.id.Contains("Birch") && Links.x.diorama.sceneName.Contains("C6"))
{
realPosition = (Vector3)moveToNode.position;
}
maxY = 4f;
}
if (moveToExit && moveToExit.mapExit.doorPoint != Vector3.zero)
{
num2 = ((Vector3)moveToNode.position - this.tr.position).sqrMagnitude;
}
maxDistance = this.InteractionDistanceCheck(moveType);
if (moveType == "Dialogue" && moveToCharacter && moveToCharacter.stats.xmlName.Contains("StoreKeep"))
{
maxDistance = this.InteractionDistanceCheck("DialogueLong");
}
if (Records.x.astarDebugging)
{
Debug.Log(string.Concat(new string[]
{
"Distance is ",
num.ToString(),
" real dist is ",
num2.ToString(),
" max distance is ",
maxDistance.ToString(),
" ",
Vector3.Distance(this.NodePosition(), (Vector3)moveToNode.position).ToString(),
" node pos ",
this.NodePosition().ToString(),
" following pos ",
((Vector3)moveToNode.position).ToString()
}));
}
if ((num <= maxDistance || num2 < maxDistance) && moveType != "Searching" && !Records.x.paused)
{
if (this.followingExit)
{
this.alwaysTurn = true;
this.SetRotation(Quaternion.LookRotation(this.followingExit.transform.position - this.tr.position), false, false);
if (this.turning)
{
yield return new WaitForSeconds(0.25f);
}
}
this.FinishMoveTo();
}
else
{
if (moveToCharacter && moveType != "Searching" && moveToCharacter.node != null)
{
this.followingNode = moveToCharacter.node;
moveToNode = this.followingNode;
}
if (moveType == "Boat")
{
this.followingNode = AstarPath.active.GetNearest(moveToBoat.transform.position, this.nodeConstraint).node;
moveToNode = this.followingNode;
}
GraphNode foundNode = null;
if (this.delayPath > 0f)
{
yield return new WaitForSeconds(this.delayPath);
this.delayPath = 0f;
}
float minDistance = 0f;
if (moveType == "Door")
{
minDistance = 0.48999998f;
}
bool stop = false;
bool onTable = false;
bool canCheckAllAngles = false;
Vector3 forwAngle = Vector3.zero;
Vector3 rightAngle = Vector3.zero;
(Vector3)moveToNode.position;
if (this.followingType == "Item" && Mathf.Abs(realPosition.y - this.tr.position.y) > 1.25f)
{
forwAngle = Quaternion.LookRotation(realPosition - new Vector3(this.tr.position.x, realPosition.y, this.tr.position.z)) * Vector3.forward;
RaycastHit raycastHit;
if (Physics.Raycast(this.tr.position + new Vector3(0f, 0.5f, 0f), forwAngle, out raycastHit, 30f, Links.x.sightBlockers) && raycastHit.normal.y <= 0.5f)
{
onTable = true;
}
canCheckAllAngles = true;
rightAngle = Quaternion.LookRotation(realPosition - new Vector3(this.tr.position.x, realPosition.y, this.tr.position.z)) * Vector3.right;
}
if (this.followingType == "Breakable" && moveToBreakable.resourceLocation >= 0)
{
canCheckAllAngles = true;
RaycastHit raycastHit2;
Physics.Raycast(moveToBreakable.gameObject.transform.position + new Vector3(0f, 10f, 0f), Vector3.up * -1f, out raycastHit2, 30f, 4194433);
forwAngle = Quaternion.LookRotation(realPosition - new Vector3(this.tr.position.x, realPosition.y, this.tr.position.z)) * Vector3.forward;
rightAngle = Quaternion.LookRotation(realPosition - new Vector3(this.tr.position.x, realPosition.y, this.tr.position.z)) * Vector3.right;
}
bool testSpread = false;
Vector3 stayPoint = Vector3.zero;
if (this.followingType == "Searching" && (this.stats.defendMainInCombat || this.stats.stayNearPatrol))
{
if (this.stats.defendMainInCombat && this.stats.defendingCharacter && this.stats.defendingCharacter.IsSentient())
{
stayPoint = this.stats.defendingCharacter.currentPosition;
testSpread = true;
}
if (this.stats.stayNearPatrol)
{
stayPoint = (Vector3)this.stats.stayNearPoint.position;
testSpread = true;
}
}
int num14;
for (int i = 0; i < 8; i = num14 + 1)
{
if (i == 0 || (foundNode == null && canCheckAllAngles))
{
GraphNode checkNode = moveToNode;
GraphNode offsetNode = null;
bool flag = false;
if (canCheckAllAngles)
{
offsetNode = null;
float num3 = 2.5f;
Vector3 vector3 = Vector3.zero;
if (i == 0)
{
vector3 = realPosition + forwAngle * -1f * num3;
}
if (i == 7)
{
vector3 = realPosition + forwAngle * num3;
}
if (i == 4)
{
vector3 = realPosition + rightAngle * -1f * num3;
}
if (i == 3)
{
vector3 = realPosition + rightAngle * num3;
}
if (i == 5)
{
vector3 = realPosition + forwAngle * num3 + rightAngle * num3;
}
if (i == 1)
{
vector3 = realPosition + forwAngle * -1f * num3 + rightAngle * num3;
}
if (i == 6)
{
vector3 = realPosition + forwAngle * num3 + rightAngle * -1f * num3;
}
if (i == 2)
{
vector3 = realPosition + forwAngle * -1f * num3 + rightAngle * -1f * num3;
}
if (onTable)
{
vector3.y = this.tr.position.y;
}
offsetNode = this.NearNode(vector3, false, 0, 2, 0);
if (offsetNode != null)
{
checkNode = offsetNode;
}
else
{
flag = true;
}
}
if (!flag && Links.x.gaia.pathfindingReady && Links.x.gaia.sceneLoaded && this.followingType != "")
{
for (int j = 0; j < 2; j = num14 + 1)
{
if (foundNode == null && this.followingType != "" && Links.x.gaia.pathfindingReady)
{
GraphNode graphNode = checkNode;
if (j == 1)
{
graphNode = this.node;
}
ConstantPath constPath = ConstantPath.ConstructFast(graphNode, Records.x.GetConstantPathRadius(4), null);
this.interactConstraint.constrainWalkability = false;
this.interactConstraint.walkable = true;
this.interactConstraint.constrainTags = false;
this.interactConstraint.passID = 0;
this.interactConstraint.passID2 = 0;
this.interactConstraint.checkConnections = 0;
this.interactConstraint.constrainToEnvironment = 1;
if (this.ghost && !this.ghostVanishing)
{
this.interactConstraint.constrainToEnvironment = 0;
}
if ((this.sailing && this.boatNavigator) || this.movesOnWater)
{
this.interactConstraint.constrainToEnvironment = 2;
}
this.interactConstraint.constrainToArea = -1;
this.interactConstraint.checkCircleID = 0;
constPath.nnConstraint = this.interactConstraint;
int x = 0;
Vector3 zero = Vector3.zero;
Vector3 thisPosition = this.tr.position;
(Vector3)checkNode.position;
Vector3 vector4 = Vector3.zero;
int num4;
if (Links.x.gaia.pathfindingReady && Links.x.gaia.sceneLoaded)
{
AstarPath.StartPath(constPath, false);
yield return base.StartCoroutine(constPath.WaitForPath());
constPath.Claim(this);
this.allNodes = constPath.allNodes;
x = this.allNodes.Count;
num4 = x - 1;
if (!this.hasActions && (this.pushCount < Links.x.fellowship.pushCountMax || this.mainSelected))
{
this.interactConstraint.constrainTags = false;
}
else
{
this.interactConstraint.constrainTags = true;
}
if (!this.mainSelected)
{
this.interactConstraint.checkCircleID = this.CheckCircleID();
}
this.interactConstraint.passID = partyCharacter.nodeMovingID;
this.interactConstraint.passID2 = partyCharacter.nodeStationaryID;
this.interactConstraint.constrainWalkability = true;
this.interactConstraint.walkable = true;
if (this.npc)
{
this.interactConstraint.constrainPenalty = 1;
}
else
{
this.interactConstraint.constrainPenalty = 2;
}
this.interactConstraint.constrainToEnvironment = 1;
if (this.ghost && !this.ghostVanishing)
{
this.interactConstraint.constrainToEnvironment = 0;
}
if (this.sailing && this.boatNavigator)
{
this.interactConstraint.constrainToEnvironment = 2;
this.interactConstraint.passID = this.boat.nodeMovingID;
this.interactConstraint.passID2 = this.boat.nodeStationaryID;
this.interactConstraint.checkConnections = this.boat.ConnectionNumber();
}
else
{
this.interactConstraint.checkConnections = partyCharacter.ConnectionNumber();
}
if (this.movesOnWater)
{
this.interactConstraint.constrainToEnvironment = 2;
}
this.interactConstraint.constrainToArea = (int)this.node.Area;
this.suitableNodes.Clear();
this.bestNodes.Clear();
this.nearNodes.Clear();
float num5 = 225f;
for (int l = 0; l < x; l++)
{
GraphNode graphNode2 = this.allNodes[l];
if ((((Vector3)graphNode2.position - realPosition).sqrMagnitude < num5 || testSpread) && this.interactConstraint.Suitable(graphNode2))
{
if (!testSpread)
{
this.suitableNodes.Add(graphNode2);
}
else if (((Vector3)graphNode2.position - stayPoint).sqrMagnitude < 100f)
{
this.suitableNodes.Add(graphNode2);
}
}
}
constPath.Release(this, false);
}
x = this.suitableNodes.Count;
num4 = x - 1;
this.used.Clear();
for (int m = 0; m < x; m++)
{
this.used.Add(false);
}
Vector3 vector5 = Quaternion.LookRotation(realPosition - new Vector3(this.tr.position.x, realPosition.y, this.tr.position.z)) * Vector3.forward;
Vector3 vector6 = Vector3.zero;
for (int n = 0; n < x; n++)
{
if (!stop)
{
float num6 = 100000f;
int num7 = -1;
for (int num8 = num4; num8 >= 0; num8--)
{
if (!stop && !this.used[num8])
{
vector4 = (Vector3)this.suitableNodes[num8].position;
float sqrMagnitude = this.SubtractVectors(new Vector3(realPosition.x, vector4.y, realPosition.z), vector4).sqrMagnitude;
bool flag2;
if (onTable)
{
if (vector4.y > thisPosition.y + 1.25f)
{
}
flag2 = true;
}
else
{
flag2 = true;
if (Mathf.Abs(vector4.y - thisPosition.y) > maxY)
{
flag2 = false;
}
}
if (testSpread || (sqrMagnitude < num6 && sqrMagnitude < maxDistance && sqrMagnitude > minDistance && flag2))
{
num7 = num8;
num6 = sqrMagnitude;
}
}
}
if (num7 > -1)
{
this.used[num7] = true;
this.bestNodes.Add(this.suitableNodes[num7]);
}
if (this.followingType == "")
{
stop = true;
}
}
}
x = this.bestNodes.Count;
num4 = x - 1;
this.used.Clear();
for (int num9 = 0; num9 < x; num9++)
{
this.used.Add(false);
}
if (moveType != "Exit")
{
for (int num10 = 0; num10 < x; num10++)
{
float num6 = -100f;
int num7 = -1;
for (int num11 = 0; num11 < x; num11++)
{
if (!this.used[num11])
{
vector4 = (Vector3)this.bestNodes[num11].position;
vector6 = Vector3.Normalize(realPosition - new Vector3(vector4.x, realPosition.y, vector4.z));
float num12 = Vector3.Dot(vector5, vector6);
if (num12 > num6)
{
num7 = num11;
num6 = num12;
}
}
}
if (num7 > -1)
{
this.used[num7] = true;
this.nearNodes.Add(this.bestNodes[num7]);
}
if (this.followingType == "")
{
stop = true;
}
}
}
else
{
for (int num13 = 0; num13 < x; num13++)
{
this.nearNodes.Add(this.bestNodes[num13]);
}
}
if (Records.x.astarDebugging)
{
Debug.Log(string.Concat(new string[]
{
this.allNodes.Count.ToString(),
" ",
this.suitableNodes.Count.ToString(),
" ",
this.bestNodes.Count.ToString(),
" ",
this.nearNodes.Count.ToString(),
" ",
stop.ToString()
}));
}
if (this.followingType == "Exit")
{
this.nearNodes.Insert(0, moveToNode);
}
x = this.nearNodes.Count;
bool flag3 = this.nearNodes.Count != 0 && !stop;
if (flag3)
{
if (x > 0)
{
bool foundPath = false;
for (int k = 0; k < x; k = num14 + 1)
{
if (!foundPath && !stop)
{
GraphNode destination = this.nearNodes[k];
if (this.node != null && destination != null)
{
ABPath p = ABPath.ConstructFast(this.node, destination, null);
p.nnConstraint = this.interactConstraint;
AstarPath.StartPath(p, false);
yield return base.StartCoroutine(p.WaitForPath());
p.Claim(this);
if (!p.error)
{
foundPath = true;
foundNode = destination;
}
p.Release(this, false);
p = null;
}
destination = null;
}
if (this.followingType == "")
{
stop = true;
}
num14 = k;
}
}
if (foundNode != null)
{
if (canCheckAllAngles)
{
this.followingNode = offsetNode;
moveToNode = offsetNode;
break;
}
break;
}
}
constPath = null;
thisPosition = default(Vector3);
}
num14 = j;
}
}
checkNode = null;
offsetNode = null;
}
num14 = i;
}
if (canCheckAllAngles)
{
num = ((Vector3)moveToNode.position - (Vector3)partyCharacter.node.position).sqrMagnitude;
num2 = (realPosition - partyCharacter.tr.position).sqrMagnitude;
maxDistance = this.InteractionDistanceCheck(moveType);
if (Records.x.astarDebugging)
{
Debug.Log(string.Concat(new string[]
{
"Item check final distance is ",
num.ToString(),
" max distance is ",
maxDistance.ToString(),
" ",
Vector3.Distance(this.NodePosition(), (Vector3)moveToNode.position).ToString(),
" node pos ",
this.NodePosition().ToString(),
" following pos ",
((Vector3)moveToNode.position).ToString()
}));
}
if (num <= maxDistance || num2 <= maxDistance)
{
stop = true;
this.FinishMoveTo();
}
}
if (!Links.x.gaia.pathfindingReady || !Links.x.gaia.sceneLoaded)
{
stop = true;
}
if (Records.x.astarDebugging && !stop)
{
if (foundNode != null)
{
string[] array = new string[8];
array[0] = "Interactive path found for ";
array[1] = ((this != null) ? this.ToString() : null);
array[2] = " ";
array[3] = ((Vector3)foundNode.position).ToString();
array[4] = " ";
array[5] = stop.ToString();
array[6] = " ";
int num15 = 7;
Character character = this.followingCharacter;
array[num15] = ((character != null) ? character.ToString() : null);
Debug.Log(string.Concat(array));
}
else
{
Debug.Log(string.Concat(new string[]
{
"Interactive path NOT found for ",
(this != null) ? this.ToString() : null,
" node counts: ",
this.suitableNodes.Count.ToString(),
" ",
this.bestNodes.Count.ToString(),
" ",
this.nearNodes.Count.ToString()
}));
if (moveToNode != null)
{
Debug.Log(((Vector3)moveToNode.position).ToString() + " move to node " + ((this != null) ? this.ToString() : null));
if (Records.x.editor)
{
this.CreateSphere((Vector3)moveToNode.position, 1f);
}
}
}
}
if (!stop)
{
if (foundNode != null && this.followingType != "")
{
if (!this.npc)
{
if (moveType == "Item" || moveType == "Breakable" || moveType == "Chest" || moveType == "Puzzle" || moveType == "Door" || moveType == "Exit" || moveType == "Boat" || moveType.Contains("Charm"))
{
this.ClearPathUpdates();
if (!this.npc && this.hasActions)
{
if (this.actions)
{
this.actions.ClearSelectedActionRealTime();
}
if (this.actions)
{
this.actions.Interrupt();
}
if (this.actions)
{
this.actions.CheckIfRunningAI();
}
}
if (this.party || (this.boatNavigator && this.sailing && this.isBoro))
{
this.showWaypoint = true;
}
if (Vector3.Distance((Vector3)foundNode.position, this.tr.position) < 0.75f)
{
this.FinishMoveTo();
}
else
{
this.MakePath(foundNode, 100, false, false, true);
}
this.movingToPatrolNode = false;
}
else
{
Links.x.fellowship.MakeWaypoints(Vector3.zero, foundNode, false, false);
}
}
else
{
this.ClearPathUpdates();
if (this.searching && moveType == "Searching" && this.animID == 24)
{
yield return new WaitForSeconds(1f);
}
this.MakePath(foundNode, 100, false, false, true);
this.movingToPatrolNode = false;
}
}
else
{
this.selectedBeforeDoor = false;
if (!this.npc && this.followingType != "")
{
this.ClearPathUpdates();
this.ClearMoveTargets();
Links.x.gameFeed.ShowNotice("Cannot reach");
}
else if (moveWithoutPoint && !stop)
{
this.ClearPathUpdates();
if (!this.npc && this.hasActions)
{
this.actions.ClearSelectedActionRealTime();
this.actions.Interrupt();
this.actions.CheckIfRunningAI();
}
if (this.party || (this.boatNavigator && this.sailing && this.isBoro))
{
this.showWaypoint = true;
}
this.MakePath(moveToNode, 100, false, true, true);
this.movingToPatrolNode = false;
}
}
}
foundNode = null;
forwAngle = default(Vector3);
rightAngle = default(Vector3);
stayPoint = default(Vector3);
}
this.pathToCharacterCoroutine = null;
yield break;
}
// Token: 0x0600039A RID: 922 RVA: 0x00054870 File Offset: 0x00052A70
public void OnMovePathComplete()
{
int count = this.prepPath.Count;
if (this.prepPath.Count > 0 && this.prepPath[this.prepPath.Count - 1] != null)
{
this.targetNode = this.prepPath[this.prepPath.Count - 1];
}
this.PrepPath(count, false);
if (this.animID == 23)
{
this.animID = 0;
}
}
// Token: 0x0600039B RID: 923 RVA: 0x000548E8 File Offset: 0x00052AE8
public GraphNode GetPathNode(int num)
{
if (this.nodePath.Count == 0)
{
return this.node;
}
if (num < this.nodePath.Count)
{
return this.nodePath[num];
}
return this.nodePath[this.nodePath.Count - 1];
}
// Token: 0x0600039C RID: 924 RVA: 0x0005493C File Offset: 0x00052B3C
public void DoFootsteps()
{
bool flag = false;
if (!this.npc || (this.npc && this.hostility == 2) || (this.npc && this.attackingUntilBribe))
{
flag = true;
}
if (this.isBoro && !this.sailing)
{
flag = false;
}
if (this.movesOnWater)
{
this.PlaySplash();
MasterAudio.PlaySound3DAtVector3AndForget("Splash", this.tr.position, Random.Range(0.4f, 0.5f), new float?(Random.Range(0.95f, 1f)), 0f, "", null);
}
if (flag)
{
if (this.sailing && this.boatNavigator)
{
this.boat.AddSounds();
}
else
{
Links.x.sensory.AddFootstep(this);
}
if (this.npc)
{
bool flag2 = this.inCombat;
}
}
this.GetTerrain();
if (this.party || this.visible == 1)
{
this.stats.CheckTerrainAbilities(this.terrain);
}
}
// Token: 0x0600039D RID: 925 RVA: 0x00054A4C File Offset: 0x00052C4C
public void PlaySplash()
{
if (this.splash)
{
Vector3 position = this.tr.position;
position.y = 20.2f;
if (!this.splash.activeSelf)
{
this.splash.SetActive(true);
}
foreach (object obj in this.splash.transform)
{
((Transform)obj).gameObject.SetActive(true);
}
this.splash.transform.position = position;
}
}
// Token: 0x0600039E RID: 926 RVA: 0x00054B00 File Offset: 0x00052D00
public void GetTerrain()
{
RaycastHit raycastHit;
if (!this.dead && !this.stunned && this.visible == 1 && Physics.Raycast(this.nodePoint, Links.x.rtsCamera.tr.forward, out raycastHit, 600f, 16777216))
{
Vector2 textureCoord = raycastHit.textureCoord;
if (this.desiredGraph == 1)
{
textureCoord.x *= (float)Links.x.sensory.terrainTextureWidthInt;
textureCoord.y *= (float)Links.x.sensory.terrainTextureHeightInt;
}
else
{
textureCoord.x *= (float)Links.x.sensory.terrainTextureWidthExt;
textureCoord.y *= (float)Links.x.sensory.terrainTextureHeightExt;
}
string text = this.terrain;
this.terrain = Links.x.sensory.GetPixelColor((int)textureCoord.x, (int)textureCoord.y, this.desiredGraph);
if (this.mainSelected && Links.x.diorama.underground)
{
Color32 color = this.terrainColor;
this.terrainColor = Links.x.sensory.GetPixelColorForUndergroundMap((int)textureCoord.x, (int)textureCoord.y);
if (Links.x.sceneMap.undergroundMap)
{
Links.x.sceneMap.undergroundMap.ChangedArea(this.indoorID);
}
}
}
}
// Token: 0x0600039F RID: 927 RVA: 0x00054C84 File Offset: 0x00052E84
public GraphNode CastPoint()
{
if (this.boatNavigator && this.sailing)
{
return this.boat.node;
}
if (this.node == null)
{
return this.NearNode(this.tr.position, false, 0, -1, 0);
}
if (this.npc)
{
return this.node;
}
if (this.SubtractVectors(this.tr.position, (Vector3)this.node.position).sqrMagnitude > 6.25f)
{
return this.NearNode(this.tr.position, false, 0, 2, 0);
}
return this.node;
}
// Token: 0x060003A0 RID: 928 RVA: 0x00054D28 File Offset: 0x00052F28
public void PrepPath(int pathLength, bool isCombatMove)
{
if (this.nodePath.Count > 0)
{
this.moveTurn = true;
}
this.blockedTime = 0f;
int num = this.prepPath.Count;
if (this.prepPath.Count > 0)
{
this.targetNode = this.prepPath[this.prepPath.Count - 1];
}
if (this.animID == 23)
{
this.animID = 0;
}
this.moveIndex = -1;
this.nodePath.Clear();
this.vectorPath.Clear();
this.nodeActions.Clear();
for (int i = 0; i < this.prepPath.Count; i++)
{
if (this.prepPath[i] != null)
{
this.nodePath.Add(this.prepPath[i]);
this.vectorPath.Add(this.prepVectorPath[i]);
this.nodeActions.Add("TileSwitch");
}
}
num = this.nodePath.Count;
if (this.nodePath.Count > 0 && this.nodePath[num - 1] != null)
{
this.targetNode = this.nodePath[num - 1];
}
if (this.party && this.raycastModifier && this.raycastModifier.enabled)
{
this.targetNode = this.NearNode(this.vectorPath[num - 1], false, 0, -1, 0);
}
if (!this.npc)
{
Links.x.fellowship.SetWaypoint();
}
if (!this.moveTurn && this.nodePath.Count > 0)
{
this.nextNode = this.nodePath[0];
}
if (Records.x.astarDebugging)
{
Debug.Log(string.Concat(new string[]
{
"Prep path made for ",
(this != null) ? this.ToString() : null,
" node points ",
this.nodePath.Count.ToString(),
" ",
this.tr.position.ToString()
}));
}
if (this.nodePath.Count == 0)
{
this.vectorPath.Clear();
this.nodePath.Clear();
this.EndPath();
if (this.fleeTime > 0f)
{
this.Flee(this.fleePoint, this.missing, 0f, 0f);
return;
}
}
else
{
if (this.fleeTime > 0f)
{
this.fleeing = true;
if (Records.x.combat && this.radius < 3f)
{
this.ignoreNodeIDs = true;
}
this.CircleColor(true);
}
this.TurnEnter(false);
if (this.isHitFlying && this.jumping && this.CanMove() && !this.pocketPaused)
{
this.Jumping();
}
}
}
// Token: 0x060003A1 RID: 929 RVA: 0x0005501C File Offset: 0x0005321C
public void PlayIdle()
{
if (this.IsSentient())
{
if (this.animID != 6 && this.animID != 7 && this.animID != 33 && this.animID != 34 && this.animID != 8 && this.animID != 9 && this.animID != 23 && this.animID != 10 && this.animID != 23 && this.animID != 15 && this.animID != 16 && this.animID != 25)
{
this.PlayAnimation("Idle", Random.Range(0f, 1f));
this.animator.SetBool("Idle", true);
if (this.summoned)
{
this.SetAnimatorSpeed(1f);
}
}
if (this.dodging)
{
this.PlayAnimation("Defend", 0f);
}
if (this.sailing)
{
this.NeedToUpdateSailingAnimator(false);
}
}
}
// Token: 0x060003A2 RID: 930 RVA: 0x00055120 File Offset: 0x00053320
public void SetIdle(bool state)
{
if (state)
{
if (this.resting && !this.hasActions)
{
this.animator.SetBool("Idle", false);
if (this.inCircle)
{
this.PlayAnimation("Fatigued", 0f);
}
else
{
this.PlayAnimation("Hit_down", 0f);
}
}
else
{
if (this.animID != 0 && this.npc && !this.sailing)
{
this.animator.SetFloat("Combat Variation", this.GetAnimatorVariation(2));
float num = this.GetAnimatorVariation(3);
if (this.stats.hasCustomIdle && !this.hasActions)
{
num = 1f;
}
this.animator.SetFloat("Idle Variation", num);
}
this.animator.SetBool("Idle", true);
if (this.IsSentient() && (this.animID == 23 || this.animID == 1))
{
this.animID = 0;
}
}
}
else
{
this.animator.SetBool("Idle", false);
}
this.SetAnimatorSpeed(1f);
}
// Token: 0x060003A3 RID: 931 RVA: 0x0005523C File Offset: 0x0005343C
public void EarlyFinish(bool doMoveTurn)
{
if (this.jumping)
{
return;
}
this.MoveBackEmpty();
this.StopEvading();
this.nodePath.Clear();
this.nodeActions.Clear();
this.vectorPath.Clear();
if (!this.npc && this.hasActions)
{
this.actions.ClearMoves();
}
this.moveIndex = -1;
this.moveTurn = doMoveTurn;
if (!this.waitingForNewPath && !this.boatNavigator && (this.animID == 23 || this.animID == 1))
{
this.animID = 0;
}
if (this.fleeing)
{
this.CheckFleeEnd();
if (this.fleeing)
{
return;
}
}
this.justMoved = true;
this.timeSinceLastMove = Time.timeSinceLevelLoad;
if (!this.moveTurn && !this.waitingForNewPath)
{
if (!this.boatNavigator)
{
this.SetIdle(true);
}
this.moving = false;
this.moveNode = null;
this.movePoint = this.vectorZero;
}
if (Records.x.astarDebugging && Links.x.gaia.sceneLoaded)
{
Debug.Log("Early finish " + ((this != null) ? this.ToString() : null));
}
}
// Token: 0x060003A4 RID: 932 RVA: 0x0005536D File Offset: 0x0005356D
public void StopMoving()
{
this.TargetReached();
}
// Token: 0x060003A5 RID: 933 RVA: 0x00055378 File Offset: 0x00053578
public void TargetReached()
{
if (this.dead || this.stunned)
{
return;
}
if (this.jumping && !this.CanEndJump())
{
return;
}
this.MoveBackEmpty();
this.animator.SetBool("Backward", false);
this.StopEvading();
if (this.sailing && this.boatNavigator)
{
this.prevNodePosition = this.boat.tr.position;
this.boat.TargetReached();
}
else
{
this.prevNodePosition = this.tr.position;
if (!this.waitingForNewPath)
{
if (this.IsMoveAnim())
{
this.SetIdle(true);
}
if (this.animID == 23 || this.animID == 1)
{
this.animID = 0;
}
}
}
if (!this.fleeing && !Records.x.removeControls && !this.inCircle && this.npc && !this.missing && !this.ambushing)
{
if (this.creatures)
{
if (this.creatures.deactivating)
{
this.ignoreNodeIDs = true;
}
else
{
this.ignoreNodeIDs = false;
}
}
else
{
this.ignoreNodeIDs = false;
}
}
if (Links.x.gaia.sceneLoaded)
{
this.timeSinceMoveEnded = Time.timeSinceLevelLoad + Random.Range(3f, 8f);
}
this.justMoved = true;
this.timeSinceLastMove = Time.timeSinceLevelLoad;
this.moving = false;
this.movingOutOfWay = false;
this.returnToPointTime = 0f;
this.running = false;
this.blockPathCount = 0;
if (this.isHitFlying)
{
this.isHitFlying = false;
}
this.movingAreas = false;
this.alwaysJump = false;
this.charging = false;
if (Records.x.astarDebugging && Links.x.gaia.sceneLoaded)
{
Debug.Log("Target reached " + ((this != null) ? this.ToString() : null) + " " + this.tr.position.ToString());
}
this.pathTries = 0;
if (this.moveTurn)
{
this.stepReady = false;
this.moveTurn = false;
return;
}
this.movePoint = this.vectorZero;
this.moveNode = null;
this.stepReady = false;
this.nodePath.Clear();
this.vectorPath.Clear();
this.nodeActions.Clear();
if (!this.npc && Records.x.InCombat(false))
{
Links.x.combat.updateCircles = true;
}
if (this.hasActions && (this.followingType == "" || this.followingType.Contains("Attack")) && (!this.sailing || (this.sailing && this.npc)) && !this.jumpingPosition && this.waitingForPath != 1)
{
this.actions.CheckIfMoveComplete();
}
if (this.fleeing)
{
this.CheckFleeEnd();
if (this.fleeing)
{
return;
}
}
if (this.missing)
{
if (this.visible == 0)
{
this.Missing();
return;
}
this.fleeing = true;
Debug.Log("Flee " + ((this != null) ? this.ToString() : null));
}
if (!this.npc)
{
if (this.waypoint)
{
if ((this.tr.position - this.sphere.transform.position).sqrMagnitude < Records.x.nodeSize * Records.x.nodeSize || Records.x.dialogue || Records.x.removeControls)
{
this.savedPathTarget = null;
this.sphere.transform.position = this.tr.position;
}
else if (!this.hasActions && !this.mainSelected && (this.tr.position - Links.x.main.tr.position).sqrMagnitude < 100f)
{
this.savedPathTarget = null;
this.sphere.transform.position = this.tr.position;
}
this.waypoint.transform.position = Links.x.gameplay.farPosition;
if (this.waypointAnimator.enabled)
{
this.waypointAnimator.enabled = false;
}
}
}
else
{
this.savedPathTarget = null;
}
if (this.movingToPatrolNode)
{
this.patrolNode++;
this.movingToPatrolNode = false;
}
this.stepReady = false;
this.tempStop = false;
this.prepPath.Clear();
this.moveNode = null;
this.movePoint = this.vectorZero;
this.targetNode = null;
this.nextNode = null;
this.moveIndex = -1;
this.blockedTime = 0f;
if (!this.inactive)
{
if (this.sailing && this.boatNavigator)
{
this.boat.SetNodeID(false, false);
}
else
{
this.ClaimNode(this.node, this.nodePoint, false);
}
}
if (this.doTurn && !this.hasActions && !this.boatNavigator && this.endTurn != Vector3.zero)
{
this.SetRotation(Quaternion.Euler(this.endTurn), false, false);
}
if (this.fleeing && this.fleeingAroundPoint)
{
this.SetRotation(Quaternion.LookRotation((Vector3)this.fleePoint.position, this.tr.position), false, false);
}
if (this.lookTarget && !this.boatNavigator && !this.moving && !this.mainSelected)
{
if (this.hasActions || Records.x.removeControls)
{
this.justMoved = false;
this.SetRotation(Quaternion.LookRotation(this.lookTarget.tr.position - this.tr.position), false, false);
this.lookTarget = null;
}
else
{
this.lookTargetTime = Time.timeSinceLevelLoad;
}
}
if (this.npc)
{
this.GetPatrolHoldTime(true);
}
if (this.boatNavigator)
{
this.boat.CheckInTile();
}
else
{
this.CheckInTile();
}
if (this.downed || ((!this.hasActions || this.inCircle) && this.resting))
{
if (this.resting && this.inCircle)
{
this.PlayAnimation("Fatigued", 0f);
}
else
{
this.PlayAnimation("Hit Down", 0f);
}
}
if (this.followingType != "")
{
bool flag = Links.x.gameplay.CanScatterPartyToMakePath(this.followingType);
if (this.npc || this.hasActions)
{
flag = false;
}
if (this.npc && this.followingType == "Searching" && this.GetLKPlayerBool(this.followingCharacter))
{
this.ClearMoveTargets();
return;
}
this.StartGetPathToTarget(this.followingNode, this.followingCharacter, this.followingItem, this.followingBreakable, this.followingChest, this.followingDoor, this.followingInteractive, this.followingBoat, this, this.followingExit, flag, false, false, this.followingType, true);
}
}
// Token: 0x060003A6 RID: 934 RVA: 0x00055AB4 File Offset: 0x00053CB4
public bool ObstacleTest(Vector3 pos, Vector3 testFromPos, bool testFromTr)
{
pos.y += 1.5f;
float num = this.radius * 0.25f;
Vector3 forward = Vector3.forward;
Quaternion quaternion = this.rot;
Vector3 vector = forward;
for (int i = 0; i < 6; i++)
{
vector.y += 60f;
quaternion = Quaternion.Euler(new Vector3(0f, vector.y, 0f));
if (Physics.Raycast(pos, quaternion * forward, num, Links.x.geometry))
{
return true;
}
}
if (testFromTr)
{
testFromPos.y += 1.5f;
if (Physics.Linecast(testFromPos, pos, Links.x.geometry))
{
return true;
}
}
return false;
}
// Token: 0x060003A7 RID: 935 RVA: 0x00055B78 File Offset: 0x00053D78
public bool PointInNodes(Vector3 pt)
{
bool flag = false;
Vector3 vector = this.NodePosition();
float num = pt.x - vector.x;
if (num < 0f)
{
num *= -1f;
}
if (num < Records.x.nodeSize / 2f + 0.1f)
{
float num2 = pt.z - vector.z;
if (num2 < 0f)
{
num2 *= -1f;
}
if (num2 < Records.x.nodeSize / 2f + 0.1f)
{
flag = true;
}
}
return flag;
}
// Token: 0x060003A8 RID: 936 RVA: 0x00055C00 File Offset: 0x00053E00
public bool ConnectionIsParty(int x)
{
int count = this.gos.Count;
for (int i = 0; i < count; i++)
{
Character character = this.gos[i];
if (character.nodeStationaryID == x || character.nodeMovingID == x)
{
return !character.npc;
}
}
return true;
}
// Token: 0x060003A9 RID: 937 RVA: 0x00055C54 File Offset: 0x00053E54
public bool ConnectionIsStill(int x, out Character pushCharacter)
{
int count = this.gos.Count;
pushCharacter = null;
for (int i = 0; i < count; i++)
{
Character character = this.gos[i];
if ((character.nodeStationaryID == x || character.nodeMovingID == x) && (character.moving || character.NodesCount() > 0))
{
if (character.npc && character.hasActions)
{
return false;
}
if (character.npc)
{
pushCharacter = character;
return true;
}
if (!character.npc)
{
if (character.moving)
{
pushCharacter = character;
}
return true;
}
}
}
return true;
}
// Token: 0x060003AA RID: 938 RVA: 0x00055CE4 File Offset: 0x00053EE4
public bool AllTilesFree(GraphNode pt, bool planning)
{
if (pt == null)
{
return true;
}
bool flag = false;
if ((!Records.x.removeControls && this.missing) || (this.offMap || this.ghostVanishing || (Records.x.pocketPause && !this.pocketPaused && !flag)) || Links.x.combat.inRally || this.ambushing)
{
return true;
}
int num = 0;
if (this.sailing && !this.boatNavigator)
{
return true;
}
if (this.ignoreNodeIDs)
{
return true;
}
if (this.charging)
{
return true;
}
int num2 = 1;
if (this.sailing || this.movesOnWater)
{
num2 = 2;
}
int num3;
if (this.boatNavigator)
{
num3 = pt.AllConnectionsFreeParty(this.boat.nodeMovingID, this.boat.nodeStationaryID, this.boat.ConnectionNumber(), num2);
}
else
{
num3 = pt.AllConnectionsFreeParty(this.nodeMovingID, this.nodeStationaryID, this.ConnectionNumber(), num2);
}
bool flag2;
if (num3 == 0)
{
flag2 = true;
}
else
{
flag2 = false;
num = num3;
}
if (!flag2)
{
if (!planning && !this.boatNavigator)
{
int count = this.gos.Count;
int i = 0;
while (i < count)
{
Character character = this.gos[i];
if (character.nodeStationaryID == num || character.nodeMovingID == num)
{
if (character.NodesCount() == 0 && character.waitingForPath == 0 && character.blockedTime == 0f && character.nodeMovingID == num)
{
character.SetNodeID(true, false);
if (Records.x.astarDebugging)
{
string[] array = new string[8];
array[0] = "setting collision character's node id ";
int num4 = 1;
Character character2 = character;
array[num4] = ((character2 != null) ? character2.ToString() : null);
array[2] = " ";
int num5 = 3;
GraphNode graphNode = character.node;
array[num5] = ((graphNode != null) ? graphNode.ToString() : null);
array[4] = " ";
array[5] = num.ToString();
array[6] = " ";
array[7] = ((this != null) ? this.ToString() : null);
Debug.Log(string.Concat(array));
}
}
if (!this.npc && !this.hasActions && !this.mainSelected)
{
bool flag3 = false;
if (Links.x.main.moving)
{
if (character.moving)
{
flag3 = true;
}
if (this.NodesCount() > 1)
{
flag3 = true;
}
}
else if ((this.currentPosition - Links.x.main.currentPosition).sqrMagnitude > 625f)
{
flag3 = true;
}
if (flag3)
{
return true;
}
}
if (character.node == null)
{
pt.ID = 0;
character.FindCurrentNode(false);
return true;
}
this.collisionCharacter = character;
break;
}
else
{
i++;
}
}
}
if (this.collisionCharacter && this.mainSelected && (!this.collisionCharacter.npc || this.movingAreas))
{
flag2 = true;
}
}
return flag2;
}
// Token: 0x060003AB RID: 939 RVA: 0x00055FCC File Offset: 0x000541CC
public Character GetNodeCharacter(int index)
{
int count = this.gos.Count;
for (int i = 0; i < count; i++)
{
Character character = this.gos[i];
if (character.nodeStationaryID == index || character.nodeMovingID == index)
{
return character;
}
}
return null;
}
// Token: 0x060003AC RID: 940 RVA: 0x00056018 File Offset: 0x00054218
public void CheckInTile()
{
if (!Links.x.gaia.sceneLoaded)
{
return;
}
if (this.inactive)
{
return;
}
if (this.isBoro && this.sailing)
{
return;
}
if (this.ghostVanishing || this.ambushing)
{
return;
}
if (Records.x.pocketPause)
{
return;
}
if (this.jumpingAreas || this.jumpingPosition)
{
return;
}
if (this.Pivoting())
{
return;
}
if (this.inAction || this.inRecovery || this.inQueuedAbility)
{
return;
}
if (this.mainSelected)
{
return;
}
if (this.ignoreRemoveControls)
{
return;
}
if (this.jumping || this.charging || Links.x.combat.inPocketAttack)
{
return;
}
if (Time.timeSinceLevelLoad < this.tileCheckUpdateTime + 0.25f)
{
return;
}
if (this.inCircle && this.npc && this.group.inSwarm)
{
return;
}
if (this.isHit || this.body.IsHit())
{
return;
}
if (this.waitingForPath == 1 || this.IsWalking())
{
return;
}
if (!this.npc && !this.hasActions && Links.x.main && Links.x.main.moving)
{
return;
}
this.tileCheckUpdateTime = Time.timeSinceLevelLoad;
if (this.node != null && this.slideNode == null)
{
Vector3 vector = this.NodePosition();
vector.y = this.tr.position.y;
float sqrMagnitude = (vector - this.tr.position).sqrMagnitude;
GraphNode graphNode = this.node;
float num = Records.x.nodeSize * Records.x.nodeSize;
if (this.radius > 1f)
{
num += 4f;
}
float num2 = 0.5625f;
if (this.radius > 1f)
{
num2 = 2.25f;
}
float sqrMagnitude2 = (this.tr.position - Links.x.main.currentPosition).sqrMagnitude;
bool flag = false;
if (!this.moving && this.node.ID != this.nodeStationaryID && this.node.ID != this.nodeMovingID)
{
flag = true;
}
if ((sqrMagnitude > num || sqrMagnitude2 < 1f || this.node == Links.x.main.node || this.node == Links.x.main.mainNode2 || this.node == Links.x.main.mainNode3 || this.node == Links.x.main.mainNode4 || flag) && !this.moving && this.nodePath.Count == 0 && this.blockedTime == 0f && !this.waitingForNewPath)
{
bool flag2 = true;
this.nodeConstraint.walkable = true;
this.nodeConstraint.constrainWalkability = true;
if (this.sailing)
{
this.nodeConstraint.checkCircleID = 0;
this.nodeConstraint.constrainTags = false;
this.nodeConstraint.passID = 0;
this.nodeConstraint.passID2 = 0;
this.nodeConstraint.constrainToEnvironment = 2;
}
else
{
this.nodeConstraint.constrainTags = true;
if (this.ghostVanishing)
{
this.nodeConstraint.constrainTags = false;
}
this.nodeConstraint.passID = this.nodeStationaryID;
this.nodeConstraint.passID2 = this.nodeMovingID;
if (this.ghost && !this.ghostVanishing)
{
this.nodeConstraint.constrainToEnvironment = 0;
}
else
{
this.nodeConstraint.constrainToEnvironment = 1;
}
if (this.movesOnWater)
{
this.nodeConstraint.constrainToEnvironment = 2;
}
this.nodeConstraint.checkCircleID = 0;
}
this.nodeConstraint.checkConnections = this.ConnectionNumber();
this.nodeConstraint.constrainToArea = -1;
GraphNode graphNode2 = this.node.ClosestConnection(this.node, this.nodeStationaryID, this.nodeMovingID, 6f, this.tr.position, (int)this.radius, this.ConnectionNumber(), this.nodeConstraint, 0);
if (graphNode2 != null)
{
vector = (Vector3)graphNode2.position;
vector.y = this.tr.position.y;
if ((vector - this.tr.position).sqrMagnitude < sqrMagnitude)
{
this.ClaimNode(graphNode2, (Vector3)graphNode2.position, false);
flag2 = false;
}
}
if (Records.x.astarDebugging && Records.x.editor && !this.sailing)
{
Debug.Log(string.Concat(new string[]
{
"Off tile ",
(this != null) ? this.ToString() : null,
" by ",
Vector3.Distance((Vector3)graphNode.position, this.tr.position).ToString(),
", new node off by ",
Vector3.Distance(this.NodePosition(), this.tr.position).ToString(),
", needs tile: ",
flag2.ToString()
}));
}
if (flag2)
{
GraphNode graphNode3 = this.NearNode(this.tr.position, true, 0, -1, 0);
if (graphNode3 != null)
{
this.ClaimNode(graphNode3, (Vector3)graphNode3.position, false);
}
}
if (this.inCombat && !this.sailing && !this.mainSelected)
{
vector = this.NodePosition();
vector.y = this.tr.position.y;
if (!this.moving && ((vector - this.tr.position).sqrMagnitude > Records.x.nodeSize / 2f * (Records.x.nodeSize / 2f) || flag) && !this.mainSelected)
{
this.Slide(this.node, false);
return;
}
}
}
else if (sqrMagnitude > num2 && !this.moving && this.nodePath.Count == 0 && this.blockedTime == 0f && !this.waitingForNewPath && !this.sailing && this.movePoint == Vector3.zero && this.rb.isKinematic && !this.mainSelected && !this.physicsMove && this.stats.Stuck() <= 0 && this.waitingForPath == 0)
{
bool flag3 = false;
if (this.inCircle && this.ignoreNodeIDs)
{
flag3 = true;
}
if (!flag3)
{
this.Slide(this.node, false);
}
}
}
}
// Token: 0x060003AD RID: 941 RVA: 0x00056708 File Offset: 0x00054908
public void SlideTo(GraphNode slide)
{
if (this.boatNavigator || this.sailing || this.jumping)
{
this.slideNode = null;
this.slideNodePosition = Vector3.zero;
return;
}
if (this.moving)
{
this.ClearNodePath();
}
this.movingOutOfWayTime = Time.timeSinceLevelLoad;
this.movingOutOfWay = true;
this.slideNode = slide;
this.slideNodePosition = (Vector3)slide.position;
if (Records.x.editor)
{
Debug.Log(((this != null) ? this.ToString() : null) + " sliding " + ((Vector3)this.slideNode.position).ToString());
}
this.ttime = 0f;
this.prevPoint = this.tr.position;
this.prevNodePosition = this.tr.position;
this.ClaimNode(this.slideNode, (Vector3)this.slideNode.position, false);
}
// Token: 0x060003AE RID: 942 RVA: 0x00056808 File Offset: 0x00054A08
public void Slide(GraphNode n, bool actualSlide)
{
if (this.sailing)
{
return;
}
if (this.charging || this.evading || this.jumping || this.isHitFlying)
{
return;
}
bool flag = actualSlide;
if (this.InAttack() && this.node.Walkable)
{
flag = false;
}
if (this.stats.Stuck() > 0 || this.stats.pinning || this.stats.pinned)
{
return;
}
if (flag)
{
if (Records.x.astarDebugging)
{
Debug.Log(((this != null) ? this.ToString() : null) + " sliding");
}
this.slideNode = n;
this.slideNodePosition = (Vector3)n.position;
if (Records.x.editor)
{
Debug.Log(((this != null) ? this.ToString() : null) + " sliding " + ((Vector3)this.slideNode.position).ToString());
}
this.ttime = 0f;
this.prevPoint = this.tr.position;
this.prevNodePosition = this.tr.position;
this.PlayAnimation("Stop", 0f);
return;
}
if (!this.InAttack() && this.NodesCount() == 0)
{
if (Records.x.astarDebugging)
{
Debug.Log(((this != null) ? this.ToString() : null) + " slide jump");
}
this.Jump(n, this.GetNodeCenter(n), false, false);
}
}
// Token: 0x060003AF RID: 943 RVA: 0x00056994 File Offset: 0x00054B94
public void ZeroPreviousNode()
{
if (this.lastNode != null && this.radius == 1f && this.lastNode != this.node && (this.lastNode.ID == this.nodeStationaryID || this.lastNode.ID == this.nodeMovingID) && this.lastNode != this.node)
{
this.lastNode.ID = 0;
this.lastNode.Tag = 0U;
}
if (this.radius > 1f && this.lastNode != null && this.lastNode != this.node)
{
this.lastNode.SetFlowerConnections(0, this.nodeMovingID, this.ConnectionNumber());
this.lastNode.SetFlowerConnections(0, this.nodeStationaryID, this.ConnectionNumber());
}
this.lastNode = null;
if (this.party)
{
if (this.mainNode2 != null)
{
this.mainNode2.SetFlowerConnections(0, this.nodeMovingID, this.ConnectionNumber());
this.mainNode2.SetFlowerConnections(0, this.nodeStationaryID, this.ConnectionNumber());
}
if (this.mainNode3 != null)
{
this.mainNode3.SetFlowerConnections(0, this.nodeMovingID, this.ConnectionNumber());
this.mainNode3.SetFlowerConnections(0, this.nodeStationaryID, this.ConnectionNumber());
}
if (this.mainNode4 != null)
{
this.mainNode4.SetFlowerConnections(0, this.nodeMovingID, this.ConnectionNumber());
this.mainNode4.SetFlowerConnections(0, this.nodeStationaryID, this.ConnectionNumber());
}
this.mainNode2 = null;
this.mainNode3 = null;
this.mainNode4 = null;
}
}
// Token: 0x060003B0 RID: 944 RVA: 0x00056B32 File Offset: 0x00054D32
public bool HasNode(GraphNode mouseNode)
{
return false;
}
// Token: 0x060003B1 RID: 945 RVA: 0x00056B35 File Offset: 0x00054D35
public Vector3 NodePosition()
{
if (this.radius == 3f)
{
return this.node.QuadCenter();
}
return (Vector3)this.node.position;
}
// Token: 0x060003B2 RID: 946 RVA: 0x00056B60 File Offset: 0x00054D60
public Vector3 GetNodeCenter(GraphNode n)
{
if (this.radius == 3f)
{
return n.QuadCenter();
}
return (Vector3)n.position;
}
// Token: 0x060003B3 RID: 947 RVA: 0x00056B84 File Offset: 0x00054D84
public void ClaimNode(GraphNode curr, Vector3 pos, bool snap)
{
if (Links.x.gaia.noAstar)
{
return;
}
if (this.offMap)
{
return;
}
bool flag = false;
if (this.outsideBounds)
{
this.nodePoint = this.tr.position;
}
else
{
if (curr == null && pos != this.vectorZero)
{
GraphNode graphNode = this.NearNode(pos, true, 0, -1, 0);
if (graphNode != null)
{
if (this.node != graphNode)
{
flag = true;
}
this.node = graphNode;
this.nodePoint = this.NodePosition();
}
else
{
this.RemoveLastNode(true);
this.nodePoint = this.tr.position;
}
}
if (curr == null && pos == this.vectorZero)
{
if (this.tr.position != this.vectorZero)
{
this.node = this.NearNode(this.tr.position, true, 0, -1, 0);
if (this.node != null)
{
this.nodePoint = this.NodePosition();
if (!this.stuckInPlace && this.stats.Stuck() == 0 && !this.sailing && (snap || this.moveOnTiles || (!this.moveOnTiles && !this.mainSelected)))
{
this.SetPosition(this.nodePoint, null);
}
}
flag = true;
}
else
{
this.RemoveLastNode(true);
this.nodePoint = this.tr.position;
}
}
if (curr != null)
{
if (this.node != curr)
{
if (curr.GraphIndex == 1U)
{
this.GetIndoorID();
}
else
{
this.indoorID = "";
}
if (this.hasActions)
{
this.CheckForLeaveBehindTiles();
}
flag = true;
if (this.body.sneaking)
{
this.CheckLights(false);
}
float num = 100f;
if (this.running)
{
num = 49f;
}
if ((this.lastFatiguePosition - this.tr.position).sqrMagnitude > num && this.npc)
{
if (this.inCombat)
{
if (this.running)
{
this.stats.AddStamina(-3f);
}
else
{
this.stats.AddStamina(-1f);
}
}
this.lastFatiguePosition = this.tr.position;
}
}
this.node = curr;
this.nodePoint = this.NodePosition();
}
if (flag && !this.moving)
{
Links.x.gameplay.CheckTileEffects(this, this.node, false);
}
if (this.node == null)
{
this.nodePoint = this.tr.position;
}
this.ZeroPreviousNode();
if (this.mainSelected && this.node != null && this.radius <= 1f)
{
int num2 = 0;
for (int i = 0; i < 4; i++)
{
float num3 = 2f;
GraphNode graphNode2 = null;
for (int j = 0; j < 8; j++)
{
GraphNode graphNode3 = this.node.ConnectionFromIndex(j);
if (graphNode3 != null && graphNode3 != this.mainNode2 && graphNode3 != this.mainNode3 && graphNode3 != this.mainNode4)
{
float num4 = Vector3.Distance(this.tr.position, (Vector3)graphNode3.position);
if (num4 < num3)
{
graphNode2 = graphNode3;
num3 = num4;
}
}
}
if (graphNode2 == null)
{
break;
}
if (num2 == 0)
{
this.mainNode2 = graphNode2;
}
if (num2 == 1)
{
this.mainNode3 = graphNode2;
}
if (num2 == 2)
{
this.mainNode4 = graphNode2;
}
num2++;
}
this.GetIndoorID();
}
if (this.node != null)
{
this.SetNodeID(false, false);
this.lastNode = this.node;
}
else
{
this.lastNode = null;
}
}
this.CheckForPickup();
if (this.party && this.IsWalking() && Links.x.diorama.InTown(this.tr.position) != this.inTown)
{
this.PlayAnimation("Walk", 0f);
}
this.heightAdd = this.characterHeight - 0.5f;
}
// Token: 0x060003B4 RID: 948 RVA: 0x00056F78 File Offset: 0x00055178
public void CheckForLeaveBehindTiles()
{
if (this.npc && this.stats.leaveBehindTiles)
{
string text = "";
if (this.stats.xmlName.Contains("Fish") && (this.IsWalking() || this.animID == 1) && this.animator.GetFloat("Combat Variation") == 1f)
{
text = "FishPoison";
}
if (text != "")
{
Library.Abilities abilityRow = Links.x.library.GetAbilityRow(text);
TileEffects tileEffects = Links.x.tileEffects.AddComponent<TileEffects>();
tileEffects.startNode = this.node;
tileEffects.spellTarget = null;
tileEffects.source = this;
tileEffects.spellIndex = this.stats.SpellIndex(text);
tileEffects.paganRow = Links.x.library.GetPaganRow(text);
tileEffects.mainSkill = abilityRow._MainSkill;
tileEffects.sourceLevel = (float)this.stats.level;
tileEffects.Setup(abilityRow, null, this.actions, null, null, this);
}
}
}
// Token: 0x060003B5 RID: 949 RVA: 0x0005708C File Offset: 0x0005528C
public void CheckForPickup()
{
Pickups pickups = Links.x.cellar.NodeHasPickup(this.node);
if (pickups)
{
pickups.PickItUp(this);
}
}
// Token: 0x060003B6 RID: 950 RVA: 0x000570C0 File Offset: 0x000552C0
public void GetIndoorID()
{
if (this.node == null)
{
return;
}
if (this.node.GraphIndex == 1U)
{
this.indoorID = Links.x.diorama.GetIndoorView().GetInteriorBoundsName((Vector3)this.node.position);
return;
}
this.indoorID = "";
}
// Token: 0x060003B7 RID: 951 RVA: 0x0005711C File Offset: 0x0005531C
public void SetNodeID(bool overrideDefaults, bool moving)
{
if (this.dead)
{
return;
}
if (this.sailing)
{
return;
}
int num = this.nodeMovingID;
if (this.nodePath.Count == 0 || (this.nodePath.Count > 0 && this.blockedTime > 0f))
{
num = this.nodeStationaryID;
}
if (overrideDefaults)
{
if (moving)
{
num = this.nodeMovingID;
}
else
{
num = this.nodeStationaryID;
}
}
if (this.node != null && !this.sailing)
{
this.node.SetFlowerConnections(num, this.nodeMovingID, this.ConnectionNumber());
this.node.SetFlowerConnections(num, this.nodeStationaryID, this.ConnectionNumber());
}
if (this.mainSelected)
{
if (this.mainNode2 != null)
{
this.mainNode2.SetFlowerConnections(num, this.nodeMovingID, this.ConnectionNumber());
this.mainNode2.SetFlowerConnections(num, this.nodeStationaryID, this.ConnectionNumber());
}
if (this.mainNode3 != null)
{
this.mainNode3.SetFlowerConnections(num, this.nodeMovingID, this.ConnectionNumber());
this.mainNode3.SetFlowerConnections(num, this.nodeStationaryID, this.ConnectionNumber());
}
if (this.mainNode4 != null)
{
this.mainNode4.SetFlowerConnections(num, this.nodeMovingID, this.ConnectionNumber());
this.mainNode4.SetFlowerConnections(num, this.nodeStationaryID, this.ConnectionNumber());
}
}
}
// Token: 0x060003B8 RID: 952 RVA: 0x0005727C File Offset: 0x0005547C
public int CheckCircleID()
{
if (this.inCircle)
{
if (!this.npc)
{
if (this.hasCircleBuff)
{
return 1;
}
}
else if (this.group)
{
if (this.hasCreatureBuff)
{
return this.group.groupID;
}
if (!this.hasCreatureBuff)
{
if (false)
{
return 0;
}
return this.group.groupID;
}
}
}
return 0;
}
// Token: 0x060003B9 RID: 953 RVA: 0x000572E0 File Offset: 0x000554E0
public GraphNode NearNode(Vector3 pos, bool checkEmpty, int uniqueID, int graphIndex, int circleID)
{
if (this.ghostVanishing)
{
checkEmpty = false;
}
if (Links.x.gaia.noAstar)
{
return null;
}
this.nodeConstraint.constrainWalkability = true;
this.nodeConstraint.walkable = true;
this.nodeConstraint.constrainTags = checkEmpty;
this.nodeConstraint.checkCircleID = circleID;
this.nodeConstraint.passID = this.nodeStationaryID;
this.nodeConstraint.passID2 = this.nodeMovingID;
this.nodeConstraint.constrainPenalty = 0;
this.nodeConstraint.checkConnections = this.ConnectionNumber();
if (this.ghost && !this.ghostVanishing)
{
this.nodeConstraint.constrainToEnvironment = 0;
}
else if (this.sailing || this.movesOnWater)
{
this.nodeConstraint.constrainToEnvironment = 2;
}
else
{
this.nodeConstraint.constrainToEnvironment = 1;
}
this.nodeConstraint.uniqueID = uniqueID;
int num = this.setArea;
this.nodeConstraint.constrainToArea = num;
this.setArea = -1;
GraphNode graphNode = AstarPath.active.GetNearest(pos, this.nodeConstraint).node;
if (graphNode != null)
{
return graphNode;
}
return null;
}
// Token: 0x060003BA RID: 954 RVA: 0x00057408 File Offset: 0x00055608
public Vector3 FindFloorPoint(Vector3 start, bool directRaycast, Vector3 checkFrom, float minDist, string type)
{
Vector3 vector = this.vectorZero;
bool flag = false;
Vector3 vector2 = start;
vector2.y += 0.9f;
float num = 1.75f;
if (Physics.Raycast(vector2, -1f * this.upVector, out this.rayHit, num, 4096))
{
Vector3 point = this.rayHit.point;
bool flag2 = false;
if (!flag2)
{
flag2 = this.ObstacleTest(point, checkFrom, directRaycast);
}
if (!flag2)
{
bool flag3 = true;
if (type != "")
{
flag3 = this.AllTilesFree(null, true);
}
if (flag3)
{
flag = true;
vector = point;
}
}
}
if (type == "")
{
flag = true;
}
bool flag4 = false;
if (type == "Quick")
{
flag4 = true;
}
if (!flag)
{
float num2 = float.PositiveInfinity;
float num3 = 2f;
float num4 = 2f;
if (start == checkFrom)
{
flag4 = true;
}
if (flag4)
{
int num5 = 0;
int num6 = 0;
int num7 = 0;
int num8 = 0;
int num9 = Random.Range(0, 4);
if (num9 == 1)
{
num5 = 1;
num6 = 2;
num7 = 3;
num8 = 0;
}
if (num9 == 2)
{
num5 = 3;
num6 = 2;
num7 = 0;
num8 = 1;
}
if (num9 == 3)
{
num5 = 2;
num6 = 3;
num7 = 1;
num8 = 0;
}
this.nodeFindDirections[num5] = checkFrom;
Vector3[] array = this.nodeFindDirections;
int num10 = num5;
array[num10].x = array[num10].x + num3;
Vector3[] array2 = this.nodeFindDirections;
int num11 = num5;
array2[num11].y = array2[num11].y + 0.5f;
this.nodeFindDirections[num6] = checkFrom;
Vector3[] array3 = this.nodeFindDirections;
int num12 = num6;
array3[num12].z = array3[num12].z + num3;
Vector3[] array4 = this.nodeFindDirections;
int num13 = num6;
array4[num13].y = array4[num13].y + 0.5f;
this.nodeFindDirections[num7] = checkFrom;
Vector3[] array5 = this.nodeFindDirections;
int num14 = num7;
array5[num14].x = array5[num14].x + num3 * -1f;
Vector3[] array6 = this.nodeFindDirections;
int num15 = num7;
array6[num15].y = array6[num15].y + 0.5f;
this.nodeFindDirections[num8] = checkFrom;
Vector3[] array7 = this.nodeFindDirections;
int num16 = num8;
array7[num16].z = array7[num16].z + num3 * -1f;
Vector3[] array8 = this.nodeFindDirections;
int num17 = num8;
array8[num17].y = array8[num17].y + 0.5f;
}
else
{
Vector3 eulerAngles = Quaternion.LookRotation(start - checkFrom).eulerAngles;
eulerAngles.x = 0f;
eulerAngles.z = 0f;
Vector3 vector3 = eulerAngles;
vector3.y += 45f;
Vector3 vector4 = eulerAngles;
vector4.y -= 45f;
Vector3 vector5 = eulerAngles;
vector5.y += 90f;
Vector3 vector6 = eulerAngles;
vector6.y -= 90f;
this.nodeFindDirections[0] = this.vectorZero;
this.nodeFindDirections[1] = this.vectorZero;
this.nodeFindDirections[2] = this.vectorZero;
this.nodeFindDirections[3] = this.vectorZero;
bool flag5 = false;
bool flag6 = false;
bool flag7 = false;
bool flag8 = false;
if (!Physics.Raycast(checkFrom + this.yAdd2, Quaternion.Euler(vector3) * Vector3.forward, 3f, Links.x.allObstacles))
{
flag6 = true;
}
if (!Physics.Raycast(checkFrom + this.yAdd2, Quaternion.Euler(vector4) * Vector3.forward, 3f, Links.x.allObstacles))
{
flag5 = true;
}
if (!Physics.Raycast(checkFrom + this.yAdd2, Quaternion.Euler(vector5) * Vector3.forward, 2f, Links.x.allObstacles))
{
flag8 = true;
}
if (!Physics.Raycast(checkFrom + this.yAdd2, Quaternion.Euler(vector6) * Vector3.forward, 2f, Links.x.allObstacles))
{
flag7 = true;
}
if (flag5)
{
this.nodeFindDirections[0] = checkFrom + Quaternion.Euler(vector4) * Vector3.forward * num4;
}
if (flag6)
{
this.nodeFindDirections[1] = checkFrom + Quaternion.Euler(vector3) * Vector3.forward * num4;
}
if (flag7)
{
this.nodeFindDirections[2] = checkFrom + Quaternion.Euler(vector6) * Vector3.forward * num4;
}
if (flag8)
{
this.nodeFindDirections[3] = checkFrom + Quaternion.Euler(vector5) * Vector3.forward * num4;
}
if (!flag5 && !flag7 && !flag6 && !flag8)
{
vector5 = eulerAngles;
vector5.y += 135f;
vector6 = eulerAngles;
vector6.y -= 135f;
if (!Physics.Raycast(checkFrom + this.yAdd2, Quaternion.Euler(vector5) * Vector3.forward, out this.rayHit, 4f, Links.x.allObstacles))
{
this.nodeFindDirections[1] = checkFrom + Quaternion.Euler(vector5) * Vector3.forward * num4;
}
if (!Physics.Raycast(checkFrom + this.yAdd2, Quaternion.Euler(vector6) * Vector3.forward, out this.rayHit, 4f, Links.x.allObstacles))
{
this.nodeFindDirections[0] = checkFrom + Quaternion.Euler(vector6) * Vector3.forward * num4;
}
}
}
for (int i = 0; i < 4; i++)
{
Vector3 vector7 = this.nodeFindDirections[i];
bool flag9 = true;
Vector3 vector8 = vector7;
vector8.y = start.y;
float sqrMagnitude = this.SubtractVectors(start, vector8).sqrMagnitude;
if (flag9 && vector7 != this.vectorZero && sqrMagnitude < num2)
{
vector2 = vector7;
vector2.y += 0.8f;
if (Physics.Raycast(vector2, -1f * this.upVector, out this.rayHit, num, 4194449))
{
Vector3 point2 = this.rayHit.point;
bool flag10 = this.ObstacleTest(point2, checkFrom, directRaycast);
if (!flag10 && !flag4)
{
flag9 = this.AllTilesFree(null, true);
}
if (!flag10 && flag9)
{
num2 = sqrMagnitude;
vector = point2;
}
}
}
}
}
return vector;
}
// Token: 0x060003BB RID: 955 RVA: 0x00057ABB File Offset: 0x00055CBB
public GraphNode GetLastNode()
{
if (this.nodePath.Count > 0)
{
return this.nodePath[this.nodePath.Count - 1];
}
return null;
}
// Token: 0x060003BC RID: 956 RVA: 0x00057AE8 File Offset: 0x00055CE8
public void ZeroAttackTime(float attackTimeReduction)
{
this.currentAttackSpeed = this.stats.ActionTime() + this.inventoryTime;
if (this.currentAttackSpeed < 0.25f)
{
this.currentAttackSpeed = 0.25f;
}
float num = this.currentAttackSpeed * attackTimeReduction / this.currentAttackSpeed;
this.at = num;
this.attackTime = num;
this.stats.UpdateAbilityTriggers();
if (this.portrait)
{
this.portrait.SetActionBar(this.attackTime);
this.portrait.skillBag.SetSelectedState();
}
this.inventoryTime = 0f;
}
// Token: 0x060003BD RID: 957 RVA: 0x00057B88 File Offset: 0x00055D88
public void FullAttackTime()
{
if (!this.IsSentient())
{
this.attackTime = 0f;
return;
}
this.at = 1f;
this.attackTime = 1f;
this.inventoryTime = 0f;
if (this.portrait)
{
this.portrait.SetActionBar(this.attackTime);
this.portrait.skillBag.SetSelectedState();
}
if (this.mainSelected)
{
Links.x.hudControl.UpdateAttackTime(this.at, 1f, this.inventoryTime);
}
}
// Token: 0x060003BE RID: 958 RVA: 0x00057C20 File Offset: 0x00055E20
public void UpdateAtkTime(float amt)
{
this.inventoryTime += amt;
if (amt < 0f && this.mainSelected)
{
Links.x.hudControl.AttackTimerDecreaseTime();
}
float num = this.at * this.currentAttackSpeed;
this.currentAttackSpeed = this.stats.ActionTime() + this.inventoryTime;
if (this.currentAttackSpeed < 0.25f)
{
this.currentAttackSpeed = 0.25f;
}
this.at = num / this.currentAttackSpeed;
this.attackTime = this.at;
if (this.portrait)
{
this.portrait.SetActionBar(this.attackTime);
}
if (this.mainSelected)
{
Links.x.hudControl.UpdateAttackTime(this.at, 1f, this.inventoryTime);
if (Records.x.pocketPause && amt > 0f)
{
Links.x.gameplay.PocketPause(false);
}
}
}
// Token: 0x060003BF RID: 959 RVA: 0x00057D1C File Offset: 0x00055F1C
public void Leave(bool canBeStunned)
{
if (this.dead || (!canBeStunned && this.stunned))
{
Debug.Log("Cannot make a dead/stunned character leave " + ((this != null) ? this.ToString() : null));
}
if (Records.x.editor)
{
Debug.Log("Leaving " + ((this != null) ? this.ToString() : null));
}
this.missing = true;
this.missingTime = Time.timeSinceLevelLoad;
this.hostility = -1;
if (this.actions && this.hasActions)
{
this.actions.EndActions();
}
if (this.sleeping)
{
this.WakeUp();
}
if (this.inactive)
{
this.TurnScriptsOn();
}
this.alwaysOn = true;
this.stats.state = "Fled";
if (Links.x.hasMain)
{
this.Flee(Links.x.main.node, true, Links.x.gameplay.seconds, 100f);
}
else
{
this.Flee(this.node, true, Links.x.gameplay.seconds, 100f);
}
if (this.stunned)
{
this.Missing();
}
}
// Token: 0x060003C0 RID: 960 RVA: 0x00057E53 File Offset: 0x00056053
public void LeaveToDeactivationPoint()
{
if (this.inactive)
{
this.TurnScriptsOn();
}
this.alwaysOn = true;
if (this.sleeping)
{
this.WakeUp();
}
this.deactivating = true;
}
// Token: 0x060003C1 RID: 961 RVA: 0x00057E80 File Offset: 0x00056080
public void Missing()
{
this.missing = true;
this.alwaysOn = true;
this.Dead(true, false, true);
CreatureActions creatureActions = this.creatures;
if (creatureActions && this.swarm)
{
creatureActions.RemoveFromScene();
}
this.SetMeshState(false);
this.stats.state = "Fled";
this.body.SetMeshState(false, true);
this.body.Missing();
if (this.summoned)
{
this.DestroyCharacter();
}
if (Records.x.editor)
{
Debug.Log(((this != null) ? this.ToString() : null) + " has left the scene");
}
}
// Token: 0x060003C2 RID: 962 RVA: 0x00057F28 File Offset: 0x00056128
public void Flee(GraphNode fromNode, bool isMissing, float startTime, float fleeTimeLength)
{
if (!this.fleeingAroundPoint && (this.fleeTime > 0f || this.stunned || this.dead))
{
return;
}
if (startTime != 0f)
{
this.fleeTime = fleeTimeLength;
this.fleeStartTime = startTime;
}
if (Records.x.editor)
{
Debug.Log("Fleeing " + ((this != null) ? this.ToString() : null));
}
this.fleePoint = fromNode;
if (this.mainSelected && this.physicsMove)
{
this.StopMove();
}
this.fleeing = true;
int num = 20;
if (this.summoned && isMissing)
{
num = 80;
this.ignoreNodeIDs = true;
}
this.MakePath(fromNode, num, false, true, false);
this.CircleColor(true);
}
// Token: 0x060003C3 RID: 963 RVA: 0x00057FE8 File Offset: 0x000561E8
public void CheckFleeEnd()
{
if (this.sailing)
{
this.fleeing = false;
}
if (this.tr)
{
Vector3 position = this.tr.position;
if (this.fleeing && this.fleePoint != null)
{
if (Links.x.hasMain)
{
if (this.fleePoint == null)
{
this.fleePoint = Links.x.main.node;
}
}
else if (this.fleePoint == null)
{
this.fleePoint = this.node;
}
if (!this.hasActions && Records.x.InCombat(false) && this.hostility != 2 && !this.attackingUntilBribe && Links.x.gameplay.seconds >= this.fleeStartTime + this.fleeTime)
{
this.fleeTime += Random.Range(100f, 200f);
this.StartQuip("Help!");
}
if (((Links.x.main.tr.position - position).sqrMagnitude < 625f && this.missing) || (!this.missing && Links.x.gameplay.seconds < this.fleeStartTime + this.fleeTime) || this.stats.Confuse() > 0 || this.fleeingAroundPoint)
{
this.MakePath(this.fleePoint, 20, false, true, false);
return;
}
if (this.missing)
{
this.Missing();
}
else
{
this.fleeing = false;
}
}
else if (this.missing)
{
this.Missing();
}
else
{
this.fleeing = false;
}
}
if (!this.missing)
{
this.fleeing = false;
}
if (!this.fleeing)
{
this.fleeTime = 0f;
this.fleeStartTime = 0f;
}
this.CircleColor(false);
}
// Token: 0x060003C4 RID: 964 RVA: 0x000581C3 File Offset: 0x000563C3
public void EndFleeFromEffect()
{
this.fleeing = false;
this.fleeTime = 0f;
this.fleeStartTime = 0f;
}
// Token: 0x060003C5 RID: 965 RVA: 0x000581E2 File Offset: 0x000563E2
public void StartFleeAroundPoint(GraphNode fromNode)
{
this.fleeingAroundPoint = true;
this.fleeing = true;
base.StartCoroutine(this.FleeAroundPt(fromNode));
}
// Token: 0x060003C6 RID: 966 RVA: 0x00058200 File Offset: 0x00056400
private IEnumerator FleeAroundPt(GraphNode fromNode)
{
if (this.actions)
{
this.actions.Interrupt();
}
this.TargetReached();
this.Flee(fromNode, this.missing, Links.x.gameplay.seconds, 10000f);
yield return new WaitForSeconds(0.1f);
if (this.fleeingAroundPoint)
{
if (this.actions)
{
this.actions.Interrupt();
}
this.TargetReached();
}
yield return new WaitForSeconds(0.1f);
if (this.fleeingAroundPoint)
{
if (this.actions)
{
this.actions.Interrupt();
}
this.TargetReached();
}
yield return new WaitForSeconds(0.1f);
if (this.fleeingAroundPoint)
{
if (this.actions)
{
this.actions.Interrupt();
}
this.TargetReached();
}
yield return new WaitForSeconds(0.1f);
if (this.fleeingAroundPoint)
{
this.Flee(fromNode, this.missing, Links.x.gameplay.seconds, 10000f);
}
yield break;
}
// Token: 0x060003C7 RID: 967 RVA: 0x00058216 File Offset: 0x00056416
public void EndFleeAroundPoint()
{
this.fleeingAroundPoint = false;
this.EndFleeFromEffect();
}
// Token: 0x060003C8 RID: 968 RVA: 0x00058228 File Offset: 0x00056428
public void GhostFlee()
{
if (!this.stats.HasEffect("GhostFlee"))
{
Effects effects = base.gameObject.AddComponent<Effects>();
Links.x.cellar.AddEffects(effects);
effects.source = this;
effects.target = this;
effects.effectName = "GhostFlee";
effects.sourceLevel = 0f;
effects.Inflicted(false);
}
if (Links.x.gameplay.seconds > this.lastGhostFleeTime + 50f)
{
this.lastGhostFleeTime = Links.x.gameplay.seconds;
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(118);
pooledGameObject.transform.position = this.tr.position - new Vector3(0f, 1.5f, 0f);
pooledGameObject.SetActive(true);
}
this.PlayAnimation("Hit", 0f);
MasterAudio.PlaySound3DAtVector3AndForget("GhostScream", this.tr.position, Random.Range(0.2f, 0.3f), new float?(Random.Range(0.7f, 1f)), 0f, "", null);
if (this.hasActions)
{
this.actions.CheckIfRunningAI();
this.actions.EndTurn(true);
}
this.ClearNodePath();
this.Knockback(Links.x.NearestIncense(this.currentPosition), 6, false, false, false);
this.SetMoveFollowPosition(this.NodePosition());
}
// Token: 0x060003C9 RID: 969 RVA: 0x000583B0 File Offset: 0x000565B0
public void SetAsLeader()
{
bool flag = false;
if (Links.x.main == this)
{
flag = true;
}
if (Links.x.main != this)
{
Character main = Links.x.main;
if (!Records.x.removeControls)
{
Links.x.gameplay.SetSelectionCircle(this);
}
Links.x.RemoveOtherLeaders(this);
Links.x.ChangePartyPositionFromLeader(this);
if (Links.x.main.moonlight)
{
Links.x.main.moonlight.moonlightRevealer.main = false;
}
if (this.hasActions && main.actions && !main.actions.ai.findingAction && !main.inRecovery && !main.inAction && !main.inQueuedAbility && !main.dead)
{
Links.x.combat.GetNextAction(main);
}
this.ClearNodePath();
this.ClearPathUpdatesAll();
if (main)
{
if (main.body)
{
main.body.CombatSheen(0);
}
if (main.portrait)
{
main.portrait.skillBag.SetTrinketGrid(false);
main.portrait.skillBag.UpdateAbilityTriggers();
}
}
if (Records.x.pocketPause)
{
main.ChangePocketPauseState();
}
Links.x.combat.pocketTarget = null;
if (Records.x.partyWait)
{
main.waitPosition = main.currentPosition;
}
}
Links.x.hasMain = true;
Links.x.main = this;
Links.x.follow.position = this.tr.position + this.headHeight;
this.mainSelected = true;
this.selected = true;
this.movingOutOfWay = false;
this.body.SeeThroughColliders(false);
this.MoveBackEmpty();
Links.x.gameplay.SetDomeSize();
Links.x.fellowship.RemoveAllFromSelected(this);
Links.x.rtsCamera.Follow(this.tr, this, false);
this.UpdateCC();
if (Links.x.sensory && !this.inCombat && !flag && Links.x.gaia.sceneLoaded)
{
Links.x.sensory.LookAtObject(this.body.headBone, 10f, false, this, 3f, 0.1f, null, 1);
}
if (this.portrait)
{
if (this.portrait.skillBag)
{
this.portrait.skillBag.SetSelectedState();
}
this.portrait.SetFatigue();
}
if (this.inCombat)
{
if (this.actions)
{
if (!this.body.attacking && !this.inAction && !this.inRecovery && !Records.x.pocketPause)
{
this.ClearNodePath();
}
this.actions.CheckIfRunningAI();
}
Links.x.hudControl.UpdateAttackTime(this.attackTime, 1f, this.inventoryTime);
}
if (this.body)
{
this.body.CombatSheen(0);
}
if (this.CanAttack())
{
if (Records.x.pocketPause)
{
Links.x.gameplay.PocketPause(true);
Shader.SetGlobalFloat("_AttackTime", this.attackTime);
this.ChangePocketPauseState();
}
}
else
{
Shader.SetGlobalFloat("_AttackTime", 0f);
}
if (Records.x.pocketPause)
{
Links.x.hudControl.ToggleAttackTimer(true);
}
Links.x.rtsCamera.Follow(this.tr, this, false);
if (this.portrait && this.portrait.skillBag)
{
Links.x.pocketWheel.Open(this);
}
if (this.moonlight)
{
this.moonlight.moonlightRevealer.main = true;
}
Links.x.fellowship.UpdatePortraits();
Links.x.gameplay.UpdateSelectedParty();
this.CircleAnimation("");
if (this.bracket)
{
this.bracket.SetActive(true);
}
}
// Token: 0x060003CA RID: 970 RVA: 0x00058808 File Offset: 0x00056A08
public void AddToSelected(bool updatePortrait, bool setLeader)
{
if (this.stunned || this.dead)
{
return;
}
if (this.isBoro)
{
return;
}
this.selected = true;
if (updatePortrait && this.portrait)
{
this.portrait.SetSelection();
}
this.CircleAnimation("");
if (Records.x.InCombat(false))
{
Links.x.combat.GetTargets(false, false, null);
}
this.selectedBeforeDoor = false;
if (this.bracket)
{
this.bracket.SetActive(true);
}
this.PlayFaceAnimation(FaceAnimations.AnimationNames.Smile);
this.SetAsLeader();
}
// Token: 0x060003CB RID: 971 RVA: 0x000588AC File Offset: 0x00056AAC
public void RemoveFromSelected(bool setLeader)
{
this.selected = false;
this.CircleAnimation("");
if (Records.x.InCombat(false))
{
Links.x.combat.GetTargets(false, false, null);
}
if (this.bracket)
{
this.bracket.SetActive(false);
}
this.PlayFaceAnimation(FaceAnimations.AnimationNames.Frown);
if (this.moonlight)
{
this.moonlight.moonlightRevealer.main = false;
}
this.body.SeeThroughColliders(false);
if (this.cc && this.cc.enabled)
{
this.cc.enabled = false;
this.playerBorders.enabled = false;
}
if (this.portrait && this.portrait.skillBag)
{
this.portrait.skillBag.SetSelectedState();
}
}
// Token: 0x060003CC RID: 972 RVA: 0x00058997 File Offset: 0x00056B97
public void StartExploration()
{
this.CircleAnimation("");
}
// Token: 0x060003CD RID: 973 RVA: 0x000589A4 File Offset: 0x00056BA4
public void ToggleCombatAnimator(bool state)
{
}
// Token: 0x060003CE RID: 974 RVA: 0x000589A6 File Offset: 0x00056BA6
public void ToggleArrow(bool on)
{
if (!on)
{
this.CircleAnimation("");
return;
}
this.CircleAnimation("");
}
// Token: 0x060003CF RID: 975 RVA: 0x000589C4 File Offset: 0x00056BC4
public void DropWeapon()
{
int num = this.bag[0];
if (num > 1)
{
int num2 = -1;
if (this.node != null)
{
num2 = (int)this.node.Area;
}
global::Item item = Links.x.inventory.groundBag.DropLoot(num, this.bag[1], Vector3.zero, Vector3.zero, this.durability[0], null, base.gameObject.transform.position, false, false, num2);
if (item)
{
Links.x.diorama.AddItem(item);
}
}
this.bag[0] = 0;
this.bag[1] = 0;
this.CreateEquippedItems(0, 0, Vector3.zero, Vector3.zero, 0, true);
}
// Token: 0x060003D0 RID: 976 RVA: 0x00058A8C File Offset: 0x00056C8C
public void CreateEquippedItems(int ID, int stackSize, Vector3 socketA, Vector3 socketB, int slot, bool force)
{
bool flag = true;
bool flag2 = false;
bool flag3 = false;
if (ID == 0 && slot <= 2)
{
ID = 1;
}
if (slot == 8 || slot == 10 || slot == 12)
{
return;
}
if (slot == 32 || slot == 34 || slot == 36)
{
return;
}
Library.Inventory inventory = null;
if (ID <= 1 || stackSize <= -100)
{
flag3 = true;
}
if (slot == 0)
{
inventory = this.invRow1;
}
if (slot == 2)
{
inventory = this.invRow2;
}
if (slot == 4)
{
inventory = this.invRow3;
}
if (slot == 6)
{
inventory = this.invRow4;
}
int num = slot / 2;
if (this.equippedItems[num])
{
Equipment component = this.equippedItems[num].GetComponent<Equipment>();
int id = component.id;
GameObject ammoObject = component.ammoObject;
string ammoObjectName = component.ammoObjectName;
component.ammoObject = null;
if (flag || force)
{
Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(id);
GameObject gameObject = this.equippedItems[num];
if (this.party && slot < 8 && gameObject)
{
MeshRenderer component2 = gameObject.gameObject.GetComponent<MeshRenderer>();
if (component2)
{
if (component2.material.GetFloat("_Glow") > 0f)
{
component2.material.SetFloat("_Glow", 0f);
}
}
else
{
SkinnedMeshRenderer component3 = gameObject.gameObject.GetComponent<SkinnedMeshRenderer>();
if (component3 && component3.material.GetFloat("_Glow") > 0f)
{
component3.material.SetFloat("_Glow", 0f);
}
}
}
Links.x.archives.RecycleItemBody(gameObject, invRowByIndex._CharacterModel);
this.equippedItems[slot / 2] = null;
inventory = null;
flag2 = true;
if (ammoObject)
{
Links.x.archives.RecycleItemBody(ammoObject, ammoObjectName);
}
}
}
if (slot == 18 && this.stats.model != this.stats.characterRow._Model)
{
flag = true;
flag3 = false;
}
if (this.bag[slot] == 0)
{
this.equippedItems[slot / 2] = null;
inventory = null;
}
Library.Inventory inventory2;
if (slot <= 6)
{
inventory = Links.x.library.GetInvRowByIndex(ID);
inventory2 = inventory;
}
else
{
inventory2 = Links.x.library.GetInvRowByIndex(ID);
}
if (inventory2._UIModel.Contains("None"))
{
flag3 = true;
}
bool flag4 = false;
bool flag5 = false;
if (slot == 0 && inventory._Tag == "Weapon")
{
this.invRow1 = inventory;
}
if (slot == 2)
{
this.invRow2 = inventory;
}
if (slot == 4)
{
this.invRow3 = inventory;
}
if (slot == 6)
{
this.invRow4 = inventory;
}
if ((slot == 0 || slot == 2 || slot == 4 || slot == 6) && this.party && this.portrait)
{
this.portrait.skillBag.SetTrinketGrid(false);
}
if (flag)
{
if (slot < 4)
{
this.stats.UpdateAbilityTriggers();
}
if (slot == 7 || slot == 13 || slot == 14)
{
this.stats.UpdateAbilityTriggers();
}
}
if (this.party && (slot == 0 || slot == 2) && this.portrait)
{
this.portrait.SetWpnDurabilityColor();
}
if (slot == 16 || slot == 20 || slot == 22 || slot == 24)
{
this.stats.EnchantJewelryEffects(slot, false);
}
if (!flag3 && (flag || force))
{
if (slot == 0 && !this.npc && ID <= 1)
{
Links.x.inventory.CreateFist(0, false, this, null, false);
}
if (slot != 4)
{
}
if (ID > 1)
{
if (slot == 18)
{
if (this.party && inventory2._ArmorID != -1)
{
if (this.bodyObj)
{
Links.x.archives.RecycleBody(this.bodyObj, this.bodyObj.name, base.gameObject.name);
}
this.bodyObj = null;
this.stats.model = Links.x.archives.GetArmorModel(inventory2._CharacterModel, this.stats.race, this.stats.sex, this);
this.SetupBody();
this.AddEquippedItems();
this.SetMeshState(true);
flag4 = true;
flag5 = true;
}
}
else
{
Transform transform = this.body.GetSlot(slot);
if (transform)
{
GameObject itemPrefabBody = Links.x.archives.GetItemPrefabBody(inventory2._CharacterModel);
bool flag6 = false;
int num2 = 2;
string text = "slingstone_ammo_clay";
if (inventory2._MeleeRangeEnd >= 5f && slot == 0)
{
flag6 = true;
}
if (inventory2._Name.Contains("Bow"))
{
transform = this.body.GetSlot(2);
num2 = 0;
text = "arrow_tier1";
}
if (inventory2._MainSkill == "Elixir" && inventory2._Tag == "Weapon")
{
text = "item_ammo_projectile_globe1";
}
if (!itemPrefabBody)
{
Debug.Log(((this != null) ? this.ToString() : null) + " missing item prefab " + inventory2._Name);
}
if (itemPrefabBody && transform)
{
itemPrefabBody.gameObject.transform.SetParent(transform, false);
itemPrefabBody.gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
itemPrefabBody.gameObject.transform.localRotation = Quaternion.Euler(this.vectorZero);
Equipment equipment = itemPrefabBody.GetComponent<Equipment>();
if (!equipment)
{
equipment = itemPrefabBody.AddComponent<Equipment>();
}
equipment.id = inventory2._ID;
if (inventory2._Tag == "Weapon")
{
itemPrefabBody.name = inventory2._MainSkill;
if (inventory2._MainSkill == "Whip")
{
itemPrefabBody.name = "FlailWhip";
}
if (inventory._MainSkill == "Sling")
{
itemPrefabBody.name = "Sling_t-1_a_maya";
}
}
BoxCollider boxCollider = itemPrefabBody.GetComponent<BoxCollider>();
if (boxCollider)
{
Object.Destroy(boxCollider);
}
this.equippedItems[slot / 2] = itemPrefabBody;
flag2 = true;
if (slot < 8 && this.party && this.durability[slot / 2].x <= (float)Records.x.durabilityThreshold && itemPrefabBody.gameObject && itemPrefabBody.gameObject.GetComponent<Renderer>() && itemPrefabBody.gameObject.GetComponent<Renderer>().material)
{
itemPrefabBody.gameObject.GetComponent<Renderer>().material.SetFloat("_Glow", 1f);
}
if (flag6)
{
GameObject itemPrefabBody2 = Links.x.archives.GetItemPrefabBody(text);
itemPrefabBody2.gameObject.transform.SetParent(this.body.GetSlot(num2), false);
itemPrefabBody2.gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
itemPrefabBody2.gameObject.transform.localRotation = Quaternion.Euler(this.vectorZero);
equipment.ammoObject = itemPrefabBody2;
equipment.ammoObjectName = text;
boxCollider = itemPrefabBody2.GetComponent<BoxCollider>();
if (boxCollider)
{
Object.Destroy(boxCollider);
}
}
}
}
}
}
else
{
this.equippedItems[slot / 2] = null;
if (slot == 18 && this.party)
{
string armorModel = Links.x.archives.GetArmorModel("Tunic", this.stats.race, this.stats.sex, this);
if (this.stats.model != armorModel && !this.ghost)
{
this.stats.model = armorModel;
this.SetupBody();
this.AddEquippedItems();
this.SetMeshState(true);
flag4 = true;
flag5 = true;
}
}
}
}
else
{
this.AnimatorController(slot);
}
if (!flag3 && (flag || force))
{
this.AnimatorController(slot);
}
if (flag2)
{
this.body.GatherRenderers(false);
if (this.visible == 1 || !this.npc)
{
this.SetMeshState(true);
}
else
{
this.SetMeshState(false);
}
if (!this.npc && (slot == 16 || slot == 24))
{
flag4 = true;
flag5 = true;
}
}
bool flag7 = false;
bool flag8 = false;
if (this.bag[14] == Links.x.library.torchID || this.bag[26] == Links.x.library.torchID || this.bag[28] == Links.x.library.torchID)
{
flag7 = true;
}
if (this.bag[14] == Links.x.library.incenseTorchID || this.bag[26] == Links.x.library.incenseTorchID || this.bag[28] == Links.x.library.incenseTorchID)
{
flag8 = true;
}
if (flag7)
{
this.AddTorch();
this.hasTorch = true;
}
if (flag8)
{
this.AddIncenseTorch();
this.hasIncenseTorch = true;
}
if (this.hasTorch && !flag7)
{
this.RemoveTorch();
this.hasTorch = false;
}
if (this.hasIncenseTorch && !flag8)
{
this.RemoveIncenseTorch();
this.hasIncenseTorch = false;
}
if (flag4 && !this.summoned)
{
Links.x.fellowship.AddHudPortraitChange(this);
}
if (flag5 && !this.summoned)
{
Links.x.fellowship.AddPortraitChange(this);
}
if (!this.npc)
{
if (this.invRow1 == null)
{
Links.x.inventory.CreateFist(0, false, this, null, false);
}
else if (this.invRow1._DisplayName == "Empty")
{
Links.x.inventory.CreateFist(0, false, this, null, false);
}
else if (this.ammoCount1 < 0)
{
this.ammoCount1 = 0;
}
}
if (this.party)
{
this.portrait.SetMagicColor();
}
this.GetAlternativeWeaponRows();
}
// Token: 0x060003D1 RID: 977 RVA: 0x000594D8 File Offset: 0x000576D8
public bool ShowSailAnim()
{
if (!this.sailing)
{
return false;
}
if (!this.npc)
{
if (!this.party)
{
return false;
}
if (Links.x.gaia.boat.leavingBoat)
{
return false;
}
}
return !this.pocketPausedOverride && !this.inAction && !this.inRecovery && !this.IsAttacking(this.body.currentHash) && !this.stats.animal && !this.inQueuedAbility && this.animID != 2 && this.animID != 32 && this.animID != 41 && this.animID != 42 && this.animID != 15 && this.animID != 16 && !this.alwaysJump && !this.jumping && !this.dead && !this.stunned && !this.dodging;
}
// Token: 0x060003D2 RID: 978 RVA: 0x000595C8 File Offset: 0x000577C8
public void NeedToUpdateSailingAnimator(bool always)
{
if (!this.sailing && !always)
{
return;
}
bool flag = this.ShowSailAnim();
if (this.oar && !flag)
{
this.AnimatorController(0);
this.AnimatorController(2);
}
if (!this.oar && flag)
{
this.AnimatorController(0);
}
GameObject gameObject = this.equippedItems[0];
GameObject gameObject2 = this.equippedItems[1];
if (this.oar)
{
if (gameObject && gameObject.activeSelf)
{
gameObject.SetActive(false);
}
if (gameObject2 && gameObject2.activeSelf)
{
gameObject2.SetActive(false);
return;
}
}
else
{
if (gameObject && !gameObject.activeSelf)
{
gameObject.SetActive(true);
}
if (gameObject2 && !gameObject2.activeSelf)
{
gameObject2.SetActive(true);
}
}
}
// Token: 0x060003D3 RID: 979 RVA: 0x0005969C File Offset: 0x0005789C
public void AnimatorController(int slot)
{
bool flag = false;
int num = 1;
if (slot == 0 && this.invRow1 != null)
{
num = this.invRow1._ID;
if (this.invRow1._UIModel.Contains("None"))
{
flag = true;
}
}
if (slot == 2 && this.invRow2 != null)
{
num = this.invRow2._ID;
}
bool flag2 = false;
if (this.sailing && this.ShowSailAnim())
{
flag2 = true;
}
if (flag2)
{
if (slot == 0)
{
bool flag3 = false;
if (this.party)
{
if (Links.x.gaia.boat)
{
flag3 = Links.x.gaia.boat.IsSailorLeft(this);
}
}
else if (this.boat)
{
flag3 = this.boat.IsSailorLeft(this);
}
string text = this.animationPrefix;
if (text != "_Volling")
{
text = "_Volling";
}
if (flag3)
{
this.animControllerName = text + "_SailingLeft";
}
else
{
this.animControllerName = text + "_SailingRight";
}
AnimatorOverrideController overrideController = Links.x.archives.GetOverrideController(this.animControllerName);
this.animator.runtimeAnimatorController = overrideController;
this.animator.SetBool("Party", this.party);
if (!this.oar)
{
this.oar = Links.x.cellar.GetPooledGameObject(137);
this.oar.transform.parent = this.body.GetSlot(0);
this.oar.SetActive(true);
this.oar.transform.localPosition = Vector3.zero;
this.oar.transform.localRotation = Quaternion.Euler(Vector3.zero);
this.oar.layer = 6;
return;
}
}
}
else
{
if (this.oar)
{
Links.x.cellar.ReturnPooledGameObject(137, this.oar);
this.oar = null;
}
if (slot == 0 && num <= 1)
{
this.animControllerName = this.animationPrefix + "_Unarmed";
AnimatorOverrideController animatorOverrideController = Links.x.archives.GetOverrideController(this.animControllerName);
if (!animatorOverrideController)
{
if (this.bag[0] <= 1)
{
this.animControllerName = this.animationPrefix + "_unarmed";
animatorOverrideController = Links.x.archives.GetOverrideController(this.animControllerName);
}
if (!animatorOverrideController)
{
Debug.Log("missing animation override controller for " + this.animControllerName + " " + ((this != null) ? this.ToString() : null));
}
}
this.animator.runtimeAnimatorController = animatorOverrideController;
this.animator.SetBool("Party", this.party);
if (this.body)
{
this.body.anim.Rebind();
this.body.anim.Update(0f);
}
this.needsRebind = false;
if (this.invRow1 != null && (this.invRow1._MainSkill == "Whip" || this.invRow1._MainSkill == "Sling"))
{
this.needsRebind = true;
}
}
if (slot == 2 && num <= 1 && this.animator.runtimeAnimatorController != null && (this.animator.runtimeAnimatorController.name.Contains("Multi") || this.animator.runtimeAnimatorController.name.Contains("Shield")))
{
string text2 = this.invRow1._CharacterAnimation;
if (this.stats.race == "Yeti")
{
text2 = Records.x.GetWeaponControllerPrefix(this.invRow1, this.invRow2, this.stats.race, false);
}
this.animControllerName = this.animationPrefix + text2;
AnimatorOverrideController overrideController2 = Links.x.archives.GetOverrideController(this.animControllerName);
if (overrideController2 != null)
{
this.animator.runtimeAnimatorController = overrideController2;
}
this.animator.enabled = false;
this.animator.enabled = true;
if (this.body)
{
this.body.anim.Rebind();
this.body.anim.Update(0f);
}
this.needsRebind = false;
if (this.invRow1 != null && (this.invRow1._MainSkill == "Whip" || this.invRow1._MainSkill == "Sling"))
{
this.needsRebind = true;
}
this.animator.SetBool("Party", this.party);
}
if (slot == 0 && num > 1 && flag && this.invRow1._CharacterAnimation != "")
{
string characterAnimation = this.invRow1._CharacterAnimation;
this.animControllerName = this.animationPrefix + characterAnimation;
AnimatorOverrideController animatorOverrideController2 = Links.x.archives.GetOverrideController(this.animControllerName);
if (animatorOverrideController2 != null)
{
this.animator.runtimeAnimatorController = animatorOverrideController2;
}
else if (!animatorOverrideController2)
{
if (this.bag[0] <= 1)
{
this.animControllerName = this.animationPrefix + "_unarmed";
animatorOverrideController2 = Links.x.archives.GetOverrideController(this.animControllerName);
}
if (!animatorOverrideController2)
{
Debug.Log("missing animation override controller for " + this.animControllerName + " " + ((this != null) ? this.ToString() : null));
}
else
{
this.animator.runtimeAnimatorController = animatorOverrideController2;
}
}
}
if (slot == 0 && num > 1)
{
if (this.equippedItems[0])
{
this.equippedItems[0].SetActive(true);
}
string weaponControllerPrefix = Records.x.GetWeaponControllerPrefix(this.invRow1, this.invRow2, this.stats.race, false);
this.animControllerName = this.animationPrefix + weaponControllerPrefix;
AnimatorOverrideController animatorOverrideController3 = Links.x.archives.GetOverrideController(this.animControllerName);
if (animatorOverrideController3 == null && this.animationPrefix.Contains("Volling"))
{
this.animControllerName = "_Volling" + weaponControllerPrefix;
animatorOverrideController3 = Links.x.archives.GetOverrideController(this.animControllerName);
}
if (animatorOverrideController3 != null)
{
this.animator.runtimeAnimatorController = animatorOverrideController3;
}
if (this.body)
{
this.body.anim.Rebind();
this.body.anim.Update(0f);
}
this.needsRebind = false;
if (this.invRow1 != null && (this.invRow1._MainSkill == "Whip" || this.invRow1._MainSkill == "Sling"))
{
this.needsRebind = true;
}
this.animator.enabled = false;
this.animator.enabled = true;
this.animator.SetBool("Party", this.party);
}
if (slot == 2 && num > 1)
{
if (this.equippedItems[1])
{
this.equippedItems[1].SetActive(true);
}
string weaponControllerPrefix2 = Records.x.GetWeaponControllerPrefix(this.invRow1, this.invRow2, this.stats.race, false);
this.animControllerName = this.animationPrefix + weaponControllerPrefix2;
AnimatorOverrideController animatorOverrideController4 = Links.x.archives.GetOverrideController(this.animControllerName);
if (animatorOverrideController4 == null && this.animationPrefix.Contains("Volling"))
{
this.animControllerName = "_Volling" + weaponControllerPrefix2;
animatorOverrideController4 = Links.x.archives.GetOverrideController(this.animControllerName);
}
if (animatorOverrideController4 != null)
{
this.animator.runtimeAnimatorController = animatorOverrideController4;
}
if (this.body)
{
this.body.anim.Rebind();
this.body.anim.Update(0f);
}
this.needsRebind = false;
if (this.invRow1 != null && (this.invRow1._MainSkill == "Whip" || this.invRow1._MainSkill == "Sling"))
{
this.needsRebind = true;
}
this.animator.SetBool("Party", this.party);
this.animator.enabled = false;
this.animator.enabled = true;
}
}
}
// Token: 0x060003D4 RID: 980 RVA: 0x00059F6C File Offset: 0x0005816C
public void InvFromDB()
{
this.bag.Clear();
this.sockets.Clear();
this.durability.Clear();
int num = 54;
if (!this.npc || this.stats.characterRow._CanJoinParty)
{
num = 176;
}
for (int i = 0; i < num / 2; i++)
{
this.bag.Add(0);
this.bag.Add(0);
this.sockets.Add(Vector3.zero);
this.sockets.Add(Vector3.zero);
this.bagPositions.Add(-1);
this.durability.Add(Vector4.zero);
}
List<int> savedBag = this.stats.savedBag;
List<Vector4> savedDur = this.stats.savedDur;
for (int j = 0; j < num; j++)
{
if (j < savedBag.Count)
{
this.bag[j] = savedBag[j];
if (this.stats.savedIntercesion > -1 && this.stats.savedIntercesion == this.bag[j])
{
this.sockets[j] = this.stats.savedIntercessionA;
this.sockets[j + 1] = this.stats.savedIntercessionB;
}
}
}
for (int k = 0; k < this.durability.Count; k++)
{
if (k < savedDur.Count)
{
this.durability[k] = savedDur[k];
}
}
if (this.bag[0] == 0)
{
this.bag[0] = 1;
this.bag[1] = 1;
}
}
// Token: 0x060003D5 RID: 981 RVA: 0x0005A124 File Offset: 0x00058324
public string GetNPCSavedItems()
{
this.str.Clear();
int count = this.bag.Count;
int num = 0;
for (int i = 0; i < count; i++)
{
if (i % 2 == 0)
{
if (num > 0)
{
this.str.Append(",");
}
Library.Inventory invRow = Links.x.library.GetInvRow(this.bag[i]);
this.str.Append(invRow._Name);
this.str.Append(",");
this.str.Append(this.bag[i + 1]);
this.str.Append(",");
this.str.Append(this.sockets[i].x);
this.str.Append(",");
this.str.Append(this.sockets[i].y);
this.str.Append(",");
this.str.Append(this.sockets[i].z);
this.str.Append(",");
this.str.Append(this.sockets[i + 1].x);
this.str.Append(",");
this.str.Append(this.sockets[i + 1].y);
this.str.Append(",");
this.str.Append(this.sockets[i + 1].z);
this.str.Append(",");
this.str.Append(this.durability[i / 2].x);
this.str.Append(",");
this.str.Append(this.durability[i / 2].z);
this.str.Append(",");
this.str.Append(this.durability[i / 2].w);
this.str.Append(",");
this.str.Append(i / 2);
num++;
}
}
return this.str.ToString();
}
// Token: 0x060003D6 RID: 982 RVA: 0x0005A3AC File Offset: 0x000585AC
public void SetNPCSavedItems(string itemList)
{
if (this.ghost)
{
return;
}
if (itemList == null)
{
return;
}
char c = ',';
int num = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
int num5 = 0;
int num6 = 0;
int num7 = 0;
int num8 = -1;
int num9 = 0;
int num10 = 0;
int num11 = 0;
List<int> list = new List<int>();
string[] array = new string[0];
array = itemList.Split(c, StringSplitOptions.None);
int num12 = array.Length;
int num13 = 0;
for (int i = 0; i < num12; i++)
{
if (num13 == 0)
{
int num14 = 0;
if (array[i] != "" && array[i] != null)
{
bool flag = true;
string text = array[i];
Library.Inventory invRowFromName = Links.x.library.GetInvRowFromName(text);
if (invRowFromName != null)
{
num14 = invRowFromName._ID;
}
if (flag)
{
int.TryParse(array[i + 1], out num);
int.TryParse(array[i + 2], out num2);
int.TryParse(array[i + 3], out num3);
int.TryParse(array[i + 4], out num4);
int.TryParse(array[i + 5], out num5);
int.TryParse(array[i + 6], out num6);
int.TryParse(array[i + 7], out num7);
int.TryParse(array[i + 8], out num8);
int.TryParse(array[i + 9], out num9);
int.TryParse(array[i + 10], out num10);
int.TryParse(array[i + 11], out num11);
list.Add(num14);
list.Add(num);
list.Add(num2);
list.Add(num3);
list.Add(num4);
list.Add(num5);
list.Add(num6);
list.Add(num7);
list.Add(num8);
list.Add(num9);
list.Add(num10);
list.Add(num11);
}
}
}
if (num13 == 11)
{
num13 = 0;
}
else
{
num13++;
}
}
for (int j = 0; j < this.bag.Count; j++)
{
if (j % 2 == 0)
{
this.bag[j] = 0;
this.bag[j + 1] = 0;
this.sockets[j] = Vector3.zero;
this.sockets[j + 1] = Vector3.zero;
this.durability[j / 2] = Vector4.zero;
}
}
num12 = list.Count;
num13 = 0;
if (!this.stunned)
{
for (int k = 0; k < num12; k++)
{
if (num13 == 0)
{
num11 = list[k + 11] * 2;
if (num11 < this.bag.Count)
{
this.bag[num11] = list[k];
this.bag[num11 + 1] = list[k + 1];
this.sockets[num11] = new Vector3((float)list[k + 2], (float)list[k + 3], (float)list[k + 4]);
this.sockets[num11 + 1] = new Vector3((float)list[k + 5], (float)list[k + 6], (float)list[k + 7]);
this.durability[num11 / 2] = new Vector4((float)list[k + 8], 0f, (float)list[k + 9], (float)list[k + 10]);
}
else
{
this.bag.Add(list[k]);
this.bag.Add(list[k + 1]);
this.sockets.Add(new Vector3((float)list[k + 2], (float)list[k + 3], (float)list[k + 4]));
this.sockets.Add(new Vector3((float)list[k + 5], (float)list[k + 6], (float)list[k + 7]));
this.durability.Add(new Vector4((float)list[k + 8], 0f, (float)list[k + 9], (float)list[k + 10]));
}
}
if (num13 == 11)
{
num13 = 0;
}
else
{
num13++;
}
}
}
}
// Token: 0x060003D7 RID: 983 RVA: 0x0005A82C File Offset: 0x00058A2C
public void SetUpInv()
{
Links.x.inventory.SetUpBag(this);
this.tempBagID = this.inventoryBag.bagID;
this.tempBagAmoumt = this.inventoryBag.bagAmount;
this.tempSocketA = this.inventoryBag.socketA;
this.tempSocketB = this.inventoryBag.socketB;
this.tempBagPos = this.inventoryBag.bagPos;
this.tempDurability = this.inventoryBag.durability;
this.tempBagItems = this.inventoryBag.bagItems;
Links.x.inventory.SpawnSavedItems(this);
}
// Token: 0x060003D8 RID: 984 RVA: 0x0005A8D0 File Offset: 0x00058AD0
public int FreeBagID()
{
int num = -1;
for (int i = 36; i < this.bag.Count; i++)
{
if (this.bag[i] == 0 && i % 2 == 0)
{
num = i;
break;
}
}
return num;
}
// Token: 0x060003D9 RID: 985 RVA: 0x0005A910 File Offset: 0x00058B10
public void UpdateListsFromInv(bool updatedBodyEquipped)
{
if (this.party)
{
this.bag.Clear();
this.bagPositions.Clear();
this.sockets.Clear();
this.durability.Clear();
int count = this.tempBagID.Count;
for (int i = 0; i < count; i++)
{
this.bag.Add(this.tempBagID[i]);
this.bag.Add(this.tempBagAmoumt[i]);
this.sockets.Add(this.tempSocketA[i]);
this.sockets.Add(this.tempSocketB[i]);
this.bagPositions.Add(this.tempBagPos[i]);
this.durability.Add(this.tempDurability[i]);
}
if (this.portrait && updatedBodyEquipped)
{
this.portrait.skillBag.SetTrinketGrid(false);
}
}
}
// Token: 0x060003DA RID: 986 RVA: 0x0005AA1C File Offset: 0x00058C1C
public void SetBagPosition(int equipIndex, int n)
{
if (equipIndex < 0)
{
return;
}
if (equipIndex >= this.bagPositions.Count)
{
Debug.Log("bagPosition list is not large enough for this " + equipIndex.ToString() + " " + ((this != null) ? this.ToString() : null));
return;
}
this.bagPositions[equipIndex] = n;
}
// Token: 0x060003DB RID: 987 RVA: 0x0005AA72 File Offset: 0x00058C72
public GameObject GetItemEquipped(int index)
{
if (this.equippedItems[index])
{
return this.equippedItems[index];
}
return null;
}
// Token: 0x060003DC RID: 988 RVA: 0x0005AA90 File Offset: 0x00058C90
public string GetAmmoType()
{
if (this.invRow1._MainSkill == "Bow")
{
return "arrows";
}
if (this.invRow1._MainSkill.Contains("Sling"))
{
return "stones";
}
return "vials";
}
// Token: 0x060003DD RID: 989 RVA: 0x0005AADC File Offset: 0x00058CDC
public bool HasAmmoOrMelee(Library.Inventory row, bool justCheckAmmo)
{
if (row._MeleeRangeEnd >= 5f)
{
if (row._MainSkill == "Bow" && row._Ammo1 == "Bow")
{
for (int i = 4; i < 8; i++)
{
if (this.bag[i * 2] >= Links.x.library.arrowsMin && this.bag[i * 2] <= Links.x.library.arrowsMax)
{
return true;
}
}
return false;
}
if (row._MainSkill == "Sling" && row._Ammo1 == "Dart")
{
for (int j = 4; j < 8; j++)
{
if (this.bag[j * 2] == Links.x.library.dartsMin)
{
return true;
}
}
return false;
}
if (row._MainSkill.Contains("Elixir"))
{
for (int k = 4; k < 8; k++)
{
if (this.bag[k * 2] >= Links.x.library.vialsMin && this.bag[k * 2] <= Links.x.library.vialsMin + 1)
{
return true;
}
}
return false;
}
for (int l = 4; l < 8; l++)
{
Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(this.bag[l * 2]);
if (invRowByIndex._Tag == "Ammunition" && (invRowByIndex._Name == row._Ammo1 || invRowByIndex._Name == row._Ammo2))
{
return true;
}
}
}
return !justCheckAmmo;
}
// Token: 0x060003DE RID: 990 RVA: 0x0005AC90 File Offset: 0x00058E90
public bool NeedsAmmo()
{
return this.invRow1._MainSkill == "Bow" || this.invRow1._MainSkill == "Sling" || this.invRow1._MainSkill.Contains("Elixir");
}
// Token: 0x060003DF RID: 991 RVA: 0x0005ACE8 File Offset: 0x00058EE8
public void GetAmmoSlotsNPC(out int slot1, out int slot2, out int slot3, Library.Inventory row)
{
slot1 = 0;
slot2 = 0;
slot3 = 0;
for (int i = 0; i < 3; i++)
{
int num = this.bag[(i + 4) * 2];
int num2 = i + 4;
if (row._MainSkill == "Bow" && row._Ammo1 == "Arrow")
{
if (this.bag[num2 * 2] < Links.x.library.arrowsMin || this.bag[num2 * 2] > Links.x.library.arrowsMax || this.bag[num2 * 2] <= 1)
{
num = 0;
}
}
else if (row._MainSkill == "Sling" && row._Ammo1 == "Dart")
{
if (this.bag[num2 * 2] != Links.x.library.dartsMin)
{
num = 0;
}
}
else if (row._MainSkill.Contains("Elixir") && row._Ammo1 != "Dart")
{
if (this.bag[num2 * 2] < Links.x.library.vialsMin || this.bag[num2 * 2] > Links.x.library.vialsMin + 1 || this.bag[num2 * 2] <= 1)
{
num = 0;
}
}
else
{
bool flag = false;
Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(this.bag[num2 * 2]);
if (invRowByIndex._Tag == "Ammunition" && (invRowByIndex._Name == row._Ammo1 || invRowByIndex._Name == row._Ammo2))
{
flag = true;
}
if (!flag)
{
num = 0;
}
}
if (i == 0)
{
slot1 = num;
}
if (i == 1)
{
slot2 = num;
}
if (i == 2)
{
slot3 = num;
}
}
}
// Token: 0x060003E0 RID: 992 RVA: 0x0005AEE8 File Offset: 0x000590E8
public int GetAmmoIndex(Library.Inventory row)
{
int num = this.selectedAmmoIndex;
bool flag = false;
if (this.selectedAmmoIndex <= 0)
{
if (row._MainSkill == "Bow" && row._Ammo1 == "Arrow" && this.bag[8] >= Links.x.library.arrowsMin && this.bag[8] <= Links.x.library.arrowsMax && this.bag[8] > 1)
{
return 8;
}
if (row._MainSkill == "Sling" && row._Ammo1 == "Dart" && this.bag[8] == Links.x.library.dartsMin)
{
return 8;
}
if (row._MainSkill.Contains("Elixir") && this.bag[8] >= Links.x.library.vialsMin && this.bag[8] <= Links.x.library.vialsMin + 1 && this.bag[8] > 1)
{
return 8;
}
if (row._MainSkill == "Sling" && row._Ammo1 != "Dart")
{
Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(this.bag[8]);
if (invRowByIndex._Tag == "Ammunition" && (invRowByIndex._Name == row._Ammo1 || invRowByIndex._Name == row._Ammo2))
{
return 8;
}
}
}
else if (this.selectedAmmoIndex == 1)
{
if (row._MainSkill == "Bow" && row._Ammo1 == "Arrow" && this.bag[10] >= Links.x.library.arrowsMin && this.bag[10] <= Links.x.library.arrowsMax && this.bag[10] > 1)
{
return 10;
}
if (row._MainSkill == "Sling" && row._Ammo1 == "Dart" && this.bag[10] == Links.x.library.dartsMin)
{
return 10;
}
if (row._MainSkill.Contains("Elixir") && this.bag[10] >= Links.x.library.vialsMin && this.bag[10] <= Links.x.library.vialsMin + 1 && this.bag[10] > 1)
{
return 10;
}
if (row._MainSkill == "Sling" && row._Ammo1 != "Dart")
{
Library.Inventory invRowByIndex2 = Links.x.library.GetInvRowByIndex(this.bag[10]);
if (invRowByIndex2._Tag == "Ammunition" && (invRowByIndex2._Name == row._Ammo1 || invRowByIndex2._Name == row._Ammo2))
{
return 10;
}
}
}
else if (this.selectedAmmoIndex == 2)
{
if (row._MainSkill == "Bow" && row._Ammo1 == "Arrow" && this.bag[12] >= Links.x.library.arrowsMin && this.bag[12] <= Links.x.library.arrowsMax && this.bag[12] > 1)
{
return 12;
}
if (row._MainSkill == "Sling" && row._Ammo1 == "Dart" && this.bag[12] == Links.x.library.dartsMin)
{
return 12;
}
if (row._MainSkill.Contains("Elixir") && this.bag[12] >= Links.x.library.vialsMin && this.bag[12] <= Links.x.library.vialsMin + 1 && this.bag[12] > 1)
{
return 12;
}
if (row._MainSkill == "Sling" && row._Ammo1 != "Dart")
{
Library.Inventory invRowByIndex3 = Links.x.library.GetInvRowByIndex(this.bag[12]);
if (invRowByIndex3._Tag == "Ammunition" && (invRowByIndex3._Name == row._Ammo1 || invRowByIndex3._Name == row._Ammo2))
{
return 12;
}
}
}
if (!flag)
{
if (row._MainSkill == "Bow" && row._Ammo1 == "Arrow")
{
for (int i = 4; i < 8; i++)
{
if (this.bag[i * 2] >= Links.x.library.arrowsMin && this.bag[i * 2] <= Links.x.library.arrowsMax && this.bag[i * 2] > 1)
{
if (i == 4)
{
this.selectedAmmoIndex = 0;
}
if (i == 5)
{
this.selectedAmmoIndex = 1;
}
if (i == 6)
{
this.selectedAmmoIndex = 2;
}
if (this.party && num != this.selectedAmmoIndex)
{
this.portrait.skillBag.selectedAmmoIndex = this.selectedAmmoIndex;
this.portrait.skillBag.SetTrinketGrid(false);
}
return i * 2;
}
}
}
else if (row._MainSkill == "Sling" && row._Ammo1 == "Dart")
{
for (int j = 4; j < 8; j++)
{
if (this.bag[j * 2] == Links.x.library.dartsMin && this.bag[j * 2] > 1)
{
if (j == 4)
{
this.selectedAmmoIndex = 0;
}
if (j == 5)
{
this.selectedAmmoIndex = 1;
}
if (j == 6)
{
this.selectedAmmoIndex = 2;
}
if (this.party && num != this.selectedAmmoIndex)
{
this.portrait.skillBag.selectedAmmoIndex = this.selectedAmmoIndex;
this.portrait.skillBag.SetTrinketGrid(false);
}
return j * 2;
}
}
}
else if (row._MainSkill.Contains("Elixir"))
{
for (int k = 4; k < 8; k++)
{
if (this.bag[k * 2] >= Links.x.library.vialsMin && this.bag[k * 2] <= Links.x.library.vialsMin + 1 && this.bag[k * 2] > 1)
{
if (k == 4)
{
this.selectedAmmoIndex = 0;
}
if (k == 5)
{
this.selectedAmmoIndex = 1;
}
if (k == 6)
{
this.selectedAmmoIndex = 2;
}
if (this.party && num != this.selectedAmmoIndex)
{
this.portrait.skillBag.selectedAmmoIndex = this.selectedAmmoIndex;
this.portrait.skillBag.SetTrinketGrid(false);
}
return k * 2;
}
}
}
else
{
for (int l = 4; l < 8; l++)
{
Library.Inventory invRowByIndex4 = Links.x.library.GetInvRowByIndex(this.bag[l * 2]);
if (invRowByIndex4._Tag == "Ammunition" && (invRowByIndex4._Name == row._Ammo1 || invRowByIndex4._Name == row._Ammo2))
{
if (l == 4)
{
this.selectedAmmoIndex = 0;
}
if (l == 5)
{
this.selectedAmmoIndex = 1;
}
if (l == 6)
{
this.selectedAmmoIndex = 2;
}
return l * 2;
}
}
}
}
if (this.party && num != this.selectedAmmoIndex)
{
this.portrait.skillBag.SetTrinketGrid(false);
}
return -1;
}
// Token: 0x060003E1 RID: 993 RVA: 0x0005B778 File Offset: 0x00059978
public void UseAmmo(int ammoIndex)
{
int num = this.bag[ammoIndex];
int num2 = this.bag[ammoIndex + 1];
num2--;
this.bag[ammoIndex + 1] = num2;
if (this.party)
{
Links.x.inventory.SetBagAmt(ammoIndex / 2, num2, this);
}
if (this.bag[ammoIndex + 1] <= 0)
{
if (this.party)
{
this.bag[ammoIndex] = 0;
this.bag[ammoIndex + 1] = 0;
Links.x.inventory.RemoveBagItem(ammoIndex / 2, this);
this.portrait.skillBag.SetTrinketGrid(false);
}
else
{
this.bag[ammoIndex] = 0;
this.bag[ammoIndex + 1] = 0;
}
if (this.npc)
{
this.LookForAmmoInBag(ammoIndex, this.invRow1._MainSkill, this.invRow1);
}
}
if (this.party)
{
this.portrait.skillBag.UpdateAmmoNumbers();
}
}
// Token: 0x060003E2 RID: 994 RVA: 0x0005B884 File Offset: 0x00059A84
public void LookForAmmoInBag(int ammoIndex, string mainSkill, Library.Inventory weaponRow)
{
bool flag = false;
if (this.npc)
{
if (ammoIndex == -1)
{
if (this.bag[8] == 0)
{
ammoIndex = 8;
}
else if (this.bag[10] == 0)
{
ammoIndex = 10;
}
else
{
if (this.bag[12] != 0)
{
return;
}
ammoIndex = 12;
}
}
int count = this.bag.Count;
for (int i = 36; i < count; i++)
{
if (i % 2 == 0 && !flag)
{
Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(this.bag[i]);
if (invRowByIndex._Tag == "Ammunition")
{
if (mainSkill == "Bow" && weaponRow._Ammo1 == "Arrow")
{
if (this.bag[i] >= Links.x.library.arrowsMin && this.bag[i] <= Links.x.library.arrowsMax && this.bag[i] > 1)
{
if (this.party && this.inventoryBag)
{
this.inventoryBag.SwapBagItem(i / 2, ammoIndex / 2, this, true);
}
else
{
this.bag[ammoIndex] = this.bag[i];
this.bag[ammoIndex + 1] = this.bag[i + 1];
}
}
}
else if (mainSkill == "Sling" && weaponRow._Ammo1 == "Dart")
{
if (this.bag[i] == Links.x.library.dartsMin && this.bag[i] > 1)
{
if (this.party && this.inventoryBag)
{
this.inventoryBag.SwapBagItem(i / 2, ammoIndex / 2, this, true);
}
else
{
this.bag[ammoIndex] = this.bag[i];
this.bag[ammoIndex + 1] = this.bag[i + 1];
}
}
}
else if (mainSkill.Contains("Elixir"))
{
if (this.bag[i] >= Links.x.library.vialsMin && this.bag[i] <= Links.x.library.vialsMin + 1 && this.bag[i] > 1)
{
if (this.party && this.inventoryBag)
{
this.inventoryBag.SwapBagItem(i / 2, ammoIndex / 2, this, true);
}
else
{
this.bag[ammoIndex] = this.bag[i];
this.bag[ammoIndex + 1] = this.bag[i + 1];
}
}
}
else if (invRowByIndex._Name == weaponRow._Ammo1 || invRowByIndex._Name == weaponRow._Ammo2)
{
if (this.party && this.inventoryBag)
{
this.inventoryBag.SwapBagItem(i / 2, ammoIndex / 2, this, true);
}
else
{
this.bag[ammoIndex] = this.bag[i];
this.bag[ammoIndex + 1] = this.bag[i + 1];
}
}
}
}
}
}
}
// Token: 0x060003E3 RID: 995 RVA: 0x0005BC28 File Offset: 0x00059E28
public void RemoveEnchantedJewelryDurability()
{
int num = 8;
if (this.sockets[num * 2].x != 0f)
{
Vector3 vector = this.sockets[num * 2 + 1];
}
num = 10;
if (this.sockets[num * 2].x != 0f)
{
Vector3 vector2 = this.sockets[num * 2 + 1];
}
num = 11;
if (this.sockets[num * 2].x != 0f)
{
Vector3 vector3 = this.sockets[num * 2 + 1];
}
num = 12;
if (this.sockets[num * 2].x != 0f)
{
Vector3 vector4 = this.sockets[num * 2 + 1];
}
}
// Token: 0x060003E4 RID: 996 RVA: 0x0005BCEC File Offset: 0x00059EEC
public void UpdateArmor(int subtractChunk)
{
if (this.stamina)
{
Vector4 vector = this.durability[9];
float num = (float)this.stamina.maxArmor / 7f * (float)subtractChunk;
vector.x -= num;
if (vector.x < 0f)
{
vector.x = 0f;
}
this.durability[9] = vector;
this.stamina.UpdateArmor((int)this.durability[9].x);
}
}
// Token: 0x060003E5 RID: 997 RVA: 0x0005BD7C File Offset: 0x00059F7C
public void UpdateDurability(int index, int loss, bool isShield, bool physicalDurability)
{
if (this.bag[index * 2] > 1)
{
int num = (int)this.durability[index].x;
if (this.invRow1._DurabilityMax < 0)
{
return;
}
if (index == 0 && this.invRow1._DurabilityMax < 0)
{
return;
}
num -= loss;
if (num < 0)
{
num = 0;
}
this.durability[index] = new Vector4((float)num, this.durability[index].y, this.durability[index].z, this.durability[index].w);
if (index == 9 && this.stamina && this.stamina.hasArmor)
{
this.stamina.UpdateArmor((int)this.durability[index].x);
}
if (this.party && this.inventoryBag)
{
this.inventoryBag.SetDurability(this.durability[index], index);
ItemEquipped itemEquipped = this.body.GetItemEquipped(index);
if (itemEquipped)
{
itemEquipped.durability = this.durability[index];
}
if (num <= 0)
{
if (index < 4 && !isShield)
{
this.str.Clear();
this.str.Append(Links.x.gameFeed.GetPartyColorText(this));
this.str.Append(this.stats.GetName());
this.str.Append("</color>");
this.str.Append("'s weapon needs to be repaired");
Links.x.gameFeed.AddFeed(this.str.ToString());
}
else if (index < 4 && isShield)
{
this.str.Clear();
this.str.Append(Links.x.gameFeed.GetPartyColorText(this));
this.str.Append(this.stats.GetName());
this.str.Append("</color>");
this.str.Append("'s shield needs to be repaired");
Links.x.gameFeed.AddFeed(this.str.ToString());
}
else
{
this.str.Clear();
this.str.Append(Links.x.gameFeed.GetPartyColorText(this));
this.str.Append(this.stats.GetName());
this.str.Append("</color>");
this.str.Append("'s armor needs to be repaired");
Links.x.gameFeed.AddFeed(this.str.ToString());
}
MasterAudio.PlaySound3DAtVector3AndForget("Armor Break", this.tr.position, 1f, new float?(1f), 0f, "", null);
}
if (num <= Records.x.durabilityThreshold)
{
this.ChangeDurabilityVisual(index);
}
if (this.portrait)
{
this.portrait.SetWpnDurabilityColor();
}
}
if ((index == 8 || index == 10 || index == 11 || index == 12) && num <= 0)
{
this.stats.EnchantJewelryEffects(index * 2, false);
}
}
}
// Token: 0x060003E6 RID: 998 RVA: 0x0005C0D8 File Offset: 0x0005A2D8
public void ChangeDurabilityVisual(int index)
{
if (this.durability[index].x <= (float)Records.x.durabilityThreshold)
{
GameObject gameObject = this.equippedItems[index];
if (gameObject && gameObject.GetComponent<MeshRenderer>())
{
gameObject.GetComponent<MeshRenderer>().material.SetFloat("_Glow", 1f);
}
}
else
{
GameObject gameObject2 = this.equippedItems[index];
if (gameObject2 && gameObject2.GetComponent<MeshRenderer>())
{
gameObject2.GetComponent<MeshRenderer>().material.SetFloat("_Glow", 0f);
}
}
if (this.portrait)
{
this.portrait.SetWpnDurabilityColor();
}
}
// Token: 0x060003E7 RID: 999 RVA: 0x0005C190 File Offset: 0x0005A390
public void UseQuickItem(int index)
{
int invNum = this.GetInvNum(index * 2);
if (invNum > 1)
{
Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(invNum);
if (this.hasActions)
{
this.actions.spellScroll = null;
}
if (Records.x.pocketPause && !this.mainSelected && (invRowByIndex._Name.Contains("SpellScroll") || invRowByIndex._Name.Contains("PaganScroll")))
{
return;
}
Links.x.inventory.UseBeltItem(index, this);
if (this.portrait && !this.hasActions)
{
this.portrait.QueueIcon(false);
}
}
}
// Token: 0x060003E8 RID: 1000 RVA: 0x0005C240 File Offset: 0x0005A440
public bool ItemHasSocket(int index)
{
Vector3 vector = this.sockets[index];
Vector3 vector2 = this.sockets[index + 1];
return vector.x > 0f || vector.y > 0f || vector.z > 0f || (vector2.x > 0f || vector2.y > 0f || vector2.z > 0f);
}
// Token: 0x060003E9 RID: 1001 RVA: 0x0005C2BC File Offset: 0x0005A4BC
public int HasSocket(int itemIndex, int socketNum)
{
Vector3 vector = this.sockets[itemIndex];
Vector3 vector2 = this.sockets[itemIndex + 1];
if (socketNum == 0)
{
return (int)vector.x;
}
if (socketNum == 1)
{
return (int)vector.y;
}
if (socketNum == 2)
{
return (int)vector.z;
}
if (socketNum == 3)
{
return (int)vector2.x;
}
if (socketNum == 4)
{
return (int)vector2.y;
}
if (socketNum == 5)
{
return (int)vector2.z;
}
return 0;
}
// Token: 0x060003EA RID: 1002 RVA: 0x0005C32D File Offset: 0x0005A52D
public int GetInstrumentRow()
{
return this.instrumentInUse;
}
// Token: 0x060003EB RID: 1003 RVA: 0x0005C338 File Offset: 0x0005A538
public int InstrumentTypeIndex(string type)
{
int invNum = this.GetInvNum(14);
if (Links.x.library.GetInvRow(invNum)._MainSkill == type)
{
return 7;
}
int invNum2 = this.GetInvNum(26);
if (Links.x.library.GetInvRow(invNum2)._MainSkill == type)
{
return 13;
}
int invNum3 = this.GetInvNum(28);
if (Links.x.library.GetInvRow(invNum3)._MainSkill == type)
{
return 14;
}
return -1;
}
// Token: 0x060003EC RID: 1004 RVA: 0x0005C3C0 File Offset: 0x0005A5C0
public int HasRosary()
{
int num = this.GetInvNum(14);
if (num > 0 && Links.x.library.GetInvRow(num)._MainSkill.Contains("Charm"))
{
return 7;
}
num = this.GetInvNum(26);
if (num > 0 && Links.x.library.GetInvRow(num)._MainSkill.Contains("Charm"))
{
return 13;
}
num = this.GetInvNum(28);
if (num > 0 && Links.x.library.GetInvRow(num)._MainSkill.Contains("Charm"))
{
return 14;
}
return -1;
}
// Token: 0x060003ED RID: 1005 RVA: 0x0005C460 File Offset: 0x0005A660
public bool HasInstrument()
{
int invNum = this.GetInvNum(14);
Library.Inventory invRow = Links.x.library.GetInvRow(invNum);
int invNum2 = this.GetInvNum(26);
Library.Inventory invRow2 = Links.x.library.GetInvRow(invNum2);
int invNum3 = this.GetInvNum(28);
Library.Inventory invRow3 = Links.x.library.GetInvRow(invNum3);
for (int i = 0; i < 3; i++)
{
Library.Inventory inventory = invRow;
if (i == 1)
{
inventory = invRow2;
}
if (i == 2)
{
inventory = invRow3;
}
if (inventory._MainSkill.Contains("Flute") || inventory._MainSkill.Contains("Drum") || inventory._MainSkill.Contains("Horn") || inventory._MainSkill.Contains("Pipe"))
{
return true;
}
}
return false;
}
// Token: 0x060003EE RID: 1006 RVA: 0x0005C534 File Offset: 0x0005A734
public bool HasInstrumentType(string n)
{
int invNum = this.GetInvNum(14);
Library.Inventory invRow = Links.x.library.GetInvRow(invNum);
int invNum2 = this.GetInvNum(26);
Library.Inventory invRow2 = Links.x.library.GetInvRow(invNum2);
int invNum3 = this.GetInvNum(28);
Library.Inventory invRow3 = Links.x.library.GetInvRow(invNum3);
for (int i = 0; i < 3; i++)
{
Library.Inventory inventory = invRow;
if (i == 1)
{
inventory = invRow2;
}
if (i == 2)
{
inventory = invRow3;
}
if (inventory._MainSkill.Contains(n))
{
return true;
}
}
return false;
}
// Token: 0x060003EF RID: 1007 RVA: 0x0005C5C8 File Offset: 0x0005A7C8
public Library.Inventory GetInstrumentType(string n)
{
int invNum = this.GetInvNum(14);
Library.Inventory invRow = Links.x.library.GetInvRow(invNum);
int invNum2 = this.GetInvNum(26);
Library.Inventory invRow2 = Links.x.library.GetInvRow(invNum2);
int invNum3 = this.GetInvNum(28);
Library.Inventory invRow3 = Links.x.library.GetInvRow(invNum3);
for (int i = 0; i < 3; i++)
{
Library.Inventory inventory = invRow;
if (i == 1)
{
inventory = invRow2;
}
if (i == 2)
{
inventory = invRow3;
}
if (inventory._MainSkill.Contains(n))
{
return inventory;
}
}
return null;
}
// Token: 0x060003F0 RID: 1008 RVA: 0x0005C65D File Offset: 0x0005A85D
public int GetInvNum(int rowID)
{
return this.bag[rowID];
}
// Token: 0x060003F1 RID: 1009 RVA: 0x0005C66C File Offset: 0x0005A86C
public float GetAllSockets(int rowID)
{
Vector3 vector = this.sockets[rowID];
Vector3 vector2 = this.sockets[rowID + 1];
return vector.x + vector.y + vector.z + vector2.x + vector2.y + vector2.z;
}
// Token: 0x060003F2 RID: 1010 RVA: 0x0005C6BE File Offset: 0x0005A8BE
public Vector3 GetSocketNum(int rowID)
{
return this.sockets[rowID];
}
// Token: 0x060003F3 RID: 1011 RVA: 0x0005C6CC File Offset: 0x0005A8CC
public Vector4 GetDurabilityNum(int rowID)
{
return this.durability[rowID];
}
// Token: 0x060003F4 RID: 1012 RVA: 0x0005C6DA File Offset: 0x0005A8DA
public void SetInvNum(int rowID, int total)
{
this.bag[rowID] = total;
}
// Token: 0x060003F5 RID: 1013 RVA: 0x0005C6EC File Offset: 0x0005A8EC
public void SetSocketNum(int rowID, int total, int id)
{
Vector3 vector = this.sockets[rowID];
if (id == 0)
{
vector.x = (float)total;
}
if (id == 1)
{
vector.y = (float)total;
}
if (id == 2)
{
vector.z = (float)total;
}
this.sockets[rowID] = vector;
}
// Token: 0x060003F6 RID: 1014 RVA: 0x0005C73C File Offset: 0x0005A93C
public void SwitchItem(int from, int to)
{
int num = this.bag[to];
int num2 = this.bag[to + 2];
Vector3 vector = this.sockets[to];
Vector3 vector2 = this.sockets[to + 1];
int num3 = this.bagPositions[to / 2];
Vector4 vector3 = this.durability[to / 2];
int num4 = this.bag[from];
int num5 = this.bag[from + 1];
Vector3 vector4 = this.sockets[from];
Vector3 vector5 = this.sockets[from + 1];
int num6 = this.bagPositions[from / 2];
Vector4 vector6 = this.durability[from / 2];
this.bag[from] = num;
this.bag[from + 1] = num2;
this.sockets[from] = vector;
this.sockets[from + 1] = vector2;
this.bagPositions[from / 2] = num3;
this.durability[from / 2] = vector3;
this.bag[to] = num4;
this.bag[to + 1] = num5;
this.sockets[to] = vector4;
this.sockets[to + 1] = vector5;
this.bagPositions[to / 2] = num6;
this.durability[to / 2] = vector6;
if (this.party)
{
this.inventoryBag.SwapBagItem(from / 2, to / 2, this, false);
}
if (this.party && this.portrait)
{
this.portrait.skillBag.SetSelectedWpnIndex(this.selectedWpnIndex);
}
}
// Token: 0x060003F7 RID: 1015 RVA: 0x0005C8F8 File Offset: 0x0005AAF8
public void SwitchWeaponsRows()
{
Library.Inventory inventory = this.altInvRow1;
this.altInvRow1 = this.invRow1;
this.invRow1 = inventory;
inventory = this.altInvRow2;
this.altInvRow2 = this.invRow2;
this.invRow2 = inventory;
inventory = this.altInvRow3;
this.altInvRow3 = this.invRow3;
this.invRow3 = inventory;
inventory = this.altInvRow4;
this.altInvRow4 = this.invRow4;
this.invRow4 = inventory;
}
// Token: 0x060003F8 RID: 1016 RVA: 0x0005C970 File Offset: 0x0005AB70
public void UpdateWeaponVisuals()
{
this.CreateEquippedItems(this.bag[2], this.bag[3], this.sockets[2], this.sockets[3], 2, true);
this.CreateEquippedItems(this.bag[4], this.bag[5], this.sockets[4], this.sockets[5], 4, true);
this.CreateEquippedItems(this.bag[6], this.bag[7], this.sockets[6], this.sockets[7], 6, true);
this.CreateEquippedItems(this.bag[0], this.bag[1], this.sockets[0], this.sockets[1], 0, true);
this.stats.UpdateAbilityTriggers();
}
// Token: 0x060003F9 RID: 1017 RVA: 0x0005CA68 File Offset: 0x0005AC68
public void GetAlternativeWeaponRows()
{
if (this.bag[32] >= 1)
{
this.altInvRow1 = Links.x.library.GetInvRowByIndex(this.bag[32]);
}
if (this.bag[34] >= 1)
{
this.altInvRow2 = Links.x.library.GetInvRowByIndex(this.bag[34]);
}
if (this.bag[36] >= 1)
{
this.altInvRow3 = Links.x.library.GetInvRowByIndex(this.bag[34]);
}
if (this.bag[30] >= 1)
{
this.altInvRow4 = Links.x.library.GetInvRowByIndex(this.bag[30]);
}
}
// Token: 0x060003FA RID: 1018 RVA: 0x0005CB40 File Offset: 0x0005AD40
public bool RemoveItem(int itemID, int amt)
{
if (this.npc)
{
int num = this.HasItem(itemID);
if (num > -1)
{
if (this.bag[num + 1] <= 1)
{
this.bag[num] = 0;
this.bag[num + 1] = 0;
this.sockets[num] = Vector3.zero;
this.sockets[num + 1] = Vector3.zero;
this.bagPositions[num / 2] = 0;
this.durability[num / 2] = Vector4.zero;
}
else
{
this.bag[num + 1] = this.bag[num + 1] - 1;
}
return true;
}
return false;
}
else
{
global::Item item = Links.x.inventory.CheckListForItem(itemID, this);
int num2 = Links.x.inventory.GetBagIndex(item, this);
if (item)
{
if (item.stackable)
{
if (amt == 1)
{
if (item.stackSize == 1)
{
item.DestroyItem(true, false);
Links.x.inventory.RemoveBagItem(num2, this);
}
else
{
item.stackSize--;
Links.x.inventory.SetBagAmt(item, item.stackSize, this);
item.CheckStackSize();
}
}
else if (item.stackSize == amt)
{
item.DestroyItem(true, false);
Links.x.inventory.RemoveBagItem(num2, this);
}
else if (item.stackSize > amt)
{
item.stackSize -= amt;
Links.x.inventory.SetBagAmt(item, item.stackSize, this);
item.CheckStackSize();
}
else
{
int num3 = amt - item.stackSize;
item.DestroyItem(true, false);
Links.x.inventory.RemoveBagItem(num2, this);
for (int i = 0; i < 100; i++)
{
if (num3 > 0)
{
item = Links.x.inventory.CheckListForItem(itemID, this);
num2 = Links.x.inventory.GetBagIndex(item, this);
if (item)
{
if (item.stackSize > num3)
{
item.stackSize -= num3;
Links.x.inventory.SetBagAmt(item, item.stackSize, this);
item.CheckStackSize();
num3 = 0;
}
else
{
num3 -= item.stackSize;
item.DestroyItem(true, false);
Links.x.inventory.RemoveBagItem(num2, this);
}
}
}
}
}
}
else
{
item.DestroyItem(true, false);
Links.x.inventory.RemoveBagItem(num2, this);
}
if (this.portrait && num2 < 36)
{
this.portrait.skillBag.SetTrinketGrid(false);
}
return true;
}
num2 = this.HasItem(itemID);
if (num2 < 36 && num2 > -1)
{
if (this.bag[num2 + 1] <= 1)
{
this.bag[num2] = 0;
this.bag[num2 + 1] = 0;
this.sockets[num2] = Vector3.zero;
this.sockets[num2 + 1] = Vector3.zero;
this.bagPositions[num2 / 2] = 0;
this.durability[num2 / 2] = Vector4.zero;
this.CreateEquippedItems(this.bag[num2], this.bag[num2 + 1], this.sockets[num2], this.sockets[num2 + 1], num2, true);
this.UpdateInvLists("", num2 / 2, this.bag[num2], this.bag[num2 + 1], this.durability[num2 / 2], this.sockets[num2], this.sockets[num2 + 1], null);
}
else
{
this.bag[num2 + 1] = this.bag[num2 + 1] - 1;
Links.x.inventory.SetListItems(num2 / 2, null, this.bag[num2], this.bag[num2 + 1], this.sockets[num2], this.sockets[num2 + 1], this.bagPositions[num2 / 2], this.durability[num2 / 2], this);
}
}
if (this.portrait && this.portrait.skillBag)
{
this.portrait.skillBag.SetTrinketGrid(false);
}
return false;
}
}
// Token: 0x060003FB RID: 1019 RVA: 0x0005CFCC File Offset: 0x0005B1CC
public void UpdateInvLists(string type, int invIndex, int newID, int newAmt, Vector4 dur, Vector3 socketA, Vector3 socketB, global::Item newItem)
{
if (invIndex * 2 + 2 >= this.bag.Count || invIndex <= -1)
{
return;
}
this.bag[invIndex * 2] = newID;
this.bag[invIndex * 2 + 1] = newAmt;
this.sockets[invIndex * 2] = socketA;
this.sockets[invIndex * 2 + 1] = socketB;
this.durability[invIndex] = dur;
if (!this.npc)
{
bool flag = false;
if (newItem && newAmt == 0 && newItem.stackable)
{
flag = true;
}
if (flag || newID == 0 || type == "BagRemove")
{
Links.x.inventory.SetListItems(invIndex, null, newID, 0, Vector3.zero, Vector3.zero, 0, Vector4.zero, this);
if (newID == 0 && (invIndex == 0 || invIndex == 2))
{
Links.x.inventory.SetListItems(invIndex, null, newID, 0, Vector3.zero, Vector3.zero, 0, Vector4.zero, this);
Links.x.inventory.CreateFist(invIndex, true, this, null, true);
}
if (newItem)
{
newItem.DestroyItem(false, false);
}
if (invIndex < 18)
{
this.CreateEquippedItems(this.bag[invIndex * 2], this.bag[invIndex * 2 + 1], this.sockets[invIndex * 2], this.sockets[invIndex * 2 + 1], invIndex * 2, true);
return;
}
}
else if (newItem)
{
Links.x.inventory.SetListItems(invIndex, newItem, newID, newAmt, socketA, socketB, 0, newItem.durability, this);
if (newItem)
{
newItem.stackSize = Links.x.inventory.GetBagAmt(invIndex);
newItem.CheckStackSize();
}
}
}
}
// Token: 0x060003FC RID: 1020 RVA: 0x0005D198 File Offset: 0x0005B398
public void AddTorch()
{
if (!this.hasTorch)
{
this.stats.AddBlind(-10f);
}
if (!this.moonlight)
{
Light light = base.gameObject.GetComponent<Light>();
if (!light)
{
light = base.gameObject.AddComponent<Light>();
}
light.color = Links.x.torchColor;
light.type = LightType.Point;
light.range = 10f;
light.enabled = false;
this.moonlight = base.gameObject.GetComponent<Moonlight>();
if (!this.moonlight)
{
this.moonlight = base.gameObject.AddComponent<Moonlight>();
}
if (this.desiredGraph == 1)
{
this.moonlight.interiorLight = true;
}
if (this.party)
{
this.moonlight.characterID = Links.x.GetPartyID(this);
}
else
{
this.moonlight.characterID = -1;
}
this.moonlight.yOffset = 4f;
this.moonlight.dynamicLight = true;
}
else
{
this.moonlight.l.color = Links.x.torchColor;
this.moonlight.SetColor();
}
this.hasTorch = true;
Links.x.fellowship.SetPartyLightColor();
}
// Token: 0x060003FD RID: 1021 RVA: 0x0005D2E0 File Offset: 0x0005B4E0
public void ChangeTorchLight()
{
if (this.hasTorch || this.hasLight || this.hasIncenseTorch)
{
this.moonlight = base.gameObject.GetComponent<Moonlight>();
if (this.indoorID != "" || Links.x.diorama.underground)
{
this.moonlight.interiorLight = true;
}
else
{
this.moonlight.interiorLight = false;
}
this.moonlight.SetupLight(true);
if (this.hasIncenseTorch)
{
this.moonlight = this.incense.gameObject.GetComponent<Moonlight>();
if (this.indoorID != "" || Links.x.diorama.underground)
{
this.moonlight.interiorLight = true;
}
else
{
this.moonlight.interiorLight = false;
}
this.moonlight.SetupLight(true);
}
}
}
// Token: 0x060003FE RID: 1022 RVA: 0x0005D3CC File Offset: 0x0005B5CC
public void RemoveTorch()
{
if (this.hasTorch)
{
this.stats.AddBlind(10f);
}
Light component = base.gameObject.GetComponent<Light>();
if (!this.party)
{
if (component)
{
Object.Destroy(component);
}
this.moonlight = base.gameObject.GetComponent<Moonlight>();
if (this.moonlight)
{
Object.Destroy(this.moonlight);
}
MoonlightRevealer component2 = base.gameObject.GetComponent<MoonlightRevealer>();
if (component2)
{
Object.Destroy(component2);
}
}
else
{
this.moonlight.l.color = Links.x.partyLightColor;
this.moonlight.SetColor();
}
this.hasTorch = false;
if (this.party)
{
Links.x.fellowship.SetPartyLightColor();
}
}
// Token: 0x060003FF RID: 1023 RVA: 0x0005D49C File Offset: 0x0005B69C
public void AddIncenseTorch()
{
if (!this.hasIncenseTorch)
{
this.incense = new GameObject("Incense");
this.incense.transform.SetParent(this.tr);
this.incense.transform.localPosition = Vector3.zero;
this.incense.AddComponent<EnvironmentNodes>().isDynamic = true;
this.hasIncenseTorch = true;
Light light = this.incense.gameObject.GetComponent<Light>();
if (!light)
{
light = this.incense.gameObject.AddComponent<Light>();
}
light.color = Links.x.incenseTorchColor;
light.type = LightType.Point;
light.range = 4f;
light.enabled = false;
Moonlight moonlight = this.incense.gameObject.GetComponent<Moonlight>();
if (!moonlight)
{
moonlight = this.incense.gameObject.AddComponent<Moonlight>();
}
if (this.desiredGraph == 1 || Links.x.diorama.underground)
{
moonlight.interiorLight = true;
}
moonlight.yOffset = 4f;
moonlight.dynamicLight = true;
}
}
// Token: 0x06000400 RID: 1024 RVA: 0x0005D5B7 File Offset: 0x0005B7B7
public void RemoveIncenseTorch()
{
this.hasIncenseTorch = false;
if (this.incense)
{
this.incense.GetComponent<EnvironmentNodes>().Remove();
Object.Destroy(this.incense);
}
}
// Token: 0x06000401 RID: 1025 RVA: 0x0005D5E8 File Offset: 0x0005B7E8
private IEnumerator PlayerLight()
{
yield return new WaitForSecondsRealtime(0.1f);
this.AddPlayerLight();
yield break;
}
// Token: 0x06000402 RID: 1026 RVA: 0x0005D5F8 File Offset: 0x0005B7F8
public void AddPlayerLight()
{
this.hasLight = true;
if (!this.moonlight)
{
Light light = base.gameObject.GetComponent<Light>();
if (!light)
{
light = base.gameObject.AddComponent<Light>();
}
light.color = Links.x.partyLightColor;
light.type = LightType.Point;
light.range = 10f;
light.enabled = false;
this.moonlight = base.gameObject.GetComponent<Moonlight>();
if (!this.moonlight)
{
this.moonlight = base.gameObject.AddComponent<Moonlight>();
}
if (this.desiredGraph == 1 || Links.x.diorama.underground)
{
this.moonlight.interiorLight = true;
}
if (this.party)
{
this.moonlight.characterID = Links.x.GetPartyID(this);
}
else
{
this.moonlight.characterID = -1;
}
this.moonlight.yOffset = 4f;
this.moonlight.dynamicLight = true;
}
if (this.hasTorch)
{
this.moonlight.l.color = Links.x.torchColor;
this.moonlight.SetColor();
}
else
{
this.moonlight.l.color = Links.x.partyLightColor;
this.moonlight.SetColor();
}
Links.x.fellowship.SetPartyLightColor();
}
// Token: 0x06000403 RID: 1027 RVA: 0x0005D768 File Offset: 0x0005B968
public void RemovePlayerLight()
{
this.hasLight = false;
Light component = base.gameObject.GetComponent<Light>();
if (component)
{
Object.Destroy(component);
}
this.moonlight = base.gameObject.GetComponent<Moonlight>();
if (this.moonlight)
{
Object.Destroy(this.moonlight);
}
MoonlightRevealer component2 = base.gameObject.GetComponent<MoonlightRevealer>();
if (component2)
{
Object.Destroy(component2);
}
base.StartCoroutine(this.PlayerLight());
}
// Token: 0x06000404 RID: 1028 RVA: 0x0005D7E8 File Offset: 0x0005B9E8
public int GetGlam()
{
return (int)(0f + Links.x.library.GetInvRowByIndex(this.GetInvNum(16))._AC + Links.x.library.GetInvRowByIndex(this.GetInvNum(20))._AC + Links.x.library.GetInvRowByIndex(this.GetInvNum(22))._AC + Links.x.library.GetInvRowByIndex(this.GetInvNum(24))._AC);
}
// Token: 0x06000405 RID: 1029 RVA: 0x0005D874 File Offset: 0x0005BA74
public int GetMagicAC()
{
return 0 + (int)Links.x.library.GetInvRowByIndex(this.GetInvNum(2))._MagicAC + (int)Links.x.library.GetInvRowByIndex(this.GetInvNum(14))._MagicAC + (int)Links.x.library.GetInvRowByIndex(this.GetInvNum(16))._MagicAC + (int)Links.x.library.GetInvRowByIndex(this.GetInvNum(18))._MagicAC + (int)Links.x.library.GetInvRowByIndex(this.GetInvNum(20))._MagicAC + (int)Links.x.library.GetInvRowByIndex(this.GetInvNum(22))._MagicAC + (int)Links.x.library.GetInvRowByIndex(this.GetInvNum(24))._MagicAC;
}
// Token: 0x06000406 RID: 1030 RVA: 0x0005D954 File Offset: 0x0005BB54
public int GetMagicItems()
{
return 0 + (int)Links.x.library.GetInvRowByIndex(this.GetInvNum(2))._MagicBonus + (int)Links.x.library.GetInvRowByIndex(this.GetInvNum(14))._MagicBonus + (int)Links.x.library.GetInvRowByIndex(this.GetInvNum(16))._MagicBonus + (int)Links.x.library.GetInvRowByIndex(this.GetInvNum(18))._MagicBonus + (int)Links.x.library.GetInvRowByIndex(this.GetInvNum(20))._MagicBonus + (int)Links.x.library.GetInvRowByIndex(this.GetInvNum(22))._MagicBonus + (int)Links.x.library.GetInvRowByIndex(this.GetInvNum(24))._MagicBonus;
}
// Token: 0x06000407 RID: 1031 RVA: 0x0005DA34 File Offset: 0x0005BC34
public int ItemAmount(int ID)
{
int num = 0;
for (int i = 0; i < this.bag.Count; i++)
{
if (this.bag[i] == ID && i % 2 == 0)
{
num += this.bag[i + 1];
}
}
return num;
}
// Token: 0x06000408 RID: 1032 RVA: 0x0005DA80 File Offset: 0x0005BC80
public int HasItem(int ID)
{
for (int i = 0; i < this.bag.Count; i++)
{
if (this.bag[i] == ID && i % 2 == 0)
{
return i;
}
}
return -1;
}
// Token: 0x06000409 RID: 1033 RVA: 0x0005DABC File Offset: 0x0005BCBC
public int HasBook(int ID)
{
for (int i = 0; i < this.bag.Count; i++)
{
if (this.bag[i] == ID && i % 2 == 0 && this.sockets[i].x == (float)this.stats.partyID)
{
return i;
}
}
return -1;
}
// Token: 0x0600040A RID: 1034 RVA: 0x0005DB18 File Offset: 0x0005BD18
public int HasItemInBag(int ID)
{
for (int i = 0; i < this.bag.Count; i++)
{
if (this.bag[i] == ID && i % 2 == 0)
{
return i;
}
}
return -1;
}
// Token: 0x0600040B RID: 1035 RVA: 0x0005DB54 File Offset: 0x0005BD54
public int HasItemInBagOnly(int ID)
{
for (int i = 18; i < this.bag.Count; i++)
{
if (this.bag[i] == ID && i % 2 == 0)
{
return i;
}
}
return -1;
}
// Token: 0x0600040C RID: 1036 RVA: 0x0005DB90 File Offset: 0x0005BD90
public int HowManyItemsInBag(int ID, int checkFrom)
{
int num = 0;
for (int i = checkFrom; i < this.bag.Count; i++)
{
if (this.bag[i] == ID && i % 2 == 0)
{
num += this.bag[i + 1];
if (this.bag[i + 1] == 0)
{
num++;
}
}
}
return num;
}
// Token: 0x0600040D RID: 1037 RVA: 0x0005DBF0 File Offset: 0x0005BDF0
public int HasHealthItem()
{
if (this.npc)
{
for (int i = 0; i < this.bag.Count; i++)
{
if (i % 2 == 0 && Links.x.library.GetInvRowByIndex(this.bag[i])._Effect.Contains("Health"))
{
return i;
}
}
}
else
{
if (this.bag[14] > 1)
{
Library.Inventory inventory = Links.x.library.GetInvRowByIndex(this.bag[14]);
if (inventory._Effect.Contains("Health") && inventory._Tag == "Consumable")
{
return 14;
}
}
if (this.bag[26] > 1)
{
Library.Inventory inventory = Links.x.library.GetInvRowByIndex(this.bag[26]);
if (inventory._Effect.Contains("Health") && inventory._Tag == "Consumable")
{
return 26;
}
}
if (this.bag[28] > 1)
{
Library.Inventory inventory = Links.x.library.GetInvRowByIndex(this.bag[28]);
if (inventory._Effect.Contains("Health") && inventory._Tag == "Consumable")
{
return 28;
}
}
}
return -1;
}
// Token: 0x0600040E RID: 1038 RVA: 0x0005DD54 File Offset: 0x0005BF54
private bool IsBuffItem(string n)
{
if (this.npc)
{
if (n.Contains("Spirit"))
{
return true;
}
}
else if (n.Contains("Spirit") && this.stats.HasSpellbook() && this.stats.SpiritCurrent() < 30)
{
float num = (float)this.stats.HealthCurrent() / (float)this.stats.HealthMax();
if (!n.Contains("Health") || (n.Contains("Health") && num < (float)this.stats.useItemsAI))
{
return true;
}
}
return false;
}
// Token: 0x0600040F RID: 1039 RVA: 0x0005DDE8 File Offset: 0x0005BFE8
public int HasBuffItem()
{
if (this.npc)
{
bool flag = false;
for (int i = 0; i < this.bag.Count; i++)
{
if (i % 2 == 0)
{
Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(this.bag[i]);
if (invRowByIndex._Tag == "Consumable" && this.IsBuffItem(invRowByIndex._Effect))
{
return -1;
}
}
}
this.stats.hasBuffItem = flag;
}
else
{
if (this.bag[14] > 1)
{
Library.Inventory inventory = Links.x.library.GetInvRowByIndex(this.bag[14]);
if (inventory._Tag == "Consumable" && this.IsBuffItem(inventory._Effect))
{
return 14;
}
}
if (this.bag[26] > 1)
{
Library.Inventory inventory = Links.x.library.GetInvRowByIndex(this.bag[26]);
if (inventory._Tag == "Consumable" && this.IsBuffItem(inventory._Effect))
{
return 26;
}
}
if (this.bag[28] > 1)
{
Library.Inventory inventory = Links.x.library.GetInvRowByIndex(this.bag[28]);
if (inventory._Tag == "Consumable" && this.IsBuffItem(inventory._Effect))
{
return 28;
}
}
}
return -1;
}
// Token: 0x06000410 RID: 1040 RVA: 0x0005DF60 File Offset: 0x0005C160
public int BuffItemID(string type)
{
for (int i = 0; i < this.bag.Count; i++)
{
if (i % 2 == 0 && Links.x.library.GetInvRowByIndex(this.bag[i])._Effect.Contains(type))
{
return this.bag[i];
}
}
return -1;
}
// Token: 0x06000411 RID: 1041 RVA: 0x0005DFC0 File Offset: 0x0005C1C0
public int GiveItem(int ID, int stackSize, Vector3 socketA, Vector3 socketB, Vector4 time, bool fromSomeone)
{
Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(ID);
int num = this.HasItem(ID);
if (num > -1 && invRowByIndex._Stackable && this.bag[num + 2] + stackSize < invRowByIndex._MaxStackSize)
{
List<int> list = this.bag;
int num2 = num + 2;
list[num2] += stackSize;
return -1;
}
int num3 = this.FreeBagID();
if (this.CheckControls() && !this.stats.animal && fromSomeone)
{
this.StartQuip("Thanks");
}
if (num3 == -1)
{
this.bag.Add(0);
this.bag.Add(0);
this.sockets.Add(Vector3.zero);
this.sockets.Add(Vector3.zero);
this.durability.Add(Vector4.zero);
num3 = this.FreeBagID();
}
if (invRowByIndex._Tag == "Weapon" && this.bag[0] <= 1)
{
int num4 = this.bag[0];
int num5 = this.bag[1];
Vector3 vector = this.sockets[0];
Vector3 vector2 = this.sockets[1];
this.bag[0] = ID;
this.bag[1] = stackSize;
this.sockets[0] = socketA;
this.sockets[1] = socketB;
if (num4 > 1)
{
this.bag[num3] = num4;
this.bag[num3 + 1] = num5;
this.sockets[num3] = vector;
this.sockets[num3 + 1] = vector2;
}
num3 = 0;
if (!this.stats.animal && fromSomeone)
{
this.StartQuip("I could use this");
}
}
else if (invRowByIndex._Tag == "Shield" && this.bag[1] <= 1)
{
int num6 = this.bag[2];
int num7 = this.bag[3];
Vector3 vector3 = this.sockets[2];
Vector3 vector4 = this.sockets[3];
this.bag[2] = ID;
this.bag[3] = stackSize;
this.sockets[2] = socketA;
this.sockets[3] = socketB;
if (num6 > 1)
{
this.bag[num3] = num6;
this.bag[num3 + 1] = num7;
this.sockets[num3] = vector3;
this.sockets[num3 + 1] = vector4;
}
num3 = 2;
if (!this.stats.animal && fromSomeone)
{
this.StartQuip("I could use this");
}
}
else if (invRowByIndex._Tag.Contains("Armor"))
{
bool flag = true;
if (this.bag[invRowByIndex._EquipSlotID * 2] > 1)
{
int num8 = this.bag[invRowByIndex._EquipSlotID * 2];
int num9 = (int)Links.x.library.GetInvRowByIndex(num8)._AC;
Library.Inventory invRowByIndex2 = Links.x.library.GetInvRowByIndex(ID);
if (num9 > (int)invRowByIndex2._AC)
{
flag = false;
}
if (flag)
{
this.bag[num3] = num8;
this.bag[num3 + 1] = this.bag[invRowByIndex._EquipSlotID * 2 + 1];
this.sockets[num3] = this.sockets[invRowByIndex._EquipSlotID * 2];
this.sockets[num3 + 1] = this.sockets[invRowByIndex._EquipSlotID * 2 + 1];
if (!this.stats.animal)
{
this.StartQuip("Looks like an upgrade");
}
}
}
else if (!this.stats.animal && fromSomeone)
{
this.StartQuip("I could use this");
}
if (flag)
{
int num10 = invRowByIndex._EquipSlotID * 2;
int num11 = this.bag[num10];
int num12 = this.bag[num10 + 1];
Vector3 vector5 = this.sockets[num10];
Vector3 vector6 = this.sockets[num10 + 1];
this.bag[num10] = ID;
this.bag[num10 + 1] = stackSize;
this.sockets[num10] = socketA;
this.sockets[num10 + 1] = socketB;
this.bag[num3] = num11;
this.bag[num3 + 1] = num12;
this.sockets[num3] = vector5;
this.sockets[num3 + 1] = vector6;
num3 = num10;
}
}
else
{
this.bag[num3] = ID;
this.bag[num3 + 1] = stackSize;
this.sockets[num3] = socketA;
this.sockets[num3 + 1] = socketB;
this.durability[num3 / 2] = time;
}
return num3;
}
// Token: 0x06000412 RID: 1042 RVA: 0x0005E4F0 File Offset: 0x0005C6F0
public void InitiateDialogue()
{
Links.x.dialogue.npc1 = this;
if (Links.x.hasMain)
{
Links.x.dialogue.party = Links.x.main;
}
else
{
Links.x.dialogue.party = Links.x.GetNearestParty(this.tr.position);
}
if (this.stats.initiateDialogue != 1 && this.stats.initiateDialogue != 11)
{
this.stats.canTalk = false;
}
Links.x.gameplay.StartDialogue(this, Links.x.dialogue.party, null, null, this.stats.dialogueFile);
}
// Token: 0x06000413 RID: 1043 RVA: 0x0005E5B0 File Offset: 0x0005C7B0
public void SetupBasic(bool isParty, int num, string workingName, int pathNodeID, bool resurrecting, int partyID)
{
this.tr = base.transform;
this.tr.gameObject.layer = 6;
if (this.ghost || resurrecting)
{
this.tr.gameObject.layer = 1;
}
this.visible = 1;
this.indoorID = "";
this.invRow1 = Links.x.library.GetInvRowByIndex(1);
this.altInvRow1 = Links.x.library.GetInvRowByIndex(1);
this.vectorZero = Vector3.zero;
this.headHeight = new Vector3(0f, 3f, 0f);
this.torsoHeight = new Vector3(0f, 2f, 0f);
this.upVector = Vector3.up;
this.yAdd2 = new Vector3(0f, 1.5f, 0f);
this.yAdd1 = new Vector3(0f, 0.5f, 0f);
this.yAdd3 = new Vector3(0f, 2.5f, 0f);
if (!this.audioSource)
{
this.audioSource = base.gameObject.AddComponent<AudioSource>();
}
this.audioSource.spatialBlend = 1f;
this.audioSource.loop = false;
this.audioSource.playOnAwake = false;
this.audioSource.maxDistance = 40f;
this.ghost = resurrecting;
if (workingName.Contains("Ghost") && !workingName.Contains("Radamant"))
{
this.ghost = true;
}
if (this.ghost)
{
this.hostility = 2;
}
if (!isParty)
{
this.npc = true;
}
else
{
this.npc = false;
}
this.CreateObjects();
if (!this.seeker)
{
this.seeker = base.gameObject.AddComponent<Seeker>();
this.seeker.pathCallback = new OnPathDelegate(this.PathFinished);
if (isParty && !this.summoned && !this.ghost)
{
this.raycastModifier = base.gameObject.AddComponent<RaycastModifier>();
this.raycastModifier.enabled = false;
}
this.simpleSmoothModifier = base.gameObject.AddComponent<SimpleSmoothModifier>();
}
this.rot = this.tr.rotation;
this.smoothRot = this.tr.rotation;
if (isParty && !this.summoned)
{
pathNodeID += 3;
}
this.nodeStationaryID = pathNodeID;
this.nodeMovingID = pathNodeID + 300;
this.followingType = "";
if (!this.stats)
{
this.stats = base.gameObject.AddComponent<Stats>();
}
this.party = false;
if (isParty && !this.summoned)
{
this.party = true;
}
this.stats.SetupStats(this, workingName);
this.animationPrefix = this.stats.characterRow._AnimationPrefix;
if (this.stats.race == "Yeti")
{
this.animationPrefix = "_VollingYeti";
}
if (this.ghost)
{
this.hostility = 2;
this.SetResurrected();
if (this.creatures)
{
this.creatures.SetTemperament(2);
}
}
this.SetupBody();
this.nodeConstraint = new NNConstraint();
this.nodeConstraint.walkable = true;
this.nodeConstraint.constrainTags = true;
this.nodeConstraint.checkCircleID = 0;
this.nodeConstraint.passID = this.nodeStationaryID;
this.nodeConstraint.passID2 = this.nodeMovingID;
this.nodeConstraint.checkConnections = this.ConnectionNumber();
this.nodeConstraint.constrainToArea = -1;
this.desiredGraph = -1;
this.walkConstraint = new NNConstraint();
this.quipIndex = Links.x.quips.GetQuipIndex(this.stats.characterRow._QuipID);
this.hasCinematicQuip = Links.x.quips.HasIdleQuip(this.quipIndex);
if (!this.npc)
{
base.gameObject.name = this.stats.displayName;
}
this.UpdateSizeRadius(this.radius);
this.SceneSetup();
this.Reincarnate();
this.InvFromDB();
if (isParty)
{
this.hostility = -1;
if (num == 0 && !this.summoned && !Links.x.gaia.sceneLoaded)
{
this.SetAsLeader();
}
if (!this.summoned)
{
this.partyColorID = Links.x.GetOpenPartyColor();
Links.x.fellowship.SetPortraits(true, 0);
if (!this.cc)
{
this.AddCC();
}
}
else
{
this.partyColorID = 6;
}
if (this.party)
{
this.fowRevealer = base.gameObject.AddComponent<FOWRevealer>();
this.fowRevealer.main = true;
this.fowRevealer.enabled = false;
this.fowRevealer.character = this;
this.fowRevealerInterior = base.gameObject.AddComponent<FOWRevealerInterior>();
this.fowRevealerInterior.main = true;
this.fowRevealerInterior.enabled = false;
this.fowRevealerInterior.character = this;
}
this.GetPartyPooledObjects();
if (this.party)
{
this.AddPlayerLight();
}
}
else
{
if (this.stats.characterRow._CanJoinParty)
{
this.ClearQuips();
}
if (!this.npc && this.body.model.Contains("heep"))
{
this.GetPartyPooledObjects();
}
}
if (isParty)
{
Links.x.diorama.sceneName != "Statues";
}
if (Records.x.editor)
{
this.sphere.name = ((this != null) ? this.ToString() : null) + " Sphere";
}
this.terrain = "Grass";
this.setupComplete = true;
if (this.npc || !this.party)
{
if (!this.creatures.ambush)
{
this.FirstPosition(null);
}
this.creatures.canJoinParty = this.stats.characterRow._CanJoinParty;
this.GetPatrolHoldTime(true);
}
if (this.party)
{
this.stats.partyID = partyID;
this.stats.CharacterLoad();
}
if (isParty)
{
if (this.bracket)
{
this.SetBracketPosition();
}
bool flag = this.summoned;
}
this.CircleAnimation("");
base.enabled = true;
if (this.ghost)
{
this.stats.soundID = 2;
}
if (this.summoned && !this.npc)
{
this.stats.SetSummonAllegiance();
}
if (this.npc && this.creatures && this.creatures.movesOnWater && !this.stats.flying && !this.waterCollider)
{
this.waterCollider = new GameObject("Water Collider " + ((this != null) ? this.ToString() : null));
CapsuleCollider capsuleCollider = this.waterCollider.AddComponent<CapsuleCollider>();
capsuleCollider.radius = 1.5f;
capsuleCollider.height = 1f;
this.waterColliderRigidbody = this.waterCollider.AddComponent<Rigidbody>();
this.waterColliderRigidbody.useGravity = false;
this.waterColliderRigidbody.isKinematic = true;
this.waterColliderRigidbody.mass = 0.1f;
this.waterColliderRigidbody.constraints = RigidbodyConstraints.FreezeAll;
capsuleCollider.material = Links.x.zeroFriction;
this.waterCollider.layer = 0;
this.waterCollisions = this.waterCollider.AddComponent<WaterCollisions>();
this.waterCollisions.character = this;
}
if (!this.party)
{
if (this.goreObj)
{
this.SetMeshState(false);
}
}
else if (!this.grassInteraction)
{
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(89);
if (pooledGameObject)
{
this.grassInteraction = pooledGameObject.transform;
pooledGameObject.SetActive(true);
}
}
this.FullAttackTime();
}
// Token: 0x06000414 RID: 1044 RVA: 0x0005EDAD File Offset: 0x0005CFAD
public Vector3 HeadHeight()
{
return this.headHeight;
}
// Token: 0x06000415 RID: 1045 RVA: 0x0005EDB8 File Offset: 0x0005CFB8
private void AddCC()
{
this.cc = base.gameObject.GetComponent<CharacterController>();
if (!this.cc)
{
this.cc = base.gameObject.AddComponent<CharacterController>();
this.cc.radius = 0.7f;
this.cc.center = new Vector3(0f, 2f, 0f);
this.cc.height = 3.5f;
this.cc.slopeLimit = 60f;
this.cc.stepOffset = 0.8f;
this.cc.minMoveDistance = 0f;
this.cc.skinWidth = 0.3f;
this.cc.enabled = false;
this.cc.transform.position = this.tr.position;
this.cc.transform.rotation = this.tr.rotation;
this.cc.enabled = true;
this.cc.enabled = false;
}
this.playerBorders = base.gameObject.GetComponent<PlayerBorders>();
if (!this.playerBorders)
{
this.playerBorders = base.gameObject.AddComponent<PlayerBorders>();
this.playerBorders.character = this;
this.playerBorders.enabled = false;
}
}
// Token: 0x06000416 RID: 1046 RVA: 0x0005EF17 File Offset: 0x0005D117
public string GetBoundCharacter()
{
if (this.dockFriend)
{
return this.dockFriend.boundCharacterName;
}
return "";
}
// Token: 0x06000417 RID: 1047 RVA: 0x0005EF38 File Offset: 0x0005D138
public void GetFriendDock(Character boundToCharacter)
{
if (!this.dockFriend && boundToCharacter)
{
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(121);
this.dockFriend = pooledGameObject.GetComponent<DockFriend>();
this.dockFriend.Setup(this, boundToCharacter);
}
}
// Token: 0x06000418 RID: 1048 RVA: 0x0005EF88 File Offset: 0x0005D188
public void Charmed(Character boundToCharacter)
{
this.charmed = true;
if (!this.heart)
{
this.heart = Links.x.cellar.GetPooledGameObject(66);
this.heart.SetActive(true);
this.SetHeartPosition();
}
this.SetMeshState(true);
this.body.SetMeshState(true, false);
this.GetFriendDock(boundToCharacter);
}
// Token: 0x06000419 RID: 1049 RVA: 0x0005EFF0 File Offset: 0x0005D1F0
public void BoroBoat()
{
if (!this.boroBoat)
{
this.boroBoat = Links.x.cellar.GetPooledGameObject(136);
this.boroBoat.SetActive(true);
this.boroBoat.transform.parent = this.body.GetHips();
this.boroBoat.transform.localPosition = new Vector3(0f, -0.1f, 0f);
this.boroBoat.transform.localRotation = Quaternion.identity;
if (this.body)
{
this.body.GatherRenderers(false);
}
}
}
// Token: 0x0600041A RID: 1050 RVA: 0x0005F0A0 File Offset: 0x0005D2A0
public void ToggleBoat(bool state)
{
if (this.sailing)
{
state = false;
}
if (this.boroBoat)
{
this.boroBoat.SetActive(state);
}
}
// Token: 0x0600041B RID: 1051 RVA: 0x0005F0C6 File Offset: 0x0005D2C6
public void SetBracketPosition()
{
this.SetSelectedPosition();
}
// Token: 0x0600041C RID: 1052 RVA: 0x0005F0D0 File Offset: 0x0005D2D0
private void CreateObjects()
{
if (!this.sphere)
{
this.sphere = Links.x.cellar.GetPooledGameObject(2);
}
if (!this.moveFollow)
{
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(2);
if (Records.x.editor)
{
pooledGameObject.name = ((this != null) ? this.ToString() : null) + " Move Follow";
}
this.moveFollow = pooledGameObject.transform;
}
if (!this.lookAtTurnTarget)
{
GameObject pooledGameObject2 = Links.x.cellar.GetPooledGameObject(2);
if (Records.x.editor)
{
pooledGameObject2.name = ((this != null) ? this.ToString() : null) + " Look At Turn Target";
}
this.lookAtTurnTarget = pooledGameObject2.transform;
}
}
// Token: 0x0600041D RID: 1053 RVA: 0x0005F1A8 File Offset: 0x0005D3A8
private void SetResurrected()
{
for (int i = 0; i < this.bag.Count; i++)
{
if (i == 0)
{
this.bag[i] = 1;
}
else
{
this.bag[i] = 0;
}
}
if (this.stats.GetSkill(13) < 100f)
{
this.stats.SetSkill(13, 120);
}
this.dayNightVanishing = false;
this.vanished = false;
this.alwaysOn = false;
this.stats.SetResurrectionFactions();
}
// Token: 0x0600041E RID: 1054 RVA: 0x0005F230 File Offset: 0x0005D430
public void CreateStamina()
{
GameObject gameObject = new GameObject("Stamina");
gameObject.transform.SetParent(Links.x.cellar.tr);
this.stamina = gameObject.AddComponent<Stamina>();
this.stamina.Setup(this);
if (this.bag[18] > 1)
{
Library.Inventory invRow = Links.x.library.GetInvRow(this.bag[18]);
this.stamina.SetupArmor(this, Mathf.RoundToInt((float)invRow._DurabilityMax / 2f), (int)this.durability[9].x);
}
}
// Token: 0x0600041F RID: 1055 RVA: 0x0005F2D8 File Offset: 0x0005D4D8
public void CreateStatusRing(Effects effect, string spriteName, int arrows)
{
if (!this.statusRing)
{
GameObject gameObject = new GameObject("Status Ring");
gameObject.transform.SetParent(Links.x.cellar.tr);
this.statusRing = gameObject.AddComponent<StatusRing>();
this.statusRing.character = this;
if (this.radius == 3f)
{
this.statusRing.radius = 1f;
this.statusRing.speedBoost = 2f;
}
if (this.radius == 4f)
{
this.statusRing.radius = 0.75f;
this.statusRing.speedBoost = 1.5f;
}
if (this.radius == 8f)
{
this.statusRing.radius = 0.5f;
this.statusRing.speedBoost = 1f;
}
}
this.statusRing.AddEffect(spriteName, effect, true, arrows);
}
// Token: 0x06000420 RID: 1056 RVA: 0x0005F3C8 File Offset: 0x0005D5C8
public void HealStatusRing(Effects effect, string spriteName)
{
if (this.statusRing)
{
this.statusRing.RemoveEffect(spriteName, effect);
}
}
// Token: 0x06000421 RID: 1057 RVA: 0x0005F3E4 File Offset: 0x0005D5E4
public void UpdateModel(string n)
{
if (this.bodyObj)
{
Links.x.archives.RecycleBody(this.bodyObj, this.bodyObj.name, base.gameObject.name);
}
this.bodyObj = null;
this.stats.model = n;
this.SetupBody();
this.AddEquippedItems();
this.SetMeshState(true);
}
// Token: 0x06000422 RID: 1058 RVA: 0x0005F450 File Offset: 0x0005D650
public void SetupBody()
{
bool flag = false;
if (this.bodyObj)
{
if (this.boroBoat)
{
flag = true;
Links.x.cellar.ReturnPooledGameObject(136, this.boroBoat);
this.boroBoat = null;
}
Links.x.archives.RecycleBody(this.bodyObj, this.bodyObj.name, base.gameObject.name);
}
this.bodyObj = null;
string text = this.stats.model;
if (this.ghost && !text.Contains("host"))
{
text = "Ghost_A";
this.stats.model = text;
}
this.bodyObj = Links.x.archives.InstantiateBody(text, this.tr);
if (this.hostility == 2)
{
bool flag2 = this.ghost;
}
if (!this.bodyObj)
{
Debug.Log(string.Concat(new string[]
{
(this != null) ? this.ToString() : null,
" missing model ",
this.stats.model,
" ",
this.stats.xmlName
}));
}
this.bodyObj.transform.localPosition = this.vectorZero;
this.body = this.bodyObj.GetComponent<Body>();
this.body.Reset();
this.body.model = text;
this.body.character = this;
this.body.SetupHead(this.stats.headModel);
this.body.GatherRenderers(true);
bool flag3 = true;
if (this.party)
{
flag3 = false;
}
this.body.SetupTextures(this.stats.race, this.stats.sex, this.stats.characterRow, this.stats.skinTexture, this.stats.hairTexture, flag3);
if (flag)
{
this.BoroBoat();
}
this.animator = this.body.anim;
this.bodyObj.name = text;
this.bodyObj.SetActive(true);
this.neck = this.body.GetNeck();
this.body.tr.localRotation = this.savedRot;
this.rotateToSlope = this.stats.characterRow._RotateToSlope;
if (this.bracket)
{
this.SetBracketPosition();
}
CapsuleCollider component = this.bodyObj.GetComponent<CapsuleCollider>();
if (component && !this.stats.animal)
{
component.enabled = false;
}
else if (component)
{
component.enabled = false;
this.body.gameObject.layer = 31;
if (!this.body.gameObject.GetComponent<SelectionCircle>())
{
this.body.gameObject.AddComponent<SelectionCircle>().character = this;
}
}
this.thisCollider = base.gameObject.GetComponent<CapsuleCollider>();
if (!this.thisCollider)
{
this.thisCollider = base.gameObject.AddComponent<CapsuleCollider>();
}
if (this.radius <= 3f)
{
this.thisCollider.radius = 0.75f;
}
if (this.ghost)
{
this.thisCollider.radius = 3f;
}
this.thisCollider.height = 3.5f;
if (component)
{
this.thisCollider.center = component.center;
}
else
{
this.thisCollider.center = new Vector3(0f, 1.75f, 0f);
}
if (!this.rb)
{
this.rb = base.gameObject.AddComponent<Rigidbody>();
}
this.rb.isKinematic = true;
this.thisCollider.enabled = true;
if (this.ghost)
{
this.thisCollider.isTrigger = true;
}
if (this.party)
{
this.StopMove();
}
if (this.stats.race == "Yeti")
{
this.animationPrefix = "_VollingYeti";
}
string text2 = this.animationPrefix + "_Unarmed";
AnimatorOverrideController animatorOverrideController = Links.x.archives.GetOverrideController(text2);
if (animatorOverrideController == null && !this.stats.animal)
{
animatorOverrideController = Links.x.archives.GetOverrideController("_Volling_Unarmed");
}
this.animator.runtimeAnimatorController = animatorOverrideController;
if (this.body)
{
this.body.anim.Rebind();
this.body.anim.Update(0f);
this.body.transform.localPosition = Vector3.zero;
}
this.needsRebind = false;
if (this.animator)
{
this.animator.SetBool("Party", this.party);
}
if (this.ghost)
{
this.body.SetGhost();
}
if (this.party && !Links.x.gameplay.spellTargetingParty)
{
this.body.SeeThroughColliders(false);
}
if (this.stats.hasCustomIdle && !this.sailing)
{
this.animator.SetFloat("Idle Variation", 1f);
}
}
// Token: 0x06000423 RID: 1059 RVA: 0x0005F995 File Offset: 0x0005DB95
public void SetupPartyAfterLoadedVariables()
{
this.portrait.SetHealthColor();
this.SetUpInv();
}
// Token: 0x06000424 RID: 1060 RVA: 0x0005F9A8 File Offset: 0x0005DBA8
public void SetupPartyAfterLoadedVariables2()
{
this.stats.UpdateAbilityTriggers();
if (this.portrait)
{
this.portrait.skillBag.UpdateWindowStates();
}
if (this.bag[18] > 0)
{
if (Links.x.library.GetInvRowByIndex(this.bag[18])._ArmorID != -1)
{
this.CreateEquippedItems(this.bag[18], this.bag[19], new Vector3(-1f, -1f, -1f), new Vector3(-1f, -1f, -1f), 18, true);
}
else
{
this.AddEquippedItems();
}
}
else
{
this.AddEquippedItems();
}
this.stats.UpdateAbilityTriggers();
if (this.portrait)
{
this.portrait.skillBag.UpdateWindowStates();
}
this.portrait.SetFatigue();
this.portrait.SetHealthColor();
this.stats.FormationTactics();
this.animationPrefix = this.stats.characterRow._AnimationPrefix;
if (this.stats.race == "Yeti")
{
this.animationPrefix = "_VollingYeti";
}
Links.x.gaia.settingUpParty = false;
}
// Token: 0x06000425 RID: 1061 RVA: 0x0005FB00 File Offset: 0x0005DD00
public void GetPartyPooledObjects()
{
this.waypoint = Links.x.cellar.GetPooledGameObject(0);
this.waypointAnimator = this.waypoint.transform.GetChild(0).gameObject.GetComponent<Animator>();
this.waypoint.SetActive(true);
this.waypoint.transform.parent = Links.x.gameplay.transform;
this.waypointRenderer = this.waypoint.transform.GetChild(0).gameObject.transform.GetChild(0).gameObject.GetComponent<MeshRenderer>();
this.waypointRenderer.sharedMaterial = Links.x.GetPartyMaterial(this.partyColorID, 4);
if (this.party)
{
this.mapIcon = this.CreateSphere(this.tr.position, 2f);
if (Records.x.editor)
{
this.mapIcon.name = this.stats.GetName() + "'s Map Icon";
}
this.mapIcon.SetActive(true);
this.mapIcon.layer = 15;
this.mapIcon.transform.parent = Links.x.cellar.tr;
this.mapIcon.GetComponent<MeshRenderer>().sharedMaterial = Links.x.mapIconMaterial;
}
}
// Token: 0x06000426 RID: 1062 RVA: 0x0005FC64 File Offset: 0x0005DE64
public void ReturnPartyPooledObjects()
{
if (this.mapIcon)
{
Object.Destroy(this.mapIcon);
}
this.mapIcon = null;
if (this.waypoint)
{
this.waypoint.gameObject.SetActive(false);
this.waypoint = null;
}
if (this.portrait)
{
this.portrait.Remove();
this.characterSheetPortrait.Remove();
}
this.portrait = null;
this.characterSheetPortrait = null;
if (this.revivalGem)
{
Links.x.cellar.ReturnPooledGameObject(123, this.revivalGem.gameObject);
this.revivalGem = null;
}
if (this.statusRing)
{
this.statusRing.End();
this.statusRing = null;
}
if (this.stamina)
{
this.stamina.End();
this.stamina = null;
}
if (this.stats.boro && this.boroBoat)
{
Links.x.cellar.ReturnPooledGameObject(136, this.boroBoat);
this.boroBoat = null;
}
}
// Token: 0x06000427 RID: 1063 RVA: 0x0005FD90 File Offset: 0x0005DF90
public void AddEquippedItems()
{
for (int i = 0; i < 19; i++)
{
if (this.bag[i * 2] > 0 || i == 0 || i == 1)
{
if ((i == 0 || i == 1) && this.bag[i * 2] == 0)
{
this.bag[i * 2] = 1;
}
if (i != 9)
{
this.CreateEquippedItems(this.bag[i * 2], this.bag[i * 2 + 1], this.sockets[i * 2], this.sockets[i * 2 + 1], i * 2, true);
}
}
}
}
// Token: 0x06000428 RID: 1064 RVA: 0x0005FE3C File Offset: 0x0005E03C
public void EquipNPC(int i, int moveTo)
{
if (i != moveTo)
{
int num = this.bag[i * 2];
int num2 = this.bag[i * 2 + 1];
Vector3 vector = this.sockets[i * 2];
Vector3 vector2 = this.sockets[i * 2 + 1];
Vector4 vector3 = this.durability[i];
this.bag[i * 2] = this.bag[moveTo * 2];
this.bag[i * 2 + 1] = this.bag[moveTo * 2 + 1];
this.sockets[i * 2] = this.sockets[moveTo * 2];
this.sockets[i * 2 + 1] = this.sockets[moveTo * 2 + 1];
this.durability[i] = this.durability[moveTo];
this.bag[moveTo * 2] = num;
this.bag[moveTo * 2 + 1] = num2;
this.sockets[moveTo * 2] = vector;
this.sockets[moveTo * 2 + 1] = vector2;
this.durability[moveTo] = vector3;
}
this.CreateEquippedItems(this.bag[moveTo * 2], this.bag[moveTo * 2 + 1], this.sockets[moveTo * 2], this.sockets[moveTo * 2 + 1], moveTo * 2, true);
}
// Token: 0x06000429 RID: 1065 RVA: 0x0005FFC4 File Offset: 0x0005E1C4
public void UnequipNPC(int i)
{
this.CreateEquippedItems(this.bag[i * 2], this.bag[i * 2 + 1], this.sockets[i * 2], this.sockets[i * 2 + 1], i * 2, true);
}
// Token: 0x0600042A RID: 1066 RVA: 0x00060018 File Offset: 0x0005E218
public void SetupNPCAfterLoadedVariables()
{
bool flag = this.wasStunned;
if (!this.stunned)
{
for (int i = 0; i < 19; i++)
{
if (this.bag[i * 2] > 0 || i == 0)
{
this.CreateEquippedItems(this.bag[i * 2], this.bag[i * 2 + 1], this.sockets[i * 2], this.sockets[i * 2 + 1], i * 2, true);
}
}
}
if (this.portrait)
{
this.portrait.skillBag.UpdateWindowStates();
}
this.stats.UpdateAbilityTriggers();
this.stats.Talk();
this.stats.FormationTactics();
}
// Token: 0x0600042B RID: 1067 RVA: 0x000600DC File Offset: 0x0005E2DC
public void AddToParty()
{
this.EndPath();
this.stats.originalMap = Links.x.diorama.sceneName;
if (this.creatures)
{
this.creatures.SetStateByIndex(0, "Companion");
}
this.npc = false;
this.hostility = -1;
if (!this.summoned)
{
this.party = true;
}
Links.x.ChangeNPCList(this, false);
Links.x.ChangePartyList(this, true, this.party);
Links.x.ClearNPCs();
if (this.creatures)
{
this.creatures.JoiningParty();
}
this.stats.state = "Companion";
Links.x.gameFeed.AddFeed(this.stats.displayName + " has joined you");
Links.x.fellowship.SetPortraits(true, 0);
this.fowRevealer = base.gameObject.AddComponent<FOWRevealer>();
this.fowRevealer.main = true;
this.fowRevealer.enabled = true;
this.fowRevealer.character = this;
this.fowRevealerInterior = base.gameObject.AddComponent<FOWRevealerInterior>();
this.fowRevealerInterior.main = true;
this.fowRevealerInterior.enabled = true;
this.fowRevealerInterior.character = this;
if (!this.raycastModifier)
{
this.raycastModifier = base.gameObject.AddComponent<RaycastModifier>();
this.raycastModifier.enabled = false;
}
this.waypoint = Links.x.cellar.GetPooledGameObject(0);
this.waypoint.SetActive(false);
this.waypoint.transform.parent = Links.x.gameplay.transform;
this.party = true;
this.body.GatherRenderers(false);
this.partyColorID = Links.x.GetOpenPartyColor();
Links.x.fellowship.SetPortraits(true, 0);
this.AddPlayerLight();
if (!this.cc)
{
this.AddCC();
}
if (Links.x.main == this && !Records.x.InCombat(false))
{
Links.x.rtsCamera.Follow(base.transform, this, false);
}
this.GetPartyPooledObjects();
Records.x.RemoveTemporaryCreature(this.stats.creaturesName, this.stats.xmlName, this.stats.originalMap, 0);
this.tr.SetParent(Links.x.fellowship.transform);
this.tr.parent = null;
this.tr.SetAsLastSibling();
this.SetUpInv();
this.RemoveFromSelected(false);
this.stats.partyID = Records.x.partyTotal;
Records.x.partyTotal++;
Debug.Log(this.stats.partyID.ToString() + " " + Records.x.partyTotal.ToString());
if (this.stats.partyID == 1)
{
global::Item item;
ItemEquipped itemEquipped;
Links.x.inventory.AddFromGround(null, null, 0, false, 0f, Links.x.library.GetInvRowID("Songbook"), 1, new Vector3((float)this.stats.partyID, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector4(0f, 0f, 0f, 0f), this, false, false, out item, out itemEquipped);
this.stats.UpdateAbilityTriggers();
this.portrait.skillBag.SetSongGrid();
}
Links.x.characterSheet.OrderPortraits();
this.stats.stamina = 30f;
this.stats.maxStamina = 30f;
Links.x.pocketWheel.NewScene();
}
// Token: 0x0600042C RID: 1068 RVA: 0x000604D0 File Offset: 0x0005E6D0
public void RemoveFromParty(bool remainAsNPC)
{
Links.x.inventory.ClearBag(this);
this.portrait.skillBag.Remove();
if (this.stats.GetName() == "Viorica")
{
this.stats.xmlName = "BanquetIsleFriend";
}
if (this.stats.GetName() == "Emil")
{
this.stats.xmlName = "BanquetIsleFriend2";
}
if (this.portrait)
{
this.portrait.Remove();
this.characterSheetPortrait.Remove();
}
if (this.waypoint)
{
this.waypoint.gameObject.SetActive(false);
this.waypoint = null;
}
this.portrait = null;
this.characterSheetPortrait = null;
if (this.raycastModifier)
{
this.raycastModifier.enabled = false;
}
if (remainAsNPC)
{
this.npc = true;
}
this.hostility = 0;
this.ClearQuips();
Links.x.AddRemovedCompanion(this);
Links.x.ChangePartyList(this, false, this.party);
if (remainAsNPC)
{
Links.x.ChangeNPCList(this, true);
}
if (this.fowRevealer)
{
Object.Destroy(this.fowRevealerInterior);
Object.Destroy(this.fowRevealer);
}
if (this.cc)
{
Object.Destroy(this.cc);
Object.Destroy(this.playerBorders);
}
if (remainAsNPC)
{
Debug.Log(string.Concat(new string[]
{
this.stats.originalMap,
" ",
Links.x.diorama.sceneName,
" ",
this.stats.xmlName
}));
if (this.stats.originalMap != Links.x.diorama.sceneName)
{
this.stats.GetEffectStrings();
Records.x.AddTemporaryCreature(this.stats.creaturesName, this.stats.xmlName, this.stats.originalMap, Links.x.diorama.sceneName, 0, this.tr.position, "Normal", "", this.stats.HealthCurrent(), this.stats.savedEffects, 0, 0f, Links.x.diorama.sceneName, this.tr.position, false);
}
else
{
this.creatures = Links.x.diorama.SetCreatureState(this.stats.xmlName, "Normal", 0);
this.stats.state = "Normal";
if (Records.x.banquetIsle)
{
this.creatures.SetTemperament(2);
this.creatures.SetCharacter0(this, 2);
}
else
{
this.creatures.SetCharacter0(this, 1);
}
}
base.gameObject.transform.parent = Links.x.diorama.creatures;
}
Links.x.ReorderPortraits();
this.ReturnPartyPooledObjects();
this.RemovePlayerLight();
if (Links.x.main == this)
{
Links.x.protagonist.SetAsLeader();
}
this.party = false;
this.mainSelected = false;
this.stats.maxStamina = this.stats.characterRow._Stamina;
this.stats.stamina = this.stats.maxStamina;
if (Records.x.editor || Records.x.secrets)
{
Links.x.gameFeed.AddFeed(this.stats.displayName + " has left the party.");
}
Links.x.pocketWheel.NewScene();
}
// Token: 0x0600042D RID: 1069 RVA: 0x00060899 File Offset: 0x0005EA99
public void AddToLists()
{
Links.x.ChangeNPCList(this, true);
this.SceneSetup();
}
// Token: 0x0600042E RID: 1070 RVA: 0x000608B0 File Offset: 0x0005EAB0
public void RemovingScene()
{
if (!this.tr)
{
return;
}
this.TargetReached();
this.ClearMoveTargets();
if (this.sphere && this.tr)
{
this.sphere.transform.position = this.tr.position;
}
this.RemoveLastNode(true);
this.node = null;
if (this.hasActions && this.npc && this.actions)
{
this.actions.EndActions();
}
if (this.dockFriend)
{
this.dockFriend.RemovePortrait();
}
if (this.npc)
{
this.ReturnPooledObjects();
this.stats.ReturnPooledEffects();
this.ReturnToPool();
}
}
// Token: 0x0600042F RID: 1071 RVA: 0x00060979 File Offset: 0x0005EB79
public void DestroyCharacter()
{
Records.x.AddDestroyCharacter(this);
}
// Token: 0x06000430 RID: 1072 RVA: 0x00060986 File Offset: 0x0005EB86
public void DestroyCharacterWait()
{
base.StartCoroutine(this.DestroyWait());
}
// Token: 0x06000431 RID: 1073 RVA: 0x00060995 File Offset: 0x0005EB95
private IEnumerator DestroyWait()
{
float timeToLerp = Random.Range(3f, 5f);
float percentage = 0f;
float startTime = Time.time;
while (percentage < 1f && Links.x.gaia.sceneLoaded)
{
percentage = (Time.time - startTime) / timeToLerp;
yield return null;
}
this.DestroyCharacter();
yield break;
}
// Token: 0x06000432 RID: 1074 RVA: 0x000609A4 File Offset: 0x0005EBA4
public void FinishDestroyingCharacter()
{
if (Links.x.gaia.sceneLoaded && Links.x.gameCard.hoverCharacter == this)
{
Links.x.gameCard.EndHover(this, false);
}
this.TargetReached();
this.ClearMoveTargets();
if (this.sphere)
{
this.sphere.transform.position = this.tr.position;
}
this.RemoveLastNode(true);
if (this.hasActions && this.actions)
{
this.actions.EndActions();
}
this.node = null;
if (this.body)
{
this.body.RemoveDeathParts();
}
if (this.bouncer)
{
this.bouncer.EndNow();
Object.Destroy(this.bouncer.gameObject);
this.bouncer = null;
}
if (this.hasIncenseTorch)
{
this.RemoveIncenseTorch();
}
if (this.hasTorch)
{
this.RemoveTorch();
}
if (this.statusRing)
{
this.statusRing.End();
this.statusRing = null;
}
if (this.stamina)
{
this.stamina.End();
this.stamina = null;
}
if (this.oar)
{
Links.x.cellar.ReturnPooledGameObject(137, this.oar);
this.oar = null;
}
if (this.npc)
{
Links.x.ChangeNPCList(this, false);
}
else if (this.party)
{
this.ReturnPartyPooledObjects();
Links.x.inventory.ClearBag(this);
if (this.portrait)
{
this.portrait.skillBag.Remove();
}
}
else if (this.creatures && this.summoned)
{
Object.Destroy(this.creatures.gameObject);
}
if (this.gos != null)
{
this.gos.Remove(this);
}
Links.x.ChangeDeadList(this, false);
if (this.portrait)
{
Links.x.hudControl.RemovePortrait(this.portrait);
this.portrait = null;
this.characterSheetPortrait.Remove();
this.characterSheetPortrait = null;
}
this.ReturnPooledObjects();
this.stats.ReturnPooledEffects();
this.ReturnToPool();
}
// Token: 0x06000433 RID: 1075 RVA: 0x00060C08 File Offset: 0x0005EE08
public void SceneSetup()
{
this.gos = Links.x.diorama.characters;
if (this.npc)
{
if (!this.setupComplete && !this.gos.Contains(this))
{
this.gos.Add(this);
return;
}
}
else
{
this.gos.Add(this);
}
}
// Token: 0x06000434 RID: 1076 RVA: 0x00060C64 File Offset: 0x0005EE64
private void CheckInTown()
{
bool flag = this.inTown;
if (this.party)
{
this.inSporeForest = Links.x.diorama.InSporeForest(this.currentPosition);
if (this.sporeTime == 0f)
{
this.sporeTime = Links.x.gameplay.seconds;
}
}
this.inTown = Links.x.diorama.InTown(this.tr.position);
if (!this.hasActions && this.inTown)
{
if (this.party)
{
this.animator.SetBool("Party", true);
}
this.animator.SetBool("InTown", true);
}
else
{
if (this.party)
{
this.animator.SetBool("Party", true);
}
this.animator.SetBool("InTown", false);
}
if (this.mainSelected && this.inTown != flag)
{
Links.x.gaia.SetEnvironmentPlaylist(false, this.inTown, false);
}
if (this.inTown != flag)
{
this.SetAnimatorSpeed(1f);
this.animator.speed = this.currentAnimatorSpeed;
}
}
// Token: 0x06000435 RID: 1077 RVA: 0x00060D90 File Offset: 0x0005EF90
public bool InSporeForest()
{
return this.inSporeForest;
}
// Token: 0x06000436 RID: 1078 RVA: 0x00060D98 File Offset: 0x0005EF98
public void MakeRandomPathAfterJump()
{
this.makePathAfterJump = true;
}
// Token: 0x06000437 RID: 1079 RVA: 0x00060DA4 File Offset: 0x0005EFA4
public void FirstPosition(GraphNode firstNode)
{
if (!this.setupComplete || (this.dead && this.npc) || !this.tr)
{
return;
}
if (this.npc && this.creatures && this.creatures.ambush)
{
return;
}
this.jumpingAreas = false;
this.jumpingPosition = true;
this.jumpPositionTime = Time.timeSinceLevelLoad;
this.jumpPositionVector = this.tr.position;
this.movingAreas = false;
this.meshAlwaysOff = false;
if (this.cc && this.cc.enabled)
{
this.cc.enabled = false;
this.cc.enabled = true;
}
this.nodePoint = this.tr.position;
if (this.party && !this.hasActions)
{
this.timeSinceMoveEnded = -100f;
if (this.animator)
{
this.animator.SetBool("Combat", false);
}
}
GraphNode graphNode = firstNode;
if (graphNode == null)
{
this.moveOnTiles = this.ghost;
graphNode = this.NearNode(this.nodePoint, true, 0, -1, 0);
this.moveOnTiles = false;
}
if (graphNode != null)
{
this.nodePoint = (Vector3)graphNode.position;
}
if (this.nodePoint != this.vectorZero && !this.stuckInPlace && !this.sailing)
{
this.SetPosition(this.nodePoint, null);
}
this.slideNode = null;
this.slideNodePosition = Vector3.zero;
this.lastFatiguePosition = this.tr.position;
this.ClaimNode(graphNode, this.nodePoint, true);
if (graphNode != null && !this.stuckInPlace && !this.sailing)
{
this.SetPosition((Vector3)graphNode.position, graphNode);
}
if (this.circleTr)
{
this.circleTr.position = this.tr.position;
}
this.SetMoveFollowPosition(this.tr.position);
if (graphNode != null)
{
this.SetMoveFollowPosition((Vector3)graphNode.position);
}
this.TargetReached();
if (!this.npc)
{
this.GetTerrain();
}
if (!this.resting && !Links.x.gaia.sceneLoaded)
{
this.PlayAnimation("Idle", Random.Range(0f, 1f));
}
if (Links.x.gaia.sceneLoaded)
{
this.DoFootsteps();
}
this.rot = this.tr.rotation;
this.smoothRot = this.tr.rotation;
this.savedRot = this.tr.rotation;
if (this.mainSelected)
{
Links.x.follow.position = this.tr.position + this.headHeight;
}
if (this.node != null)
{
this.desiredGraph = (int)this.node.GraphIndex;
}
this.lastFatiguePosition = this.tr.position;
if (this.desiredGraph == 1)
{
if (Links.x.diorama.GetIndoorView())
{
this.indoorID = Links.x.diorama.GetIndoorView().GetInteriorBoundsName(this.tr.position);
}
}
else
{
this.indoorID = "";
}
if (this.sphere)
{
this.sphere.transform.position = this.tr.position;
}
this.savedPathTarget = this.node;
this.savedFollowNode = this.node;
this.body.SetMagicaClothWind();
if (this.mainSelected)
{
this.CheckInTown();
if (!this.inTown)
{
Links.x.gaia.SetEnvironmentPlaylist(Links.x.gameplay.sailing, this.inTown, false);
}
}
}
// Token: 0x06000438 RID: 1080 RVA: 0x00061178 File Offset: 0x0005F378
public void SettlePosition()
{
if (this.node != null)
{
this.desiredGraph = (int)this.node.GraphIndex;
}
this.rot = this.tr.rotation;
this.smoothRot = this.tr.rotation;
this.savedRot = this.tr.rotation;
this.SetMoveFollowPosition(this.tr.position);
if (this.desiredGraph == 1)
{
this.indoorID = Links.x.diorama.GetIndoorView().GetInteriorBoundsName(this.tr.position);
}
else
{
this.indoorID = "";
}
if (this.sphere)
{
this.sphere.transform.position = this.tr.position;
}
}
// Token: 0x06000439 RID: 1081 RVA: 0x00061248 File Offset: 0x0005F448
public void TurnScriptsOff()
{
if (this.party && !this.isBoro && !this.offMap)
{
return;
}
if (this.deactivating || this.fleeing)
{
return;
}
if (this.dayNightVanishing || this.alwaysOn)
{
return;
}
if (this.creatures && this.creatures.activating)
{
return;
}
if (this.hasActions && this.actions)
{
this.actions.EndActions();
}
base.enabled = false;
this.animator.enabled = false;
this.stats.enabled = false;
if (this.body)
{
this.body.lookAtController.SetAsActive(false);
this.body.TurnOffIK();
if (this.body.headAnim)
{
this.body.headAnim.enabled = false;
}
}
this.SetMeshState(false);
this.body.enabled = false;
this.inactive = true;
this.TargetReached();
if (this.thisCollider)
{
this.thisCollider.enabled = false;
}
this.audioSource.enabled = false;
if (this.usingCircles && this.circleTr)
{
this.circle.SetActive(false);
}
this.ClearLKP();
if (this.party || this.isBoro || this.vanished)
{
this.RemoveLastNode(true);
}
}
// Token: 0x0600043A RID: 1082 RVA: 0x000613C4 File Offset: 0x0005F5C4
public void TurnScriptsOn()
{
if (this.offMap || this.vanished)
{
return;
}
if (Records.x.partySailing && this.summoned && !this.npc)
{
return;
}
base.enabled = true;
this.body.enabled = true;
this.animator.enabled = true;
this.stats.enabled = true;
this.audioSource.enabled = true;
if (this.thisCollider)
{
this.thisCollider.enabled = true;
}
this.inactive = false;
if (this.body.headAnim)
{
this.body.headAnim.enabled = true;
}
if (this.creatures)
{
this.creatures.CheckSleep(this);
}
if (this.party)
{
this.FindCurrentNode(true);
}
if (this.circleTr && !this.isBoro && !this.inactive && this.visible == 1 && !this.stunned && this.usingCircles)
{
this.circle.SetActive(true);
}
this.CircleAnimation("");
}
// Token: 0x0600043B RID: 1083 RVA: 0x000614EE File Offset: 0x0005F6EE
public void Reincarnate()
{
if (!this.npc)
{
Links.x.ChangePartyList(this, true, this.party);
return;
}
Links.x.ChangeNPCList(this, true);
}
// Token: 0x0600043C RID: 1084 RVA: 0x00061518 File Offset: 0x0005F718
public void ResetCharacter()
{
this.setupComplete = false;
this.outsideBounds = false;
this.animID = 0;
this.nodeActions.Clear();
this.nodePath.Clear();
this.vectorPath.Clear();
this.prepPath.Clear();
this.moving = false;
this.swarm = false;
this.inCombat = false;
if (this.actions)
{
this.actions.EndActions();
this.actions = null;
}
this.hasActions = false;
this.npc = true;
this.dead = false;
this.moveNode = null;
this.movePoint = this.vectorZero;
this.patrolNode = 0;
this.canLeave = false;
this.moveTurn = false;
this.mainSelected = false;
this.protagonist = false;
this.mainSelected = false;
this.moveTurns = 0f;
this.hovering = false;
if (this.mainSelected)
{
Debug.Log("sliding");
}
this.slideNode = null;
this.nextNode = null;
this.prevNodePosition = this.vectorZero;
this.node = null;
this.nodePoint = this.vectorZero;
this.targetNode = null;
this.moveIndex = -1;
this.missing = false;
this.fleeing = false;
for (int i = 0; i < this.equippedItems.Length; i++)
{
if (this.equippedItems[i] != null)
{
Object.Destroy(this.equippedItems[i]);
}
this.equippedItems[i] = null;
}
this.blockedTime = 0f;
this.tempStop = false;
this.setupComplete = false;
this.isHit = false;
this.downed = false;
this.resting = false;
this.doingHit = false;
}
// Token: 0x0600043D RID: 1085 RVA: 0x000616C8 File Offset: 0x0005F8C8
public void ReturnToPool()
{
if (this.bodyObj)
{
base.enabled = false;
this.body.enabled = true;
this.animator.enabled = true;
this.stats.enabled = true;
if (this.body)
{
this.body.lookAtController.SetAsActive(false);
this.body.TurnOffIK();
if (this.body.headAnim)
{
this.body.headAnim.enabled = true;
}
}
Links.x.archives.RecycleBody(this.bodyObj, this.bodyObj.name, base.gameObject.name);
}
this.bodyObj = null;
if (this.dead)
{
Links.x.ChangeDeadList(this, false);
}
if (this.npc)
{
Links.x.ChangeNPCList(this, false);
}
this.ReturnPooledObjects();
if (this)
{
Object.Destroy(base.gameObject);
}
}
// Token: 0x0600043E RID: 1086 RVA: 0x000617CF File Offset: 0x0005F9CF
public int GetLKPCount()
{
return this.lkPlayer.Count;
}
// Token: 0x0600043F RID: 1087 RVA: 0x000617DC File Offset: 0x0005F9DC
public void UpdateLKP(Character character, GraphNode position, string action, bool seen)
{
if (this.hasActions && this.actions.ai.findingAction)
{
return;
}
if (character == this || !character)
{
return;
}
int num = this.lkPlayer.IndexOf(character);
if (num == -1)
{
if (seen || action == "Heard")
{
if (!seen)
{
action = "Search";
}
this.lkPlayer.Add(character);
this.lkPosition.Add(position);
this.lkAction.Add(action);
this.lkBool.Add(seen);
}
}
else
{
bool flag = true;
if (!seen)
{
if (action.Contains("Heard"))
{
if (this.lkBool[num])
{
flag = false;
}
else
{
string text = this.lkAction[num];
if (!text.Contains("Search"))
{
action = "Search";
}
else
{
action = text;
}
}
}
else
{
string text2 = this.lkAction[num];
if (!text2.Contains("Search"))
{
action = "Search";
}
else
{
action = text2;
}
}
}
if (flag)
{
this.lkPosition[num] = position;
this.lkAction[num] = action;
this.lkBool[num] = seen;
}
}
this.hasLKP = true;
}
// Token: 0x06000440 RID: 1088 RVA: 0x00061924 File Offset: 0x0005FB24
public void TransferLKP(Character source)
{
this.lkPlayer.Clear();
this.lkPosition.Clear();
this.lkAction.Clear();
this.lkBool.Clear();
List<Character> list = source.lkPlayer;
List<GraphNode> list2 = source.lkPosition;
List<string> list3 = source.lkAction;
List<bool> list4 = source.lkBool;
int count = list.Count;
for (int i = 0; i < count; i++)
{
this.lkPlayer.Add(list[i]);
this.lkPosition.Add(list2[i]);
this.lkAction.Add(list3[i]);
this.lkBool.Add(list4[i]);
}
}
// Token: 0x06000441 RID: 1089 RVA: 0x000619E0 File Offset: 0x0005FBE0
public void UpdateLKPSpecial(Character character, GraphNode position, string action, bool seen)
{
if (this.lkPlayer.IndexOf(character) == -1)
{
this.lkPlayer.Add(character);
this.lkPosition.Add(position);
this.lkAction.Add(action);
this.lkBool.Add(seen);
}
this.hasLKP = true;
}
// Token: 0x06000442 RID: 1090 RVA: 0x00061A34 File Offset: 0x0005FC34
public void RemoveLKPlayer(Character character)
{
int num = this.lkPlayer.IndexOf(character);
if (num > -1)
{
this.lkPlayer.RemoveAt(num);
this.lkPosition.RemoveAt(num);
this.lkAction.RemoveAt(num);
this.lkBool.RemoveAt(num);
}
}
// Token: 0x06000443 RID: 1091 RVA: 0x00061A82 File Offset: 0x0005FC82
public bool HasLKPlayer(Character character)
{
return this.lkPlayer.IndexOf(character) != -1;
}
// Token: 0x06000444 RID: 1092 RVA: 0x00061A98 File Offset: 0x0005FC98
public bool GetLKPlayerBool(Character character)
{
int num = this.lkPlayer.IndexOf(character);
return num != -1 && this.lkBool[num];
}
// Token: 0x06000445 RID: 1093 RVA: 0x00061AC4 File Offset: 0x0005FCC4
public Character GetNearestPartyLKP(Vector3 pt)
{
float num = float.PositiveInfinity;
Character character = null;
for (int i = 0; i < this.lkPlayer.Count; i++)
{
if (this.lkPlayer[i].party && !this.lkPlayer[i].stunned && !this.lkPlayer[i].dead)
{
float sqrMagnitude = (this.lkPlayer[i].tr.position - pt).sqrMagnitude;
if (sqrMagnitude < num)
{
num = sqrMagnitude;
character = this.lkPlayer[i];
}
}
}
return character;
}
// Token: 0x06000446 RID: 1094 RVA: 0x00061B68 File Offset: 0x0005FD68
public bool HasSomeoneInSight()
{
for (int i = 0; i < this.lkPlayer.Count; i++)
{
if (!this.lkPlayer[i].npc && !this.lkPlayer[i].stunned && !this.lkPlayer[i].dead && this.lkBool[i])
{
return true;
}
}
return false;
}
// Token: 0x06000447 RID: 1095 RVA: 0x00061BD8 File Offset: 0x0005FDD8
public bool HasPartyLKP()
{
for (int i = 0; i < this.lkPlayer.Count; i++)
{
if (this.lkPlayer[i].party && !this.lkPlayer[i].stunned && !this.lkPlayer[i].dead)
{
return true;
}
}
return false;
}
// Token: 0x06000448 RID: 1096 RVA: 0x00061C37 File Offset: 0x0005FE37
public void ClearLKP()
{
this.hasLKP = false;
this.lkAction.Clear();
this.lkPosition.Clear();
this.lkBool.Clear();
this.lkPlayer.Clear();
}
// Token: 0x06000449 RID: 1097 RVA: 0x00061C6C File Offset: 0x0005FE6C
public bool CanSee(Character checkCharacter)
{
int num = this.lkPlayer.IndexOf(checkCharacter);
return num > -1 && this.lkBool[num];
}
// Token: 0x0600044A RID: 1098 RVA: 0x00061C98 File Offset: 0x0005FE98
public void ReturnPooledObjects()
{
if (this.sleeping)
{
this.sleeping = false;
this.RemoveEffect(40, "", true);
}
if (this.splash)
{
Links.x.cellar.ReturnPooledGameObject(141, this.splash);
this.splash = null;
}
if (this.quip)
{
this.quip.gameObject.SetActive(false);
this.quip.EndFinal();
this.quip = null;
}
if (this.stunGauge)
{
this.stunGauge.gameObject.SetActive(false);
this.stunGauge = null;
}
if (this.dazedGauge)
{
this.dazedGauge.gameObject.SetActive(false);
this.dazedGauge = null;
}
if (this.waypoint)
{
this.waypoint.gameObject.SetActive(false);
this.waypoint = null;
}
if (this.heart)
{
Links.x.cellar.ReturnPooledGameObject(66, this.heart);
this.heart = null;
}
if (this.dodgeFX)
{
Links.x.cellar.ReturnPooledGameObject(91, this.dodgeFX);
this.dodgeFX = null;
}
if (this.dazed)
{
Links.x.cellar.ReturnPooledGameObject(100, this.dazed.transform.parent.gameObject);
this.dazed = null;
}
this.ReturnHealthBar();
this.ReturnStaminaBar();
if (this.grassInteraction)
{
Links.x.cellar.ReturnPooledGameObject(89, this.grassInteraction.gameObject);
this.grassInteraction = null;
}
if (this.bracket)
{
Links.x.cellar.ReturnPooledGameObject(61, this.bracket);
}
if (this.stats.boro && this.boroBoat)
{
Links.x.cellar.ReturnPooledGameObject(136, this.boroBoat);
this.boroBoat = null;
}
if (this.dockFriend)
{
this.dockFriend.Remove();
this.dockFriend = null;
}
if (this.moveFollow)
{
Links.x.cellar.ReturnEmptyPoint(this.moveFollow.gameObject);
this.moveFollow = null;
}
if (this.sphere)
{
Links.x.cellar.ReturnEmptyPoint(this.sphere);
this.sphere = null;
}
if (this.lookAtTurnTarget)
{
Links.x.cellar.ReturnEmptyPoint(this.lookAtTurnTarget.gameObject);
this.lookAtTurnTarget = null;
}
if (this.heard)
{
Links.x.cellar.ReturnPooledGameObject(22, this.heard);
this.heard.SetActive(false);
this.heard = null;
}
if (this.seen)
{
Links.x.cellar.ReturnPooledGameObject(23, this.seen);
this.seen.SetActive(false);
this.seen = null;
}
if (this.oar)
{
Links.x.cellar.ReturnPooledGameObject(137, this.oar);
this.oar = null;
}
this.EndQuip();
}
// Token: 0x0600044B RID: 1099 RVA: 0x00062000 File Offset: 0x00060200
public void UpdateArrowColor()
{
int num = this.partyColorID;
if (this.hoverWaypointRenderer)
{
this.hoverWaypointRenderer.sharedMaterial = Links.x.GetPartyMaterial(num, 4);
this.waypointRenderer.sharedMaterial = Links.x.GetPartyMaterial(num, 4);
}
}
// Token: 0x0600044C RID: 1100 RVA: 0x0006204F File Offset: 0x0006024F
public void ClearQuips()
{
this.hasCinematicQuip = false;
}
// Token: 0x0600044D RID: 1101 RVA: 0x00062058 File Offset: 0x00060258
public void FindQuip()
{
if (this.hasCinematicQuip && !Records.x.dialogue && !Records.x.removeControls)
{
bool flag = false;
if (this.stats.xmlName.Contains("Fairy"))
{
flag = true;
}
bool flag2 = true;
if (Time.timeSinceLevelLoad < this.lastIdleQuipTime)
{
return;
}
if (Time.timeSinceLevelLoad < Records.x.lastQuipTime + 3f && !flag)
{
return;
}
if ((Random.Range(0, 200) > 0 && !flag) || this.quip)
{
flag2 = false;
}
if (this.hasActions)
{
flag2 = false;
}
if (flag2)
{
Records.x.lastQuipTime = Time.timeSinceLevelLoad;
this.lastIdleQuipTime = Time.timeSinceLevelLoad + Random.Range(10f, 25f);
if (flag)
{
this.lastIdleQuipTime = Time.timeSinceLevelLoad + Random.Range(15f, 20f);
}
string text = "Idle";
if (this.inCombat)
{
text = "Combat";
}
string text2 = Links.x.quips.GetQuip(text, this.quipIndex);
this.StartQuip(text2);
}
}
}
// Token: 0x0600044E RID: 1102 RVA: 0x00062180 File Offset: 0x00060380
public GameObject AddEffect(int num, string extra)
{
int num2 = -1;
for (int i = 0; i < this.headEffectsID.Count; i++)
{
if (num == this.headEffectsID[i] && extra == this.headEffectsExtras[i])
{
num2 = i;
break;
}
}
if (num2 == -1)
{
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(num);
if (pooledGameObject)
{
pooledGameObject.transform.position = this.neck.position + new Vector3(0f, 1.5f, 0f);
pooledGameObject.transform.parent = this.tr;
pooledGameObject.SetActive(true);
this.headEffectsID.Add(num);
this.headEffectsExtras.Add(extra);
this.headEffects.Add(pooledGameObject);
this.currentEffect = this.headEffects.Count - 2;
this.RotateEffects();
if (num == 85)
{
Links.x.cameraEffects.AddRemoveGhost(pooledGameObject.transform.GetChild(0).gameObject.GetComponent<MeshRenderer>(), true);
}
}
return pooledGameObject;
}
int count = this.headEffects.Count;
return null;
}
// Token: 0x0600044F RID: 1103 RVA: 0x000622B0 File Offset: 0x000604B0
public void RemoveEffect(int num, string extra, bool returnIt)
{
int num2 = -1;
for (int i = 0; i < this.headEffectsID.Count; i++)
{
if (num == this.headEffectsID[i] && extra == this.headEffectsExtras[i])
{
num2 = i;
break;
}
}
if (num2 > -1)
{
if (num == 85 && this.headEffects[num2])
{
Links.x.cameraEffects.AddRemoveGhost(this.headEffects[num2].transform.GetChild(0).gameObject.GetComponent<MeshRenderer>(), false);
}
if (returnIt && this.headEffects[num2])
{
Links.x.cellar.ReturnPooledGameObject(num, this.headEffects[num2]);
}
this.headEffectsID.RemoveAt(num2);
this.headEffects.RemoveAt(num2);
this.headEffectsExtras.RemoveAt(num2);
this.RotateEffects();
}
}
// Token: 0x06000450 RID: 1104 RVA: 0x000623A8 File Offset: 0x000605A8
public void RotateEffects()
{
this.currentEffect++;
if (this.currentEffect > this.headEffects.Count - 1)
{
this.currentEffect = 0;
}
if (this.seen || this.heard)
{
this.currentEffect = -1;
}
for (int i = 0; i < this.headEffects.Count; i++)
{
if (this.headEffectsID[i] == 44 && !this.headEffects[i].activeSelf)
{
this.headEffects[i].SetActive(true);
}
}
this.currentEffectTime = Time.realtimeSinceStartup;
}
// Token: 0x06000451 RID: 1105 RVA: 0x00062458 File Offset: 0x00060658
public void PositionEffects()
{
for (int i = 0; i < this.headEffects.Count; i++)
{
if (this.headEffects[i])
{
int num = this.headEffectsID[i];
if (num == 46 || num == 48)
{
this.headEffects[i].transform.position = this.tr.position + new Vector3(0f, 0.1f, 0f);
}
else if (num != 43)
{
if (num == 44 || num == 85)
{
Vector3 eulerAngles = Quaternion.LookRotation(Links.x.worldCamera.transform.position - this.currentPosition).eulerAngles;
eulerAngles.x = 0f;
eulerAngles.z = 0f;
this.headEffects[i].transform.position = this.body.GetHead().position + new Vector3(0f, 0.3f, 0f) + Quaternion.Euler(eulerAngles) * Vector3.forward * 0.4f;
this.headEffects[i].transform.rotation = Quaternion.Euler(eulerAngles);
}
else if (!this.IsSentient())
{
if (num == 40)
{
Vector3 eulerAngles2 = Quaternion.LookRotation(Links.x.worldCamera.transform.position - this.currentPosition).eulerAngles;
eulerAngles2.x = 0f;
eulerAngles2.z = 0f;
this.headEffects[i].transform.position = this.body.GetHead().position + new Vector3(0f, 1f, 0f) + Quaternion.Euler(eulerAngles2) * Vector3.forward * 0.4f;
this.headEffects[i].transform.rotation = Quaternion.Euler(eulerAngles2);
}
else
{
this.headEffects[i].transform.position = this.body.GetHead().position + new Vector3(0f, 1f, 0f);
}
}
else if (this.neck == this.tr || this.neck == this.body.tr)
{
float num2 = this.characterHeight;
if (this.npc && this.hasActions)
{
num2 += 0.25f;
}
this.headEffects[i].transform.position = this.tr.position + new Vector3(0f, num2, 0f);
}
else
{
float num3 = 1.5f;
if (this.npc && this.hasActions)
{
num3 += 0.25f;
}
if (this.npc && this.stats.pinning)
{
num3 += 0.5f;
}
this.headEffects[i].transform.position = this.neck.position + new Vector3(0f, num3, 0f);
}
}
}
}
}
// Token: 0x06000452 RID: 1106 RVA: 0x000627E4 File Offset: 0x000609E4
public Vector3 SubtractVectors(Vector3 a, Vector3 b)
{
Vector3 vector;
vector.x = a.x - b.x;
vector.y = a.y - b.y;
vector.z = a.z - b.z;
return vector;
}
// Token: 0x06000453 RID: 1107 RVA: 0x00062830 File Offset: 0x00060A30
public Vector3 AddVectors(Vector3 a, Vector3 b)
{
Vector3 vector;
vector.x = a.x + b.x;
vector.y = a.y + b.y;
vector.z = a.z + b.z;
return vector;
}
// Token: 0x06000454 RID: 1108 RVA: 0x0006287C File Offset: 0x00060A7C
public Vector3 AddVectorY(Vector3 a, float b)
{
Vector3 vector;
vector.x = a.x;
vector.y = a.y + b;
vector.z = a.z;
return vector;
}
// Token: 0x06000455 RID: 1109 RVA: 0x000628B4 File Offset: 0x00060AB4
public float AngleDir(Vector3 fwd, Vector3 targetDir, Vector3 up)
{
float num = Vector3.Dot(Vector3.Cross(fwd, targetDir), up);
if (num > 0f)
{
return 1f;
}
if (num <= 0f)
{
return -1f;
}
return 1f;
}
// Token: 0x06000456 RID: 1110 RVA: 0x000628F0 File Offset: 0x00060AF0
public Vector3 CustomNormalize(Vector3 v)
{
double num = Math.Sqrt((double)(v.x * v.x + v.y * v.y + v.z * v.z));
if (num > 9.99999974737875E-06)
{
float num2 = (float)num;
v.x /= num2;
v.y /= num2;
v.z /= num2;
return v;
}
return this.vectorZero;
}
// Token: 0x06000457 RID: 1111 RVA: 0x00062968 File Offset: 0x00060B68
public GameObject CreateSphere(Vector3 position, float size)
{
GameObject gameObject = GameObject.CreatePrimitive(PrimitiveType.Sphere);
gameObject.transform.parent = Links.x.gameplay.transform;
gameObject.transform.position = position;
gameObject.transform.localScale = new Vector3(size, size, size);
Object.Destroy(gameObject.GetComponent<SphereCollider>());
gameObject.layer = 2;
return gameObject;
}
// Token: 0x06000458 RID: 1112 RVA: 0x000629C8 File Offset: 0x00060BC8
public float AttackRange()
{
float num = this.invRow1._MeleeRangeEnd;
if (this.hasActions && this.actions.hasPowerDraw)
{
num += 30f;
}
return num * Records.x.nodeSize + this.attackRadius + Records.x.nodeSize / 2f;
}
// Token: 0x06000459 RID: 1113 RVA: 0x00062A24 File Offset: 0x00060C24
public bool InAttackShape(Character target, Vector3 targetPosition, Character attacker, Vector3 attackerPosition, Vector3 checkPosition, Library.Inventory row)
{
float num = attacker.stats.MultiHitMod();
if (attacker.stats.HandCount() > 1f)
{
if (target != this)
{
float num2 = (row._MeleeRangeEnd * Records.x.nodeSize + attacker.attackRadius + this.attackRadius) * (row._MeleeRangeEnd * Records.x.nodeSize + attacker.attackRadius + this.attackRadius);
if ((attackerPosition - checkPosition).sqrMagnitude < num2)
{
float num3 = 80f;
Vector3 vector = Quaternion.LookRotation(targetPosition - new Vector3(attackerPosition.x, targetPosition.y, attackerPosition.z)) * Vector3.forward;
float num4 = Vector3.Angle(this.SubtractVectors(checkPosition, new Vector3(attackerPosition.x, checkPosition.y, attackerPosition.z)), vector);
float num5 = num3 + num / 10f;
if (num4 <= num5 && num4 >= num5 * -1f)
{
return true;
}
}
}
return false;
}
if (row._MainSkill == "Pole")
{
if (target != this)
{
float num6 = (row._MeleeRangeEnd * Records.x.nodeSize + attacker.attackRadius + this.attackRadius + 5f + num / 10f) * (row._MeleeRangeEnd * Records.x.nodeSize + attacker.attackRadius + this.attackRadius + 5f + num / 10f);
if ((attackerPosition - checkPosition).sqrMagnitude < num6)
{
float num7 = 15f;
Vector3 vector2 = Quaternion.LookRotation(targetPosition - new Vector3(attackerPosition.x, targetPosition.y, attackerPosition.z)) * Vector3.forward;
float num8 = Vector3.Angle(this.SubtractVectors(checkPosition, new Vector3(attackerPosition.x, checkPosition.y, attackerPosition.z)), vector2);
float num9 = num7 + num / 10f;
if (num8 <= num9 && num8 >= num9 * -1f)
{
return true;
}
}
}
return false;
}
if (row._MainSkill == "Sword")
{
if (target != this)
{
float num10 = (row._MeleeRangeEnd * Records.x.nodeSize + attacker.attackRadius + this.attackRadius + 2.5f) * (row._MeleeRangeEnd * Records.x.nodeSize + attacker.attackRadius + this.attackRadius + 2.5f);
if ((attackerPosition - checkPosition).sqrMagnitude < num10)
{
float num11 = 40f;
Vector3 vector3 = Quaternion.LookRotation(targetPosition - new Vector3(attackerPosition.x, targetPosition.y, attackerPosition.z)) * Vector3.forward;
float num12 = Vector3.Angle(this.SubtractVectors(checkPosition, new Vector3(attackerPosition.x, checkPosition.y, attackerPosition.z)), vector3);
float num13 = num11 + num / 10f;
if (num12 <= num13 && num12 >= num13 * -1f)
{
return true;
}
}
}
return false;
}
if (row._MainSkill == "Bow")
{
return false;
}
if (row._MainSkill == "Elixir" && Links.x.combat.inPocketAttack)
{
if (target != this)
{
float num14 = (5f + num / 10f) * (5f + num / 10f);
if ((targetPosition - checkPosition).sqrMagnitude < num14)
{
return true;
}
}
return false;
}
if (row._MainSkill == "Sling" && Links.x.combat.inPocketAttack)
{
if (target != this)
{
float num15 = (5f + num / 10f) * (5f + num / 10f);
if ((targetPosition - checkPosition).sqrMagnitude < num15)
{
return true;
}
}
return false;
}
if (row._MainSkill == "ShortSword" || row._MainSkill == "Ax" || row._MainSkill == "Hand-to-Hand")
{
if (target != this)
{
bool flag = false;
if (row._Name.Contains("Dagger") || row._Name.Contains("Awl") || row._Name.Contains("Knife"))
{
flag = true;
}
float num16 = 0f;
if (flag)
{
num16 = Mathf.Round(num / 10f);
}
float num17 = (row._MeleeRangeEnd * Records.x.nodeSize + attacker.attackRadius + this.attackRadius + num16) * (row._MeleeRangeEnd * Records.x.nodeSize + attacker.attackRadius + this.attackRadius + num16);
if ((attackerPosition - checkPosition).sqrMagnitude < num17)
{
float num18 = 60f;
Vector3 vector4 = Quaternion.LookRotation(targetPosition - new Vector3(attackerPosition.x, targetPosition.y, attackerPosition.z)) * Vector3.forward;
float num19 = Vector3.Angle(this.SubtractVectors(checkPosition, new Vector3(attackerPosition.x, checkPosition.y, attackerPosition.z)), vector4);
float num20 = num18 + num / 10f;
if (num19 <= num20 && num19 >= num20 * -1f)
{
return true;
}
}
}
return false;
}
if (row._MainSkill == "Scepter")
{
if (target != this)
{
float num21 = (3f + num / 10f) * (3f + num / 10f);
if ((attackerPosition + Quaternion.LookRotation(targetPosition - attackerPosition) * Vector3.forward * 2f - checkPosition).sqrMagnitude < num21)
{
return true;
}
}
return false;
}
if (row._MainSkill == "Whip")
{
if (target != this)
{
float num22 = (4f + num / 10f) * (4f + num / 10f);
if ((attackerPosition + Quaternion.LookRotation(targetPosition - attackerPosition) * Vector3.forward * 4f - checkPosition).sqrMagnitude < num22)
{
return true;
}
}
return false;
}
return false;
}
// Token: 0x0600045A RID: 1114 RVA: 0x00063098 File Offset: 0x00061298
public void GetAttackShapeCone(Vector3 targetPosition, Library.Inventory row, out Vector3 conePosition, out Quaternion coneRotation, out float coneAngle, out float coneDistance, out float sphereRadius)
{
conePosition = Vector3.zero;
coneRotation = Quaternion.LookRotation(targetPosition - new Vector3(this.currentPosition.x, targetPosition.y, this.currentPosition.z));
coneAngle = 45f;
coneDistance = 2f;
sphereRadius = 0f;
float num = this.stats.MultiHitMod();
if (this.stats.HandCount() > 1f)
{
conePosition = this.currentPosition;
coneAngle = (80f + num / 10f) * 2f;
coneDistance = this.attackRadius * 2f + row._MeleeRangeEnd * Records.x.nodeSize;
return;
}
if (row._MainSkill == "Pole")
{
conePosition = this.currentPosition;
coneAngle = (15f + num / 10f) * 2f;
coneDistance = this.attackRadius * 2f + row._MeleeRangeEnd * Records.x.nodeSize + num / 10f + 5f;
}
if (row._MainSkill == "Sword")
{
conePosition = this.currentPosition;
coneAngle = (40f + num / 10f) * 2f;
coneDistance = this.attackRadius * 2f + row._MeleeRangeEnd * Records.x.nodeSize + 2.5f;
}
if (row._MainSkill == "Bow")
{
conePosition = Vector3.zero;
}
if (row._MainSkill == "Elixir")
{
if (!Links.x.combat.inPocketAttack)
{
conePosition = Vector3.zero;
}
else
{
conePosition = targetPosition;
coneAngle = 360f;
sphereRadius = 5f + num / 10f;
coneDistance = 0f;
}
}
if (row._MainSkill == "Sling")
{
if (!Links.x.combat.inPocketAttack)
{
conePosition = Vector3.zero;
}
else
{
conePosition = targetPosition;
coneAngle = 360f;
sphereRadius = 5f + num / 10f;
coneDistance = 0f;
}
}
if (row._MainSkill == "ShortSword" || row._MainSkill == "Ax" || row._MainSkill == "Hand-to-Hand")
{
bool flag = false;
if (row._Name.Contains("Dagger") || row._Name.Contains("Awl") || row._Name.Contains("Knife"))
{
flag = true;
}
if (!flag)
{
conePosition = this.currentPosition;
coneAngle = (60f + num / 10f) * 2f;
coneDistance = this.attackRadius * 2f + row._MeleeRangeEnd * Records.x.nodeSize;
}
else
{
conePosition = this.currentPosition;
coneAngle = 360f;
sphereRadius = this.attackRadius * 2f + row._MeleeRangeEnd * Records.x.nodeSize + num / 10f;
coneDistance = 0f;
}
}
if (row._MainSkill == "Scepter")
{
Vector3 vector = this.currentPosition + Quaternion.LookRotation(targetPosition - this.currentPosition) * Vector3.forward * 2f;
conePosition = vector;
coneAngle = 360f;
sphereRadius = 3f + num / 10f;
coneDistance = 0f;
}
if (row._MainSkill == "Whip")
{
Vector3 vector2 = this.currentPosition + Quaternion.LookRotation(targetPosition - this.currentPosition) * Vector3.forward * 4f;
conePosition = vector2;
coneAngle = 360f;
sphereRadius = 4f + num / 10f;
coneDistance = 0f;
}
}
// Token: 0x0600045B RID: 1115 RVA: 0x000634BA File Offset: 0x000616BA
public int GetArcPoints()
{
return this.arcPoints.Count;
}
// Token: 0x0600045C RID: 1116 RVA: 0x000634C8 File Offset: 0x000616C8
public void DrawArc(Vector3 arcEndPosition, int traj)
{
this.arcTarget = arcEndPosition;
if (this.isHitFlying)
{
this.arcTarget = arcEndPosition + Quaternion.LookRotation(this.tr.position - arcEndPosition) * Vector3.forward * 3f;
}
this.arcPoints.Clear();
Vector3 position = this.tr.position;
this.trajectoryModifier = 1;
this.initialVelocity = (float)traj;
Quaternion quaternion = this.GetBearing(position, this.arcTarget);
this.moveFollow.rotation = quaternion;
this.CalculateTrajectory(position, 0);
if (traj == 0 && !this.isHitFlying && !this.ambushing && this.evading && Mathf.Abs(arcEndPosition.y - position.y) < 2f)
{
int num = this.arcPoints.Count - 1;
float num2 = Vector3.Distance(position, arcEndPosition);
for (int i = 0; i < this.arcPoints.Count; i++)
{
if (i != num)
{
Vector3 vector = this.arcPoints[i];
Vector3 vector2 = vector;
vector2.y = position.y;
float num3 = Vector3.Distance(position, vector2);
Vector3 vector3 = Vector3.Lerp(position, arcEndPosition, num3 / num2);
float num4 = vector.y - vector3.y;
num4 /= 2f;
num4 += vector3.y;
this.arcPoints[i] = new Vector3(vector.x, num4, vector.z);
}
}
}
if (this.isHitFlying && this.arcPoints.Count > 3 && Random.Range(0, 3) == 0)
{
position = this.arcTarget;
this.arcTarget = arcEndPosition;
this.trajectoryModifier = 1;
this.initialVelocity = 0f;
quaternion = this.GetBearing(position, this.arcTarget);
this.moveFollow.rotation = quaternion;
this.CalculateTrajectory(position, 1);
}
this.moveFollow.rotation = Quaternion.identity;
}
// Token: 0x0600045D RID: 1117 RVA: 0x000636D8 File Offset: 0x000618D8
public Quaternion GetBearing(Vector3 start, Vector3 targetPt)
{
this.bearing = Quaternion.Euler(Vector3.zero);
Vector3 vector = targetPt - start;
float num = Mathf.Sqrt(Mathf.Pow(vector.x, 2f) + Mathf.Pow(vector.z, 2f));
float num2 = -vector.y;
float num3 = this.gravity * (this.gravity * Mathf.Pow(num, 2f) + 2f * num2 * Mathf.Pow(this.initialVelocity, 2f));
float num4 = Mathf.Sqrt(Mathf.Pow(this.initialVelocity, 4f) - num3);
bool flag = float.IsNaN(num4);
if (!flag)
{
float num5 = (Mathf.Pow(this.initialVelocity, 2f) + (float)this.trajectoryModifier * num4) / (this.gravity * num);
float num6 = 57.29578f * Mathf.Atan(num5);
this.bearing = Quaternion.LookRotation(vector);
Vector3 eulerAngles = this.bearing.eulerAngles;
eulerAngles.x = num6;
this.bearing.eulerAngles = eulerAngles;
}
if (flag)
{
this.initialVelocity += 1f;
this.GetBearing(start, targetPt);
}
return this.bearing;
}
// Token: 0x0600045E RID: 1118 RVA: 0x0006380C File Offset: 0x00061A0C
public RaycastHit CalculateTrajectory(Vector3 start, int x)
{
RaycastHit raycastHit = default(RaycastHit);
float num = -(1f / this.trajectoryPrecision);
bool flag = false;
for (int i = 0; i < this.maximumIterations; i++)
{
if (!flag)
{
num += 1f / this.trajectoryPrecision;
Vector3 vector = start + this.moveFollow.forward * this.initialVelocity * num + 0.5f * this.gravity2 * Mathf.Pow(num, 2f);
if ((vector - this.arcTarget).sqrMagnitude < 0.25f)
{
flag = true;
this.prevPos = vector;
}
this.arcPoints.Add(vector);
}
}
this.arcPoints.Add(this.arcTarget);
float num2 = -100000f;
if (x == 0)
{
for (int j = 0; j < this.arcPoints.Count; j++)
{
if (this.arcPoints[j].y > num2)
{
this.topJumpPoint = this.arcPoints[j];
num2 = this.topJumpPoint.y;
}
}
}
return raycastHit;
}
// Token: 0x04000526 RID: 1318
[Header("SETTINGS")]
public string workingName;
// Token: 0x04000527 RID: 1319
public string animationPrefix;
// Token: 0x04000528 RID: 1320
public string doorID;
// Token: 0x04000529 RID: 1321
public string lastDoorID;
// Token: 0x0400052A RID: 1322
public string terrain;
// Token: 0x0400052B RID: 1323
public bool protagonist;
// Token: 0x0400052C RID: 1324
public bool mainSelected;
// Token: 0x0400052D RID: 1325
public bool missing;
// Token: 0x0400052E RID: 1326
public bool npc;
// Token: 0x0400052F RID: 1327
public bool dead;
// Token: 0x04000530 RID: 1328
public bool stunned;
// Token: 0x04000531 RID: 1329
public bool swarm;
// Token: 0x04000532 RID: 1330
public bool canLeave;
// Token: 0x04000533 RID: 1331
public bool party;
// Token: 0x04000534 RID: 1332
public bool inCombat;
// Token: 0x04000535 RID: 1333
public bool doingHit;
// Token: 0x04000536 RID: 1334
public bool hovering;
// Token: 0x04000537 RID: 1335
public bool isHit;
// Token: 0x04000538 RID: 1336
public bool isHitFlying;
// Token: 0x04000539 RID: 1337
public bool downed;
// Token: 0x0400053A RID: 1338
public bool resting;
// Token: 0x0400053B RID: 1339
public bool sleeping;
// Token: 0x0400053C RID: 1340
public bool hasCinematicQuip;
// Token: 0x0400053D RID: 1341
public bool running;
// Token: 0x0400053E RID: 1342
public bool inactive;
// Token: 0x0400053F RID: 1343
public bool deadInactive;
// Token: 0x04000540 RID: 1344
public bool alwaysOn;
// Token: 0x04000541 RID: 1345
public bool stuckInPlace;
// Token: 0x04000542 RID: 1346
public bool cannotAttack;
// Token: 0x04000543 RID: 1347
public bool useGrounder;
// Token: 0x04000544 RID: 1348
public bool centerOfAttention;
// Token: 0x04000545 RID: 1349
public bool isTarget;
// Token: 0x04000546 RID: 1350
public bool summoned;
// Token: 0x04000547 RID: 1351
public bool pipeSummons;
// Token: 0x04000548 RID: 1352
public bool charmed;
// Token: 0x04000549 RID: 1353
public bool actionPicked;
// Token: 0x0400054A RID: 1354
public bool selected;
// Token: 0x0400054B RID: 1355
public bool inAction;
// Token: 0x0400054C RID: 1356
public bool inRecovery;
// Token: 0x0400054D RID: 1357
public bool inQueuedAbility;
// Token: 0x0400054E RID: 1358
public bool offMap;
// Token: 0x0400054F RID: 1359
public bool changingMaps;
// Token: 0x04000550 RID: 1360
public bool changingTeleports;
// Token: 0x04000551 RID: 1361
public bool waitingToUseItem;
// Token: 0x04000552 RID: 1362
public bool dayNightVanishing;
// Token: 0x04000553 RID: 1363
public bool ghostVanishing;
// Token: 0x04000554 RID: 1364
public bool vanished;
// Token: 0x04000555 RID: 1365
public bool sailing;
// Token: 0x04000556 RID: 1366
public bool boatNavigator;
// Token: 0x04000557 RID: 1367
public bool alwaysJump;
// Token: 0x04000558 RID: 1368
public bool isBoro;
// Token: 0x04000559 RID: 1369
public bool ignoreNodeIDs;
// Token: 0x0400055A RID: 1370
public bool interactiveObject;
// Token: 0x0400055B RID: 1371
public bool selectedBeforeDoor;
// Token: 0x0400055C RID: 1372
public bool ghost;
// Token: 0x0400055D RID: 1373
public bool hasIncenseTorch;
// Token: 0x0400055E RID: 1374
public bool leashed;
// Token: 0x0400055F RID: 1375
public bool deactivating;
// Token: 0x04000560 RID: 1376
public bool dodging;
// Token: 0x04000561 RID: 1377
public bool hasTorch;
// Token: 0x04000562 RID: 1378
public bool pocketPaused;
// Token: 0x04000563 RID: 1379
public bool jumpingAreas;
// Token: 0x04000564 RID: 1380
public bool jumpedAreas;
// Token: 0x04000565 RID: 1381
public bool inTown;
// Token: 0x04000566 RID: 1382
public bool ambushing;
// Token: 0x04000567 RID: 1383
public bool movingAreas;
// Token: 0x04000568 RID: 1384
public bool attackingUntilBribe;
// Token: 0x04000569 RID: 1385
public bool meshAlwaysOn;
// Token: 0x0400056A RID: 1386
public bool meshAlwaysOff;
// Token: 0x0400056B RID: 1387
public bool enraged;
// Token: 0x0400056C RID: 1388
public bool wasStunned;
// Token: 0x0400056D RID: 1389
public bool droppedItems;
// Token: 0x0400056E RID: 1390
public bool moveBackward;
// Token: 0x0400056F RID: 1391
public bool evading;
// Token: 0x04000570 RID: 1392
public bool charging;
// Token: 0x04000571 RID: 1393
public bool vipFollow;
// Token: 0x04000572 RID: 1394
public bool inFriendGroup;
// Token: 0x04000573 RID: 1395
public bool isFriendGroupLeader;
// Token: 0x04000574 RID: 1396
public bool movesOnWater;
// Token: 0x04000575 RID: 1397
public bool hasCreatureBuff;
// Token: 0x04000576 RID: 1398
public bool inCircle;
// Token: 0x04000577 RID: 1399
public bool hasCircleBuff;
// Token: 0x04000578 RID: 1400
public bool protectMe;
// Token: 0x04000579 RID: 1401
public bool listenForPhysicsEnd;
// Token: 0x0400057A RID: 1402
public bool pocketPausedOverride;
// Token: 0x0400057B RID: 1403
public bool willBeHostile;
// Token: 0x0400057C RID: 1404
public bool alwaysLookAtParty;
// Token: 0x0400057D RID: 1405
public bool isHostage;
// Token: 0x0400057E RID: 1406
public bool inSporeForest;
// Token: 0x0400057F RID: 1407
public int visible;
// Token: 0x04000580 RID: 1408
public int nodeMovingID;
// Token: 0x04000581 RID: 1409
public int nodeStationaryID;
// Token: 0x04000582 RID: 1410
public int hostility;
// Token: 0x04000583 RID: 1411
public int koCount;
// Token: 0x04000584 RID: 1412
public int moveAnimID;
// Token: 0x04000585 RID: 1413
public int patrolNode;
// Token: 0x04000586 RID: 1414
public int combatLevel;
// Token: 0x04000587 RID: 1415
public int quipSound;
// Token: 0x04000588 RID: 1416
public int quipIndex;
// Token: 0x04000589 RID: 1417
public int partyColorID;
// Token: 0x0400058A RID: 1418
public int tilesMoved;
// Token: 0x0400058B RID: 1419
public int desiredGraph;
// Token: 0x0400058C RID: 1420
public int selectedAmmoIndex;
// Token: 0x0400058D RID: 1421
public int selectedWpnIndex;
// Token: 0x0400058E RID: 1422
public int currentDoor;
// Token: 0x0400058F RID: 1423
public int startFleeArea;
// Token: 0x04000590 RID: 1424
public float distanceToParty;
// Token: 0x04000591 RID: 1425
public float knockback;
// Token: 0x04000592 RID: 1426
public float timeOfDeath;
// Token: 0x04000593 RID: 1427
public float leashDistance;
// Token: 0x04000594 RID: 1428
public float numberOfTimesKilled;
// Token: 0x04000595 RID: 1429
public float portraitID;
// Token: 0x04000596 RID: 1430
public Quaternion circleRot;
// Token: 0x04000597 RID: 1431
public float radius = 1f;
// Token: 0x04000598 RID: 1432
public float currentAnimatorSpeed;
// Token: 0x04000599 RID: 1433
public float fellowshipMod;
// Token: 0x0400059A RID: 1434
public float attackRadius = 0.5f;
// Token: 0x0400059B RID: 1435
public float characterHeight = 3f;
// Token: 0x0400059C RID: 1436
private int prevAnimID;
// Token: 0x0400059D RID: 1437
private bool hasLight;
// Token: 0x0400059E RID: 1438
private bool needsRebind;
// Token: 0x0400059F RID: 1439
private bool exploded;
// Token: 0x040005A0 RID: 1440
public string indoorID = "";
// Token: 0x040005A1 RID: 1441
public string animControllerName;
// Token: 0x040005A2 RID: 1442
public Vector3 currentPosition;
// Token: 0x040005A3 RID: 1443
private Color32 terrainColor;
// Token: 0x040005A4 RID: 1444
[Header("INVENTORY")]
public int ammoCount1;
// Token: 0x040005A5 RID: 1445
public Library.Inventory invRow1;
// Token: 0x040005A6 RID: 1446
public Library.Inventory invRow2;
// Token: 0x040005A7 RID: 1447
public Library.Inventory invRow3;
// Token: 0x040005A8 RID: 1448
public Library.Inventory invRow4;
// Token: 0x040005A9 RID: 1449
public Library.Inventory altInvRow1;
// Token: 0x040005AA RID: 1450
public Library.Inventory altInvRow2;
// Token: 0x040005AB RID: 1451
public Library.Inventory altInvRow3;
// Token: 0x040005AC RID: 1452
public Library.Inventory altInvRow4;
// Token: 0x040005AD RID: 1453
public List<int> bag = new List<int>();
// Token: 0x040005AE RID: 1454
public List<int> bagPositions = new List<int>();
// Token: 0x040005AF RID: 1455
public List<Vector3> sockets = new List<Vector3>();
// Token: 0x040005B0 RID: 1456
public List<Vector4> durability = new List<Vector4>();
// Token: 0x040005B1 RID: 1457
public GameObject[] equippedItems = new GameObject[19];
// Token: 0x040005B2 RID: 1458
private List<int> tempBagID;
// Token: 0x040005B3 RID: 1459
private List<global::Item> tempBagItems;
// Token: 0x040005B4 RID: 1460
private List<int> tempBagAmoumt;
// Token: 0x040005B5 RID: 1461
private List<Vector3> tempSocketA;
// Token: 0x040005B6 RID: 1462
private List<Vector3> tempSocketB;
// Token: 0x040005B7 RID: 1463
private List<int> tempBagPos;
// Token: 0x040005B8 RID: 1464
private List<Vector4> tempDurability;
// Token: 0x040005B9 RID: 1465
public float inventoryTime;
// Token: 0x040005BA RID: 1466
public InventoryContainer inventoryBag;
// Token: 0x040005BB RID: 1467
[Header("LISTS")]
public List<Character> lkPlayer = new List<Character>();
// Token: 0x040005BC RID: 1468
public List<GraphNode> lkPosition = new List<GraphNode>();
// Token: 0x040005BD RID: 1469
public List<string> lkAction = new List<string>();
// Token: 0x040005BE RID: 1470
public List<bool> lkBool = new List<bool>();
// Token: 0x040005BF RID: 1471
public bool hasLKP;
// Token: 0x040005C0 RID: 1472
private List<Character> gos;
// Token: 0x040005C1 RID: 1473
private Vector3[] nodeFindDirections = new Vector3[4];
// Token: 0x040005C2 RID: 1474
[Header("AI")]
public Actions actions;
// Token: 0x040005C3 RID: 1475
public bool hasActions;
// Token: 0x040005C4 RID: 1476
public bool searching;
// Token: 0x040005C5 RID: 1477
public bool noiseImmune;
// Token: 0x040005C6 RID: 1478
public bool outsideDome;
// Token: 0x040005C7 RID: 1479
public bool waitingToJoinDome;
// Token: 0x040005C8 RID: 1480
public bool doingAction;
// Token: 0x040005C9 RID: 1481
public bool waitForPathToCharacter;
// Token: 0x040005CA RID: 1482
public bool moveOnTiles;
// Token: 0x040005CB RID: 1483
public bool usingKeys;
// Token: 0x040005CC RID: 1484
public bool overlapping;
// Token: 0x040005CD RID: 1485
public bool canSwitchBackToIdle;
// Token: 0x040005CE RID: 1486
public bool justMoved;
// Token: 0x040005CF RID: 1487
private float knockbackMax;
// Token: 0x040005D0 RID: 1488
public string anim;
// Token: 0x040005D1 RID: 1489
public int animID;
// Token: 0x040005D2 RID: 1490
public int walkUsed;
// Token: 0x040005D3 RID: 1491
public int currentTargetIndex;
// Token: 0x040005D4 RID: 1492
private Vector3 targetPosition;
// Token: 0x040005D5 RID: 1493
private Vector3 lastFatiguePosition;
// Token: 0x040005D6 RID: 1494
public float actionNumber;
// Token: 0x040005D7 RID: 1495
public GraphNode savedFollowNode;
// Token: 0x040005D8 RID: 1496
private float at;
// Token: 0x040005D9 RID: 1497
private float hitTimeReal;
// Token: 0x040005DA RID: 1498
private float timeSinceLastMove;
// Token: 0x040005DB RID: 1499
private float currentAttackSpeed;
// Token: 0x040005DC RID: 1500
public float attackTime;
// Token: 0x040005DD RID: 1501
public float hitTime;
// Token: 0x040005DE RID: 1502
public Character orbitTarget;
// Token: 0x040005DF RID: 1503
[Header("PHYSICS")]
public bool physicsMove;
// Token: 0x040005E0 RID: 1504
public float movingOutOfWayTime;
// Token: 0x040005E1 RID: 1505
public bool turningMain;
// Token: 0x040005E2 RID: 1506
public bool hittingWall;
// Token: 0x040005E3 RID: 1507
private Quaternion lastRotation;
// Token: 0x040005E4 RID: 1508
private Vector3 prevMoveSpeed;
// Token: 0x040005E5 RID: 1509
private float rbMaxSpeed;
// Token: 0x040005E6 RID: 1510
public Vector3 mainMovePoint;
// Token: 0x040005E7 RID: 1511
public Vector3 groundPoint;
// Token: 0x040005E8 RID: 1512
public CharacterController cc;
// Token: 0x040005E9 RID: 1513
public Vector3 physicsY;
// Token: 0x040005EA RID: 1514
public PlayerBorders playerBorders;
// Token: 0x040005EB RID: 1515
private Vector3 lastFrame;
// Token: 0x040005EC RID: 1516
public bool jumpingPosition;
// Token: 0x040005ED RID: 1517
private float lastFrameTime;
// Token: 0x040005EE RID: 1518
private float jumpPositionTime;
// Token: 0x040005EF RID: 1519
private float previouslyMovingStartTime;
// Token: 0x040005F0 RID: 1520
private Vector3 jumpPositionVector;
// Token: 0x040005F1 RID: 1521
private bool needToEndJump;
// Token: 0x040005F2 RID: 1522
[Header("PATHFINDING")]
public Vector3 nodePoint;
// Token: 0x040005F3 RID: 1523
public Vector3 endTurn;
// Token: 0x040005F4 RID: 1524
public Vector3 movePoint;
// Token: 0x040005F5 RID: 1525
public Vector3 pathTargPosition;
// Token: 0x040005F6 RID: 1526
public Vector3 leashCenter;
// Token: 0x040005F7 RID: 1527
public Vector3 terrainNormal;
// Token: 0x040005F8 RID: 1528
public Vector3 waitPosition;
// Token: 0x040005F9 RID: 1529
public int waitingForPath;
// Token: 0x040005FA RID: 1530
public int nextOpen;
// Token: 0x040005FB RID: 1531
public int nextOpenVisual;
// Token: 0x040005FC RID: 1532
public int nexOpenOverlap;
// Token: 0x040005FD RID: 1533
public int pushCount;
// Token: 0x040005FE RID: 1534
public int blockPathCount;
// Token: 0x040005FF RID: 1535
public GraphNode node;
// Token: 0x04000600 RID: 1536
public GraphNode mainNode2;
// Token: 0x04000601 RID: 1537
public GraphNode mainNode3;
// Token: 0x04000602 RID: 1538
public GraphNode mainNode4;
// Token: 0x04000603 RID: 1539
public GraphNode moveNode;
// Token: 0x04000604 RID: 1540
public GraphNode targetNode;
// Token: 0x04000605 RID: 1541
public GraphNode nextNode;
// Token: 0x04000606 RID: 1542
public GraphNode savedPathTarget;
// Token: 0x04000607 RID: 1543
public GraphNode prevNode;
// Token: 0x04000608 RID: 1544
public GraphNode returnToPoint;
// Token: 0x04000609 RID: 1545
private Vector3 prevPoint;
// Token: 0x0400060A RID: 1546
private Vector3 prevNodePosition;
// Token: 0x0400060B RID: 1547
private Vector3 prevFollowPosition;
// Token: 0x0400060C RID: 1548
private Vector3 randomRot;
// Token: 0x0400060D RID: 1549
public Quaternion rot;
// Token: 0x0400060E RID: 1550
public Quaternion look;
// Token: 0x0400060F RID: 1551
public Quaternion smoothRot;
// Token: 0x04000610 RID: 1552
public Quaternion savedRot;
// Token: 0x04000611 RID: 1553
private bool rotLeft;
// Token: 0x04000612 RID: 1554
private Quaternion startRot;
// Token: 0x04000613 RID: 1555
private Quaternion intervalRot;
// Token: 0x04000614 RID: 1556
private Quaternion jumpingAreasRotation;
// Token: 0x04000615 RID: 1557
public GraphNode slideNode;
// Token: 0x04000616 RID: 1558
public GraphNode lastNode;
// Token: 0x04000617 RID: 1559
public GraphNode fleePoint;
// Token: 0x04000618 RID: 1560
public GraphNode commandMove;
// Token: 0x04000619 RID: 1561
public Vector3 slideNodePosition;
// Token: 0x0400061A RID: 1562
private Character collisionCharacter;
// Token: 0x0400061B RID: 1563
public Character lookTarget;
// Token: 0x0400061C RID: 1564
public Character attackTarget;
// Token: 0x0400061D RID: 1565
public Character moveBackTarget;
// Token: 0x0400061E RID: 1566
public NNConstraint nodeConstraint;
// Token: 0x0400061F RID: 1567
public NNConstraint walkConstraint;
// Token: 0x04000620 RID: 1568
public bool forceNodePath;
// Token: 0x04000621 RID: 1569
public bool rotateToSlope;
// Token: 0x04000622 RID: 1570
public bool moving;
// Token: 0x04000623 RID: 1571
public bool alwaysTurn;
// Token: 0x04000624 RID: 1572
public bool turning;
// Token: 0x04000625 RID: 1573
public bool tempStop;
// Token: 0x04000626 RID: 1574
public bool stepReady;
// Token: 0x04000627 RID: 1575
public bool doTurn;
// Token: 0x04000628 RID: 1576
public bool fleeing;
// Token: 0x04000629 RID: 1577
public bool fleeingAroundPoint;
// Token: 0x0400062A RID: 1578
public bool prepMove;
// Token: 0x0400062B RID: 1579
public bool blocked;
// Token: 0x0400062C RID: 1580
public bool ignoreRemoveControls;
// Token: 0x0400062D RID: 1581
public bool moveTurn;
// Token: 0x0400062E RID: 1582
public bool outsideBounds;
// Token: 0x0400062F RID: 1583
public bool movingOutOfWay;
// Token: 0x04000630 RID: 1584
public bool moveToObject;
// Token: 0x04000631 RID: 1585
public bool movingToPatrolNode;
// Token: 0x04000632 RID: 1586
public bool waitingForNewPath;
// Token: 0x04000633 RID: 1587
public bool jumping;
// Token: 0x04000634 RID: 1588
public bool jumpLanding;
// Token: 0x04000635 RID: 1589
public bool showWaypoint;
// Token: 0x04000636 RID: 1590
public bool noJumpArc;
// Token: 0x04000637 RID: 1591
public bool checkForLeaderPath;
// Token: 0x04000638 RID: 1592
public bool changedFleeArea;
// Token: 0x04000639 RID: 1593
private bool estimatedPathSave;
// Token: 0x0400063A RID: 1594
private bool toDirectionSave;
// Token: 0x0400063B RID: 1595
private bool startTurnExit;
// Token: 0x0400063C RID: 1596
private bool startWithRotate;
// Token: 0x0400063D RID: 1597
private bool turningComplete;
// Token: 0x0400063E RID: 1598
private bool makePathAfterJump;
// Token: 0x0400063F RID: 1599
private float ammoMessageTime;
// Token: 0x04000640 RID: 1600
private float lookTargetTime;
// Token: 0x04000641 RID: 1601
private float jumpTime;
// Token: 0x04000642 RID: 1602
private float timeSinceLastEvade;
// Token: 0x04000643 RID: 1603
private float attackTargetTime;
// Token: 0x04000644 RID: 1604
private float t;
// Token: 0x04000645 RID: 1605
private float intervalY;
// Token: 0x04000646 RID: 1606
private float startRotY;
// Token: 0x04000647 RID: 1607
private float rotationTime;
// Token: 0x04000648 RID: 1608
private float seenTime;
// Token: 0x04000649 RID: 1609
private float waitForPathTime;
// Token: 0x0400064A RID: 1610
private float ttime;
// Token: 0x0400064B RID: 1611
private float moveFollowTime;
// Token: 0x0400064C RID: 1612
private float moveTurnSpeed;
// Token: 0x0400064D RID: 1613
private float moveTurns;
// Token: 0x0400064E RID: 1614
private float totalDist;
// Token: 0x0400064F RID: 1615
private float totalDistNodes;
// Token: 0x04000650 RID: 1616
private float fleeTime;
// Token: 0x04000651 RID: 1617
private float fleeStartTime;
// Token: 0x04000652 RID: 1618
private float returnToPointTime;
// Token: 0x04000653 RID: 1619
private float turnDirection;
// Token: 0x04000654 RID: 1620
private float timeSinceLastDirectiveCheck;
// Token: 0x04000655 RID: 1621
private int moveCount;
// Token: 0x04000656 RID: 1622
private int moveIndex;
// Token: 0x04000657 RID: 1623
private int maxNodesSave;
// Token: 0x04000658 RID: 1624
public int setArea = -1;
// Token: 0x04000659 RID: 1625
private float jumpingAreasTime;
// Token: 0x0400065A RID: 1626
private float patrolSpeed;
// Token: 0x0400065B RID: 1627
private GraphNode jumpAreasNode;
// Token: 0x0400065C RID: 1628
private float turnTimeStarted;
// Token: 0x0400065D RID: 1629
private float waitToNextDodge;
// Token: 0x0400065E RID: 1630
private float jumpSpeed;
// Token: 0x0400065F RID: 1631
public float waitingForNewPathTime;
// Token: 0x04000660 RID: 1632
private List<GraphNode> prepPathTemp;
// Token: 0x04000661 RID: 1633
private List<Vector3> prepVectorPathTemp;
// Token: 0x04000662 RID: 1634
public List<string> nodeActions = new List<string>();
// Token: 0x04000663 RID: 1635
public List<GraphNode> nodePath = new List<GraphNode>();
// Token: 0x04000664 RID: 1636
public List<GraphNode> prepPath = new List<GraphNode>();
// Token: 0x04000665 RID: 1637
public List<Vector3> vectorPath = new List<Vector3>();
// Token: 0x04000666 RID: 1638
public List<Vector3> prepVectorPath = new List<Vector3>();
// Token: 0x04000667 RID: 1639
private List<Vector3> pathpointVectors;
// Token: 0x04000668 RID: 1640
private List<Vector3> pointsTemp = new List<Vector3>();
// Token: 0x04000669 RID: 1641
private List<GraphNode> nodesTemp = new List<GraphNode>();
// Token: 0x0400066A RID: 1642
public global::Item clickedItem;
// Token: 0x0400066B RID: 1643
public Character followingCharacter;
// Token: 0x0400066C RID: 1644
public string followingType;
// Token: 0x0400066D RID: 1645
private float followingTime;
// Token: 0x0400066E RID: 1646
public GraphNode followingNode;
// Token: 0x0400066F RID: 1647
public global::Item followingItem;
// Token: 0x04000670 RID: 1648
public PuzzleActions followingInteractive;
// Token: 0x04000671 RID: 1649
public BreakableActions followingBreakable;
// Token: 0x04000672 RID: 1650
public ChestActions followingChest;
// Token: 0x04000673 RID: 1651
public DoorActions followingDoor;
// Token: 0x04000674 RID: 1652
public Boat followingBoat;
// Token: 0x04000675 RID: 1653
public MapExitActions followingExit;
// Token: 0x04000676 RID: 1654
private List<GraphNode> tempPath;
// Token: 0x04000677 RID: 1655
private List<GraphNode> tempPath2;
// Token: 0x04000678 RID: 1656
public Interact moveToInteract;
// Token: 0x04000679 RID: 1657
public Transform moveFollow;
// Token: 0x0400067A RID: 1658
public int pathTries;
// Token: 0x0400067B RID: 1659
public int attackRadiusTries;
// Token: 0x0400067C RID: 1660
private Seeker seeker;
// Token: 0x0400067D RID: 1661
private SimpleSmoothModifier simpleSmoothModifier;
// Token: 0x0400067E RID: 1662
private RaycastModifier raycastModifier;
// Token: 0x0400067F RID: 1663
public float blockedTime;
// Token: 0x04000680 RID: 1664
public float timeSinceFollowPath;
// Token: 0x04000681 RID: 1665
private bool canPush = true;
// Token: 0x04000682 RID: 1666
public IEnumerator pathToCharacterCoroutine;
// Token: 0x04000683 RID: 1667
public IEnumerator worldUIFade;
// Token: 0x04000684 RID: 1668
public float delayPath;
// Token: 0x04000685 RID: 1669
public Vector3 clickedPoint;
// Token: 0x04000686 RID: 1670
private NNConstraint interactConstraint = new NNConstraint();
// Token: 0x04000687 RID: 1671
private List<GraphNode> allNodes;
// Token: 0x04000688 RID: 1672
private List<GraphNode> suitableNodes = new List<GraphNode>();
// Token: 0x04000689 RID: 1673
private List<bool> used = new List<bool>();
// Token: 0x0400068A RID: 1674
private List<GraphNode> bestNodes = new List<GraphNode>();
// Token: 0x0400068B RID: 1675
private List<GraphNode> nearNodes = new List<GraphNode>();
// Token: 0x0400068C RID: 1676
[Header("MISC")]
public bool setupComplete;
// Token: 0x0400068D RID: 1677
private Vector3 vectorZero;
// Token: 0x0400068E RID: 1678
private Vector3 upVector;
// Token: 0x0400068F RID: 1679
private Vector3 yAdd3;
// Token: 0x04000690 RID: 1680
private Vector3 yAdd2;
// Token: 0x04000691 RID: 1681
private Vector3 yAdd1;
// Token: 0x04000692 RID: 1682
private Vector3 headHeight;
// Token: 0x04000693 RID: 1683
private Vector3 torsoHeight;
// Token: 0x04000694 RID: 1684
private RaycastHit rayHit;
// Token: 0x04000695 RID: 1685
public string goreType;
// Token: 0x04000696 RID: 1686
public int updateCount;
// Token: 0x04000697 RID: 1687
public Vector3 torsoPosition;
// Token: 0x04000698 RID: 1688
public Vector3 raycastPosition;
// Token: 0x04000699 RID: 1689
private float updateTime;
// Token: 0x0400069A RID: 1690
private float quipStartTime;
// Token: 0x0400069B RID: 1691
private float tileCheckUpdateTime;
// Token: 0x0400069C RID: 1692
private float sporeTime;
// Token: 0x0400069D RID: 1693
public float postHitTime;
// Token: 0x0400069E RID: 1694
public float heightAdd;
// Token: 0x0400069F RID: 1695
public float attackSpeed;
// Token: 0x040006A0 RID: 1696
public float timeSinceMoveEnded;
// Token: 0x040006A1 RID: 1697
public float patrolHoldTime;
// Token: 0x040006A2 RID: 1698
public float spinTime;
// Token: 0x040006A3 RID: 1699
public float timeSinceCircle;
// Token: 0x040006A4 RID: 1700
private bool currentlyInDialogue;
// Token: 0x040006A5 RID: 1701
private bool slowLook;
// Token: 0x040006A6 RID: 1702
private bool huddleOn;
// Token: 0x040006A7 RID: 1703
private bool waitingForSpinUp;
// Token: 0x040006A8 RID: 1704
public IEnumerator delayPathCoroutine;
// Token: 0x040006A9 RID: 1705
private float timeSinceHeardTime;
// Token: 0x040006AA RID: 1706
private float collidedTime;
// Token: 0x040006AB RID: 1707
private float timeSinceSeenTime;
// Token: 0x040006AC RID: 1708
private float lastIdleQuipTime;
// Token: 0x040006AD RID: 1709
private float attentionTime;
// Token: 0x040006AE RID: 1710
private float prevAnimSpeed;
// Token: 0x040006AF RID: 1711
private float prePausedSpeed;
// Token: 0x040006B0 RID: 1712
private float lastExcuseTime;
// Token: 0x040006B1 RID: 1713
private float kickUseTime;
// Token: 0x040006B2 RID: 1714
private float soundTime;
// Token: 0x040006B3 RID: 1715
private float fatigueUpdateTime;
// Token: 0x040006B4 RID: 1716
private float lastGhostFleeTime;
// Token: 0x040006B5 RID: 1717
private float chargeTime;
// Token: 0x040006B6 RID: 1718
public int attentionCount;
// Token: 0x040006B7 RID: 1719
public int waitingToUseBeltItemID;
// Token: 0x040006B8 RID: 1720
public int waitingToUseBeltItemIndex;
// Token: 0x040006B9 RID: 1721
public global::Item waitingToUseBagItem;
// Token: 0x040006BA RID: 1722
private StringFast str = new StringFast(64);
// Token: 0x040006BB RID: 1723
public int instrumentInUse;
// Token: 0x040006BC RID: 1724
public bool emphasizeQuip;
// Token: 0x040006BD RID: 1725
public float blockDodgeStartTime;
// Token: 0x040006BE RID: 1726
private bool waitingForDodgeUp;
// Token: 0x040006BF RID: 1727
public float inQueuedAbilityTime;
// Token: 0x040006C0 RID: 1728
public float inActionTime;
// Token: 0x040006C1 RID: 1729
public float inRecoveryTime;
// Token: 0x040006C2 RID: 1730
public float dazedTime;
// Token: 0x040006C3 RID: 1731
public float pickupTime;
// Token: 0x040006C4 RID: 1732
public float missingTime;
// Token: 0x040006C5 RID: 1733
public int dazedCount;
// Token: 0x040006C6 RID: 1734
[Header("OBJECTS")]
public Transform tr;
// Token: 0x040006C7 RID: 1735
public GameObject sphere;
// Token: 0x040006C8 RID: 1736
public GameObject waypoint;
// Token: 0x040006C9 RID: 1737
public GameObject bodyObj;
// Token: 0x040006CA RID: 1738
public GameObject goreObj;
// Token: 0x040006CB RID: 1739
public OverHeadUI quip;
// Token: 0x040006CC RID: 1740
public Boat boat;
// Token: 0x040006CD RID: 1741
private Gauge stunGauge;
// Token: 0x040006CE RID: 1742
private Gauge sneakGauge;
// Token: 0x040006CF RID: 1743
private Gauge itemGauge;
// Token: 0x040006D0 RID: 1744
private Gauge dazedGauge;
// Token: 0x040006D1 RID: 1745
public Body body;
// Token: 0x040006D2 RID: 1746
public Transform grassInteraction;
// Token: 0x040006D3 RID: 1747
public Animator animator;
// Token: 0x040006D4 RID: 1748
private Animator waypointAnimator;
// Token: 0x040006D5 RID: 1749
public Stats stats;
// Token: 0x040006D6 RID: 1750
public GameObject seen;
// Token: 0x040006D7 RID: 1751
public GameObject heard;
// Token: 0x040006D8 RID: 1752
public Portrait characterSheetPortrait;
// Token: 0x040006D9 RID: 1753
public Portrait portrait;
// Token: 0x040006DA RID: 1754
public DockFriend dockFriend;
// Token: 0x040006DB RID: 1755
public Rigidbody rb;
// Token: 0x040006DC RID: 1756
public AudioSource audioSource;
// Token: 0x040006DD RID: 1757
public CreatureActions creatures;
// Token: 0x040006DE RID: 1758
public TimelineIcon timelineIcon;
// Token: 0x040006DF RID: 1759
public CapsuleCollider thisCollider;
// Token: 0x040006E0 RID: 1760
public FOWRevealer fowRevealer;
// Token: 0x040006E1 RID: 1761
public FOWRevealerInterior fowRevealerInterior;
// Token: 0x040006E2 RID: 1762
public Moonlight moonlight;
// Token: 0x040006E3 RID: 1763
public GameObject mapIcon;
// Token: 0x040006E4 RID: 1764
public Transform lookAtTurnTarget;
// Token: 0x040006E5 RID: 1765
public Animator circleAnimator;
// Token: 0x040006E6 RID: 1766
public Transform circleTr;
// Token: 0x040006E7 RID: 1767
private GameObject circle;
// Token: 0x040006E8 RID: 1768
private List<MeshRenderer> circleRenderers = new List<MeshRenderer>();
// Token: 0x040006E9 RID: 1769
private MeshRenderer waypointRenderer;
// Token: 0x040006EA RID: 1770
private MeshRenderer hoverWaypointRenderer;
// Token: 0x040006EB RID: 1771
private bool usingCircles;
// Token: 0x040006EC RID: 1772
public GameObject bracket;
// Token: 0x040006ED RID: 1773
public GameObject heart;
// Token: 0x040006EE RID: 1774
public Animator dazed;
// Token: 0x040006EF RID: 1775
private GameObject incense;
// Token: 0x040006F0 RID: 1776
public GameObject healthBar;
// Token: 0x040006F1 RID: 1777
public GameObject healthBarTarget;
// Token: 0x040006F2 RID: 1778
public Transform healthBarTr;
// Token: 0x040006F3 RID: 1779
private Vector3 healthBarScale;
// Token: 0x040006F4 RID: 1780
public GameObject staminaBar;
// Token: 0x040006F5 RID: 1781
public Transform staminaBarTr;
// Token: 0x040006F6 RID: 1782
private Vector3 staminaBarScale;
// Token: 0x040006F7 RID: 1783
public Transform neck;
// Token: 0x040006F8 RID: 1784
public List<GameObject> headEffects = new List<GameObject>();
// Token: 0x040006F9 RID: 1785
private List<int> headEffectsID = new List<int>();
// Token: 0x040006FA RID: 1786
private List<string> headEffectsExtras = new List<string>();
// Token: 0x040006FB RID: 1787
private int currentEffect;
// Token: 0x040006FC RID: 1788
private float currentEffectTime;
// Token: 0x040006FD RID: 1789
private GameObject dodgeFX;
// Token: 0x040006FE RID: 1790
private GameObject boroBoat;
// Token: 0x040006FF RID: 1791
public bool hasInfoCard;
// Token: 0x04000700 RID: 1792
public Character friendLeader;
// Token: 0x04000701 RID: 1793
public EnemyGroup group;
// Token: 0x04000702 RID: 1794
public PuzzleActions revivalGem;
// Token: 0x04000703 RID: 1795
public StatusRing statusRing;
// Token: 0x04000704 RID: 1796
public Stamina stamina;
// Token: 0x04000705 RID: 1797
public GameObject oar;
// Token: 0x04000706 RID: 1798
public GameObject splash;
// Token: 0x04000707 RID: 1799
public GameObject waterCollider;
// Token: 0x04000708 RID: 1800
private Rigidbody waterColliderRigidbody;
// Token: 0x04000709 RID: 1801
private WaterCollisions waterCollisions;
// Token: 0x0400070A RID: 1802
[Header("ARC")]
private float gravity = -9.81f;
// Token: 0x0400070B RID: 1803
private float initialVelocity = 3f;
// Token: 0x0400070C RID: 1804
private Quaternion bearing;
// Token: 0x0400070D RID: 1805
private int trajectoryModifier = 1;
// Token: 0x0400070E RID: 1806
private Vector3 projectileVelocity;
// Token: 0x0400070F RID: 1807
private Vector3 arcTarget;
// Token: 0x04000710 RID: 1808
private float trajectoryPrecision = 20f;
// Token: 0x04000711 RID: 1809
private int maximumIterations = 50;
// Token: 0x04000712 RID: 1810
private Vector3 gravity2 = new Vector3(0f, -9.81f, 0f);
// Token: 0x04000713 RID: 1811
public LineRenderer lineRendererToDrawTrajectory;
// Token: 0x04000714 RID: 1812
private Vector3 prevPos;
// Token: 0x04000715 RID: 1813
public List<Vector3> arcPoints = new List<Vector3>();
// Token: 0x04000716 RID: 1814
public int currentArcIndex;
// Token: 0x04000717 RID: 1815
private Vector3 previousPosition;
// Token: 0x04000718 RID: 1816
private Vector3 topJumpPoint;
// Token: 0x04000719 RID: 1817
public CollisionListener bouncer;
// Token: 0x0400071A RID: 1818
private Vector3 savedBounceVel;
// Token: 0x0400071B RID: 1819
private Vector3 savedBounceAngVel;
}