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

4069 lines
113 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using Pathfinding;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
// Token: 0x0200002E RID: 46
public class Fellowship : MonoBehaviour
{
// Token: 0x060006EF RID: 1775 RVA: 0x00094B38 File Offset: 0x00092D38
private void Start()
{
this.playerInput = base.gameObject.GetComponent<PlayerInput>();
this.moveAction = this.playerInput.actions["Move"];
this.directionAction = this.playerInput.actions["Target"];
this.party = Links.x.party;
this.waypoint = Links.x.cellar.GetPooledGameObject(0);
this.waypoint.SetActive(false);
this.waypointAnimator = this.waypoint.transform.GetChild(0).gameObject.GetComponent<Animator>();
this.waypoint.transform.parent = base.transform;
this.gameplayCircleTiles = Links.x.gameplay.circleTiles;
this.nodeConstraintDir.constrainWalkability = true;
this.nodeConstraintDir.walkable = true;
this.nodeConstraintDir.constrainTags = false;
this.nodeConstraintDir.checkCircleID = 0;
this.nodeConstraintDir.passID = 0;
this.nodeConstraintDir.passID2 = 0;
this.nodeConstraintDir.constrainPenalty = 0;
this.nodeConstraintDir.checkConnections = 8;
this.nodeConstraintDir.constrainToArea = -1;
Shader.SetGlobalVector("_JoystickDirection", Links.x.gameplay.farPosition);
this.checkTime = Time.timeSinceLevelLoad;
this.portraitParentRoleSheet = Links.x.characterSheet.portraitParent;
this.currentFormationPoints = this.formationPoints1;
this.GetFormation();
}
// Token: 0x060006F0 RID: 1776 RVA: 0x00094CC6 File Offset: 0x00092EC6
public int CharacterIndex(Character character)
{
return this.party.IndexOf(character);
}
// Token: 0x060006F1 RID: 1777 RVA: 0x00094CD4 File Offset: 0x00092ED4
public int GroupLevel()
{
int num = 0;
for (int i = 0; i < this.party.Count; i++)
{
Character character = this.party[i];
if (character && character.IsSentient() && character.party)
{
num += character.stats.level;
}
}
return num;
}
// Token: 0x060006F2 RID: 1778 RVA: 0x00094D30 File Offset: 0x00092F30
public void SetPartyNodes(string type)
{
bool flag = false;
if (type == "Moving")
{
flag = true;
}
for (int i = 0; i < this.party.Count; i++)
{
if (!this.party[i].CanMove())
{
this.party[i].SetNodeID(true, flag);
}
}
}
// Token: 0x060006F3 RID: 1779 RVA: 0x00094D8A File Offset: 0x00092F8A
public void NewScene()
{
this.nodeConstraint = new NNConstraint();
this.nodeConstraintParty = new NNConstraint();
this.nodeConstraintFormation = new NNConstraint();
this.mouseNode = null;
this.canPath = true;
}
// Token: 0x060006F4 RID: 1780 RVA: 0x00094DBC File Offset: 0x00092FBC
public GraphNode NearNode(Vector3 pos, bool checkEmpty, bool overWater, bool spellTargetingGround, int checkCircle, int area)
{
if (!Links.x.gaia.pathfindingReady)
{
return null;
}
this.nodeConstraint.constrainWalkability = true;
this.nodeConstraint.walkable = true;
this.nodeConstraint.constrainTags = checkEmpty;
this.nodeConstraintDir.checkCircleID = checkCircle;
this.nodeConstraint.passID = 0;
this.nodeConstraint.passID2 = 0;
this.nodeConstraint.constrainPenalty = 0;
this.nodeConstraint.checkConnections = 0;
this.nodeConstraint.constrainToArea = area;
if (overWater)
{
this.nodeConstraint.constrainToEnvironment = 2;
}
else if (spellTargetingGround)
{
this.nodeConstraint.constrainToEnvironment = 3;
}
else
{
this.nodeConstraint.constrainToEnvironment = 1;
}
if (!(AstarPath.active != null))
{
return null;
}
GraphNode node = AstarPath.active.GetNearest(pos, this.nodeConstraint).node;
if (node != null)
{
return node;
}
return null;
}
// Token: 0x060006F5 RID: 1781 RVA: 0x00094EA8 File Offset: 0x000930A8
public bool GetDirection(Character character, out Quaternion rot, out Vector3 moveSpeed)
{
rot = Quaternion.Euler(Vector3.zero);
moveSpeed = Vector3.zero;
if (Links.x.joy && (Links.x.gameplay.hudLeftOpen || Links.x.gameplay.hudRightOpen || Links.x.gameplay.descWindowOpen))
{
this.joyStickDown = true;
return false;
}
if (Links.x.joy && (this.joyStickDown || Links.x.gameplay.aimHold || Links.x.gameplay.gameFeedScrolling || Links.x.gameplay.makeCircleMode))
{
return false;
}
if (Records.x.paused)
{
return false;
}
float num = this.angle;
Quaternion rot2 = character.rot;
this.angle = Mathf.Atan2(this.move.x, this.move.y) / 3.1415927f * 180f;
if (this.angle < 0f)
{
this.angle += 360f;
}
if (Input.GetKeyDown(Links.x.gameplay.keyControl.GetHotkey("Left")))
{
this.keyDown = "Left";
}
if (Input.GetKeyDown(Links.x.gameplay.keyControl.GetHotkey("Right")))
{
this.keyDown = "Right";
}
if (Input.GetKeyDown(Links.x.gameplay.keyControl.GetHotkey("Up")))
{
this.keyDown = "Up";
}
if (Input.GetKeyDown(Links.x.gameplay.keyControl.GetHotkey("Down")))
{
this.keyDown = "Down";
}
if (this.keyDown == "Left" && !Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Left")))
{
this.keyDown = "";
}
if (this.keyDown == "Right" && !Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Right")))
{
this.keyDown = "";
}
if (this.keyDown == "Up" && !Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Up")))
{
this.keyDown = "";
}
if (this.keyDown == "Down" && !Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Down")))
{
this.keyDown = "";
}
float y = Links.x.worldCamera.transform.rotation.eulerAngles.y;
bool flag = false;
if (Links.x.mk)
{
if (Input.GetMouseButton(0) && Links.x.pathfind)
{
float num2 = 0.5f;
if (!Links.x.worldCamera.orthographic)
{
num2 = 1.25f;
}
Vector3 right = Links.x.rtsCamera.gameObject.transform.right;
Vector3 vector = character.tr.position + right * -1f * num2;
Vector3 vector2 = character.tr.position + right * num2;
Vector3 vector3 = character.tr.position + new Vector3(0f, num2, 0f);
Vector3 vector4 = character.tr.position - new Vector3(0f, num2, 0f);
Vector3 vector5 = Links.x.worldCamera.WorldToViewportPoint(character.tr.position);
Vector3 vector6 = Links.x.worldCamera.WorldToViewportPoint(vector);
Vector3 vector7 = Links.x.worldCamera.WorldToViewportPoint(vector2);
Vector3 vector8 = Links.x.worldCamera.WorldToViewportPoint(vector3);
Vector3 vector9 = Links.x.worldCamera.WorldToViewportPoint(vector4);
Vector2 vector10 = new Vector2(vector5.x, vector5.y) - new Vector2(0.5f, 0.5f);
new Vector2(vector5.x, vector5.y) - new Vector2(Input.mousePosition.x / (float)Screen.width, Input.mousePosition.y / (float)Screen.height);
Vector3 vector11 = new Vector3(Input.mousePosition.x / (float)Screen.width, Input.mousePosition.y / (float)Screen.height, 0f);
float num3 = Mathf.Atan2(Input.mousePosition.x / (float)Screen.width - (0.5f + vector10.x), Input.mousePosition.y / (float)Screen.height - (0.5f + vector10.y)) / 3.1415927f * 180f;
if (vector11.x > vector6.x && vector11.x < vector7.x && vector11.y > vector9.y && vector11.y < vector8.y && character.mainSelected)
{
this.angle = num;
}
else
{
character.fellowshipMod = 1f;
this.angle = num3;
}
rot = Quaternion.Euler(new Vector3(0f, this.angle + y, 0f));
flag = true;
}
else
{
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Left")) && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Up")))
{
rot = Quaternion.Euler(new Vector3(0f, 315f + y, 0f));
flag = true;
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Right")) && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Up")))
{
rot = Quaternion.Euler(new Vector3(0f, 45f + y, 0f));
flag = true;
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Left")) && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Down")))
{
rot = Quaternion.Euler(new Vector3(0f, 225f + y, 0f));
flag = true;
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Right")) && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Down")))
{
rot = Quaternion.Euler(new Vector3(0f, 135f + y, 0f));
flag = true;
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Right")) && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Left")))
{
if (this.keyDown == "Left")
{
rot = Quaternion.Euler(new Vector3(0f, 270f + y, 0f));
flag = true;
}
else
{
rot = Quaternion.Euler(new Vector3(0f, 90f + y, 0f));
flag = true;
}
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Up")) && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Down")))
{
if (this.keyDown == "Down")
{
rot = Quaternion.Euler(new Vector3(0f, 180f + y, 0f));
flag = true;
}
else
{
rot = Quaternion.Euler(new Vector3(0f, 0f + y, 0f));
flag = true;
}
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Left")))
{
rot = Quaternion.Euler(new Vector3(0f, 270f + y, 0f));
flag = true;
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Right")))
{
rot = Quaternion.Euler(new Vector3(0f, 90f + y, 0f));
flag = true;
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Down")))
{
rot = Quaternion.Euler(new Vector3(0f, 180f + y, 0f));
flag = true;
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Up")))
{
rot = Quaternion.Euler(new Vector3(0f, 0f + y, 0f));
flag = true;
}
}
}
if (Links.x.mk)
{
if (flag)
{
this.t += Time.deltaTime;
if (this.t > 1f)
{
this.t = 1f;
}
}
else
{
this.t -= Time.deltaTime;
if (this.t < 0f)
{
this.t = 0f;
}
}
moveSpeed = new Vector3(this.t, 0f, this.t);
}
if (Links.x.joy)
{
rot = Quaternion.Euler(new Vector3(0f, this.angle + y, 0f));
if (this.angle > 0f)
{
flag = true;
}
moveSpeed = new Vector3(this.move.x, 0f, this.move.y);
}
if (flag && character.mainSelected)
{
this.formationHead.rotation = Quaternion.LookRotation(Links.x.main.tr.position + rot * Vector3.forward * 0.5f - Links.x.main.tr.position);
}
return flag;
}
// Token: 0x060006F6 RID: 1782 RVA: 0x00095994 File Offset: 0x00093B94
public bool MakeDirectionalWaypoint(bool endOfPath)
{
if (!Links.x.main || Links.x.main)
{
return false;
}
if (Links.x.joy)
{
this.joyStickDown = true;
return false;
}
if (Links.x.joy && this.joyStickDown)
{
return false;
}
if (Records.x.paused)
{
return false;
}
Vector3 zero = Vector3.zero;
Quaternion quaternion = Quaternion.Euler(Vector3.zero);
float num = Mathf.Atan2(this.move.x, this.move.y) / 3.1415927f * 180f;
if (num < 0f)
{
num += 360f;
}
if (Input.GetKeyDown(Links.x.gameplay.keyControl.GetHotkey("Left")))
{
this.keyDown = "Left";
}
if (Input.GetKeyDown(Links.x.gameplay.keyControl.GetHotkey("Right")))
{
this.keyDown = "Right";
}
if (Input.GetKeyDown(Links.x.gameplay.keyControl.GetHotkey("Up")))
{
this.keyDown = "Up";
}
if (Input.GetKeyDown(Links.x.gameplay.keyControl.GetHotkey("Down")))
{
this.keyDown = "Down";
}
if (this.keyDown == "Left" && !Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Left")))
{
this.keyDown = "";
}
if (this.keyDown == "Right" && !Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Right")))
{
this.keyDown = "";
}
if (this.keyDown == "Up" && !Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Up")))
{
this.keyDown = "";
}
if (this.keyDown == "Down" && !Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Down")))
{
this.keyDown = "";
}
if (this.prevKeyDown != this.keyDown)
{
this.prevConnection1 = null;
this.prevConnection2 = null;
this.prevConnection3 = null;
}
float num2 = Links.x.worldCamera.transform.rotation.eulerAngles.y + Records.x.gridOffset;
bool flag = false;
Vector3 vector = Links.x.main.tr.position;
if (Links.x.mk)
{
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Left")) && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Up")))
{
quaternion = Quaternion.Euler(new Vector3(0f, 315f + num2, 0f));
flag = true;
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Right")) && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Up")))
{
quaternion = Quaternion.Euler(new Vector3(0f, 45f + num2, 0f));
flag = true;
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Left")) && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Down")))
{
quaternion = Quaternion.Euler(new Vector3(0f, 225f + num2, 0f));
flag = true;
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Right")) && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Down")))
{
quaternion = Quaternion.Euler(new Vector3(0f, 135f + num2, 0f));
flag = true;
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Right")) && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Left")))
{
if (this.keyDown == "Left")
{
quaternion = Quaternion.Euler(new Vector3(0f, 270f + num2, 0f));
flag = true;
}
else
{
quaternion = Quaternion.Euler(new Vector3(0f, 90f + num2, 0f));
flag = true;
}
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Up")) && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Down")))
{
if (this.keyDown == "Down")
{
quaternion = Quaternion.Euler(new Vector3(0f, 180f + num2, 0f));
flag = true;
}
else
{
quaternion = Quaternion.Euler(new Vector3(0f, 0f + num2, 0f));
flag = true;
}
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Left")))
{
quaternion = Quaternion.Euler(new Vector3(0f, 270f + num2, 0f));
flag = true;
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Right")))
{
quaternion = Quaternion.Euler(new Vector3(0f, 90f + num2, 0f));
flag = true;
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Down")))
{
quaternion = Quaternion.Euler(new Vector3(0f, 180f + num2, 0f));
flag = true;
}
if (!flag && Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Up")))
{
quaternion = Quaternion.Euler(new Vector3(0f, 0f + num2, 0f));
flag = true;
}
}
if (Links.x.joy)
{
quaternion = Quaternion.Euler(new Vector3(0f, num + num2, 0f));
if (num > 0f)
{
flag = true;
}
}
this.prevKeyDown = this.keyDown;
bool flag2 = false;
if (this.savedRot != quaternion && !Links.x.joy)
{
flag2 = true;
}
this.savedRot = quaternion;
if (flag && Links.x.hasMain && (endOfPath || (!endOfPath && !Links.x.main.moving) || (!endOfPath && flag2)) && !Records.x.pocketPause)
{
Character main = Links.x.main;
Vector3 vector2 = main.moveFollow.position;
if (main.node != null)
{
vector2 = (Vector3)main.node.position;
}
if ((endOfPath || main.CanMakePath()) && main.IsSentient())
{
Vector3 vector3 = vector2 + quaternion * Vector3.forward * Records.x.nodeSize;
Debug.DrawRay(vector2, quaternion * Vector3.forward * 2f, Color.white, 2f);
main.StopMoveToRoutine();
main.ClearMoveTargets();
this.nodeConstraintDir.constrainWalkability = true;
this.nodeConstraintDir.walkable = true;
this.nodeConstraintDir.constrainTags = false;
this.nodeConstraintDir.passID = main.nodeStationaryID;
this.nodeConstraintDir.passID2 = main.nodeMovingID;
this.nodeConstraintDir.constrainPenalty = 0;
this.nodeConstraintDir.checkConnections = main.ConnectionNumber();
this.nodeConstraintDir.constrainToArea = -1;
this.nodeConstraint.constrainToEnvironment = 1;
RaycastHit raycastHit;
if (Physics.Raycast(vector3 + new Vector3(0f, 3f, 0f), Vector3.up * -1f, out raycastHit, 10f, 4456449))
{
vector3 = raycastHit.point;
}
float num3 = Records.x.nodeSize + 0.5f;
GraphNode graphNode = null;
Vector3 vector4 = (Vector3)main.node.position;
float num4 = -1f;
Character character = null;
for (int i = 0; i < 8; i++)
{
GraphNode graphNode2 = main.node.ConnectionFromIndex(i);
if (graphNode2 != null)
{
Vector3 vector5 = (Vector3)graphNode2.position;
Vector3 vector6 = Quaternion.LookRotation(vector3 - vector4) * Vector3.forward;
Vector3 vector7 = Vector3.Normalize(vector5 - vector4);
float num5 = Vector3.Dot(vector6, vector7);
if (num5 >= -0.25f && num5 > num4)
{
this.nodeConstraintDir.constrainTags = main.hasActions;
if (this.nodeConstraintDir.Suitable(graphNode2))
{
bool flag3 = true;
if (!main.hasActions)
{
for (int j = 0; j < 8; j++)
{
int num6 = graphNode2.ConnectionID(j);
if (num6 != main.nodeStationaryID && num6 != main.nodeMovingID)
{
Character character2 = null;
if (!main.ConnectionIsStill(num6, out character2))
{
flag3 = false;
character = character2;
}
}
}
}
if (flag3)
{
num4 = num5;
graphNode = graphNode2;
}
}
}
}
}
if (character)
{
character.EndPath();
}
if (graphNode == null)
{
graphNode = main.node;
}
if (graphNode != null)
{
(Vector3)graphNode.position;
if (Vector3.Distance((Vector3)graphNode.position, vector3) < num3)
{
vector = vector3;
}
else
{
vector = (Vector3)graphNode.position;
}
if (flag2 && main.NodesCount() > 0)
{
main.ClearNodePath();
}
main.pathTargPosition = (Vector3)graphNode.position;
Links.x.main.AddKeyNode(graphNode, vector);
this.SetFormationHead(graphNode);
this.savedRot = quaternion;
return true;
}
}
}
return false;
}
// Token: 0x060006F7 RID: 1783 RVA: 0x0009640C File Offset: 0x0009460C
public void SetFormationHead(GraphNode n)
{
Character character = Links.x.main;
if (character.summoned)
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i].selected && !this.party[i].summoned)
{
character = this.party[i];
this.party[i].SetAsLeader();
break;
}
}
}
if ((Vector3)n.position != character.tr.position)
{
this.formationHead.rotation = Quaternion.LookRotation((Vector3)n.position - character.tr.position);
}
this.formationHead.position = (Vector3)n.position;
}
// Token: 0x060006F8 RID: 1784 RVA: 0x000964E8 File Offset: 0x000946E8
public GraphNode GetFormationPosition(GraphNode node, Character character, bool useLine)
{
GraphNode graphNode = null;
int num;
if (!character.vipFollow)
{
num = Links.x.GetPortraitIndexWaypoints(character);
if (character.summoned)
{
num = 4 + Links.x.GetPartySummonsIDReal(character);
if (!useLine && num > 3)
{
num = 3;
}
}
}
else
{
num = 3;
if (useLine)
{
num = 4;
}
}
if (node == null)
{
return null;
}
this.nodeConstraintFormation.constrainToArea = (int)node.Area;
this.nodeConstraintFormation.walkable = true;
this.nodeConstraintFormation.constrainWalkability = true;
this.nodeConstraintFormation.constrainTags = true;
this.nodeConstraintFormation.checkCircleID = 1;
this.nodeConstraintFormation.passID = character.nodeStationaryID;
this.nodeConstraintFormation.passID2 = character.nodeMovingID;
this.nodeConstraintFormation.constrainPenalty = 2;
this.nodeConstraintFormation.checkConnections = character.ConnectionNumber();
if (Records.x.partySailing)
{
this.nodeConstraintFormation.constrainToEnvironment = 2;
}
else
{
this.nodeConstraintFormation.constrainToEnvironment = 1;
}
if (this.companionNode1 != null && !Records.x.InCombat(false))
{
if (num == 1)
{
return this.companionNode1;
}
if (num == 2 && this.companionNode2 != null)
{
return this.companionNode2;
}
if (num == 3 && this.companionNode3 != null)
{
return this.companionNode3;
}
if (character.summoned && this.companionNode4 != null)
{
GraphNode graphNode2 = character.NearNode((Vector3)this.companionNode4.position, true, 0, -1, character.CheckCircleID());
if (graphNode2 != null)
{
return graphNode2;
}
}
}
bool flag = false;
if (num > 1 && character.hasActions && !useLine)
{
num = Mathf.RoundToInt((float)num / 2f);
}
character.portraitID = (float)num;
if (num == 0)
{
return node;
}
GraphNode graphNode3 = node;
int num2 = 0;
Vector3 vector = this.formationHead.forward * (float)num * -2f + (Vector3)node.position;
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i])
{
if (this.party[i].moving)
{
if (this.party[i].savedPathTarget != null)
{
this.party[i].savedPathTarget.planningA = 1;
}
}
else if (this.party[i].node != null)
{
this.party[i].node.planningA = 1;
}
}
}
if (useLine)
{
this.nodeConstraintFormation.constrainTags = true;
this.nodeConstraintFormation.constrainPenalty = 2;
this.nodeConstraintFormation.constrainWalkability = true;
this.nodeConstraintFormation.uniqueID = 1;
int num3 = -1;
if (Links.x.main && Links.x.main.node != null)
{
num3 = (int)Links.x.main.node.Area;
}
this.nodeConstraint.constrainToArea = num3;
vector = this.formationHead.forward * (float)num * -2.5f + (Vector3)node.position;
if (num % 2 == 0)
{
vector += this.formationHead.right * 2.5f;
}
else
{
vector += this.formationHead.right * -2.5f;
}
graphNode = AstarPath.active.GetNearest(vector, this.nodeConstraint).node;
}
else
{
int num4 = num;
if (flag)
{
num4 = 1;
}
for (int j = 0; j < 50; j++)
{
this.nodeConstraintFormation.constrainTags = true;
this.nodeConstraintFormation.constrainPenalty = 2;
this.nodeConstraintFormation.constrainWalkability = true;
this.nodeConstraintFormation.uniqueID = 0;
GraphNode graphNode4 = graphNode3.ClosestConnectionDirectional(graphNode3, character.nodeStationaryID, character.nodeMovingID, 10000f, vector, (int)character.radius, character.ConnectionNumber(), this.nodeConstraintFormation, null, null, null, 0, -1);
if (graphNode4 != null)
{
(Vector3)graphNode3.position;
(Vector3)graphNode3.position;
this.nodeConstraintFormation.uniqueID = 1;
if (this.nodeConstraintFormation.Suitable(graphNode4))
{
num2++;
graphNode = graphNode4;
if (num2 >= num4)
{
break;
}
graphNode3 = graphNode4;
vector -= this.formationHead.forward * 2.5f;
}
else
{
graphNode3 = graphNode4;
vector -= this.formationHead.forward * 1.5f;
}
}
else
{
this.nodeConstraintFormation.constrainTags = false;
this.nodeConstraintFormation.constrainPenalty = 0;
this.nodeConstraintFormation.constrainWalkability = false;
this.nodeConstraintFormation.uniqueID = 0;
graphNode4 = graphNode3.ClosestConnectionDirectional(graphNode3, 0, 0, 10000f, vector, 1, 0, this.nodeConstraintFormation, null, null, null, 0, -1);
if (graphNode4 != null)
{
graphNode3 = graphNode4;
}
vector -= this.formationHead.forward * 3f;
}
if (j % 5 == 0 && j >= 10)
{
vector += this.formationHead.right * 2f;
}
if (j % 8 == 0 && j >= 10)
{
vector += this.formationHead.right * -2f;
}
}
}
for (int k = 0; k < this.party.Count; k++)
{
if (this.party[k])
{
if (this.party[k].moving)
{
if (this.party[k].savedPathTarget != null)
{
this.party[k].savedPathTarget.planningA = 0;
}
}
else if (this.party[k].node != null)
{
this.party[k].node.planningA = 0;
}
}
}
return graphNode;
}
// Token: 0x060006F9 RID: 1785 RVA: 0x00096B10 File Offset: 0x00094D10
public GraphNode GetFormationPointInCircle(Character c)
{
GraphNode graphNode = c.node;
if (this.circleTiles.Contains(graphNode))
{
return graphNode;
}
if (c.summoned && !Links.x.main.hasCircleBuff && Records.x.InCombat(false))
{
return graphNode;
}
this.nodeConstraintFormation.constrainToArea = -1;
this.nodeConstraintFormation.walkable = true;
this.nodeConstraintFormation.constrainWalkability = true;
this.nodeConstraintFormation.constrainTags = true;
this.nodeConstraintFormation.checkCircleID = 1;
this.nodeConstraintFormation.passID = c.nodeStationaryID;
this.nodeConstraintFormation.passID2 = c.nodeMovingID;
this.nodeConstraintFormation.constrainPenalty = 0;
this.nodeConstraintFormation.checkConnections = c.ConnectionNumber();
if (Records.x.partySailing)
{
this.nodeConstraintFormation.constrainToEnvironment = 2;
}
else
{
this.nodeConstraintFormation.constrainToEnvironment = 1;
}
this.openTiles.Clear();
for (int i = 0; i < this.circleTiles.Count; i++)
{
GraphNode graphNode2 = this.circleTiles[i];
if (this.nodeConstraintFormation.Suitable(graphNode2))
{
bool flag = false;
for (int j = 0; j < this.party.Count; j++)
{
if (this.party[j] && this.party[j].savedPathTarget == graphNode2)
{
flag = true;
}
}
if (!flag)
{
this.openTiles.Add(graphNode2);
}
}
}
Vector3 vector = Links.x.gameplay.frontOfCircle;
float num = float.PositiveInfinity;
if (c.stats.formationGroup >= 4 && c.stats.formationGroup <= 6)
{
vector = Links.x.gameplay.middleCircle;
}
if (c.stats.formationGroup >= 7 && c.stats.formationGroup <= 9)
{
vector = Links.x.gameplay.backOfCircle;
}
for (int k = 0; k < this.openTiles.Count; k++)
{
float sqrMagnitude = ((Vector3)this.openTiles[k].position - vector).sqrMagnitude;
if (sqrMagnitude < num)
{
num = sqrMagnitude;
graphNode = this.openTiles[k];
}
}
return graphNode;
}
// Token: 0x060006FA RID: 1786 RVA: 0x00096D64 File Offset: 0x00094F64
public void MakeWaypoints(Vector3 mousePoint, GraphNode moveToNode, bool estimatePath, bool overWater)
{
if (Links.x.hasMain)
{
bool flag = EventSystem.current.IsPointerOverGameObject();
if ((flag && (moveToNode != null || this.newFormation)) || !flag)
{
this.mPoint = mousePoint;
this.mouseNode = null;
if (mousePoint != Vector3.zero && (estimatePath || Input.GetMouseButtonDown(0)) && this.mouseNode == null && Links.x.main.node != null)
{
this.mouseNode = this.NearNode(mousePoint, false, overWater, false, 0, (int)Links.x.main.node.Area);
}
GraphNode graphNode = this.mouseNode;
bool flag2 = false;
if (moveToNode != null)
{
graphNode = moveToNode;
flag2 = true;
if (!Links.x.hasMain)
{
return;
}
}
else
{
graphNode = Links.x.gameplay.mouseNode;
}
if (graphNode != null && estimatePath)
{
this.StartEstimatePath(graphNode);
}
bool flag3 = false;
if (Links.x.gameplay.quickReposition || (Links.x.pocketWheel.open && (Links.x.pocketWheel.selected == "Command Group" || Links.x.pocketWheel.selected == "Command Reposition")))
{
flag3 = true;
}
if (graphNode != null && !estimatePath)
{
this.canPath = true;
if ((this.canPath && Input.GetMouseButtonDown(0)) || flag2 || this.newFormation || flag3)
{
if (this.estimatePathRoutine != null)
{
base.StopCoroutine(this.estimatePathRoutine);
this.estimatePathRoutine = null;
}
if (!flag2 && this.scatterCoroutine != null)
{
base.StopCoroutine(this.scatterCoroutine);
}
if (!this.drawingSquare)
{
this.creatingPath = true;
this.SetFormationHead(graphNode);
Links.x.gameplay.NewPaths();
int num = 0;
this.pickedNodes.Clear();
Character character = null;
if (Records.x.partySailing)
{
Links.x.gaia.boro.showWaypoint = true;
Links.x.gaia.boro.MakePath(this.mouseNode, 500, false, false, true);
}
else
{
for (int i = 0; i < this.party.Count; i++)
{
Character character2 = this.party[i];
if (((!flag3 && character2.mainSelected) || (flag3 && !character2.mainSelected)) && character2.IsSentient() && !character2.isBoro && !character2.pipeSummons)
{
bool flag4 = true;
character2.running = false;
if (character2.hasActions && character2.actions.cannotInterrupt)
{
flag4 = false;
character2.actions.TryingToInterruptInventoryWait();
}
if (flag4)
{
character2.StopMoveToRoutine();
if (!flag2)
{
character2.ClearMoveTargets();
}
num++;
if (!character2.mainSelected)
{
if (!character)
{
character = character2;
this.pickedNodes.Add(graphNode);
}
else
{
GraphNode graphNode2;
if (character2.inCircle)
{
if (this.circleTiles.Contains(graphNode))
{
graphNode2 = this.GetFormationPointInCircle(character2);
}
else
{
graphNode2 = this.GetFormationPosition(graphNode, character2, true);
}
}
else
{
graphNode2 = this.GetFormationPosition(graphNode, character2, true);
}
if (graphNode2 == null)
{
graphNode2 = graphNode;
}
this.pickedNodes.Add(graphNode2);
}
}
else
{
this.pickedNodes.Add(graphNode);
}
}
else
{
this.pickedNodes.Add(null);
}
}
else
{
this.pickedNodes.Add(null);
}
}
for (int j = 0; j < this.pickedNodes.Count; j++)
{
Character character3 = this.party[j];
if (this.pickedNodes[j] != null && character3)
{
if (character3.stats.Overburdened())
{
character3.StartQuip("I'm overburdened");
}
if (character3.actions)
{
if (character3.actions && !character3.mainSelected)
{
character3.actions.ClearSelectedActionRealTime();
}
if (character3.actions && !character3.mainSelected)
{
character3.actions.Interrupt();
}
if (character3.actions)
{
character3.actions.CheckIfRunningAI();
}
if (character3.actions)
{
character3.actions.hasWaypoint = true;
}
}
if (!flag2)
{
character3.ClearMoveTargets();
}
if (!character3.mainSelected)
{
character3.ClearPathUpdates();
character3.showWaypoint = true;
if (flag2 && Links.x.main.followingType != "Dialogue" && !flag3)
{
character3.followingType = Links.x.main.followingType;
character3.followingExit = Links.x.main.followingExit;
character3.followingBoat = Links.x.main.followingBoat;
character3.followingNode = Links.x.main.followingNode;
character3.followingCharacter = Links.x.main.followingCharacter;
if (!character3.CheckEarlyIfInRange())
{
character3.MakePath(this.pickedNodes[j], 500, false, false, true);
}
}
else if (Records.x.paused || Records.x.pocketPause || flag3)
{
if (!Links.x.pocketWheel.selected.Contains("Group") || !Links.x.pocketWheel.open)
{
character3.showWaypoint = true;
if (character3 == character)
{
character3.SetWaypoint(mousePoint);
}
else
{
character3.SetWaypoint((Vector3)this.pickedNodes[j].position);
}
character3.commandMove = this.pickedNodes[j];
}
else
{
character3.showWaypoint = false;
}
character3.StartDelayedPath(this.pickedNodes[j], (float)j, (float)j * 0.02f + Random.Range(0f, 0.02f));
if (flag3 && character3.actions && character3.actions.hasTarget)
{
float num2 = character3.AttackRange();
if (character3.actions.selectedTargetInteractive)
{
if (Vector3.Distance((Vector3)this.pickedNodes[j].position, character3.actions.selectedTargetInteractive.transform.position) > num2)
{
character3.actions.SetSelectedTarget(false, null, null, null);
}
}
else if (character3.actions.selectedTarget && Vector3.Distance((Vector3)this.pickedNodes[j].position, character3.actions.selectedTarget.currentPosition) > num2)
{
character3.actions.SetSelectedTarget(false, null, null, null);
}
}
}
else
{
character3.StartDelayedPath(this.pickedNodes[j], (float)j, (float)j * 0.02f + Random.Range(0f, 0.02f));
}
}
else
{
character3.clickedPoint = mousePoint;
character3.ClearPathUpdates();
character3.showWaypoint = true;
character3.pathTargPosition = (Vector3)this.pickedNodes[j].position;
character3.MakePath(this.pickedNodes[j], 500, false, false, true);
}
if (Links.x.gameplay.doubleClick && (Records.x.editor || Records.x.secrets))
{
character3.running = true;
}
}
}
}
this.waypoint.transform.position = mousePoint;
}
this.creatingPath = false;
this.previousClick = (Vector3)graphNode.position;
}
}
this.newFormation = false;
}
}
}
// Token: 0x060006FB RID: 1787 RVA: 0x00097570 File Offset: 0x00095770
public void StartEstimatePath(GraphNode mNode)
{
if (this.prevNode == mNode && Time.timeSinceLevelLoad > this.prevNodeTime + 0.5f)
{
this.prevNode = null;
this.prevNodeTime = Time.timeSinceLevelLoad;
}
if (this.combatWait || !Records.x.combat)
{
this.prevNode = null;
this.combatWait = false;
}
if (false && this.estimatePathRoutine == null && mNode != null && !Links.x.combat.combatCinematics && !Links.x.gameplay.targetingCharacter && this.prevNode != mNode)
{
this.estimatePathRoutine = this.EstimatePath(mNode);
base.StartCoroutine(this.estimatePathRoutine);
this.prevNode = mNode;
}
this.canPath = true;
}
// Token: 0x060006FC RID: 1788 RVA: 0x00097633 File Offset: 0x00095833
private IEnumerator EstimatePath(GraphNode mNode)
{
if (!this.creatingPath)
{
Character mainCharacter = Links.x.main;
this.pickedNodesEstimated.Clear();
this.SetFormationHead(mNode);
for (int j = 0; j < this.party.Count; j++)
{
if (this.party[j].mainSelected)
{
GraphNode formationPosition = this.GetFormationPosition(mNode, this.party[j], true);
if (formationPosition != null)
{
this.pickedNodesEstimated.Add(formationPosition);
}
else
{
this.pickedNodesEstimated.Add(null);
this.waypoint.transform.position = Links.x.gameplay.farPosition;
}
}
else
{
this.pickedNodesEstimated.Add(null);
}
}
int num2;
for (int i = 0; i < this.pickedNodesEstimated.Count; i = num2 + 1)
{
if (i < this.party.Count && this.party[i] && this.pickedNodesEstimated[i] != null && this.party[i].node != null)
{
this.SetNodeConstraint(this.party[i], true, true, false, 0, 1);
ABPath p = ABPath.ConstructFast(this.party[i].node, this.pickedNodesEstimated[i], null);
p.nnConstraint = this.nodeConstraint;
AstarPath.StartPath(p, false);
yield return base.StartCoroutine(p.WaitForPath());
p.Claim(this);
if (!p.error)
{
this.canPath = true;
this.path = p.path;
this.waypoint.transform.position = (Vector3)this.pickedNodesEstimated[i].position - new Vector3(0f, 0.5f, 0f);
if (!Links.x.gameplay.targetingCharacter && !Links.x.gameplay.spellTargetingGround)
{
(Vector3)this.pickedNodesEstimated[i].position;
int num = 0;
for (int k = 0; k < this.path.Count; k++)
{
if (this.path[k] != null)
{
if (k == 0)
{
if (this.path[k] != mainCharacter.node)
{
(Vector3)this.path[k].position;
GraphNode graphNode = this.path[k];
num++;
}
}
else
{
(Vector3)this.path[k].position;
GraphNode graphNode2 = this.path[k];
num++;
}
}
}
}
}
else
{
this.canPath = false;
this.waypoint.transform.position = Links.x.gameplay.farPosition;
}
p.Release(this, false);
p = null;
}
num2 = i;
}
mainCharacter = null;
}
bool flag = this.canPath;
this.estimatePathRoutine = null;
yield break;
}
// Token: 0x060006FD RID: 1789 RVA: 0x00097649 File Offset: 0x00095849
public void AddHudPortraitChange(Character character)
{
if (this.portraitHudUpdate.IndexOf(character) < 0)
{
this.portraitHudUpdate.Add(character);
}
}
// Token: 0x060006FE RID: 1790 RVA: 0x00097666 File Offset: 0x00095866
public void AddPortraitChange(Character character)
{
if (this.portraitUpdate.IndexOf(character) < 0)
{
this.portraitUpdate.Add(character);
}
}
// Token: 0x060006FF RID: 1791 RVA: 0x00097684 File Offset: 0x00095884
private void Update()
{
this.move = this.moveAction.ReadValue<Vector2>();
this.direction = this.directionAction.ReadValue<Vector2>();
if (this.joyStickDown && this.move.magnitude < 0.2f)
{
this.joyStickDown = false;
}
if (Links.x.joy)
{
bool flag = false;
if (Mathf.Abs(this.move.magnitude) > 0.1f && Links.x.hasMain && !Links.x.pocketWheel.spellbook.activeSelf && !Links.x.gameplay.inPartyDock && !Links.x.gameplay.gameFeedScrolling && ((Records.x.pocketPause && Links.x.pocketWheel.targetSelection) || (!Records.x.pocketPause && Links.x.gameplay.aimHold)) && Links.x.main.IsSentient() && !Records.x.inMenus && !Records.x.removeControls && !Records.x.typing && !Links.x.gameplay.dockDown && !Links.x.gameplay.badgeScrolling)
{
this.angle = Mathf.Atan2(this.move.x, this.move.y) / 3.1415927f * 180f;
float y = Links.x.worldCamera.transform.rotation.eulerAngles.y;
if (this.angle < 0f)
{
this.angle += 360f;
}
Quaternion quaternion = Quaternion.Euler(new Vector3(0f, this.angle + y, 0f));
Vector3 vector = Links.x.main.tr.position + quaternion * Vector3.forward * 10f;
Shader.SetGlobalVector("_JoystickDirection", vector);
Shader.SetGlobalFloat("_JoystickMagnitude", Mathf.Abs(this.move.magnitude));
flag = true;
}
if (!flag)
{
Shader.SetGlobalVector("_JoystickDirection", Links.x.gameplay.farPosition);
}
}
if (this.portraitUpdate.Count > 0 && Links.x.gaia.sceneLoaded)
{
Links.x.renderPortraits.AddCharacter(this.portraitUpdate[0], this.portraitUpdate[0].stats.xmlName, this.portraitUpdate[0].characterSheetPortrait, false, null, null, null, null);
this.portraitUpdate.RemoveAt(0);
}
if (Time.timeSinceLevelLoad > this.updateTime + 0.05f && !Records.x.paused && !Records.x.paused && Links.x.gaia.sceneLoaded && !Records.x.pocketPause && this.waypointRoutine == null)
{
this.StartCheckIfAtTargetLocation();
this.updateTime = Time.timeSinceLevelLoad;
}
if (Time.timeSinceLevelLoad > this.checkTime + 2f && Links.x.gaia.sceneLoaded)
{
this.checkTime = Time.timeSinceLevelLoad;
Links.x.renderPortraits.CheckForModel();
}
if (Records.x.circle)
{
this.CheckCircle();
this.CheckCircleMorale();
}
if (this.fading)
{
this.currentDither = Mathf.Lerp(this.startDither, this.endDither, this.fadeAmount * 1f);
if ((this.endDither == 1f && this.currentDither >= 1f) || (this.endDither == 0f && this.currentDither <= 0f))
{
this.fading = false;
}
this.fadeAmount += Time.deltaTime * 1.5f;
}
}
// Token: 0x06000700 RID: 1792 RVA: 0x00097AB0 File Offset: 0x00095CB0
public bool EveryoneInPosition(Character c)
{
int num = 0;
for (int i = 0; i < this.party.Count; i++)
{
Character character = this.party[i];
if (character && character.node != null)
{
Vector3 position = character.sphere.transform.position;
float sqrMagnitude = ((Vector3)character.node.position - position).sqrMagnitude;
if (character.moving || character.moveNode != null || character.tempStop || character.NodesCount() != 0 || sqrMagnitude >= 0.36f)
{
num++;
}
}
}
return num == 0;
}
// Token: 0x06000701 RID: 1793 RVA: 0x00097B60 File Offset: 0x00095D60
public void FreshBlinks()
{
foreach (Character character in this.party)
{
if (character && character.party)
{
Links.x.renderPortraits.FreshBlinks(character);
}
}
}
// Token: 0x06000702 RID: 1794 RVA: 0x00097BCC File Offset: 0x00095DCC
public void ClearCompanionNodes()
{
this.companionNode1 = null;
this.companionNode2 = null;
this.companionNode3 = null;
this.companionNode4 = null;
}
// Token: 0x06000703 RID: 1795 RVA: 0x00097BEC File Offset: 0x00095DEC
public void SetUpCompanionNodes(Transform c1, Transform c2, Transform c3, Transform c4)
{
if (Records.x.editor)
{
Debug.Log(string.Concat(new string[]
{
"SETUP NODES ",
(c1 != null) ? c1.ToString() : null,
" ",
(c2 != null) ? c2.ToString() : null,
" ",
(c3 != null) ? c3.ToString() : null,
" ",
(c4 != null) ? c4.ToString() : null
}));
}
this.ClearCompanionNodes();
if (c1)
{
this.companionNode1 = this.NearNode(c1.position, false, false, false, 1, -1);
}
if (c2)
{
this.companionNode2 = this.NearNode(c2.position, false, false, false, 1, -1);
}
if (c3)
{
this.companionNode3 = this.NearNode(c3.position, false, false, false, 1, -1);
}
if (c4)
{
this.companionNode4 = this.NearNode(c4.position, false, false, false, 1, -1);
}
}
// Token: 0x06000704 RID: 1796 RVA: 0x00097CFA File Offset: 0x00095EFA
public void AddRallySpeed(float amt)
{
this.rallySpeed += amt;
}
// Token: 0x06000705 RID: 1797 RVA: 0x00097D0C File Offset: 0x00095F0C
public void SetWaitPositions()
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i])
{
this.party[i].waitPosition = this.party[i].currentPosition;
}
}
}
// Token: 0x06000706 RID: 1798 RVA: 0x00097D64 File Offset: 0x00095F64
public bool InCircle(Vector3 n, bool mustBeInside)
{
Vector3 vector = Vector3.zero;
float num = 5f;
if (mustBeInside)
{
num = 1.5f;
}
for (int i = 0; i < this.circleTiles.Count; i++)
{
vector = (Vector3)this.circleTiles[i].position;
float num2 = vector.x - n.x;
if (num2 < 0f)
{
num2 *= -1f;
}
if (num2 < num)
{
float num3 = vector.z - n.z;
if (num3 < 0f)
{
num3 *= -1f;
}
if (num3 < num)
{
return true;
}
}
}
return false;
}
// Token: 0x06000707 RID: 1799 RVA: 0x00097E08 File Offset: 0x00096008
public void StartCircle(Vector3 clampedPoint)
{
if (this.breakRoutine != null)
{
base.StopCoroutine(this.breakRoutine);
}
Records.x.circle = true;
this.circleTiles.Clear();
for (int i = 0; i < this.gameplayCircleTiles.Count; i++)
{
this.circleTiles.Add(this.gameplayCircleTiles[i]);
this.gameplayCircleTiles[i].circle = 1;
if (this.gameplayCircleTiles[i].Penalty == 0U)
{
this.circleTiles[i].Penalty = 8000U;
}
}
this.timeOutsideCircle.Clear();
for (int j = 0; j < this.party.Count; j++)
{
if (this.party[j] && !this.party[j].pipeSummons && !this.party[j].isBoro)
{
this.party[j].inCircle = true;
this.party[j].commandMove = null;
}
this.timeOutsideCircle.Add(-1f);
}
this.morale = 100;
Links.x.hudControl.SetMorale((float)this.morale);
this.dioramaCharacters = Links.x.diorama.characters;
this.DrawCircle(clampedPoint);
for (int k = 0; k < this.circleTiles.Count; k++)
{
Links.x.cameraEffects.GroupCharacters((Vector3)this.circleTiles[k].position, null, true);
}
this.StartCircleFade(false);
}
// Token: 0x06000708 RID: 1800 RVA: 0x00097FB4 File Offset: 0x000961B4
public void StartCircleFade(bool fadeOut)
{
if (fadeOut)
{
this.startDither = 0f;
this.endDither = 1f;
}
else
{
this.startDither = 1f;
this.endDither = 0f;
}
this.currentDither = this.startDither;
this.fadeAmount = 0f;
this.fading = true;
}
// Token: 0x06000709 RID: 1801 RVA: 0x00098010 File Offset: 0x00096210
public void RemovePartyFromCircle(Character p)
{
int num = this.party.IndexOf(p);
if (num > -1)
{
this.timeOutsideCircle.RemoveAt(num);
}
}
// Token: 0x0600070A RID: 1802 RVA: 0x0009803A File Offset: 0x0009623A
public void AddPartyToCircle(Character p)
{
this.timeOutsideCircle.Add(-1f);
}
// Token: 0x0600070B RID: 1803 RVA: 0x0009804C File Offset: 0x0009624C
private void CheckCircleMorale()
{
bool flag = false;
bool flag2 = false;
int num = this.morale;
int num2 = 0;
for (int i = 0; i < this.party.Count; i++)
{
Character character = this.party[i];
if (character && character.inCircle && !character.pipeSummons && !character.isBoro)
{
num2++;
}
}
int num3 = 1;
int num4 = 1;
int num5 = 1;
if (num3 < 1)
{
num3 = 1;
}
int num6 = 3;
int num7 = 0;
int num8 = 0;
int num9 = 0;
float seconds = Links.x.gameplay.seconds;
for (int j = 0; j < this.party.Count; j++)
{
Character character2 = this.party[j];
if (character2 && character2.IsSentient() && character2.inCircle && !character2.pipeSummons && !character2.summoned && !character2.isBoro)
{
bool flag3;
if (!character2.hasCircleBuff)
{
if (this.timeOutsideCircle[j] == 0f)
{
num9++;
this.timeOutsideCircle[j] = seconds;
flag3 = true;
}
else if (this.timeOutsideCircle[j] == -1f)
{
num9++;
if (character2.hasCircleBuff)
{
this.timeOutsideCircle[j] = 0f;
}
flag3 = true;
}
else if (seconds > this.timeOutsideCircle[j] + 6f)
{
flag3 = false;
}
else
{
num9++;
flag3 = true;
}
}
else
{
num9++;
this.timeOutsideCircle[j] = 0f;
flag3 = character2.IsSentient();
if (!character2.IsSentient())
{
flag2 = true;
}
}
if (flag3)
{
num8++;
}
}
}
if (num8 < num3)
{
flag = true;
}
else
{
if (num8 <= num4)
{
num7++;
}
if (num8 <= num5)
{
num7++;
}
}
if (!flag)
{
this.intruderTemp.Clear();
this.intruderTimeTemp.Clear();
int num10 = 0;
int num11 = 0;
int num12 = 0;
for (int k = 0; k < this.dioramaCharacters.Count; k++)
{
Character character3 = this.dioramaCharacters[k];
if (character3 && character3.npc && (character3.hostility >= 2 || character3.attackingUntilBribe) && this.InCircle(character3.currentPosition, true))
{
int num13 = this.intruders.IndexOf(character3);
if (num13 == -1)
{
this.intruderTemp.Add(character3);
this.intruderTimeTemp.Add(seconds);
}
else
{
float num14 = this.intruderTime[num13];
this.intruderTemp.Add(character3);
this.intruderTimeTemp.Add(num14);
if (seconds > num14 + 100f)
{
num10++;
if (seconds > num14 + 400f)
{
num12++;
}
}
else
{
num11++;
}
}
}
}
this.intruders.Clear();
this.intruderTime.Clear();
int num15 = 0;
for (int l = 0; l < this.intruderTemp.Count; l++)
{
this.intruders.Add(this.intruderTemp[l]);
this.intruderTime.Add(this.intruderTimeTemp[l]);
if (seconds > this.intruderTimeTemp[l] + 60f)
{
num15++;
}
}
if (num10 >= num6 || num12 > 0)
{
flag2 = true;
flag = true;
}
if (num10 >= 1)
{
num7++;
}
if (num11 >= 1)
{
num7++;
}
if (num15 >= 2)
{
num7++;
}
if (num7 == 0)
{
this.morale = 100;
}
if (num7 == 1)
{
this.morale = 50;
}
if (num7 >= 2)
{
this.morale = 10;
}
Links.x.hudControl.SetMorale((float)this.morale);
if (num != this.morale)
{
}
if (!flag)
{
for (int m = 0; m < this.circleTiles.Count; m++)
{
if (this.circleTiles[m].Penalty == 0U)
{
this.circleTiles[m].Penalty = 8000U;
}
}
}
}
if (flag)
{
this.BreakCircle(flag2);
Links.x.gameplay.circleBreakObject.SetActive(false);
}
}
// Token: 0x0600070C RID: 1804 RVA: 0x000984D0 File Offset: 0x000966D0
private void ReturnLines(int l)
{
for (int i = 0; i < this.lines.Count; i++)
{
Links.x.cellar.ReturnPooledGameObject(l, this.lines[i]);
}
this.lines.Clear();
}
// Token: 0x0600070D RID: 1805 RVA: 0x0009851C File Offset: 0x0009671C
private void DrawCircle(Vector3 clampedPoint)
{
float num = 9f;
int num2 = 60;
int num3 = this.linenum;
this.linenum = 127;
if (this.morale > 33 && this.morale < 66)
{
this.linenum = 126;
}
if (this.morale <= 33)
{
this.linenum = 125;
}
if (this.linenum != num3)
{
this.ReturnLines(num3);
}
bool flag = true;
Vector3 vector = Vector3.zero;
Vector3 vector2 = Vector3.up * -1f;
Vector3 forward = Vector3.forward;
Vector3 zero = Vector3.zero;
float num4 = 0.25f;
Vector3 vector3 = clampedPoint;
vector3.y += 1.5f;
197120;
Quaternion quaternion = Quaternion.identity;
Vector3 vector4 = clampedPoint;
Vector3 one = Vector3.one;
int num5 = 0;
this.positions.Clear();
for (int i = 0; i < this.circleTiles.Count; i++)
{
vector = (Vector3)this.circleTiles[i].position;
int num6 = 12;
if (flag)
{
num6 = 6;
}
float num7 = 6.2831855f / (float)num6;
float num8 = 1.8f;
if (flag)
{
num8 = 1.8f;
}
for (int j = 0; j < num6; j++)
{
float num9 = (float)j * num7;
float num10 = num8 * Mathf.Cos(num9);
float num11 = num8 * Mathf.Sin(num9);
vector = (Vector3)this.circleTiles[i].position;
vector.x += num10;
vector.z += num11;
this.positions.Add(vector);
}
}
this.linesPoints.Clear();
float num12 = 6.2831855f / (float)num2;
for (int k = 0; k < num2 + 1; k++)
{
int num13 = k;
if (k == num2)
{
num13 = 0;
}
float num9 = (float)num13 * num12;
float num10 = num * Mathf.Cos(num9);
float num11 = num * Mathf.Sin(num9);
vector = clampedPoint;
vector.x += num10;
vector.z += num11;
float num14 = 200f;
int num15 = -1;
for (int l = 0; l < this.positions.Count; l++)
{
this.positions[l].y = vector.y;
float sqrMagnitude = (this.positions[l] - vector).sqrMagnitude;
if (sqrMagnitude < num14)
{
num14 = sqrMagnitude;
num15 = l;
}
}
if (num15 > -1)
{
vector = this.positions[num15];
}
else
{
vector = Vector3.zero;
}
if (vector.x != 0f && vector.z != 0f)
{
float y = vector.y;
vector.y += 3f;
RaycastHit raycastHit;
if (Physics.Raycast(vector, vector2, out raycastHit, 8f, Links.x.floor))
{
vector.y = raycastHit.point.y + num4;
}
else
{
vector.y = y + num4;
}
if (vector4 != vector)
{
quaternion = Quaternion.LookRotation(vector4 - vector);
if (k > 0)
{
if (flag)
{
this.linesPoints.Add(vector);
}
else
{
GameObject gameObject;
if (num5 < this.lines.Count)
{
gameObject = this.lines[num5];
}
else
{
gameObject = Links.x.cellar.GetPooledGameObject(this.linenum);
this.lines.Add(gameObject);
gameObject.SetActive(true);
}
gameObject.transform.position = vector;
gameObject.transform.rotation = quaternion;
num5++;
one.z = Vector3.Distance(vector4, vector);
gameObject.transform.localScale = one;
}
}
vector4 = vector;
}
}
}
if (num5 < this.lines.Count)
{
for (int m = num5; m < this.lines.Count; m++)
{
Links.x.cellar.ReturnPooledGameObject(this.linenum, this.lines[m]);
this.lines[m] = null;
}
this.lines.RemoveAll((GameObject item) => item == null);
}
float num16 = float.PositiveInfinity;
Vector3 vector5 = Vector3.zero;
for (int n = 0; n < this.linesPoints.Count; n++)
{
float sqrMagnitude2 = (this.linesPoints[n] - Links.x.gameplay.backOfCircle).sqrMagnitude;
if (sqrMagnitude2 < num16)
{
num16 = sqrMagnitude2;
vector5 = this.linesPoints[n];
}
}
if (vector5 != Vector3.zero)
{
Links.x.gameplay.circleBreakObject.SetActive(true);
Links.x.gameplay.circleBreakObject.transform.position = vector5;
Vector3 eulerAngles = Quaternion.LookRotation(Links.x.worldCamera.gameObject.transform.position - vector5).eulerAngles;
eulerAngles.x = 0f;
eulerAngles.z = 0f;
Links.x.gameplay.circleBreakObject.transform.rotation = Quaternion.Euler(eulerAngles);
}
}
// Token: 0x0600070E RID: 1806 RVA: 0x00098ABD File Offset: 0x00096CBD
public void BreakCircle(bool fromEnemies)
{
Records.x.circle = false;
if (this.breakRoutine != null)
{
base.StopCoroutine(this.breakRoutine);
}
this.breakRoutine = this.BreakCircleFade(fromEnemies);
base.StartCoroutine(this.breakRoutine);
}
// Token: 0x0600070F RID: 1807 RVA: 0x00098AF8 File Offset: 0x00096CF8
private IEnumerator BreakCircleFade(bool fromEnemies)
{
Links.x.hudControl.SetFalseStayBack();
if (fromEnemies)
{
Links.x.hudControl.CircleBreak();
}
Links.x.gameplay.circleBreakObject.SetActive(false);
for (int i = 0; i < this.party.Count; i++)
{
Character character = this.party[i];
if (character && !character.isBoro)
{
character.inCircle = false;
character.hasCircleBuff = false;
character.stats.HealEffect("CircleHarmony");
if (fromEnemies)
{
Effects effects = character.gameObject.AddComponent<Effects>();
Links.x.cellar.AddEffects(effects);
effects.gameObject.SetActive(true);
effects.source = character;
effects.target = character;
effects.effectName = "CircleBreak";
effects.Inflicted(false);
}
}
}
if (fromEnemies)
{
this.timeToNextCircle = 0f;
}
else
{
this.timeToNextCircle = 0f;
}
this.StartCircleFade(true);
while (this.fading)
{
yield return null;
}
for (int j = 0; j < this.circleTiles.Count; j++)
{
this.circleTiles[j].circle = 0;
if (this.circleTiles[j].Penalty == 8000U)
{
this.circleTiles[j].Penalty = 0U;
}
}
Links.x.gameplay.BreakCircle();
this.ReturnLines(this.linenum);
this.breakRoutine = null;
yield break;
}
// Token: 0x06000710 RID: 1808 RVA: 0x00098B10 File Offset: 0x00096D10
public void CheckCircle()
{
for (int i = 0; i < this.party.Count; i++)
{
Character character = this.party[i];
if (character)
{
bool hasCircleBuff = character.hasCircleBuff;
bool flag = false;
for (int j = 0; j < this.circleTiles.Count; j++)
{
if (!flag)
{
Vector3 vector = (Vector3)this.circleTiles[j].position;
vector.y = character.currentPosition.y;
if ((vector - character.currentPosition).sqrMagnitude < 4f)
{
flag = true;
}
}
}
if (flag)
{
if (!hasCircleBuff)
{
character.hasCircleBuff = true;
if (!character.stats.HasEffect("CircleHarmony"))
{
Effects effects = character.gameObject.AddComponent<Effects>();
Links.x.cellar.AddEffects(effects);
effects.gameObject.SetActive(true);
effects.source = character;
effects.target = character;
effects.effectName = "CircleHarmony";
effects.sourceLevel = this.AverageLevel();
effects.Inflicted(false);
}
}
}
else if (hasCircleBuff)
{
character.hasCircleBuff = false;
character.stats.HealEffect("CircleHarmony");
}
}
}
}
// Token: 0x06000711 RID: 1809 RVA: 0x00098C60 File Offset: 0x00096E60
private float AverageLevel()
{
float num = 0f;
float num2 = 0f;
for (int i = 0; i < this.portraitOrder.Count; i++)
{
if (this.portraitOrder[i])
{
num += (float)this.portraitOrder[i].stats.level;
num2 += 1f;
}
}
return num / num2;
}
// Token: 0x06000712 RID: 1810 RVA: 0x00098CC8 File Offset: 0x00096EC8
public void SetFriends()
{
if (Records.x.editor)
{
this.friend1.Clear();
this.friend2.Clear();
for (int i = 0; i < this.portraitOrder.Count; i++)
{
if (this.friend1.Count < 2)
{
this.friend1.Add(this.portraitOrder[i]);
}
else
{
this.friend2.Add(this.portraitOrder[i]);
}
}
for (int j = 0; j < this.party.Count; j++)
{
if (this.party[j].summoned)
{
this.friend1.Add(this.party[j]);
}
}
}
}
// Token: 0x06000713 RID: 1811 RVA: 0x00098D8E File Offset: 0x00096F8E
public bool InFriendGroup(Character c)
{
return this.friend1.Contains(c) || this.friend2.Contains(c);
}
// Token: 0x06000714 RID: 1812 RVA: 0x00098DB4 File Offset: 0x00096FB4
public bool IsGroupLeader(Character c, out Character groupLeader)
{
groupLeader = null;
if (c.mainSelected)
{
if (this.friend1.Contains(c))
{
groupLeader = c;
return true;
}
if (this.friend2.Contains(c))
{
groupLeader = c;
return true;
}
}
else
{
if (this.friend1.Contains(c))
{
for (int i = 0; i < this.friend1.Count; i++)
{
if (this.friend1[i].mainSelected)
{
groupLeader = this.friend1[i];
return false;
}
}
if (this.friend1.Count > 0)
{
if (this.friend1[0] == c)
{
groupLeader = c;
return true;
}
groupLeader = this.friend1[0];
return false;
}
}
if (this.friend2.Contains(c))
{
for (int j = 0; j < this.friend2.Count; j++)
{
if (this.friend2[j].mainSelected)
{
groupLeader = this.friend2[j];
return false;
}
}
if (this.friend2.Count > 0)
{
if (this.friend2[0] == c)
{
groupLeader = c;
return true;
}
groupLeader = this.friend2[0];
return false;
}
}
}
return false;
}
// Token: 0x06000715 RID: 1813 RVA: 0x00098EF4 File Offset: 0x000970F4
public bool TeleportParty(bool always)
{
bool flag = false;
if (Links.x.main.indoorID == "?")
{
Links.x.main.indoorID = "";
}
if (Links.x.main.node == null)
{
return false;
}
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && (!flag || always))
{
Character character = this.party[i];
if (!character.mainSelected && !character.isBoro && character.IsSentient() && !character.inCircle)
{
if (character.indoorID == "?")
{
character.indoorID = "";
}
bool flag2 = false;
if (character.indoorID != Links.x.main.indoorID || character.desiredGraph != Links.x.main.desiredGraph || flag2 || always)
{
Links.x.GetPartyID(character);
Vector3 eulerAngles = Links.x.main.tr.rotation.eulerAngles;
eulerAngles.x = 0f;
eulerAngles.z = 0f;
eulerAngles.y *= -1f;
this.formationHead.rotation = Quaternion.Euler(eulerAngles);
GraphNode graphNode = Links.x.fellowship.GetFormationPosition(Links.x.main.node, character, false);
bool flag3;
if (graphNode != null)
{
Vector3 vector = (Vector3)graphNode.position;
vector.y = Links.x.main.tr.position.y;
if ((vector - Links.x.main.tr.position).sqrMagnitude > 625f)
{
flag3 = false;
graphNode = null;
}
else
{
flag3 = true;
}
}
else
{
flag3 = true;
}
if (flag3)
{
character.TargetReached();
character.ClearPathUpdatesAll();
if (character.actions)
{
if (character.actions)
{
character.actions.ClearSelectedActionRealTime();
}
if (character.actions)
{
character.actions.Interrupt();
}
if (character.actions)
{
character.actions.CheckIfRunningAI();
}
}
character.body.turnOnMagicaClothNextFrame = 5;
character.body.SetMagicaClothState(false);
if (graphNode != null)
{
character.tr.position = (Vector3)graphNode.position;
character.SetRotation(Quaternion.LookRotation((Vector3)graphNode.position - Links.x.main.tr.position), false, true);
character.FirstPosition(graphNode);
}
else
{
character.tr.position = Links.x.main.tr.position + new Vector3(1f, 0f, 1f);
character.FirstPosition(null);
}
if (character.actions)
{
character.actions.EndTurn(true);
}
character.MakeRandomPathAfterJump();
flag = true;
}
}
}
}
}
return flag;
}
// Token: 0x06000716 RID: 1814 RVA: 0x0009924C File Offset: 0x0009744C
public void StartCheckIfAtTargetLocation()
{
if (Records.x.partySailing)
{
return;
}
if (Records.x.removeControls)
{
return;
}
if (this.waypointRoutine == null && Links.x.main && !this.TeleportParty(false))
{
this.waypointRoutine = this.CheckIfAtTargetLocation();
base.StartCoroutine(this.waypointRoutine);
}
}
// Token: 0x06000717 RID: 1815 RVA: 0x000992AE File Offset: 0x000974AE
private IEnumerator CheckIfAtTargetLocation()
{
Character c = null;
bool someoneNeedsPath = false;
bool doFollow = true;
int pickupCount = this.PickupCount();
if (!Records.x.editor)
{
this.debug = false;
}
int count = this.party.Count;
this.waypointOrder.Clear();
for (int j = 0; j < count; j++)
{
if (j == 0)
{
this.waypointOrder.Add(this.party[j]);
}
else
{
bool flag = false;
for (int k = 0; k < this.waypointOrder.Count; k++)
{
if (!flag && this.party[j].stats.formationGroup < this.waypointOrder[k].stats.formationGroup)
{
flag = true;
this.waypointOrder.Insert(k, this.party[j]);
}
}
if (!flag)
{
this.waypointOrder.Add(this.party[j]);
}
}
}
this.waypointOrder.Remove(Links.x.main);
if (Links.x.main)
{
this.waypointOrder.Insert(0, Links.x.main);
}
Character main = Links.x.main;
if (main)
{
int num23;
for (int i = 0; i < this.waypointOrder.Count; i = num23 + 1)
{
c = this.waypointOrder[i];
if (c && !someoneNeedsPath)
{
if (!main.physicsMove && main.savedPathTarget == null)
{
main.savedPathTarget = main.node;
}
if (Records.x.editor && (Input.GetKey(KeyCode.Alpha9) || this.debug))
{
string[] array = new string[26];
array[0] = "Checking if in location ";
int num = 1;
Character character = c;
array[num] = ((character != null) ? character.ToString() : null);
array[2] = " ";
array[3] = c.jumpingPosition.ToString();
array[4] = " ";
array[5] = c.jumpingAreas.ToString();
array[6] = " ";
array[7] = c.moving.ToString();
array[8] = " ";
int num2 = 9;
GraphNode moveNode2 = c.moveNode;
array[num2] = ((moveNode2 != null) ? moveNode2.ToString() : null);
array[10] = " ";
int num3 = 11;
GraphNode slideNode = c.slideNode;
array[num3] = ((slideNode != null) ? slideNode.ToString() : null);
array[12] = " ";
array[13] = c.movingOutOfWay.ToString();
array[14] = " ";
array[15] = c.NodesCount().ToString();
array[16] = " ";
array[17] = c.CanMakePath().ToString();
array[18] = " ";
array[19] = Links.x.gaia.sceneLoaded.ToString();
array[20] = " ";
array[21] = Links.x.gaia.pathfindingReady.ToString();
array[22] = " ";
array[23] = c.blockedTime.ToString();
array[24] = " ";
array[25] = c.inCombat.ToString();
Debug.Log(string.Concat(array));
}
bool flag2 = false;
if (c.movingOutOfWayTime > 0f && Time.timeSinceLevelLoad < c.movingOutOfWayTime + 2f)
{
flag2 = true;
}
bool flag3 = c.inCombat;
if (c.inCombat && c.actions && c.actions.ai.seenCount == 0)
{
flag3 = false;
}
bool flag4 = false;
bool flag5 = false;
Character character2 = null;
if (!Records.x.friends)
{
flag4 = false;
c.inFriendGroup = false;
}
GraphNode graphNode = main.savedPathTarget;
Vector3 vector = main.tr.position;
if (main.moving && !main.physicsMove && main.savedPathTarget != null)
{
vector = (Vector3)main.savedPathTarget.position;
}
GraphNode leaderNode = main.node;
Character leader = main;
if (!main.moving && !main.physicsMove && main.NodesCount() == 0)
{
graphNode = leaderNode;
}
if (main.physicsMove)
{
graphNode = main.node;
}
bool justMoved = c.justMoved;
if (!c.jumpingPosition && !c.jumpingAreas && !c.isBoro)
{
if (!c.moving && c.moveNode == null && c.slideNode == null && !c.movingOutOfWay && c.NodesCount() == 0 && c.CanMakePath() && Links.x.gaia.sceneLoaded && Links.x.gaia.pathfindingReady && c.blockedTime == 0f && !flag3 && (!c.sailing || (c.sailing && c.boatNavigator && !c.boat.turning)) && !c.isBoro && !c.physicsMove)
{
Vector3 vector2 = c.sphere.transform.position;
float sqrMagnitude = (c.sphere.transform.position - vector2).sqrMagnitude;
if (sqrMagnitude > 0.75f && sqrMagnitude < 10f)
{
vector2 = c.sphere.transform.position;
}
float num4 = (c.tr.position - new Vector3(main.tr.position.x, c.tr.position.y, main.tr.position.z)).sqrMagnitude;
float num5 = 0f;
float sqrMagnitude2 = (c.tr.position - vector2).sqrMagnitude;
float num6 = 5f + 2f * (float)Links.x.GetPortraitIndexWaypoints(c);
if (!Links.x.main.moving)
{
num6 += 6f;
}
if (main.node != null && main.node.Penalty > 25000U)
{
num6 += 15f;
}
if (c.summoned)
{
num6 = 20f;
}
if ((Records.x.partyWait || c.inCircle) && doFollow)
{
num6 = 50000f;
}
if (flag4 && !flag5)
{
Vector3 vector3 = c.tr.position;
if (c.GetLastNode() != null)
{
vector3 = (Vector3)c.GetLastNode().position;
}
num5 = (vector3 - new Vector3(character2.tr.position.x, c.tr.position.y, character2.tr.position.z)).sqrMagnitude;
num6 = 50f;
num4 = 0f;
}
if (Records.x.editor && (Input.GetKey(KeyCode.Alpha9) || this.debug))
{
string[] array2 = new string[26];
array2[0] = "Checking if in location 2 ";
int num7 = 1;
Character character3 = c;
array2[num7] = ((character3 != null) ? character3.ToString() : null);
array2[2] = " ";
array2[3] = num4.ToString();
array2[4] = " ";
array2[5] = sqrMagnitude2.ToString();
array2[6] = " ";
array2[7] = num6.ToString();
array2[8] = " ";
array2[9] = Records.x.partyWait.ToString();
array2[10] = " ";
array2[11] = justMoved.ToString();
array2[12] = " ";
array2[13] = c.movingOutOfWayTime.ToString();
array2[14] = " ";
int num8 = 15;
GraphNode graphNode2 = this.companionNode1;
array2[num8] = ((graphNode2 != null) ? graphNode2.ToString() : null);
array2[16] = " ";
int num9 = 17;
GraphNode savedPathTarget = c.savedPathTarget;
array2[num9] = ((savedPathTarget != null) ? savedPathTarget.ToString() : null);
array2[18] = " ";
array2[19] = flag4.ToString();
array2[20] = " ";
array2[21] = flag5.ToString();
array2[22] = " ";
array2[23] = main.moving.ToString();
array2[24] = " ";
int num10 = 25;
Vector3 vector4 = vector;
array2[num10] = vector4.ToString();
Debug.Log(string.Concat(array2));
}
if (sqrMagnitude2 > 9f && c.savedPathTarget != null && ((doFollow && (num4 < num6 * num6 || (flag4 && !flag5 && num5 < 64f))) || !doFollow) && !Records.x.partyWait && !c.mainSelected)
{
GraphNode moveNode = c.savedPathTarget;
if (moveNode != null && c.node != null && c.stats.Stuck() == 0)
{
if (c.followingType == "")
{
GraphNode graphNode3 = c.NearNode(vector2, true, 0, -1, c.CheckCircleID());
if (graphNode3 != null)
{
Vector3 vector5 = (Vector3)graphNode3.position;
if ((vector5 - vector2).sqrMagnitude < 9f && Mathf.Abs(vector5.y - vector2.y) < 1.5f)
{
moveNode = graphNode3;
}
}
}
ABPath p = ABPath.ConstructFast(c.node, moveNode, null);
bool flag6 = false;
if (c.pushCount >= this.pushCountMax)
{
flag6 = true;
}
this.SetNodeConstraintParty(c, flag6, true, true, 0, 1);
p.nnConstraint = this.nodeConstraintParty;
AstarPath.StartPath(p, false);
yield return base.StartCoroutine(p.WaitForPath());
p.Claim(this);
bool flag7 = !p.error;
p.Release(this, false);
if (Records.x.astarDebugging && c.mainSelected)
{
string[] array3 = new string[7];
int num11 = 0;
Character character4 = c;
array3[num11] = ((character4 != null) ? character4.ToString() : null);
array3[1] = " ";
array3[2] = flag7.ToString();
array3[3] = " ";
array3[4] = c.node.position;
array3[5] = " ";
array3[6] = moveNode.position;
Debug.Log(string.Concat(array3));
}
if (flag7 && c.waitingForPath != 1)
{
c.ClearCurrentPathNodes();
c.ClearPathUpdates();
c.pathTargPosition = (Vector3)moveNode.position;
int num12 = 500;
if (Records.x.partyWait)
{
num12 = 5;
}
c.MakePath(moveNode, num12, false, false, false);
if (c.waypoint && !(c.waypoint.transform.position == Links.x.gameplay.farPosition))
{
c.showWaypoint = true;
}
yield return new WaitForSeconds(0.1f);
}
else
{
c.pushCount = 0;
}
p = null;
}
moveNode = null;
}
else if (Random.Range(0, 5) == 0 && pickupCount > 0 && !c.hasActions && !c.mainSelected)
{
this.LookForPickups(c);
}
else
{
if (Records.x.editor && (Input.GetKey(KeyCode.Alpha9) || this.debug))
{
string[] array4 = new string[24];
array4[0] = "Checking if in location 3 ";
int num13 = 1;
Character character5 = c;
array4[num13] = ((character5 != null) ? character5.ToString() : null);
array4[2] = " ";
array4[3] = num4.ToString();
array4[4] = " ";
array4[5] = sqrMagnitude2.ToString();
array4[6] = " ";
array4[7] = num5.ToString();
array4[8] = " ";
array4[9] = num6.ToString();
array4[10] = " ";
array4[11] = Records.x.partyWait.ToString();
array4[12] = " ";
array4[13] = justMoved.ToString();
array4[14] = " ";
array4[15] = flag2.ToString();
array4[16] = " ";
int num14 = 17;
GraphNode graphNode4 = this.companionNode1;
array4[num14] = ((graphNode4 != null) ? graphNode4.ToString() : null);
array4[18] = " ";
int num15 = 19;
GraphNode commandMove = c.commandMove;
array4[num15] = ((commandMove != null) ? commandMove.ToString() : null);
array4[20] = " ";
int num16 = 21;
GraphNode savedPathTarget2 = c.savedPathTarget;
array4[num16] = ((savedPathTarget2 != null) ? savedPathTarget2.ToString() : null);
array4[22] = " ";
array4[23] = c.pickupTime.ToString();
Debug.Log(string.Concat(array4));
}
if (!Records.x.InCombat(false) && !c.mainSelected && doFollow && !c.isBoro && ((!justMoved && !flag2) || (flag4 && !flag5)) && (num4 > num6 * num6 || c.inCircle) && c.pickupTime == 0f)
{
if (num4 >= num6 * num6 && this.companionNode1 == null && c.commandMove == null && !c.inCircle)
{
GraphNode graphNode5 = graphNode;
if (graphNode5 == null)
{
graphNode5 = leaderNode;
}
if (Records.x.editor && Input.GetKey(KeyCode.Alpha9))
{
string text = "Checking if in location 4 ";
Character character6 = c;
string text2 = ((character6 != null) ? character6.ToString() : null);
string text3 = " ";
GraphNode graphNode6 = graphNode5;
Debug.Log(text + text2 + text3 + ((graphNode6 != null) ? graphNode6.ToString() : null));
}
if (graphNode5 != null)
{
if (main.physicsMove)
{
Vector3 vector6 = (Vector3)graphNode5.position + Links.x.main.tr.forward * 4f;
GraphNode graphNode7 = graphNode5.ClosestConnection(graphNode5, 0, 0, 25f, vector6, 0, 0, c.nodeConstraint, 0);
if (graphNode7 != null)
{
graphNode5 = graphNode7;
}
}
this.formationHead.rotation = Quaternion.LookRotation(main.tr.position - c.tr.position);
GraphNode formationPosition = this.GetFormationPosition(graphNode5, c, true);
if (Records.x.editor && (Input.GetKey(KeyCode.Alpha9) || this.debug))
{
string[] array5 = new string[6];
array5[0] = "Checking if in location 4 ";
int num17 = 1;
Character character7 = c;
array5[num17] = ((character7 != null) ? character7.ToString() : null);
array5[2] = " ";
int num18 = 3;
GraphNode graphNode8 = formationPosition;
array5[num18] = ((graphNode8 != null) ? graphNode8.ToString() : null);
array5[4] = " ";
array5[5] = Vector3.Distance((Vector3)graphNode5.position, c.tr.position).ToString();
Debug.Log(string.Concat(array5));
}
if (formationPosition != null && c.waitingForPath != 1)
{
c.savedFollowNode = graphNode5;
int num19 = 500;
if (Records.x.partyWait)
{
num19 = 5;
}
if (flag4 && !flag5)
{
c.clickedPoint = character2.tr.position + this.formationHead.forward * -2.5f;
}
c.MakePath(formationPosition, num19, false, false, true);
}
}
}
else if (this.companionNode1 != null && !flag2)
{
this.CompanionIndoorNode(c);
}
else if (c.commandMove != null && !flag2 && !c.hasActions)
{
if (((Vector3)c.commandMove.position - c.tr.position).sqrMagnitude > 16f)
{
c.savedFollowNode = c.commandMove;
c.ClearPathUpdates();
c.pathTargPosition = (Vector3)c.commandMove.position;
c.MakePath(c.commandMove, 500, false, false, true);
}
}
else if (c.inCircle && !c.mainSelected && !flag2 && !c.hasActions)
{
this.CheckCirclePositionAndMove(c);
}
}
}
}
else if (((((flag5 && flag4) || !flag4 || !Records.x.friends) && (main.physicsMove || main.moving) && !justMoved) || (flag4 && !flag5 && (character2.moving || character2.physicsMove))) && c.savedFollowNode != null && graphNode != null && doFollow && c.CanMakePath() && c.slideNode == null && !c.movingOutOfWay && Links.x.gaia.sceneLoaded && Links.x.gaia.pathfindingReady && !flag3 && !c.mainSelected && !Records.x.partyWait && this.companionNode1 == null && c.pickupTime == 0f && c.commandMove == null && !c.inCircle)
{
float num20 = 6f;
if (Links.x.main.physicsMove)
{
num20 = 10f;
}
if (c.NodesCount() <= 1)
{
num20 = 2f;
}
if (leaderNode.Penalty > 25000U)
{
num20 += 8f;
}
bool flag8 = false;
if (c.savedFollowNode == leaderNode)
{
flag8 = true;
}
if (Records.x.editor && (Input.GetKey(KeyCode.Alpha9) || this.debug))
{
string[] array6 = new string[18];
array6[0] = "Looking for point on the move ";
int num21 = 1;
Character character8 = c;
array6[num21] = ((character8 != null) ? character8.ToString() : null);
array6[2] = " ";
array6[3] = c.moving.ToString();
array6[4] = " ";
array6[5] = ((Vector3)c.savedFollowNode.position - vector).sqrMagnitude.ToString();
array6[6] = " ";
array6[7] = num20.ToString();
array6[8] = " ";
array6[9] = ((Vector3)c.savedFollowNode.position).ToString();
array6[10] = " ";
int num22 = 11;
Vector3 vector4 = vector;
array6[num22] = vector4.ToString();
array6[12] = " ";
array6[13] = flag8.ToString();
array6[14] = " ";
array6[15] = c.waitingForPath.ToString();
array6[16] = " ";
array6[17] = c.NodesCount().ToString();
Debug.Log(string.Concat(array6));
}
if (((Vector3)c.savedFollowNode.position - vector).sqrMagnitude > num20 * num20 && !flag8)
{
if (Random.Range(0, 4) == 0 && !c.hasActions && !c.mainSelected && pickupCount > 0)
{
this.LookForPickups(c);
}
else
{
if (graphNode == null)
{
graphNode = leaderNode;
}
this.GetNewPath(c, graphNode);
}
}
}
else if (this.companionNode1 != null && !flag2)
{
if (!c.moving && c.moveNode == null && c.slideNode == null && !c.movingOutOfWay && c.NodesCount() == 0 && c.CanMakePath() && Links.x.gaia.sceneLoaded && Links.x.gaia.pathfindingReady && !flag3 && !c.sailing && !c.isBoro && !c.mainSelected)
{
this.CompanionIndoorNode(c);
}
}
else if (c.commandMove != null && flag2 && !c.hasActions)
{
if (!c.moving && c.moveNode == null && c.slideNode == null && !c.movingOutOfWay && c.NodesCount() == 0 && c.CanMakePath() && Links.x.gaia.sceneLoaded && Links.x.gaia.pathfindingReady && !flag3 && !c.sailing && !c.isBoro && !c.mainSelected && ((Vector3)c.commandMove.position - c.tr.position).sqrMagnitude > 16f)
{
c.savedFollowNode = c.commandMove;
c.ClearPathUpdates();
c.pathTargPosition = (Vector3)c.commandMove.position;
c.MakePath(c.commandMove, 500, false, false, true);
}
}
else if (c.inCircle && !c.mainSelected && !flag2 && !c.hasActions && !c.moving && c.waitingForPath == 0 && c.blockedTime == 0f)
{
this.CheckCirclePositionAndMove(c);
}
if (!c.mainSelected && !c.hasActions && Links.x.gaia.sceneLoaded && Links.x.gaia.pathfindingReady && doFollow && !c.fleeing && !c.missing && !Records.x.partyWait && !c.inCircle && !leader.jumpingAreas && !leader.jumpingPosition && !c.jumpingPosition && !c.jumpingAreas && c.IsSentient() && (c.tr.position - leader.tr.position).sqrMagnitude > 4900f && leaderNode != null)
{
bool flag9 = false;
if (c.indoorID == "?")
{
c.indoorID = "";
}
if (c.indoorID != leader.indoorID || c.desiredGraph != leader.desiredGraph)
{
flag9 = true;
}
if (!flag9)
{
this.JumpPosition(leader, i, c);
}
}
}
leaderNode = null;
leader = null;
}
num23 = i;
}
}
this.waypointRoutine = null;
yield break;
}
// Token: 0x06000718 RID: 1816 RVA: 0x000992C0 File Offset: 0x000974C0
public void GetNewPath(Character c, GraphNode fromNode)
{
if (c.CanMakePath() && Links.x.gaia.sceneLoaded && Links.x.gaia.pathfindingReady)
{
GraphNode graphNode = fromNode;
if (Links.x.main.physicsMove)
{
graphNode = Links.x.main.node;
Vector3 vector = (Vector3)graphNode.position + Links.x.main.tr.forward * 2.5f;
GraphNode graphNode2 = graphNode.ClosestConnection(graphNode, 0, 0, 36f, vector, 0, 0, c.nodeConstraint, 0);
if (graphNode2 != null)
{
graphNode = graphNode2;
vector = (Vector3)graphNode.position + Links.x.main.tr.forward * 2.5f;
graphNode2 = graphNode.ClosestConnection(graphNode, 0, 0, 36f, vector, 0, 0, c.nodeConstraint, 0);
if (graphNode2 != null)
{
graphNode = graphNode2;
}
}
}
if (graphNode != null && c.waitingForPath != 1 && (c.timeSinceFollowPath == 0f || Time.timeSinceLevelLoad > c.timeSinceFollowPath + 0.5f))
{
this.formationHead.rotation = Links.x.main.tr.rotation;
GraphNode formationPosition = this.GetFormationPosition(graphNode, c, true);
if (formationPosition != null)
{
c.savedFollowNode = graphNode;
c.ClearPathUpdates();
c.pathTargPosition = (Vector3)formationPosition.position;
c.MakePath(formationPosition, 500, false, false, true);
}
}
}
}
// Token: 0x06000719 RID: 1817 RVA: 0x00099448 File Offset: 0x00097648
public void StopWalking(bool all)
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && (all || !this.party[i].mainSelected))
{
this.party[i].TargetReached();
}
}
}
// Token: 0x0600071A RID: 1818 RVA: 0x000994A8 File Offset: 0x000976A8
public int PickupCount()
{
int num = 0;
if (this.pickups == null)
{
this.pickups = Links.x.cellar.pickups;
}
int count = this.pickups.Count;
for (int i = 0; i < count; i++)
{
if (this.pickups[i])
{
num++;
}
}
return num;
}
// Token: 0x0600071B RID: 1819 RVA: 0x00099504 File Offset: 0x00097704
public bool LookForPickups(Character character)
{
if (this.pickups == null)
{
this.pickups = Links.x.cellar.pickups;
}
int count = this.pickups.Count;
float num = 20f;
if (character.inCircle)
{
num = 8f;
}
float num2 = num * num;
this.nearPickups.Clear();
bool flag = false;
float num3 = (float)character.stats.HealthCurrent() / (float)character.stats.HealthMax();
bool flag2 = false;
if (num3 < 1f)
{
flag2 = true;
}
if (character.party && character.stats.HasSpellbook() && character.stats.SpiritCurrent() < 90)
{
flag = true;
}
for (int i = 0; i < count; i++)
{
Pickups pickups = this.pickups[i];
if (pickups && ((flag2 && pickups.isHealth) || (pickups.isSpirit && flag)) && (pickups.tr.position - character.currentPosition).sqrMagnitude < num2)
{
this.nearPickups.Add(pickups);
}
}
if (this.nearPickups.Count > 0)
{
this.pickupCoroutine = this.PickupMove(character);
base.StartCoroutine(this.pickupCoroutine);
return true;
}
return false;
}
// Token: 0x0600071C RID: 1820 RVA: 0x00099645 File Offset: 0x00097845
private IEnumerator PickupMove(Character character)
{
bool foundItem = false;
Pickups itemToPickup = null;
if (!foundItem && !character.sailing)
{
int num2;
for (int i = 0; i < this.pickups.Count; i = num2 + 1)
{
if (!foundItem)
{
Pickups item = this.pickups[i];
GraphNode node = item.node;
if (node != null)
{
ABPath p = ABPath.ConstructFast(character.node, node, null);
p.nnConstraint = this.nodeConstraint;
AstarPath.StartPath(p, false);
yield return base.StartCoroutine(p.WaitForPath());
p.Claim(this);
bool flag = false;
if (!p.error)
{
flag = true;
}
if (flag)
{
this.tempPath = p.path;
GraphNode graphNode = null;
int num = 0;
for (int j = 0; j < this.tempPath.Count; j++)
{
if (this.tempPath[j] != character.node)
{
graphNode = this.tempPath[j];
num++;
}
}
if (graphNode != null)
{
foundItem = true;
itemToPickup = item;
character.pickupTime = Time.timeSinceLevelLoad;
break;
}
}
p.Release(this, false);
p = null;
}
item = null;
}
num2 = i;
}
}
this.pickupCoroutine = null;
if (foundItem && itemToPickup.node != null)
{
character.ClearPathUpdates();
character.pathTargPosition = (Vector3)itemToPickup.node.position;
character.MakePath(itemToPickup.node, 500, false, false, true);
}
yield break;
}
// Token: 0x0600071D RID: 1821 RVA: 0x0009965C File Offset: 0x0009785C
public void JumpPosition(Character main, int i, Character selectedParty)
{
GraphNode formationPosition = this.GetFormationPosition(main.node, selectedParty, false);
if (formationPosition != null)
{
selectedParty.body.SetMagicaClothState(false);
selectedParty.body.turnOnMagicaClothNextFrame = 3;
selectedParty.SetPosition((Vector3)formationPosition.position, null);
selectedParty.ClaimNode(formationPosition, (Vector3)formationPosition.position, true);
selectedParty.sphere.transform.position = (Vector3)formationPosition.position;
selectedParty.savedFollowNode = main.node;
selectedParty.SetMoveFollowPosition((Vector3)formationPosition.position);
selectedParty.indoorID = "";
selectedParty.doorID = "";
selectedParty.TargetReached();
selectedParty.waitingForPath = 0;
selectedParty.ClearMoveTargets();
if (main.desiredGraph == 1)
{
if (Links.x.diorama.GetIndoorView())
{
selectedParty.indoorID = Links.x.diorama.GetIndoorView().GetInteriorBoundsName((Vector3)formationPosition.position);
}
else
{
selectedParty.indoorID = "?";
}
selectedParty.doorID = "";
}
selectedParty.ChangeTorchLight();
selectedParty.FirstPosition(formationPosition);
}
}
// Token: 0x0600071E RID: 1822 RVA: 0x00099788 File Offset: 0x00097988
public bool CheckCirclePositionAndMove(Character c)
{
GraphNode graphNode = c.node;
if (this.circleTiles.Contains(graphNode))
{
return false;
}
graphNode = this.GetFormationPointInCircle(c);
if (graphNode != null && graphNode != c.node)
{
c.savedFollowNode = graphNode;
c.ClearPathUpdates();
c.pathTargPosition = (Vector3)graphNode.position;
c.MakePath(graphNode, 500, false, false, true);
return true;
}
return false;
}
// Token: 0x0600071F RID: 1823 RVA: 0x000997F0 File Offset: 0x000979F0
private void CompanionIndoorNode(Character selectedParty)
{
int portraitIndexWaypoints = Links.x.GetPortraitIndexWaypoints(selectedParty);
GraphNode graphNode = null;
if (portraitIndexWaypoints == 1)
{
graphNode = this.companionNode1;
}
if (portraitIndexWaypoints == 2 && this.companionNode2 != null)
{
graphNode = this.companionNode2;
}
if (portraitIndexWaypoints == 3 && this.companionNode3 != null)
{
graphNode = this.companionNode3;
}
if (selectedParty.summoned && this.companionNode4 != null)
{
GraphNode graphNode2 = selectedParty.NearNode((Vector3)this.companionNode4.position, true, 0, -1, selectedParty.CheckCircleID());
if (graphNode2 != null)
{
graphNode = graphNode2;
}
}
if (graphNode != null)
{
float num = 10f;
if (selectedParty.summoned)
{
num = 50f;
}
float sqrMagnitude = (Links.x.main.tr.position - (Vector3)graphNode.position).sqrMagnitude;
if (((Vector3)graphNode.position - selectedParty.tr.position).sqrMagnitude > num && sqrMagnitude > 25f)
{
selectedParty.savedFollowNode = graphNode;
selectedParty.ClearPathUpdates();
selectedParty.pathTargPosition = (Vector3)graphNode.position;
selectedParty.MakePath(graphNode, 500, false, false, true);
}
}
}
// Token: 0x06000720 RID: 1824 RVA: 0x00099914 File Offset: 0x00097B14
public bool AnyoneResurrecting(Character c)
{
for (int i = 0; i < this.portraitOrder.Count; i++)
{
Character character = this.portraitOrder[i];
if (character && character.actions && character.actions.ai.resurrectCorout != null)
{
if (!c)
{
return true;
}
if (c == character.actions.ai.pinnedTarget)
{
return true;
}
}
}
return false;
}
// Token: 0x06000721 RID: 1825 RVA: 0x00099990 File Offset: 0x00097B90
public bool AnyonePinning()
{
for (int i = 0; i < this.portraitOrder.Count; i++)
{
Character character = this.portraitOrder[i];
if (character && (character.stats.pinning || character.stats.pinned))
{
return true;
}
}
return false;
}
// Token: 0x06000722 RID: 1826 RVA: 0x000999E8 File Offset: 0x00097BE8
public bool NearCompanionNode(Character selectedParty)
{
int portraitIndexWaypoints = Links.x.GetPortraitIndexWaypoints(selectedParty);
GraphNode graphNode = null;
if (portraitIndexWaypoints == 1)
{
graphNode = this.companionNode1;
}
if (portraitIndexWaypoints == 2 && this.companionNode2 != null)
{
graphNode = this.companionNode2;
}
if (portraitIndexWaypoints == 3 && this.companionNode3 != null)
{
graphNode = this.companionNode3;
}
if (selectedParty.summoned && this.companionNode4 != null)
{
graphNode = this.companionNode4;
}
return graphNode != null && ((Vector3)graphNode.position - selectedParty.tr.position).sqrMagnitude < 10f;
}
// Token: 0x06000723 RID: 1827 RVA: 0x00099A7C File Offset: 0x00097C7C
public void SetPartyPositions(bool useSelected)
{
Vector3 position = this.party[0].tr.position;
GraphNode graphNode = this.party[0].node;
if (graphNode == null)
{
graphNode = this.party[0].NearNode(position, true, 0, -1, 1);
if (graphNode != null)
{
this.party[0].ClaimNode(graphNode, (Vector3)graphNode.position, true);
}
}
if (graphNode != null)
{
this.SetFormationHead(graphNode);
for (int i = 1; i < this.party.Count; i++)
{
if (this.party[i] && ((useSelected && this.party[i].selected) || !useSelected))
{
GraphNode graphNode2 = this.party[i].NearNode((Vector3)graphNode.position, true, 0, -1, 1);
if (graphNode2 != null)
{
this.party[i].SetPosition((Vector3)graphNode2.position, null);
Quaternion quaternion = Links.x.diorama.playerStartDefault.rotation;
if (!this.party[i].mainSelected)
{
quaternion = Quaternion.LookRotation(Links.x.main.tr.position = this.party[i].tr.position);
}
Vector3 eulerAngles = quaternion.eulerAngles;
eulerAngles.x = 0f;
eulerAngles.z = 0f;
eulerAngles.y += Random.Range(-180f, 180f);
this.party[i].SetRotation(Quaternion.Euler(eulerAngles), false, true);
this.party[i].FirstPosition(graphNode2);
}
}
}
}
else
{
Debug.Log("Start node is null");
}
}
// Token: 0x06000724 RID: 1828 RVA: 0x00099C60 File Offset: 0x00097E60
public void UpdateHotkeys()
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && this.party[i].portrait && !this.party[i].isBoro)
{
this.party[i].portrait.UpdateKey(Links.x.joy);
}
}
}
// Token: 0x06000725 RID: 1829 RVA: 0x00099CE4 File Offset: 0x00097EE4
public void RemoveAllFromSelected(Character c)
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && this.party[i] != c)
{
this.party[i].RemoveFromSelected(false);
}
}
}
// Token: 0x06000726 RID: 1830 RVA: 0x00099D40 File Offset: 0x00097F40
public void SetFirstAsSelected(bool setLeader)
{
bool flag = false;
int num = 10;
int num2 = -1;
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && this.party[i].selected && !this.party[i].isBoro && this.party[i].stats.formationGroup < num && !this.party[i].summoned)
{
flag = true;
num2 = i;
num = this.party[i].stats.formationGroup;
}
}
if (num2 == -1)
{
for (int j = 0; j < this.party.Count; j++)
{
if (this.party[j] && this.party[j].selected && !this.party[j].isBoro && this.party[j].stats.formationGroup < num)
{
flag = true;
num2 = j;
num = this.party[j].stats.formationGroup;
}
}
}
if (num2 >= 0)
{
this.party[num2].SetAsLeader();
}
if (!flag && setLeader)
{
this.party[0].SetAsLeader();
this.party[0].AddToSelected(true, false);
}
}
// Token: 0x06000727 RID: 1831 RVA: 0x00099EC8 File Offset: 0x000980C8
public void StopMoving()
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i])
{
this.party[i].EndPath();
}
}
}
// Token: 0x06000728 RID: 1832 RVA: 0x00099F10 File Offset: 0x00098110
private bool PartyClose(Character character, Vector3 point)
{
point.y = character.tr.position.y;
return (character.tr.position - point).sqrMagnitude < 100f;
}
// Token: 0x06000729 RID: 1833 RVA: 0x00099F58 File Offset: 0x00098158
public void CheckForPartySongs(string trigger)
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && this.party[i].IsSentient() && !this.party[i].isBoro)
{
int num;
this.party[i].stats.CheckForSongsAndWords(trigger, out num);
}
}
}
// Token: 0x0600072A RID: 1834 RVA: 0x00099FD0 File Offset: 0x000981D0
public Character GetSearchNumber(string job, out int jobTotal, string skill, Vector3 point)
{
Character character = null;
float num = -1f;
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && this.PartyClose(this.party[i], point) && !this.party[i].isBoro)
{
float num2 = this.party[i].stats.SearchNumber(job, false, skill);
if (num2 > num)
{
character = this.party[i];
num = num2;
}
}
}
jobTotal = (int)Mathf.Ceil(num);
return character;
}
// Token: 0x0600072B RID: 1835 RVA: 0x0009A070 File Offset: 0x00098270
public bool OnlyOneMoving(Character character)
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && this.party[i] != character && !this.party[i].isBoro)
{
return false;
}
}
return true;
}
// Token: 0x0600072C RID: 1836 RVA: 0x0009A0D0 File Offset: 0x000982D0
public float GetPartyMoveSpeed()
{
int count = this.party.Count;
float num = 0f;
float num2 = 0f;
if (Links.x.main.stats.moveSpeedMod != 0f)
{
return Links.x.main.stats.MoveSpeed(false);
}
for (int i = 0; i < count; i++)
{
Character character = this.party[i];
if (character && !character.isBoro && !character.summoned)
{
float num3 = this.party[i].stats.MoveSpeed(false);
num += num3;
num2 += 1f;
}
}
return num / num2;
}
// Token: 0x0600072D RID: 1837 RVA: 0x0009A18C File Offset: 0x0009838C
public float GetSailingSpeed(out float weightTotal, out float sailingFamilyMod, out float banners, out float boroBonus)
{
float num = 0f;
weightTotal = 0f;
sailingFamilyMod = 0f;
float num2 = 0f;
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i])
{
weightTotal += this.party[i].stats.CharacterWeight();
num2 += (float)this.party[i].stats.CarryingWeight() + 50f;
}
}
banners = 0f;
boroBonus = Mathf.Round(Records.x.boroBonus.x * 5f * 100f) / 100f;
weightTotal /= num2;
weightTotal *= 3f;
weightTotal = Mathf.Round(weightTotal * 100f) / 100f;
num -= weightTotal;
num += banners;
return num + boroBonus;
}
// Token: 0x0600072E RID: 1838 RVA: 0x0009A280 File Offset: 0x00098480
public void SetPartyLightColor()
{
bool flag = false;
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && !this.party[i].summoned && !this.party[i].isBoro && this.party[i].hasTorch)
{
flag = true;
}
}
if (flag)
{
Links.x.currentPartyLightColor = Links.x.torchColor;
return;
}
Links.x.currentPartyLightColor = Links.x.partyLightColor;
}
// Token: 0x0600072F RID: 1839 RVA: 0x0009A320 File Offset: 0x00098520
public bool PartyHasTorch()
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && !this.party[i].summoned && !this.party[i].isBoro && this.party[i].hasTorch)
{
return true;
}
}
return false;
}
// Token: 0x06000730 RID: 1840 RVA: 0x0009A392 File Offset: 0x00098592
public void StartDeathSequence()
{
base.StartCoroutine(this.DeathSequence());
}
// Token: 0x06000731 RID: 1841 RVA: 0x0009A3A1 File Offset: 0x000985A1
private IEnumerator DeathSequence()
{
Records.x.RemoveControls(true);
Records.x.mainCharacterDead = true;
Links.x.cameraEffects.PlayAnimation("CameraDeath");
Links.x.gaia.SetPlaylist("Death", true, 0f);
Links.x.combat.EndCombat(false);
foreach (Character character in this.party)
{
if (character.party)
{
Links.x.inventory.ClearBag(character);
}
}
yield return new WaitForSecondsRealtime(2.5f);
Links.x.gameplay.OpenDock();
Links.x.deathScreen.SetActive(true);
Links.x.deathScreen.GetComponent<DeathScreen>().Setup();
yield break;
}
// Token: 0x06000732 RID: 1842 RVA: 0x0009A3B0 File Offset: 0x000985B0
public void SingleSelected(Character character)
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && this.party[i] != character && !this.party[i].isBoro)
{
this.party[i].RemoveFromSelected(false);
}
}
}
// Token: 0x06000733 RID: 1843 RVA: 0x0009A420 File Offset: 0x00098620
public void SetPartyRotation(Vector3 pt)
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && !this.party[i].isBoro && !this.party[i].summoned && !this.party[i].mainSelected)
{
this.party[i].SetRotation(Quaternion.LookRotation(pt - this.party[i].tr.position), false, false);
}
}
}
// Token: 0x06000734 RID: 1844 RVA: 0x0009A4CC File Offset: 0x000986CC
public void SelectAll()
{
if (Links.x.cameraEffects.indoors)
{
string currentBoundsName = Links.x.rtsCamera.currentBoundsName;
}
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && !this.party[i].selected && !this.party[i].isBoro)
{
this.party[i].AddToSelected(true, false);
}
}
this.SetFirstAsSelected(true);
}
// Token: 0x06000735 RID: 1845 RVA: 0x0009A564 File Offset: 0x00098764
public bool AnyoneOutside()
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && !this.party[i].isBoro && this.party[i].desiredGraph == 0)
{
return true;
}
}
return false;
}
// Token: 0x06000736 RID: 1846 RVA: 0x0009A5C3 File Offset: 0x000987C3
public void GetFormation()
{
this.currentFormationPoints = this.formationPoints1;
this.formationHead = this.formationPoints1[0].parent;
}
// Token: 0x06000737 RID: 1847 RVA: 0x0009A5E8 File Offset: 0x000987E8
public void SetNodeConstraint(Character pathfinder, bool constrainTags, bool constrainRadius, bool checkWalkRadius, int uniqueID, int checkCircle)
{
this.nodeConstraint.constrainWalkability = true;
this.nodeConstraint.walkable = true;
this.nodeConstraint.constrainPenalty = 0;
this.nodeConstraint.constrainTags = constrainTags;
this.nodeConstraint.checkCircleID = checkCircle;
if (!pathfinder)
{
this.nodeConstraint.passID = 0;
this.nodeConstraint.passID2 = 0;
this.nodeConstraint.checkConnections = Records.x.playerDefaultConnections;
this.nodeConstraint.constrainPenalty = 0;
}
else
{
this.nodeConstraint.passID = pathfinder.nodeStationaryID;
this.nodeConstraint.passID2 = pathfinder.nodeMovingID;
this.nodeConstraint.checkConnections = pathfinder.ConnectionNumber();
if (pathfinder.npc)
{
this.nodeConstraint.constrainPenalty = 1;
}
else
{
this.nodeConstraint.constrainPenalty = 2;
}
}
this.nodeConstraint.constrainToArea = -1;
if (Records.x.partySailing)
{
this.nodeConstraint.constrainToEnvironment = 2;
return;
}
this.nodeConstraint.constrainToEnvironment = 1;
}
// Token: 0x06000738 RID: 1848 RVA: 0x0009A6FC File Offset: 0x000988FC
public void SetNodeConstraintParty(Character pathfinder, bool constrainTags, bool constrainRadius, bool checkWalkRadius, int uniqueID, int checkCircle)
{
this.nodeConstraintParty.constrainWalkability = true;
this.nodeConstraintParty.walkable = true;
this.nodeConstraintParty.constrainPenalty = 0;
this.nodeConstraintParty.constrainTags = constrainTags;
this.nodeConstraintParty.checkCircleID = checkCircle;
if (!pathfinder)
{
this.nodeConstraintParty.passID = 0;
this.nodeConstraintParty.passID2 = 0;
this.nodeConstraintParty.checkConnections = Records.x.playerDefaultConnections;
this.nodeConstraintParty.constrainPenalty = 0;
}
else
{
this.nodeConstraintParty.passID = pathfinder.nodeStationaryID;
this.nodeConstraintParty.passID2 = pathfinder.nodeMovingID;
this.nodeConstraintParty.checkConnections = pathfinder.ConnectionNumber();
if (pathfinder.npc)
{
this.nodeConstraintParty.constrainPenalty = 1;
}
else
{
this.nodeConstraintParty.constrainPenalty = 2;
}
}
this.nodeConstraintParty.constrainToArea = -1;
if (Records.x.partySailing)
{
this.nodeConstraintParty.constrainToEnvironment = 2;
return;
}
this.nodeConstraintParty.constrainToEnvironment = 1;
}
// Token: 0x06000739 RID: 1849 RVA: 0x0009A810 File Offset: 0x00098A10
public void UpdateSelectionFromDoors()
{
bool indoors = Links.x.cameraEffects.indoors;
string text = "";
if (indoors)
{
text = Links.x.rtsCamera.currentBoundsName;
}
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && !this.party[i].isBoro && (!indoors || this.party[i].desiredGraph != 1 || !(this.party[i].indoorID == text)) && !indoors)
{
int desiredGraph = this.party[i].desiredGraph;
}
}
this.SetFirstAsSelected(true);
}
// Token: 0x0600073A RID: 1850 RVA: 0x0009A8D0 File Offset: 0x00098AD0
public float GetDistanceToCompanions(GameObject go)
{
Character character = null;
for (int i = 0; i < this.portraitOrder.Count; i++)
{
if (go == this.portraitOrder[i].gameObject)
{
character = this.portraitOrder[i];
}
}
float num = 10f;
float num2 = num;
for (int j = 0; j < this.portraitOrder.Count; j++)
{
if (this.portraitOrder[j] != character && this.portraitOrder[j] && character)
{
float num3 = Vector3.Distance(this.portraitOrder[j].tr.position, character.tr.position);
if (num3 < num2)
{
num2 = num3;
}
}
}
return num2 / num;
}
// Token: 0x0600073B RID: 1851 RVA: 0x0009A9A4 File Offset: 0x00098BA4
public void SetMainSelectedForSection()
{
if (Links.x.cameraEffects.indoors)
{
string currentBoundsName = Links.x.rtsCamera.currentBoundsName;
}
bool flag = false;
for (int i = 0; i < this.portraitOrder.Count; i++)
{
if (this.party[i] && this.party[i].selected && !this.party[i].isBoro)
{
if (!flag)
{
this.party[i].SetAsLeader();
}
flag = true;
}
}
if (!flag)
{
for (int j = 0; j < this.party.Count; j++)
{
if (!flag && this.party[j] && !this.party[j].isBoro)
{
this.party[j].SetAsLeader();
flag = true;
}
}
}
}
// Token: 0x0600073C RID: 1852 RVA: 0x0009AA90 File Offset: 0x00098C90
public void SetPortraitHotkeys(bool joystick)
{
if (this.party == null)
{
return;
}
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i].portrait)
{
this.party[i].portrait.UpdateKey(joystick);
}
}
}
// Token: 0x0600073D RID: 1853 RVA: 0x0009AAEC File Offset: 0x00098CEC
public void UpdatePortraits()
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i].portrait)
{
this.party[i].portrait.SetSelection();
}
this.party[i].CircleColor(false);
}
}
// Token: 0x0600073E RID: 1854 RVA: 0x0009AB50 File Offset: 0x00098D50
public void AddXP(int xp, Character actionTarget, bool show)
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && !this.party[i].dead && !this.party[i].summoned && !this.party[i].stunned && !this.party[i].isBoro)
{
this.party[i].stats.AddXP(xp, actionTarget, show);
}
}
}
// Token: 0x0600073F RID: 1855 RVA: 0x0009ABEE File Offset: 0x00098DEE
public void CompanionDied()
{
Links.x.OrderPortraitList();
Links.x.hudControl.SetPortraitPositions();
Links.x.characterSheet.OrderPortraits();
Links.x.hudControl.SetPortraitBacks();
}
// Token: 0x06000740 RID: 1856 RVA: 0x0009AC28 File Offset: 0x00098E28
public void SetPortraits(bool all, int num)
{
this.portraitOrder = Links.x.portraitOrder;
for (int i = 0; i < this.portraitOrder.Count; i++)
{
if (this.portraitOrder[i] && (i == num || all))
{
Portrait portrait = null;
this.GetPortrait(i, out portrait);
Portrait portrait2;
if (!this.portraitOrder[i].portrait)
{
portrait2 = Links.x.hudControl.CreatePortrait(this.portraitOrder[i]);
}
else
{
portrait2 = this.portraitOrder[i].portrait;
}
this.portraitOrder[i].portrait = portrait2;
this.portraitOrder[i].characterSheetPortrait = portrait;
portrait2.SetSelection();
portrait.SetCharacter(this.portraitOrder[i]);
portrait.SetSelection();
}
}
}
// Token: 0x06000741 RID: 1857 RVA: 0x0009AD19 File Offset: 0x00098F19
public void GetPortrait(int num, out Portrait characterSheetPortrait)
{
characterSheetPortrait = null;
if (num < this.portraitParentRoleSheet.childCount && num > -1)
{
characterSheetPortrait = this.portraitParentRoleSheet.GetChild(num).gameObject.GetComponent<Portrait>();
}
}
// Token: 0x06000742 RID: 1858 RVA: 0x0009AD48 File Offset: 0x00098F48
public void SetStartingFormation()
{
this.portraitOrder = Links.x.portraitOrder;
List<int> list = new List<int>();
List<int> list2 = new List<int>();
for (int i = 0; i < this.portraitOrder.Count; i++)
{
if (this.portraitOrder[i] && !this.portraitOrder[i].isBoro && !this.portraitOrder[i].summoned)
{
int num = 0;
int num2 = 0;
this.portraitOrder[i].stats.SetStartingFormation(out num, out num2);
list.Add(num);
list2.Add(num2);
}
}
for (int j = 0; j < this.portraitOrder.Count; j++)
{
if (this.portraitOrder[j] && !this.portraitOrder[j].isBoro && !this.portraitOrder[j].summoned)
{
bool flag = false;
bool flag2 = false;
for (int k = 0; k < list.Count; k++)
{
if (k != j)
{
if (list[k] == list[j])
{
flag = true;
}
if (list2[k] == list2[j])
{
flag2 = true;
}
}
}
if (!flag)
{
this.portraitOrder[j].stats.formationGroup = list[j];
}
else if (flag2)
{
this.portraitOrder[j].stats.formationGroup = list[j];
}
else
{
this.portraitOrder[j].stats.formationGroup = list2[j];
}
}
}
}
// Token: 0x06000743 RID: 1859 RVA: 0x0009AF08 File Offset: 0x00099108
public int PartyCount()
{
int num = 0;
for (int i = 0; i < this.party.Count; i++)
{
num++;
}
return num;
}
// Token: 0x06000744 RID: 1860 RVA: 0x0009AF34 File Offset: 0x00099134
public void SetMinimapIcons(bool state)
{
if (this.party != null)
{
for (int i = 0; i < this.party.Count; i++)
{
if (this.party[i] && this.party[i].mapIcon)
{
this.party[i].mapIcon.SetActive(state);
}
}
}
}
// Token: 0x06000745 RID: 1861 RVA: 0x0009AFA1 File Offset: 0x000991A1
public void SetWaypoint()
{
}
// Token: 0x04000A1B RID: 2587
[Header("CLICKING")]
public Vector3 mousePoint;
// Token: 0x04000A1C RID: 2588
public GraphNode mouseNode;
// Token: 0x04000A1D RID: 2589
[Header("PARTY")]
public bool drawingSquare;
// Token: 0x04000A1E RID: 2590
public int formation;
// Token: 0x04000A1F RID: 2591
private Transform portraitParentRoleSheet;
// Token: 0x04000A20 RID: 2592
public List<Character> portraitUpdate = new List<Character>();
// Token: 0x04000A21 RID: 2593
public List<Character> portraitHudUpdate = new List<Character>();
// Token: 0x04000A22 RID: 2594
private StringFast str = new StringFast(64);
// Token: 0x04000A23 RID: 2595
private List<Character> portraitOrder;
// Token: 0x04000A24 RID: 2596
public List<Character> friend1 = new List<Character>();
// Token: 0x04000A25 RID: 2597
public List<Character> friend2 = new List<Character>();
// Token: 0x04000A26 RID: 2598
public int morale;
// Token: 0x04000A27 RID: 2599
public float rally;
// Token: 0x04000A28 RID: 2600
public float rallySpeed;
// Token: 0x04000A29 RID: 2601
public float rallyBoost;
// Token: 0x04000A2A RID: 2602
public float rallyAttacks;
// Token: 0x04000A2B RID: 2603
public bool debug;
// Token: 0x04000A2C RID: 2604
[Header("MOVEMENT")]
public LineRenderer lineRendererToDrawTrajectory;
// Token: 0x04000A2D RID: 2605
public bool canPath;
// Token: 0x04000A2E RID: 2606
public bool lineOn;
// Token: 0x04000A2F RID: 2607
public bool debuggingPath;
// Token: 0x04000A30 RID: 2608
public bool newFormation;
// Token: 0x04000A31 RID: 2609
private List<GraphNode> refPrepPath;
// Token: 0x04000A32 RID: 2610
private List<Character> party;
// Token: 0x04000A33 RID: 2611
private List<Character> dioramaCharacters;
// Token: 0x04000A34 RID: 2612
public List<Character> waypointOrder = new List<Character>();
// Token: 0x04000A35 RID: 2613
private Vector3 dir;
// Token: 0x04000A36 RID: 2614
public List<GraphNode> pickedNodes = new List<GraphNode>();
// Token: 0x04000A37 RID: 2615
public List<GraphNode> pickedNodesEstimated = new List<GraphNode>();
// Token: 0x04000A38 RID: 2616
public GameObject waypoint;
// Token: 0x04000A39 RID: 2617
public int summonsFormationGroup;
// Token: 0x04000A3A RID: 2618
public GraphNode formationFront;
// Token: 0x04000A3B RID: 2619
public SelectionBox box;
// Token: 0x04000A3C RID: 2620
public int pushCountMax = 100;
// Token: 0x04000A3D RID: 2621
public float angle;
// Token: 0x04000A3E RID: 2622
private List<Pickups> pickups;
// Token: 0x04000A3F RID: 2623
private List<Pickups> nearPickups = new List<Pickups>();
// Token: 0x04000A40 RID: 2624
private IEnumerator pickupCoroutine;
// Token: 0x04000A41 RID: 2625
public float updateTime;
// Token: 0x04000A42 RID: 2626
private List<Character> nearbyParty = new List<Character>();
// Token: 0x04000A43 RID: 2627
private List<GraphNode> nearbyPartyNode = new List<GraphNode>();
// Token: 0x04000A44 RID: 2628
public Transform formationHead;
// Token: 0x04000A45 RID: 2629
public List<Transform> formationPoints1 = new List<Transform>();
// Token: 0x04000A46 RID: 2630
private List<Transform> currentFormationPoints;
// Token: 0x04000A47 RID: 2631
private Vector3 previousClick;
// Token: 0x04000A48 RID: 2632
private Vector3 mPoint;
// Token: 0x04000A49 RID: 2633
public int lookingForDomePaths;
// Token: 0x04000A4A RID: 2634
private List<GraphNode> path;
// Token: 0x04000A4B RID: 2635
public bool creatingPath;
// Token: 0x04000A4C RID: 2636
public Quaternion savedRot;
// Token: 0x04000A4D RID: 2637
public bool combatWait;
// Token: 0x04000A4E RID: 2638
public GraphNode prevConnection1;
// Token: 0x04000A4F RID: 2639
public GraphNode prevConnection2;
// Token: 0x04000A50 RID: 2640
public GraphNode prevConnection3;
// Token: 0x04000A51 RID: 2641
public string prevKeyDown;
// Token: 0x04000A52 RID: 2642
private string keyDown;
// Token: 0x04000A53 RID: 2643
public GraphNode companionNode1;
// Token: 0x04000A54 RID: 2644
public GraphNode companionNode2;
// Token: 0x04000A55 RID: 2645
public GraphNode companionNode3;
// Token: 0x04000A56 RID: 2646
public GraphNode companionNode4;
// Token: 0x04000A57 RID: 2647
private List<GraphNode> gameplayCircleTiles;
// Token: 0x04000A58 RID: 2648
public List<GraphNode> circleTiles = new List<GraphNode>();
// Token: 0x04000A59 RID: 2649
private List<GraphNode> openTiles = new List<GraphNode>();
// Token: 0x04000A5A RID: 2650
[Header("INTERACTION")]
public Character moveToCharacter;
// Token: 0x04000A5B RID: 2651
private List<GraphNode> tempPath;
// Token: 0x04000A5C RID: 2652
private NNConstraint nodeConstraint = new NNConstraint();
// Token: 0x04000A5D RID: 2653
private NNConstraint nodeConstraintParty = new NNConstraint();
// Token: 0x04000A5E RID: 2654
private NNConstraint nodeConstraintFormation = new NNConstraint();
// Token: 0x04000A5F RID: 2655
private NNConstraint nodeConstraintDir = new NNConstraint();
// Token: 0x04000A60 RID: 2656
public float dialogueMaxDistance = 4f;
// Token: 0x04000A61 RID: 2657
public IEnumerator scatterCoroutine;
// Token: 0x04000A62 RID: 2658
public IEnumerator waypointRoutine;
// Token: 0x04000A63 RID: 2659
public IEnumerator estimatePathRoutine;
// Token: 0x04000A64 RID: 2660
public IEnumerator resurrectCoroutine;
// Token: 0x04000A65 RID: 2661
private float updateTimeDomePaths;
// Token: 0x04000A66 RID: 2662
private GraphNode prevNode;
// Token: 0x04000A67 RID: 2663
private float prevNodeTime;
// Token: 0x04000A68 RID: 2664
private Animator waypointAnimator;
// Token: 0x04000A69 RID: 2665
private PlayerInput playerInput;
// Token: 0x04000A6A RID: 2666
private InputAction moveAction;
// Token: 0x04000A6B RID: 2667
private InputAction directionAction;
// Token: 0x04000A6C RID: 2668
public Vector2 move;
// Token: 0x04000A6D RID: 2669
public Vector3 direction;
// Token: 0x04000A6E RID: 2670
public bool joyStickDown;
// Token: 0x04000A6F RID: 2671
private float t;
// Token: 0x04000A70 RID: 2672
private float checkTime;
// Token: 0x04000A71 RID: 2673
[Header("GROUPS")]
private List<Vector3> positions = new List<Vector3>();
// Token: 0x04000A72 RID: 2674
public List<GameObject> lines = new List<GameObject>();
// Token: 0x04000A73 RID: 2675
public int linenum;
// Token: 0x04000A74 RID: 2676
public List<float> timeOutsideCircle = new List<float>();
// Token: 0x04000A75 RID: 2677
private List<Character> intruders = new List<Character>();
// Token: 0x04000A76 RID: 2678
private List<float> intruderTime = new List<float>();
// Token: 0x04000A77 RID: 2679
private List<Character> intruderTemp = new List<Character>();
// Token: 0x04000A78 RID: 2680
private List<float> intruderTimeTemp = new List<float>();
// Token: 0x04000A79 RID: 2681
private List<Vector3> linesPoints = new List<Vector3>();
// Token: 0x04000A7A RID: 2682
public float currentDither;
// Token: 0x04000A7B RID: 2683
private float startDither;
// Token: 0x04000A7C RID: 2684
private float endDither;
// Token: 0x04000A7D RID: 2685
private float fadeAmount;
// Token: 0x04000A7E RID: 2686
public bool fading;
// Token: 0x04000A7F RID: 2687
private IEnumerator breakRoutine;
// Token: 0x04000A80 RID: 2688
public float timeToNextCircle;
// Token: 0x04000A81 RID: 2689
public float circleRecoverTime = 150f;
}