using System; using System.Collections; using System.Collections.Generic; using DarkTonic.MasterAudio; using Pathfinding; using PixelCrushers.DialogueSystem; using UnityEngine; // Token: 0x02000022 RID: 34 public class CreatureActions : MonoBehaviour { // Token: 0x06000509 RID: 1289 RVA: 0x0006F352 File Offset: 0x0006D552 private void Awake() { this.thisName = base.gameObject.name; this.tr = base.gameObject.transform; } // Token: 0x0600050A RID: 1290 RVA: 0x0006F376 File Offset: 0x0006D576 public void UpdateName() { this.thisName = base.gameObject.name; } // Token: 0x0600050B RID: 1291 RVA: 0x0006F389 File Offset: 0x0006D589 private void Start() { } // Token: 0x0600050C RID: 1292 RVA: 0x0006F38C File Offset: 0x0006D58C public void SetupCreatures() { if (this.creatures.number == 0) { this.creatures.number = 1; } this.waitingForPrompt = false; this.xmlName = this.creatures.characterName.ToString(); this.characterRow = Links.x.library.GetPCRowFromName(this.xmlName); if (this.characterRow == null) { Debug.Log(this.xmlName + " doesn't have database row"); return; } this.GetMorningNightHours(); this.disappearDay = false; this.disappearNight = false; this.waitTime = 0f; this.tr = base.transform; this.questPointSwap = false; if (this.creatures.changePointsFromQuest != Creatures.Adventures.None) { QuestState questState = QuestLog.GetQuestState(this.creatures.changePointsFromQuest.ToString()); QuestState questState2 = Records.x.StringToQuestState(this.creatures.changePointsFromQuestState.ToString()); if (questState == questState2) { this.questPointSwap = true; } } Transform parent = base.gameObject.transform.parent; if (parent && parent.gameObject != Links.x.diorama.creatures.gameObject) { this.inGroup = true; } this.GetPoints(this.questPointSwap, false); if (this.temporary) { this.LoadCreatures(); } string sceneName = Links.x.diorama.sceneName; if (this.temporary) { sceneName = this.originalScene; } if (this.temporaryState != "" && this.temporary) { for (int i = 0; i < this.states.Count; i++) { this.states[i] = this.temporaryState; } } if (this.delays != null) { this.waitingForDelay = true; this.startDelayTime = Links.x.gameplay.seconds; this.FinishSetUp(); return; } this.InstantiateCreatures(sceneName, this.thisName); } // Token: 0x0600050D RID: 1293 RVA: 0x0006F58C File Offset: 0x0006D78C public void CheckHourRespawn() { if (this.CheckForAllDead()) { bool flag = this.CanRespawn(); if (flag) { for (int i = 0; i < this.creatures.number; i++) { if (i < this.states.Count) { string text = this.states[i]; if (Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours()) >= this.data[i].x && flag && text != "Purgatory" && text != "Resurrected" && text != "Stunned" && text != "Fled" && !text.Contains("Dazed")) { text = "Respawning"; this.states[i] = "Respawning"; if (this.sailing && this.creatures.wipeOutBehavior != Creatures.wipeOutState.RespawnBoat) { this.sailing = false; if (this.creatureBoat) { this.creatureBoat.creatureBoat.RemoveBoat(); } this.creatureBoat.creatureBoat.leadCreature = null; this.creatures.isCreatureGroupLeader = false; this.creatureBoat = null; } if (this.sailing && this.creatureBoat && this.creatureBoat.creatureBoat) { this.creatureBoat.creatureBoat.NewNPC(); } if (this.creatures.wipeOutBehavior == Creatures.wipeOutState.RespawnTowerWithHostileCreature || this.creatures.wipeOutBehavior == Creatures.wipeOutState.RespawnTowerWithPeacefulCreature || this.creatures.wipeOutBehavior == Creatures.wipeOutState.RespawnBoat) { this.xmlName = this.creatures.afterDeathSpawns.ToString(); this.characterRow = Links.x.library.GetPCRowFromName(this.xmlName); if (this.creatures.wipeOutBehavior == Creatures.wipeOutState.RespawnTowerWithPeacefulCreature) { this.temperaments[i] = 1; } else { this.temperaments[i] = 2; } } else if (this.creatures.temperament == Creatures.temperamentState.FightsIfAttacked) { this.temperaments[i] = 1; } else { this.temperaments[i] = 2; } this.data[i] = new Vector3(0f, 0f, this.data[i].z); this.health[i] = this.characterRow._Life; this.InstanceCreature(i, this.thisName, false, Vector3.zero, text); this.states[i] = "Normal"; } } } } } } // Token: 0x0600050E RID: 1294 RVA: 0x0006F840 File Offset: 0x0006DA40 private bool CanRespawn() { bool flag = false; if (this.creatures.wipeOutBehavior == Creatures.wipeOutState.RespawnTowerWithHostileCreature || this.creatures.wipeOutBehavior == Creatures.wipeOutState.RespawnTowerWithPeacefulCreature || this.creatures.wipeOutBehavior == Creatures.wipeOutState.ResurrectTowerAfterTimePasses || this.creatures.wipeOutBehavior == Creatures.wipeOutState.RespawnBoat) { flag = Random.Range(0, 2) == 0 || this.sailing; } return flag; } // Token: 0x0600050F RID: 1295 RVA: 0x0006F8A0 File Offset: 0x0006DAA0 private bool CheckForAllDead() { bool flag = false; if (this.creatures.afterDeathSpawns != Creatures.xmlNames.None) { int num = 0; for (int i = 0; i < this.creatures.number; i++) { string text = ""; if (i < this.maps.Count) { text = this.states[i]; } if (text == null) { text = ""; } if (text.Contains("Gone") || text.Contains("Fled") || text.Contains("Swallowed") || text.Contains("Respawning")) { num++; } } if (num == this.creatures.number) { flag = true; } } return flag; } // Token: 0x06000510 RID: 1296 RVA: 0x0006F94C File Offset: 0x0006DB4C public void InstantiateCreatures(string scene, string objName) { bool flag = false; this.CheckForAllDead(); if (this.creatures.deactivateFromQuest != Creatures.Adventures.None) { QuestState questState = QuestLog.GetQuestState(this.creatures.deactivateFromQuest.ToString()); string text = this.creatures.deactivateQuestState.ToString(); QuestState questState2 = Records.x.StringToQuestState(text); if (questState == questState2 && this.creatures.deactivateQuestState != Creatures.AdventureStates.NotApplicable) { bool flag2 = false; if (Records.x.HasQuestTimer(this.creatures.deactivateFromQuest.ToString(), text)) { flag2 = true; } if (!flag2) { if (Records.x.questDebugging) { Debug.Log(string.Concat(new string[] { "Deactivate: ", (this != null) ? this.ToString() : null, " ", Records.x.StringToQuestState(this.creatures.deactivateQuestState.ToString()).ToString(), " ", questState.ToString() })); } for (int i = 0; i < this.states.Count; i++) { this.states[i] = "Fled"; } flag = true; } } } if (this.sailing && this.creatures.isCreatureGroupLeader && !Records.x.turnOffCharacters) { GameObject gameObject = Links.x.archives.InstantiateBoat(this.creatureBoat.boat.ToString(), Links.x.gameplay.gameObject.transform); Vector3 vector = this.walkPointsDay[0].position; Quaternion quaternion = this.walkPointsDay[0].rotation; gameObject.transform.parent = null; if (this.hasSaveFile) { Vector4 vector2 = this.positions[0]; vector = Vector3.zero; vector.x = vector2.x; vector.z = vector2.z; vector.y = vector2.y; float num = float.PositiveInfinity; for (int j = 0; j < this.walkPointsDay.Count; j++) { Vector3 vector3 = this.walkPointsDay[j].position - vector; float sqrMagnitude = vector3.sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; quaternion = this.walkPointsDay[j].rotation; } } } this.creatureBoat.creatureBoat = gameObject.GetComponent(); this.creatureBoat.creatureBoat.inMenu = false; this.creatureBoat.creatureBoat.model = this.creatureBoat.boat.ToString(); this.creatureBoat.creatureBoat.NPCSetupFromLoad(vector, quaternion); this.creatureBoat.creatureBoat.leadCreature = this; this.creatureBoat.leadCreature = this.creatures; gameObject.SetActive(true); } this.GetPointNodes(); for (int k = 0; k < this.creatures.number; k++) { string text2 = Links.x.diorama.sceneName; string text3 = ""; if (k < this.maps.Count) { text2 = this.maps[k]; text3 = this.states[k]; } if (text3 == null) { text3 = ""; } if (text3.Contains("Resurrected") && this.health[k] <= 0 && !Links.x.diorama.mapCanResurrect) { text3 = "Gone"; this.states[k] = "Gone"; } if (text3.Contains("Purgatory")) { if (!Links.x.diorama.mapCanResurrect) { text3 = "Gone"; this.states[k] = "Gone"; } if (Mathf.Floor(Links.x.gameplay.seconds) >= this.data[k].x && Links.x.diorama.mapCanResurrect && this.LeaderAliveOrNoLeader()) { text3 = "Resurrected"; this.states[k] = "Resurrected"; this.health[k] = 2; string text4 = "Resurrecting "; Vector3 vector3 = this.data[k]; Debug.Log(text4 + vector3.x.ToString() + " " + Links.x.gameplay.seconds.ToString()); } else { this.health[k] = 0; } } if (text3.Contains("Stunned")) { if (Links.x.forfeits.InForfeitsBoard(this.xmlName) || (this.xmlName.Contains("LocalGraveKeeper") && !Links.x.diorama.mapCanResurrect)) { Debug.Log("Stun ended for " + this.xmlName + " but was turned in so setting state to gone"); text3 = "Gone"; if (k < this.states.Count) { this.states[k] = "Gone"; } } if (Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours()) >= this.data[k].x && text3 != "Gone" && text3 != "Fled") { text3 = "NormalDazed"; this.states[k] = text3; this.health[k] = this.characterRow._Life / 2; this.SetAfterStunState(k); Debug.Log("done with stun " + ((this != null) ? this.ToString() : null)); } if (text3.Contains("Exile") && this.characterRow._Quest != "" && QuestLog.GetQuestState(this.characterRow._Quest) == QuestState.ExileIsland) { text3 = "Gone"; } } else if (this.xmlName.Contains("LocalGraveKeeper") && !Links.x.diorama.mapCanResurrect) { text3 = "Gone"; if (k < this.states.Count) { this.states[k] = "Gone"; } } bool flag3 = true; if (Records.x.turnOffAnimals) { flag3 = false; if (this.characterRow._Quest != "") { flag3 = true; } if (this.characterRow._DialogueFile != "") { flag3 = true; } if (this.characterRow._Name.Contains("Boro")) { flag3 = true; } } if (Records.x.turnOffCharacters) { flag3 = false; } if ((text2 == scene || this.temporary) && (text3.Contains("Normal") || text3 == "" || text3.Contains("Stunned") || text3 == null || text3 == "Resurrected" || text3 == "Respawning" || text3 == "Purgatory2") && flag3 && !flag) { if (text3 == "Resurrected") { this.characters.Add(null); text3 = "Resurrected"; this.states[k] = "Resurrected"; this.health[k] = 2; this.InstanceCreature(k, objName, true, (Vector3)this.GetWalkIndex(k).position, text3); } else { this.characters.Add(null); bool flag4 = false; if (text3 == "Purgatory2") { flag4 = true; } this.InstanceCreature(k, objName, flag4, Vector3.zero, text3); if (text3 == "NormalDazed") { this.SetAfterStunState(k); } if (flag4 && this.characters[k] && this.health[k] > 0) { this.characters[k].stats.SetHealth((int)this.ResurrectedHealth(), true); this.characters[k].stats.state = "Resurrected"; } this.CheckVIP(); } } else { this.characters.Add(null); } } this.waitTime = 0f; this.FinishSetUp(); } // Token: 0x06000511 RID: 1297 RVA: 0x00070207 File Offset: 0x0006E407 public void FinishSetUp() { if (this.characters.Count == 0 && !this.waitingForDelay) { base.enabled = false; } } // Token: 0x06000512 RID: 1298 RVA: 0x00070225 File Offset: 0x0006E425 public void SetAsResurrected() { } // Token: 0x06000513 RID: 1299 RVA: 0x00070228 File Offset: 0x0006E428 public void CheckResurrections() { if (Records.x.turnOffCharacters || Records.x.turnOffAnimals) { return; } for (int i = 0; i < this.creatures.number; i++) { string text = Links.x.diorama.sceneName; string text2 = ""; if (i < this.maps.Count) { text = this.maps[i]; text2 = this.states[i]; } else if (i >= this.initiateDialogue.Count) { this.initiateDialogue.Add(0); this.health.Add(10); this.data.Add(new Vector2(0f, 0f)); this.states.Add("Normal"); this.temperaments.Add((int)this.creatures.temperament); this.positions.Add(Vector4.zero); this.maps.Add(Links.x.diorama.sceneName); this.effects.Add(""); this.doorID.Add(""); } if (text2 == null) { text2 = ""; } if (text2.Contains("Purgatory")) { if (Links.x.diorama.mapCanResurrect && this.LeaderAliveOrNoLeader()) { this.temperaments[i] = 2; if (Links.x.gameplay.seconds >= this.data[i].x) { this.states[i] = "Resurrected"; if (text == Links.x.diorama.sceneName || this.temporary) { Vector3 vector = (Vector3)this.GetWalkIndex(i).position; if (this.characters[i]) { vector = this.characters[i].tr.position; } else { if (this.hasSaveFile) { Vector4 vector2 = this.positions[i]; if (vector2.x != 0f && vector2.z != 0f && !this.sailing) { vector = Vector3.zero; vector.x = vector2.x; vector.z = vector2.z; vector.y = vector2.y; } } this.health[i] = 10; } this.health[i] = (int)this.ResurrectedHealth(); this.InstanceCreature(i, this.thisName, true, vector, "Resurrected"); this.characters[i].hostility = 2; this.characters[i].stats.SetHealth((int)this.ResurrectedHealth(), true); this.characters[i].stats.state = "Resurrected"; } } } else if (!Links.x.diorama.mapCanResurrect) { this.states[i] = "Gone"; } } } } // Token: 0x06000514 RID: 1300 RVA: 0x0007055B File Offset: 0x0006E75B private float ResurrectedHealth() { return (float)Random.Range(1, Mathf.RoundToInt((float)this.characterRow._Life / 3f)); } // Token: 0x06000515 RID: 1301 RVA: 0x0007057C File Offset: 0x0006E77C public bool LeaderAliveOrNoLeader() { if (!this.creatures.hasLeader) { return true; } if (this.xmlName.Contains("Ghost")) { Character leader = this.GetLeader(); return leader && !leader.dead && !leader.stunned; } return true; } // Token: 0x06000516 RID: 1302 RVA: 0x000705D0 File Offset: 0x0006E7D0 public void ResurrectCreature(Character character, Vector3 startPosition) { if (Records.x.turnOffCharacters || Records.x.turnOffAnimals) { return; } int num = -1; for (int i = 0; i < this.characters.Count; i++) { if (this.characters[i] == character) { num = i; break; } } if (num == -1) { for (int j = 0; j < this.characters.Count; j++) { if (this.characters[j] == null) { num = j; break; } } } if (num > -1) { if (Links.x.diorama.mapCanResurrect && this.LeaderAliveOrNoLeader()) { this.temperaments[num] = 2; this.health[num] = (int)this.ResurrectedHealth(); this.InstanceCreature(num, this.thisName, true, startPosition, "Resurrected"); this.characters[num].dead = false; this.characters[num].hostility = 0; this.characters[num].stats.SetHealth(this.health[num], true); this.characters[num].stats.state = "Resurrected"; this.characters[num].tr.position = startPosition; this.characters[num].FirstPosition(null); this.characters[num].SetupNPCAfterLoadedVariables(); this.characters[num].hostility = 2; this.characters[num].CircleAnimation(""); return; } this.states[num] = "Gone"; this.characters[num].stats.state = "Gone"; } } // Token: 0x06000517 RID: 1303 RVA: 0x000707A4 File Offset: 0x0006E9A4 public void CheckStuns() { if (Records.x.turnOffCharacters || Records.x.turnOffAnimals || this.xmlName == null) { return; } for (int i = 0; i < this.creatures.number; i++) { string sceneName = Links.x.diorama.sceneName; string text = ""; if (i < this.maps.Count) { string text2 = this.maps[i]; text = this.states[i]; } else if (i >= this.initiateDialogue.Count) { this.initiateDialogue.Add(0); this.health.Add(10); this.data.Add(new Vector2(0f, 0f)); this.states.Add("Normal"); this.temperaments.Add((int)this.creatures.temperament); this.positions.Add(Vector4.zero); this.maps.Add(Links.x.diorama.sceneName); this.effects.Add(""); this.doorID.Add(""); } if (text == null) { text = ""; } if (text.Contains("Stunned") && Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours()) >= this.data[i].x) { if (Links.x.forfeits.InForfeitsBoard(this.xmlName) || (this.xmlName.Contains("LocalGraveKeeper") && !Links.x.diorama.mapCanResurrect)) { Debug.Log("Stun ended for " + this.xmlName + " but was turned in so setting state to gone"); text = "Gone"; if (i < this.states.Count) { this.states[i] = "Gone"; } } if (text != "Gone") { if (this.characterRow != null && i < this.health.Count) { this.health[i] = this.characterRow._Life / 2; } if (text.Contains("Exile")) { text = "NormalDazed"; } else { text = "NormalDazed"; } this.states[i] = text; if (this.characters.Count < 1) { Debug.Log(((this != null) ? this.ToString() : null) + " did not have characters for stun end"); this.characters.Add(null); } if (this.characters[i]) { this.characters[i].EndStun(); } else { this.InstanceCreature(i, this.thisName, false, (Vector3)this.GetWalkIndex(i).position, text); this.characters[i].EndStun(); } this.SetAfterStunState(i); if (this.xmlName.Contains("LocalGraveKeeper")) { Debug.Log(this.characters[i].stunned.ToString() + " " + this.characters[i].dead.ToString()); Transform parent = base.gameObject.transform.parent; if (parent.gameObject != Links.x.diorama.creatures) { foreach (object obj in parent) { CreatureActions component = ((Transform)obj).gameObject.GetComponent(); if (component && component != this) { component.CheckResurrections(); string text3 = "Check resurrections "; CreatureActions creatureActions = component; Debug.Log(text3 + ((creatureActions != null) ? creatureActions.ToString() : null)); } } } } } } } } // Token: 0x06000518 RID: 1304 RVA: 0x00070BA4 File Offset: 0x0006EDA4 public void SetAfterStunState(int i) { if (i < this.temperaments.Count && i > -1 && i < this.characters.Count) { if (this.creatures.afterStunState == Creatures.AfterStun.Passive || this.creatures.afterStunState == Creatures.AfterStun.Panic) { bool flag = false; if (this.temperaments[i] != (int)this.creatures.temperament) { flag = true; } this.temperaments[i] = 1; if (this.characters[i]) { this.characters[i].hostility = this.temperaments[i]; this.characters[i].CircleAnimation(""); if (!this.characters[i].stats.animal && flag) { int num = Random.Range(0, 3); if (num == 0) { this.characters[i].StartQuip("What happened?"); } if (num == 1) { this.characters[i].StartQuip("Everything's a bit hazy"); } if (num == 2) { this.characters[i].StartQuip("Memory is a little blurry"); } } } } if (this.creatures.afterStunState == Creatures.AfterStun.Hostile) { this.temperaments[i] = 2; if (this.characters[i]) { this.characters[i].hostility = this.temperaments[i]; this.characters[i].CircleAnimation(""); } } if (this.creatures.afterStunState == Creatures.AfterStun.Panic && this.characters[i]) { this.characters[i].Flee(this.characters[i].node, false, Links.x.gameplay.seconds, 1000f); this.characters[i].StartQuip("Help!"); } if (this.creatures.afterStunState == Creatures.AfterStun.LeaveWithQuestDeactivation) { if (Records.x.editor) { Debug.Log(((this != null) ? this.ToString() : null) + " awake from stun"); } if (this.deactivation) { if (this.characters[i]) { if (Records.x.editor) { Debug.Log(string.Concat(new string[] { (this != null) ? this.ToString() : null, " awake from stun ", this.creatures.deactivateFromQuest.ToString(), " ", QuestLog.GetQuestState(this.creatures.deactivateFromQuest.ToString()).ToString(), " ", Records.x.StringToQuestState(this.creatures.deactivateQuestState.ToString()).ToString() })); } if (QuestLog.GetQuestState(this.creatures.deactivateFromQuest.ToString()) == Records.x.StringToQuestState(this.creatures.deactivateQuestState.ToString()) || (this.creatures.deactivateFromQuest.ToString() != "" && this.creatures.deactivateQuestState == Creatures.AdventureStates.NotApplicable)) { string text = this.creatures.deactivateQuestState.ToString(); if (this.creatures.deactivateQuestState == Creatures.AdventureStates.NotApplicable) { text = "any"; Debug.Log("any"); } Records.x.AddQuestToTimer(this.creatures.deactivateFromQuest.ToString(), 1f, text, this.creatures.deactivateQuestStateComplete.ToString(), true); return; } } } else if (this.characters[i]) { this.characters[i].ignoreNodeIDs = true; this.characters[i].Leave(true); } } } } // Token: 0x06000519 RID: 1305 RVA: 0x00070FE4 File Offset: 0x0006F1E4 public void InstanceCreature(int i, string n, bool resurrected, Vector3 startPosition, string stateName) { GameObject gameObject = new GameObject(string.Concat(new string[] { this.xmlName, "_", this.thisName, "_", i.ToString() })); if (this.alliedToParty) { gameObject.transform.parent = Links.x.gameplay.transform; gameObject.transform.parent = null; } Character character = gameObject.AddComponent(); int num = i; if (resurrected) { gameObject.transform.position = startPosition; } else if (!this.ambush) { if (this.GetWalkIndex(num) != null) { gameObject.transform.position = (Vector3)this.GetWalkIndex(num).position; } else { gameObject.transform.position = this.walkPointsDay[0].position; } } if (this.activation && this.creatures.activateFromQuest != Creatures.Adventures.None && !this.ambush) { QuestState questState = QuestLog.GetQuestState(this.creatures.activateFromQuest.ToString()); QuestState questState2 = Records.x.StringToQuestState(this.creatures.activateQuestState.ToString()); if (questState == questState2) { this.activating = true; if (this.activation.childCount == 0) { gameObject.transform.position = this.activation.position; } else { gameObject.transform.position = this.activation.GetChild(0).position; } } } if (stateName == "NormalDazed") { character.wasStunned = true; } character.patrolNode = num; character.creatures = this; character.hostility = (int)this.creatures.temperament; character.summoned = this.summons; character.protectMe = this.creatures.protectUs; character.movesOnWater = this.movesOnWater; this.characters[i] = character; if (resurrected && !this.xmlName.Contains("host")) { this.xmlName = "LazureGhostDrudge"; } character.SetupBasic(this.alliedToParty, 0, this.xmlName, Records.x.currentPathNode, resurrected, 0); Records.x.currentPathNode++; Quaternion rotation = this.GetWalkTransform(num).rotation; if (rotation == Quaternion.Euler(Vector3.zero)) { rotation.y = Random.Range(-1f, 1f); } character.SetRotation(rotation, false, true); if (this.creatures.stayNearPoints) { this.characters[i].stats.stayNearPatrol = true; GraphNode graphNode; if (this.daySleep) { graphNode = this.GetWalkNodeNight(0); } else { graphNode = this.GetWalkNodeDay(0); } this.characters[i].stats.stayNearPoint = graphNode; } character.stats.creaturesName = n; if (i < this.states.Count) { character.stats.state = this.states[i]; } if (this.creatures.number == 1 && this.hasSaveFile) { if (this.Peddler() && this.saveFile.KeyExists("Peddler")) { character.stats.savedMerchantList = this.saveFile.Load("Peddler"); character.stats.savedMerchantTime = this.saveFile.Load("PeddlerTime"); if (this.saveFile.KeyExists("PeddlerHistory")) { character.stats.savedMerchantHistory = this.saveFile.Load("PeddlerHistory"); } } if (this.data.Count > 0 && (this.creatures.saveItems || this.data[0].z > 0f)) { bool flag = false; if (this.characterRow._DialogueFile != "") { flag = true; } if ((flag || this.creatures.saveItems) && this.saveFile.KeyExists("Items")) { this.savedBagItems = this.saveFile.Load("Items"); character.SetNPCSavedItems(this.savedBagItems); } } } character.stuckInPlace = false; character.cannotAttack = false; if (this.creatures.mobility == Creatures.mobilityState.IdlesOffGridUntilAttacked && this.temperaments[i] != 0) { character.stuckInPlace = true; } if (this.creatures.mobility == Creatures.mobilityState.AlwaysOffGrid) { character.cannotAttack = true; } if (!this.hasSaveFile) { if (!this.summons) { this.initiateDialogue[i] = this.characters[i].stats.initiateDialogue; this.health[i] = this.characters[i].stats.HealthCurrent(); this.states[i] = "Normal"; this.temperaments[i] = this.characters[i].hostility; Vector4 vector = new Vector4(0f, 0f, 0f, 0f); vector.x = this.characters[i].tr.position.x; vector.y = this.characters[i].tr.position.y; vector.z = this.characters[i].tr.position.z; vector.w = (float)this.characters[i].desiredGraph; this.positions[i] = vector; this.doorID[i] = this.characters[i].doorID; if (this.temporary) { this.maps[i] = this.originalScene; } else { this.maps[i] = Links.x.diorama.sceneName; } } else if (i >= this.initiateDialogue.Count) { this.initiateDialogue.Add(0); this.health.Add(10); this.data.Add(new Vector2(0f, 0f)); this.states.Add("Normal"); this.temperaments.Add((int)this.creatures.temperament); this.positions.Add(Vector4.zero); this.maps.Add(Links.x.diorama.sceneName); this.effects.Add(""); this.doorID.Add(this.characters[i].doorID); } } else if (i < this.health.Count && this.health[i] <= 0 && !resurrected) { character.Stunned(true); } if (this.creatures.rope && character) { this.creatures.rope.SetActive(true); Rope rope = this.creatures.rope.GetComponent(); if (!rope) { rope = this.creatures.rope.AddComponent(); } rope.SetupCharacter(character, 10f); } if (this.creatureBoat) { int num2 = 0; int num3 = 0; using (IEnumerator enumerator = this.creatureBoat.transform.GetEnumerator()) { while (enumerator.MoveNext()) { if ((Transform)enumerator.Current == base.transform) { num2 = num3; } num3++; } } this.creatureBoat.creatureBoat.AddSailor(character, num2); this.sailing = true; } this.SetLoadedVariables(false, i); if (resurrected) { this.randomNodeCenter = character.node; } if (!this.sailing) { if (this.GetDayNight(false)) { this.StartDay(true); } else { this.StartNight(true); } this.CheckSleep(character); } } // Token: 0x0600051A RID: 1306 RVA: 0x00071828 File Offset: 0x0006FA28 public bool GetDayNight(bool timeJump) { bool flag = false; int num = (int)Mathf.Floor(Links.x.gameplay.gameHours); bool flag2 = false; for (int i = this.morningHour; i < this.morningHour + 24; i++) { int num2 = i; if (i >= 24) { num2 -= 24; } if (!flag2 && !flag && num2 == this.nightHour) { flag2 = true; } if (num == num2 && !flag2) { flag = true; } } if (flag) { this.isDay = true; } else { this.isDay = false; } this.CheckIfHasTimeLocation(timeJump); return flag; } // Token: 0x0600051B RID: 1307 RVA: 0x000718B4 File Offset: 0x0006FAB4 public void SetLoadedVariables(bool all, int index) { if (this.waitingForPrompt) { return; } bool flag = false; if (this.hasSaveFile) { for (int i = 0; i < this.characters.Count; i++) { if (this.characters[i] && (all || index == i)) { if (i < this.initiateDialogue.Count) { this.characters[i].stats.initiateDialogue = this.initiateDialogue[i]; int num = this.health[i]; if (Links.x.diorama.lastTimeOnScene > 0f && num > 0 && (float)Links.x.gameplay.gameDays > Links.x.diorama.lastTimeOnScene + 1f) { num += 10 * (int)((float)Links.x.gameplay.gameDays - Links.x.diorama.lastTimeOnScene); } this.characters[i].stats.SetHealth(num, false); if (this.health[i] <= 0 && !this.states[i].Contains("Stunned")) { this.characters[i].Dead(true, false, false); } this.characters[i].stats.state = this.states[i]; this.characters[i].hostility = this.temperaments[i]; this.characters[i].patrolNode = (int)this.data[i].y; this.characters[i].numberOfTimesKilled = this.data[i].z; if (!this.temporary || (this.temporary && this.characters[i].ghost)) { this.characters[i].doorID = this.doorID[i]; Vector4 vector = this.positions[i]; if (vector.x != 0f && vector.z != 0f && !this.sailing) { Vector3 zero = Vector3.zero; zero.x = vector.x; zero.z = vector.z; zero.y = vector.y; this.characters[i].desiredGraph = (int)vector.w; this.characters[i].tr.position = zero; this.characters[i].FirstPosition(null); } } this.characters[i].stats.savedEffects = this.effects[i]; if (this.characters[i].stats.state == null) { this.characters[i].stats.state = ""; } if (this.characters[i].hostility >= 1 && this.characters[i].stats.HealthCurrent() > 0 && this.effects[i] != "") { flag = true; } this.characters[i].CircleAnimation(""); } else { this.LoadFresh(i); } } } } else { for (int j = 0; j < this.characters.Count; j++) { if (this.characters[j] && (all || index == j)) { this.LoadFresh(j); } } } for (int k = 0; k < this.characters.Count; k++) { if (this.characters[k] && (all || index == k)) { this.characters[k].SetupNPCAfterLoadedVariables(); } } if (flag) { for (int l = 0; l < this.characters.Count; l++) { if (this.characters[l] && (all || index == l)) { this.SpawnEffects(this.characters[l], this.effects[l]); } } } if (this.sailing && this.hasSaveFile) { if (this.creatureBoat.leadCreature == this.creatures) { Vector4 vector2 = this.positions[0]; Vector3 zero2 = Vector3.zero; zero2.x = vector2.x; zero2.z = vector2.z; zero2.y = vector2.y; this.creatureBoat.creatureBoat.tr.position = zero2; return; } } else if (this.sailing && !this.hasSaveFile && this.creatureBoat.creatureBoat.navigator == this.characters[0]) { this.creatureBoat.creatureBoat.transform.position = this.creatureBoat.leadCreature.GetComponent().GetWalkTransform(0).position; } } // Token: 0x0600051C RID: 1308 RVA: 0x00071DFC File Offset: 0x0006FFFC private void LoadFresh(int i) { if (!this.sailing) { string text = ""; if (this.characters[i].node == null) { this.characters[i].FindCurrentNode(true); } this.characters[i].doorID = text; if (text != "") { this.characters[i].desiredGraph = 1; } if (!this.ambush && !this.activation) { this.characters[i].FirstPosition(null); } else if (this.activation) { this.characters[i].SettlePosition(); } } else { this.characters[i].doorID = ""; this.characters[i].desiredGraph = 0; this.characters[i].FirstPosition(null); } this.characters[i].stats.SpawnStartingEffect(); } // Token: 0x0600051D RID: 1309 RVA: 0x00071F0C File Offset: 0x0007010C public void SpawnEffects(Character character, string savedEffects) { this.rawlines = new string[0]; char c = ','; this.rawlines = savedEffects.Split(c, StringSplitOptions.None); int num = 0; string text = ""; string text2 = ""; string text3 = ""; string text4 = ""; if (savedEffects != " " && savedEffects != ",") { foreach (string text5 in this.rawlines) { num++; if (num == 1) { text = text5; } if (num == 2) { text2 = text5; } if (num == 3) { text3 = text5; } if (num == 4) { text4 = text5; } if (num == 4 && text != "") { character.stats.AddEffectFromLoad(text, text2, text3, text4); num = 0; } } } character.stats.SpawnEffects(); } // Token: 0x0600051E RID: 1310 RVA: 0x00071FE0 File Offset: 0x000701E0 public void OverrideLoadedVariables(int life, string savedEffects) { for (int i = 0; i < this.characters.Count; i++) { if (this.characters[i]) { this.characters[i].stats.SetHealth(life, true); this.health[i] = life; this.effects[i] = savedEffects; this.characters[i].stats.savedEffects = savedEffects; if (this.characters[i].hostility > 1 && (this.characters[i].stats.state.Contains("Normal") || this.characters[i].stats.state == "") && this.characters[i].stats.HealthCurrent() > 0) { this.SpawnEffects(this.characters[i], this.effects[i]); } this.characters[i].SetupNPCAfterLoadedVariables(); } } } // Token: 0x0600051F RID: 1311 RVA: 0x00072108 File Offset: 0x00070308 public string GetSaveIdentifier() { if ((this.creatures.activateFromQuest == Creatures.Adventures.None && this.creatures.deactivateFromQuest == Creatures.Adventures.None) || this.creatures.number > 1) { return this.thisName; } return this.creatures.characterName.ToString(); } // Token: 0x06000520 RID: 1312 RVA: 0x0007215C File Offset: 0x0007035C public void LoadCreatures() { string sceneName = Links.x.diorama.sceneName; if (this.temporary) { sceneName = this.originalScene; } string text = string.Concat(new string[] { Records.x.openBook, "/Creature_", sceneName, "_", this.GetSaveIdentifier(), ".es3" }); if (base.gameObject.transform.parent) { this.creatureBoat = base.gameObject.transform.parent.gameObject.GetComponent(); if (this.creatureBoat) { this.sailing = true; } } if (ES3.FileExists(text) && !this.summons) { this.hasSaveFile = true; this.saveFile = new ES3File(text); this.initiateDialogue = this.saveFile.Load>("InitiateDialogue"); this.health = this.saveFile.Load>("Health"); this.data = this.saveFile.Load>("Data"); this.states = this.saveFile.Load>("States"); this.temperaments = this.saveFile.Load>("Temperment"); this.positions = this.saveFile.Load>("Positions"); this.timeSinceWipeOut = this.saveFile.Load("TimeSinceWipeOut"); this.maps = this.saveFile.Load>("Maps"); this.effects = this.saveFile.Load>("Effects"); this.doorID = this.saveFile.Load>("Indoors"); if (this.sailing && this.creatures.isCreatureGroupLeader) { this.savedItems = this.saveFile.Load("SailingItems"); return; } } else { this.hasSaveFile = false; this.timeSinceWipeOut = 0f; for (int i = 0; i < this.creatures.number; i++) { this.initiateDialogue.Add(0); this.health.Add(10); this.data.Add(Vector2.zero); this.states.Add("Normal"); this.temperaments.Add((int)this.creatures.temperament); this.positions.Add(Vector4.zero); this.maps.Add(sceneName); this.effects.Add(""); this.doorID.Add(""); } } } // Token: 0x06000521 RID: 1313 RVA: 0x00072408 File Offset: 0x00070608 public void SaveCreatures() { if (this.waitingForPrompt || (this.summons && !this.onlyTemporary)) { return; } string sceneName = Links.x.diorama.sceneName; if (!this.onlyTemporary) { if (this.temporary) { sceneName = this.originalScene; } for (int i = 0; i < this.characters.Count; i++) { if (i >= this.initiateDialogue.Count) { this.initiateDialogue.Add(0); this.health.Add(10); this.data.Add(new Vector2(0f, 0f)); this.states.Add("Normal"); this.temperaments.Add((int)this.creatures.temperament); this.positions.Add(Vector4.zero); this.maps.Add(Links.x.diorama.sceneName); this.effects.Add(""); this.doorID.Add(""); } if (this.characters[i]) { int num = this.characters[i].stats.initiateDialogue; if (num == 3) { num = 1; } this.initiateDialogue[i] = num; this.health[i] = this.characters[i].stats.HealthCurrent(); if (this.characters[i].missing) { this.health[i] = 0; } this.temperaments[i] = this.characters[i].hostility; this.data[i] = new Vector3(this.data[i].x, (float)this.characters[i].patrolNode, this.characters[i].numberOfTimesKilled); Vector4 vector = new Vector4(0f, 0f, 0f, 0f); vector.x = this.characters[i].tr.position.x; vector.y = this.characters[i].tr.position.y; vector.z = this.characters[i].tr.position.z; if (this.sailing && this.creatureBoat.creatureBoat.navigator == this.characters[i]) { vector.x = this.creatureBoat.creatureBoat.tr.position.x; vector.y = this.creatureBoat.creatureBoat.tr.position.y; vector.z = this.creatureBoat.creatureBoat.tr.position.z; } vector.w = (float)this.characters[i].desiredGraph; if (!this.questPointSwap && this.creatures.changePointsFromQuest != Creatures.Adventures.None) { QuestState questState = QuestLog.GetQuestState(this.creatures.changePointsFromQuest.ToString()); QuestState questState2 = Records.x.StringToQuestState(this.creatures.changePointsFromQuestState.ToString()); if (questState == questState2) { Debug.Log(((this != null) ? this.ToString() : null) + " needs to swap points next time, not saving position"); vector.x = 0f; vector.y = 0f; vector.z = 0f; vector.w = 0f; } } this.positions[i] = vector; this.doorID[i] = this.characters[i].doorID; this.states[i] = this.characters[i].stats.state; if (this.characters[i].party) { Debug.Log("states " + this.states[i]); } if (!this.characters[i].changingMaps && !this.temporary) { this.maps[i] = sceneName; } if (this.characters[i].hostility >= 1) { this.characters[i].stats.GetEffectStrings(); } this.effects[i] = this.characters[i].stats.savedEffects; } } string text = string.Concat(new string[] { Records.x.openBook, "/Creature_", sceneName, "_", this.GetSaveIdentifier(), ".es3" }); this.saveFile = new ES3File(text); this.saveFile.Save>("InitiateDialogue", this.initiateDialogue); this.saveFile.Save>("Health", this.health); this.saveFile.Save>("Data", this.data); this.saveFile.Save>("Temperment", this.temperaments); this.saveFile.Save>("Positions", this.positions); this.saveFile.Save>("Maps", this.maps); this.saveFile.Save>("States", this.states); this.saveFile.Save>("Indoors", this.doorID); this.saveFile.Save>("Effects", this.effects); this.saveFile.Save("TimeSinceWipeOut", this.timeSinceWipeOut); if (this.sailing && this.creatureBoat.leadCreature == this.creatures) { if (this.items != null) { this.MakeItemSaveString(); } this.saveFile.Save("SailingItems", this.savedItems); } if (this.creatures.number <= 1 && this.characters.Count > 0 && this.characters[0] && this.Peddler()) { this.saveFile.Save("Peddler", this.characters[0].stats.savedMerchantList); this.saveFile.Save("PeddlerTime", this.characters[0].stats.savedMerchantTime); this.saveFile.Save("PeddlerHistory", this.characters[0].stats.savedMerchantHistory); } if (this.creatures.number == 1 && this.data.Count > 0 && (this.creatures.saveItems || this.data[0].z > 0f)) { bool flag = false; if (this.characterRow._DialogueFile != "") { flag = true; } if (flag || this.creatures.saveItems) { if (this.characters.Count > 0) { if (this.characters[0]) { this.savedBagItems = this.characters[0].GetNPCSavedItems(); this.saveFile.Save("Items", this.savedBagItems); } else if (this.savedBagItems != "") { this.saveFile.Save("Items", this.savedBagItems); } } else if (this.savedBagItems != "") { this.saveFile.Save("Items", this.savedBagItems); } } } if (this.temporary) { Character firstCharacter = this.GetFirstCharacter(); if (firstCharacter) { this.AddTempCreature(this.GetFirstCharacter(), this.maps[0], firstCharacter.tr.position, this.futureDelay, Links.x.diorama.sceneName, false); } else { this.AddTempCreature(null, this.maps[0], this.positions[0], this.futureDelay, Links.x.diorama.sceneName, false); } } this.saveFile.Sync(); this.hasSaveFile = true; return; } Character firstCharacter2 = this.GetFirstCharacter(); this.originalScene = ""; if (firstCharacter2) { this.AddTempCreature(this.GetFirstCharacter(), Links.x.diorama.sceneName, firstCharacter2.tr.position, 0f, Links.x.diorama.sceneName, false); return; } this.AddTempCreature(null, Links.x.diorama.sceneName, this.positions[0], 0f, Links.x.diorama.sceneName, false); } // Token: 0x06000522 RID: 1314 RVA: 0x00072D48 File Offset: 0x00070F48 private bool Peddler() { if (this.xmlName.Contains("Peddler")) { return true; } if (Links.x.diorama.sceneName.Contains("D6")) { if (this.xmlName.Contains("Chanter")) { return true; } if (this.xmlName.Contains("RozafirUndergroundMerchant")) { return true; } } return false; } // Token: 0x06000523 RID: 1315 RVA: 0x00072DB0 File Offset: 0x00070FB0 public void UpdatePosition(Vector3 pt) { for (int i = 0; i < this.delays.Count; i++) { if (i >= this.initiateDialogue.Count) { this.initiateDialogue.Add(0); this.health.Add(10); this.data.Add(new Vector2(0f, 0f)); this.states.Add("Normal"); this.temperaments.Add((int)this.creatures.temperament); this.positions.Add(Vector4.zero); this.maps.Add(Links.x.diorama.sceneName); this.effects.Add(""); this.doorID.Add(""); } if (this.delays[i] > -1f && this.delays[i] != 0f && i < this.positions.Count) { this.positions[i] = pt; } } } // Token: 0x06000524 RID: 1316 RVA: 0x00072ED8 File Offset: 0x000710D8 public void UpdateCharacter(Character character) { int num = this.characters.IndexOf(character); if (num > -1) { this.health[num] = character.stats.HealthCurrent(); int num2 = character.stats.initiateDialogue; if (num2 == 3) { num2 = 2; } this.initiateDialogue[num] = num2; this.temperaments[num] = character.hostility; Vector4 vector = new Vector4(0f, 0f, 0f, 0f); vector.x = character.tr.position.x; vector.y = character.tr.position.y; vector.z = character.tr.position.z; vector.w = (float)character.desiredGraph; if (this.sailing && this.creatureBoat.creatureBoat.navigator == character) { vector.x = this.creatureBoat.creatureBoat.tr.position.x; vector.y = this.creatureBoat.creatureBoat.tr.position.y; vector.z = this.creatureBoat.creatureBoat.tr.position.z; } this.positions[num] = vector; this.doorID[num] = character.doorID; this.states[num] = character.stats.state; this.data[num] = new Vector3(this.data[num].x, (float)character.patrolNode, character.numberOfTimesKilled); if (character.hostility >= 1) { character.stats.GetEffectStrings(); } this.effects[num] = character.stats.savedEffects; } } // Token: 0x06000525 RID: 1317 RVA: 0x000730C4 File Offset: 0x000712C4 public void Charmed(Character character) { int num = this.characters.IndexOf(character); this.states[num] = "Gone"; this.characters[num] = null; this.health[num] = 0; this.effects[num] = ""; } // Token: 0x06000526 RID: 1318 RVA: 0x0007311C File Offset: 0x0007131C public string GetState(Character character) { int num = this.characters.IndexOf(character); if (num > -1) { return this.states[num]; } return ""; } // Token: 0x06000527 RID: 1319 RVA: 0x0007314C File Offset: 0x0007134C public int GetCharacterIndex(Character character) { return this.characters.IndexOf(character); } // Token: 0x06000528 RID: 1320 RVA: 0x0007315A File Offset: 0x0007135A public Character GetCharacterAtIndex(int index) { if (index == -1) { return null; } if (this.characters.Count <= 0) { return null; } if (index < this.characters.Count) { return this.characters[index]; } return null; } // Token: 0x06000529 RID: 1321 RVA: 0x00073190 File Offset: 0x00071390 public Character GetFirstCharacter(bool canBeStunned) { if (this.characters.Count > 0) { Character character = this.characters[0]; if (character) { if (!character.dead && (!character.stunned || canBeStunned)) { return character; } return null; } } return null; } // Token: 0x0600052A RID: 1322 RVA: 0x000731DC File Offset: 0x000713DC public bool AnyAlive() { if (this.characters.Count > 0) { for (int i = 0; i < this.characters.Count; i++) { Character character = this.characters[i]; if (character && !character.dead) { return true; } } } return false; } // Token: 0x0600052B RID: 1323 RVA: 0x00073230 File Offset: 0x00071430 public bool AnyNearParty() { if (!Links.x.hasMain) { return true; } for (int i = 0; i < this.characters.Count; i++) { Character character = this.characters[i]; if (character && (Links.x.main.currentPosition - character.currentPosition).sqrMagnitude < 2500f) { return true; } } return false; } // Token: 0x0600052C RID: 1324 RVA: 0x000732A4 File Offset: 0x000714A4 public Character GetFirstCharacter() { if (this.characters.Count <= 0 || !this.characters[0]) { return null; } if (!this.characters[0].dead && !this.characters[0].stunned) { return this.characters[0]; } return null; } // Token: 0x0600052D RID: 1325 RVA: 0x00073308 File Offset: 0x00071508 public void AddTimeOfDeath(float t, Character character) { for (int i = 0; i < this.characters.Count; i++) { if (i >= this.initiateDialogue.Count) { this.initiateDialogue.Add(0); this.health.Add(10); this.data.Add(new Vector2(0f, 0f)); this.states.Add("Normal"); this.temperaments.Add((int)this.creatures.temperament); this.positions.Add(Vector4.zero); this.maps.Add(Links.x.diorama.sceneName); this.effects.Add(""); this.doorID.Add(""); } if (character == this.characters[i]) { this.data[i] = new Vector3(t, this.data[i].y, character.numberOfTimesKilled); } } } // Token: 0x0600052E RID: 1326 RVA: 0x00073428 File Offset: 0x00071628 public float GetTimeOfDeath(Character character) { for (int i = 0; i < this.characters.Count; i++) { if (i >= this.initiateDialogue.Count) { this.initiateDialogue.Add(0); this.health.Add(10); this.data.Add(new Vector2(0f, 0f)); this.states.Add("Normal"); this.temperaments.Add((int)this.creatures.temperament); this.positions.Add(Vector4.zero); this.maps.Add(Links.x.diorama.sceneName); this.effects.Add(""); this.doorID.Add(""); } if (character == this.characters[i]) { return this.data[i].x; } } return 0f; } // Token: 0x0600052F RID: 1327 RVA: 0x00073538 File Offset: 0x00071738 public void DayNightSwitch(bool timeJump) { this.GetDayNight(timeJump); bool flag = false; bool flag2 = false; if (Mathf.Floor(Links.x.gameplay.gameHours) == (float)this.morningHour) { flag = true; } if (Mathf.Floor(Links.x.gameplay.gameHours) == (float)this.nightHour) { flag2 = true; } if (flag) { this.StartDay(false); } if (flag2) { this.StartNight(false); } } // Token: 0x06000530 RID: 1328 RVA: 0x000735A4 File Offset: 0x000717A4 public bool NearWalkNode(string type, Character character, float max, bool canCheckArea) { if (character.sleeping) { return false; } if (type == "Night" || type == "Any") { Vector3 position = character.tr.position; if (character.node != null && this.walkNodesNight.Count > 0 && canCheckArea && !this.activation && !this.deactivation && character.node.Area == this.walkNodesNight[0].Area) { return true; } for (int i = 0; i < this.walkNodesNight.Count; i++) { if (this.walkNodesNight[i] == null) { Debug.Log(((this != null) ? this.ToString() : null) + " null node"); } else if ((position - (Vector3)this.walkNodesNight[i].position).sqrMagnitude < max) { return true; } } } if (type == "Day" || type == "Any") { Vector3 position2 = character.tr.position; if (character.node != null && this.walkNodesDay.Count > 0 && canCheckArea && !this.activation && !this.deactivation && character.node.Area == this.walkNodesDay[0].Area) { return true; } for (int j = 0; j < this.walkNodesDay.Count; j++) { if (this.walkNodesDay[j] != null && (position2 - (Vector3)this.walkNodesDay[j].position).sqrMagnitude < max) { return true; } } } return false; } // Token: 0x06000531 RID: 1329 RVA: 0x0007377C File Offset: 0x0007197C private void CheckGhostVanish(Character character) { if (character.ghost && Links.x.diorama.ghostPoint && (Links.x.diorama.ghostPoint.transform.position - character.tr.position).sqrMagnitude > 25f) { character.ghostVanishing = true; character.alwaysOn = true; character.TurnScriptsOn(); } } // Token: 0x06000532 RID: 1330 RVA: 0x000737F4 File Offset: 0x000719F4 public void StartNight(bool checkFromArea) { if (this.deactivating) { return; } if (this.stopPatrolTemporarily) { return; } if (this.disappearNight || this.hasDayNightCycle) { for (int i = 0; i < this.characters.Count; i++) { if (this.characters[i]) { if (i == -1 || i >= this.vanishNodesNight.Count) { this.waitTime = 0f; this.standTime = 0f; if (this.characters[i].inactive) { this.characters[i].TurnScriptsOn(); } this.CheckSleep(this.characters[i]); if (!this.NearWalkNode("Night", this.characters[i], 100f, checkFromArea)) { this.characters[i].dayNightVanishing = true; if (this.characters[i].inactive) { this.characters[i].TurnScriptsOn(); } this.characters[i].alwaysOn = true; if (i == -1 || i >= this.walkNodesNight.Count) { Debug.LogWarning("Missing node " + ((this != null) ? this.ToString() : null)); } else { this.vanishNode = this.walkNodesNight[i]; } } } else { this.vanishNode = this.vanishNodesNight[i]; if (this.characters[i].inactive) { this.characters[i].TurnScriptsOn(); } this.CheckSleep(this.characters[i]); if (this.disappearDay && this.disappearNight) { if (this.characters[i].actions) { this.characters[i].actions.EndActions(); } if (PathUtilities.IsPathPossible(this.vanishNode, this.characters[i].node)) { this.characters[i].dayNightVanishing = true; if (this.characters[i].inactive) { this.characters[i].TurnScriptsOn(); } this.characters[i].alwaysOn = true; } else { this.characters[i].dayNightVanishing = false; this.characters[i].alwaysOn = false; } } else if (!this.characters[i].vanished) { this.characters[i].dayNightVanishing = true; if (this.characters[i].inactive) { this.characters[i].TurnScriptsOn(); } this.characters[i].alwaysOn = true; } } } } return; } if (this.disappearDay) { for (int j = 0; j < this.characters.Count; j++) { if (this.characters[j]) { this.VanishReturn(this.characters[j]); } } } } // Token: 0x06000533 RID: 1331 RVA: 0x00073B2C File Offset: 0x00071D2C public void LoopNight(int index) { if (this.deactivating) { return; } if (this.stopPatrolTemporarily) { return; } if (!this.disappearNight) { for (int i = 0; i < this.characters.Count; i++) { if (this.characters[i]) { this.characters[i].patrolNode = i; } } return; } if (index <= -1 || index >= this.vanishNodesNight.Count) { Debug.LogWarning(((this != null) ? this.ToString() : null) + " did not have enough vanish nodes " + index.ToString()); return; } this.vanishNode = this.vanishNodesNight[index]; if (this.disappearDay && this.disappearNight) { this.VanishMapExit(this.characters[index], index); return; } this.VanishDisappear(this.characters[index]); } // Token: 0x06000534 RID: 1332 RVA: 0x00073C0D File Offset: 0x00071E0D public void VanishReturn(Character character) { character.dayNightVanishing = false; character.alwaysOn = false; character.vanished = false; character.TurnScriptsOn(); } // Token: 0x06000535 RID: 1333 RVA: 0x00073C2C File Offset: 0x00071E2C public void VanishDisappear(Character character) { if ((this.vanishNodesNight.Count > 0 && this.disappearNight && !this.isDay) || (this.disappearDay && this.vanishNodesDay.Count > 0 && this.isDay)) { character.dayNightVanishing = true; character.alwaysOn = false; character.TurnScriptsOff(); character.vanished = true; return; } character.alwaysOn = false; character.dayNightVanishing = false; character.vanished = false; } // Token: 0x06000536 RID: 1334 RVA: 0x00073CA8 File Offset: 0x00071EA8 public void VanishMapExit(Character character, int i) { MapExit mapExit = Links.x.diorama.ClosestMapEntrance((Vector3)this.vanishNode.position); if (mapExit != null) { bool flag = Links.x.diorama.IsInteriorExit(mapExit); MapExit.interiorNames exteriorConnection = mapExit.exteriorConnection; string text = ""; if (flag) { text = mapExit.interiorConnection.ToString(); } string indoorID = this.characters[i].indoorID; MapExit mapExit2 = Links.x.diorama.MatchMapExitInteriorExterior(flag, exteriorConnection, mapExit); Links.x.gaia.TeleportNPC(character, mapExit2, text, flag); Debug.Log(string.Concat(new string[] { "finish vanishing ", (this != null) ? this.ToString() : null, " ", this.characters[i].node.GraphIndex.ToString(), " ", this.vanishNode.GraphIndex.ToString(), " ", this.characters[i].indoorID, " ", indoorID })); this.characters[i].dayNightVanishing = false; this.characters[i].alwaysOn = false; } } // Token: 0x06000537 RID: 1335 RVA: 0x00073E14 File Offset: 0x00072014 public void StartDay(bool checkFromArea) { if (this.deactivating) { return; } if (this.stopPatrolTemporarily) { return; } if (this.disappearDay || this.hasDayNightCycle) { for (int i = 0; i < this.characters.Count; i++) { if (this.characters[i]) { if (this.vanishNodesDay.Count == 0) { this.waitTime = 0f; this.standTime = 0f; if (this.characters[i].inactive) { this.characters[i].TurnScriptsOn(); } this.CheckSleep(this.characters[i]); if (!this.NearWalkNode("Day", this.characters[i], 100f, checkFromArea)) { this.characters[i].dayNightVanishing = true; if (this.characters[i].inactive) { this.characters[i].TurnScriptsOn(); } this.characters[i].alwaysOn = true; this.vanishNode = this.walkNodesDay[i]; } } else { this.vanishNode = this.vanishNodesDay[i]; if (this.characters[i].inactive) { this.characters[i].TurnScriptsOn(); } this.CheckSleep(this.characters[i]); if (this.disappearDay && this.disappearNight) { if (this.characters[i].node != null) { if (this.characters[i].actions) { this.characters[i].actions.EndActions(); } if (PathUtilities.IsPathPossible(this.vanishNode, this.characters[i].node)) { this.characters[i].dayNightVanishing = true; if (this.characters[i].inactive) { this.characters[i].TurnScriptsOn(); } this.characters[i].alwaysOn = true; } else { this.characters[i].dayNightVanishing = false; this.characters[i].alwaysOn = false; } } } else if (!this.characters[i].vanished) { this.characters[i].dayNightVanishing = true; if (this.characters[i].inactive) { this.characters[i].TurnScriptsOn(); } this.characters[i].alwaysOn = true; } } } } return; } if (this.disappearNight) { for (int j = 0; j < this.characters.Count; j++) { if (this.characters[j] && !this.characters[j].ghost) { this.VanishReturn(this.characters[j]); } } } } // Token: 0x06000538 RID: 1336 RVA: 0x0007413C File Offset: 0x0007233C public void LoopDay(int index) { if (this.deactivating) { return; } if (this.stopPatrolTemporarily) { return; } if (this.disappearDay) { if (index == -1 || index >= this.vanishNodesDay.Count) { Debug.Log(((this != null) ? this.ToString() : null) + " error for vanish day nodes"); } this.vanishNode = this.vanishNodesDay[index]; if (Records.x.editor) { if (this.characters[index].node == null && !this.characters[index].stunned) { Character character = this.characters[index]; Debug.Log(((character != null) ? character.ToString() : null) + " has no node"); } if (this.vanishNode == null) { Character character2 = this.characters[index]; Debug.Log(((character2 != null) ? character2.ToString() : null) + " night vanish node is null"); } } if (this.characters[index].node != null) { if (this.disappearDay && this.disappearNight) { this.VanishMapExit(this.characters[index], index); return; } this.VanishDisappear(this.characters[index]); return; } else if (!this.characters[index].stunned) { Character character3 = this.characters[index]; Debug.Log(((character3 != null) ? character3.ToString() : null) + " is missing node, cannot vanish, position is " + this.characters[index].tr.position.ToString()); return; } } else { for (int i = 0; i < this.characters.Count; i++) { if (this.characters[i]) { this.characters[i].patrolNode = i; } } } } // Token: 0x06000539 RID: 1337 RVA: 0x00074315 File Offset: 0x00072515 public void ChangingTime(float gameHours, bool partyCamping) { if (this.waitingForPrompt) { return; } base.StartCoroutine(this.JumpTime(gameHours, partyCamping)); } // Token: 0x0600053A RID: 1338 RVA: 0x0007432F File Offset: 0x0007252F private IEnumerator JumpTime(float gameHours, bool partyCamping) { if (this.sailing) { if (this.creatureBoat && this.creatureBoat.creatureBoat && !this.CheckForAllDead()) { Character character2 = null; for (int j = 0; j < this.characters.Count; j++) { if (this.characters[j] && this.characters[j].boatNavigator) { character2 = this.characters[j]; } } if (character2) { int num = character2.patrolNode; float num2 = float.PositiveInfinity; Vector3 position = this.creatureBoat.creatureBoat.tr.position; for (int k = 0; k < this.walkPointsDay.Count; k++) { float sqrMagnitude = (this.walkPointsDay[k].position - position).sqrMagnitude; if (sqrMagnitude < num2) { num2 = sqrMagnitude; num = k; } } num++; if (num >= this.walkPointsDay.Count) { num = 0; } this.isDay = true; GraphNode walkIndex = this.GetWalkIndex(num); Debug.Log(walkIndex); this.creatureBoat.creatureBoat.TimeJump((Vector3)walkIndex.position, this.walkPointsDay[num].rotation); } } } else { this.noSleep = false; int num3; for (int i = 0; i < this.characters.Count; i = num3 + 1) { Character character = this.characters[i]; if (character && !character.dead && !character.stunned && !character.missing) { character.TargetReached(); bool flag = false; bool flag2 = false; if (Mathf.Floor(gameHours) == (float)this.morningHour) { flag = true; } if (Mathf.Floor(gameHours) == (float)this.nightHour) { flag2 = true; } this.GetDayNight(true); bool flag3 = false; if (Records.x.dialogue && (character == Links.x.dialogue.npc1 || character == Links.x.dialogue.npc2 || character == Links.x.dialogue.npc3 || character == Links.x.dialogue.npc4)) { flag2 = false; flag = false; flag3 = true; } if (flag2 || flag) { this.DayNightSwitch(true); if (flag2 && this.disappearNight) { this.LoopNight(i); } if (flag && this.disappearDay) { this.LoopDay(i); } } bool flag4 = true; if (character.node == null && Records.x.editor) { Character character3 = character; Debug.Log(((character3 != null) ? character3.ToString() : null) + " has no node when time jumping"); flag4 = false; } if (this.summons || this.temporary || flag3 || this.stopPatrolTemporarily) { flag4 = false; } if (flag4 && !this.sailing) { this.CheckSleep(character); if (!character.vanished && !character.sleeping) { int currentPatrolID = character.patrolNode; if (!flag2 && !flag) { num3 = currentPatrolID; currentPatrolID = num3 + 1; } if (currentPatrolID >= this.CurrentPointsCount()) { currentPatrolID = 0; } GraphNode destination = this.GetWalkIndex(currentPatrolID); if (this.deactivating) { destination = this.deactivationNode; } if (this.hasTimePoint > -1) { destination = this.timeNode; } if (character.node != null && destination != null) { bool flag5 = false; if (character.node.Area == destination.Area || this.sailing) { flag5 = true; } if (!flag5) { NNConstraint nnconstraint = new NNConstraint(); nnconstraint.constrainWalkability = true; nnconstraint.walkable = true; nnconstraint.constrainTags = false; nnconstraint.checkCircleID = 0; nnconstraint.passID = 0; nnconstraint.passID2 = 0; nnconstraint.constrainPenalty = 0; nnconstraint.checkConnections = 0; nnconstraint.constrainToArea = -1; nnconstraint.constrainToEnvironment = 1; if (this.movesOnWater) { nnconstraint.constrainToEnvironment = 2; } nnconstraint.constrainDistance = false; ABPath p = ABPath.ConstructFast(character.node, destination, null); p.nnConstraint = nnconstraint; AstarPath.StartPath(p, false); yield return base.StartCoroutine(p.WaitForPath()); p.Claim(this); flag5 = !p.error; p.Release(this, false); if (!flag5) { character.patrolNode++; } if (!flag5 && Records.x.editor) { string[] array = new string[9]; int num4 = 0; Character character4 = character; array[num4] = ((character4 != null) ? character4.ToString() : null); array[1] = " cannot time jump to new area, current area is "; array[2] = ((Vector3)character.node.position).ToString(); array[3] = " "; array[4] = character.indoorID; array[5] = ", going to node at "; array[6] = destination.GraphIndex.ToString(); array[7] = " "; array[8] = ((Vector3)destination.position).ToString(); Debug.Log(string.Concat(array)); } p = null; } if (flag5) { if (this.hasDayNightCycle) { character.dayNightVanishing = false; } character.patrolNode = currentPatrolID; character.ClearNodePath(); character.tr.position = (Vector3)this.GetWalkIndex(currentPatrolID).position; Transform walkTransform = this.GetWalkTransform(currentPatrolID); if (walkTransform) { character.SetRotation(walkTransform.rotation, false, true); } character.FirstPosition(null); } } destination = null; } } if (character.quip) { character.quip.ReturnToCellar(); character.quip = null; } if (partyCamping && character.hostility == 2) { Links.x.diorama.CheckDistanceToRestingParty(character); } this.CheckSleep(character); } character = null; num3 = i; } } yield break; } // Token: 0x0600053B RID: 1339 RVA: 0x0007434C File Offset: 0x0007254C public bool AddAllToCombat(Character closestParty, bool searching, bool overrideSleep, bool quip) { if (!closestParty) { return false; } bool flag = false; int desiredGraph = closestParty.desiredGraph; for (int i = 0; i < this.characters.Count; i++) { Character character = this.characters[i]; if (character && character.hostility < 2 && !character.attackingUntilBribe && !character.inCombat && (overrideSleep || !character.sleeping) && (!Links.x.combat.isJustice || (Links.x.combat.isJustice && character.stats.characterRow._QuestProofState != "")) && character.desiredGraph == desiredGraph && (desiredGraph == 0 || character.indoorID == closestParty.indoorID)) { float num = character.stats.SightRadius(false, false, false) * character.stats.SightRadius(false, false, false); closestParty = Links.x.GetNearestParty(character.currentPosition); if (closestParty && (closestParty.currentPosition - character.currentPosition).sqrMagnitude < num) { if (character.sleeping && overrideSleep) { character.WakeUp(); } if (character.IsSentient()) { if (character.vipFollow || this.vipFollow) { this.VIPFail(); } character.hostility = 2; searching = false; this.characters[i].UpdateLKP(closestParty, closestParty.node, "Heard", false); Links.x.sensory.AddPlayerToCombat(this.characters[i], closestParty, false, searching, true); if (quip) { if (!Links.x.sensory.CheckProof(this.characters[i])) { this.characters[i].HostileQuip(); } else { this.characters[i].GuiltyQuip(); } } flag = true; } } } } return flag; } // Token: 0x0600053C RID: 1340 RVA: 0x00074558 File Offset: 0x00072758 public void SetState(Character character, string s) { for (int i = 0; i < this.characters.Count; i++) { if (character == this.characters[i]) { this.states[i] = s; } } } // Token: 0x0600053D RID: 1341 RVA: 0x0007459C File Offset: 0x0007279C public void SetStateByIndex(int num, string s) { this.states[num] = s; } // Token: 0x0600053E RID: 1342 RVA: 0x000745AC File Offset: 0x000727AC public bool ReturnSingleToMap(string creaturesName, int temperament, string xmlName, int xmlNameIndex, string originalMap, Vector3 position, string state, int life, string savedEffects, int index) { bool flag = false; if (index > -1) { this.positions[index] = position; this.maps[index] = originalMap; if (originalMap == Links.x.diorama.sceneName) { flag = true; } } return flag; } // Token: 0x0600053F RID: 1343 RVA: 0x00074600 File Offset: 0x00072800 public void UpdateTemporaryListsFromMapChange(string mapToCheck) { for (int i = 0; i < this.delays.Count; i++) { if (this.delays[i] > 0f) { Debug.Log(string.Concat(new string[] { (this != null) ? this.ToString() : null, " ", this.movingFromMap[i], " ", mapToCheck })); if (this.movingFromMap[i] == mapToCheck) { Records.x.ReturnTemporaryCreatureToPreviousMap(base.gameObject.name, this.xmlName, i, this.originalScene); } } } } // Token: 0x06000540 RID: 1344 RVA: 0x000746B8 File Offset: 0x000728B8 public void MoveToNewMap(Character character, string newMap, Vector3 newPosition, float delayTime) { if (!this.canJoinParty) { int num = this.characters.IndexOf(character); if (character.hostility >= 1) { character.stats.GetEffectStrings(); } this.maps[num] = newMap; this.AddTempCreature(character, newMap, newPosition, delayTime, Links.x.diorama.sceneName, true); } } // Token: 0x06000541 RID: 1345 RVA: 0x00074718 File Offset: 0x00072918 public void AddTempCreature(Character character, string newMap, Vector3 newPosition, float delayTime, string mapMovingFrom, bool saveMapMoving) { Debug.Log(string.Concat(new string[] { "From creature, add temp ", this.xmlName, " ", (character != null) ? character.ToString() : null, " ", newMap, " ", this.temporary.ToString(), " ", delayTime.ToString(), " ", this.onlyTemporary.ToString() })); int num = this.characters.IndexOf(character); string text = Links.x.diorama.sceneName; if (this.temporary) { text = this.originalScene; } if (this.onlyTemporary) { text = ""; mapMovingFrom = ""; } int num2 = num; if (this.temporary) { num2 = this.temporaryIndex; } if (character) { if (character.ghost) { newMap = Links.x.diorama.sceneName; } if (this.states[num].Contains("Purgatory")) { this.states[num] = "Resurrected"; } if (character.missing) { this.states[num] = "Gone"; } Records.x.AddTemporaryCreature(this.thisName, this.xmlName, text, newMap, character.hostility, newPosition, this.states[num], this.GetSaveIdentifier(), character.stats.HealthCurrent(), character.stats.savedEffects, num2, delayTime, mapMovingFrom, character.tr.position, saveMapMoving); return; } if (this.temporary || this.onlyTemporary) { if (this.onlyTemporary) { this.health[0] = 0; this.states[0] = "Gone"; num2 = 0; } Records.x.AddTemporaryCreature(this.thisName, this.xmlName, text, newMap, this.temperaments[0], newPosition, this.states[0], this.GetSaveIdentifier(), this.health[0], "", num2, delayTime, mapMovingFrom, this.positions[0], saveMapMoving); } } // Token: 0x06000542 RID: 1346 RVA: 0x0007495C File Offset: 0x00072B5C public void UpdateDelays(float delayTime, int index, string map) { Debug.Log(string.Concat(new string[] { "update delay time ", index.ToString(), " ", (this != null) ? this.ToString() : null, " ", delayTime.ToString(), " ", this.creatures.number.ToString() })); if (this.delays == null) { this.delays = new List(); this.movingFromMap = new List(); for (int i = 0; i < this.creatures.number; i++) { this.delays.Add(-1f); this.movingFromMap.Add(map); } } if (delayTime == 0f) { delayTime = -1f; } if (index < this.delays.Count && index > -1) { this.delays[index] = delayTime; } } // Token: 0x06000543 RID: 1347 RVA: 0x00074A50 File Offset: 0x00072C50 public Transform GetWalkTransform(int i) { if (i == -1) { i = 0; } if (this.isDay) { if (this.disappearDay && !this.disappearNight) { return this.vanishPointsDay[i]; } if (i < this.walkPointsDay.Count && i > -1) { return this.walkPointsDay[i]; } if (this.walkPointsDay.Count > 0) { return this.walkPointsDay[0]; } return null; } else { if (i == -1) { i = 0; } if (!this.disappearDay && this.disappearNight) { return this.vanishPointsNight[i]; } if (i < this.walkPointsNight.Count && i > -1) { return this.walkPointsNight[i]; } if (this.walkPointsNight.Count > 0) { return this.walkPointsNight[0]; } return null; } } // Token: 0x06000544 RID: 1348 RVA: 0x00074B24 File Offset: 0x00072D24 public int CurrentPointsCount() { if (this.isDay) { return this.walkPointsDay.Count; } return this.walkPointsNight.Count; } // Token: 0x06000545 RID: 1349 RVA: 0x00074B48 File Offset: 0x00072D48 public GraphNode GetWalkIndex(int i) { if (this.sailing) { if (this.isDay) { return this.creatureBoat.leadCreature.GetComponent().walkNodesDay[i]; } return this.creatureBoat.leadCreature.GetComponent().walkNodesNight[i]; } else { if (i < 0) { i = 0; } if (this.isDay) { if (this.disappearDay && !this.disappearNight) { return this.vanishNodesDay[i]; } if (i >= this.walkNodesDay.Count || this.walkNodesDay == null) { if (Records.x.editor) { Debug.LogError("Not enough nodes " + ((this != null) ? this.ToString() : null) + " " + i.ToString()); } return this.walkNodesDay[0]; } if (i < 0 || i >= this.walkNodesDay.Count) { Debug.Log(string.Concat(new string[] { i.ToString(), " ", this.walkNodesDay.Count.ToString(), " not enough walk nodes ", (this != null) ? this.ToString() : null })); i = 0; } return this.walkNodesDay[i]; } else { if (!this.disappearDay && this.disappearNight) { return this.vanishNodesNight[i]; } if (i >= this.walkNodesNight.Count || this.walkNodesNight == null) { if (Records.x.editor) { Debug.LogError("Not enough nodes " + ((this != null) ? this.ToString() : null) + " " + i.ToString()); } return this.walkNodesNight[0]; } if (i < 0 || i >= this.walkNodesNight.Count) { Debug.Log(string.Concat(new string[] { i.ToString(), " ", this.walkNodesNight.Count.ToString(), " not enough walk nodes ", (this != null) ? this.ToString() : null })); i = 0; } return this.walkNodesNight[i]; } } } // Token: 0x06000546 RID: 1350 RVA: 0x00074D7C File Offset: 0x00072F7C public Vector3 GetWalkTurnIndex(int i) { if (this.isDay) { if (this.walkPointsDay.Count == 0) { return Vector3.zero; } return this.walkPointsDay[i].rotation.eulerAngles; } else { if (this.walkPointsNight.Count == 0) { return Vector3.zero; } return this.walkPointsNight[i].rotation.eulerAngles; } } // Token: 0x06000547 RID: 1351 RVA: 0x00074DEC File Offset: 0x00072FEC public GraphNode GetWalkNodeIndex(int i) { if (this.isDay) { if (this.walkPointsDay.Count == 0) { return null; } return this.walkNodesDay[i]; } else { if (this.walkPointsNight.Count == 0) { return null; } return this.walkNodesNight[i]; } } // Token: 0x06000548 RID: 1352 RVA: 0x00074E38 File Offset: 0x00073038 public GraphNode GetWalkNodeDay(int i) { if (this.walkPointsDay.Count == 0) { return null; } return this.walkNodesDay[i]; } // Token: 0x06000549 RID: 1353 RVA: 0x00074E55 File Offset: 0x00073055 public GraphNode GetWalkNodeNight(int i) { if (this.walkPointsNight.Count == 0) { return null; } return this.walkNodesNight[i]; } // Token: 0x0600054A RID: 1354 RVA: 0x00074E72 File Offset: 0x00073072 public int GetWalkCount() { if (this.isDay) { return this.walkPointsDay.Count; } return this.walkPointsNight.Count; } // Token: 0x0600054B RID: 1355 RVA: 0x00074E93 File Offset: 0x00073093 public void SetTemperament(int t) { if (t == 0) { this.creatures.temperament = Creatures.temperamentState.NeverFights; } if (t == 1) { this.creatures.temperament = Creatures.temperamentState.FightsIfAttacked; } if (t == 2) { this.creatures.temperament = Creatures.temperamentState.AttacksOnSight; } } // Token: 0x0600054C RID: 1356 RVA: 0x00074EC4 File Offset: 0x000730C4 public void SetCharacter0(Character character, int temp) { if (this.states.Count > 0) { if (this.characters.Count == 0) { this.characters.Add(character); } this.states[0] = "Normal"; this.temperaments[0] = temp; } } // Token: 0x0600054D RID: 1357 RVA: 0x00074F16 File Offset: 0x00073116 public void SetState(int index, string s) { if (index < this.states.Count) { this.states[index] = s; } } // Token: 0x0600054E RID: 1358 RVA: 0x00074F33 File Offset: 0x00073133 public void JoiningParty() { this.waitTime = 0f; this.characters[0].stats.state = "Companion"; this.states[0] = "Companion"; base.enabled = false; } // Token: 0x0600054F RID: 1359 RVA: 0x00074F74 File Offset: 0x00073174 public void CheckForTextureSwap() { if (this.xmlName == "BanquetIsleFriend" || this.xmlName == "LachoPriestStart") { for (int i = 0; i < this.characters.Count; i++) { Character character = this.characters[i]; if (character) { if (this.xmlName == "LachoPriestStart") { if (QuestLog.GetQuestState("F5_BanquetPriest") != QuestState.Unassigned) { character.body.faceRenderer.material.SetTexture("_MainTex", Links.x.cinematicLachoTextureSwap1); Debug.Log("Setting priest head texture"); return; } break; } else if (this.xmlName == "BanquetIsleFriend") { if (QuestLog.GetQuestState("F5_BanquetFriend") == QuestState.Complete) { character.body.faceRenderer.material.SetTexture("_MainTex", Links.x.cinematicLachoTextureSwap2); Debug.Log("Setting companion head texture"); return; } break; } else if (this.xmlName == "BanquetIsleFriend2") { if (QuestLog.GetQuestState("F5_BanquetFriend") == QuestState.Complete) { character.body.faceRenderer.material.SetTexture("_MainTex", Links.x.cinematicLachoTextureSwap2); Debug.Log("Setting companion head texture"); return; } break; } } } } } // Token: 0x06000550 RID: 1360 RVA: 0x000750D4 File Offset: 0x000732D4 public void Ambush(Character hitCharacter) { for (int i = 0; i < this.characters.Count; i++) { Character character = this.characters[i]; if (character) { character.ClearMoveTargets(); character.ClearPathUpdates(); character.SetRotation(Quaternion.LookRotation(hitCharacter.tr.position - character.tr.position), true, true); character.StartGetPathToTarget(hitCharacter.node, hitCharacter, null, null, null, null, null, null, character, null, false, false, true, "Searching", false); character.movingToPatrolNode = true; } } } // Token: 0x06000551 RID: 1361 RVA: 0x00075168 File Offset: 0x00073368 public void CheckSleep(Character character) { if (!character) { return; } if (this.noSleep) { return; } if (this.isDay) { if (this.daySleep) { if (!character.sleeping) { bool flag = false; Quaternion quaternion = character.tr.rotation; for (int i = 0; i < this.walkNodesDay.Count; i++) { if (((Vector3)this.walkNodesDay[i].position - character.tr.position).sqrMagnitude < 2.25f) { flag = true; quaternion = this.walkPointsDay[i].rotation; } } if (flag && !character.hasActions) { character.Sleep(quaternion); } character.stats.AddHealth(10); return; } } else if (character.sleeping) { character.WakeUp(); return; } } else if (this.nightSleep) { if (!character.sleeping) { bool flag2 = false; Quaternion quaternion2 = character.tr.rotation; for (int j = 0; j < this.walkNodesNight.Count; j++) { if (((Vector3)this.walkNodesNight[j].position - character.tr.position).sqrMagnitude < 2.25f) { flag2 = true; if (j < this.walkPointsNight.Count) { quaternion2 = this.walkPointsNight[j].rotation; } } } if (flag2 && !character.hasActions) { character.Sleep(quaternion2); return; } } } else if (character.sleeping) { character.WakeUp(); } } // Token: 0x06000552 RID: 1362 RVA: 0x00075308 File Offset: 0x00073508 public bool IsAsleep() { foreach (object obj in base.transform) { Transform transform = (Transform)obj; if (transform.gameObject.name.Contains("Sleep")) { if (transform.gameObject.name.Contains("Day") && this.isDay) { return true; } if (transform.gameObject.name.Contains("Night") && !this.isDay) { return true; } } } return false; } // Token: 0x06000553 RID: 1363 RVA: 0x000753BC File Offset: 0x000735BC public void FarFromPoints(float currTime, Character c) { if (!this.noSleep & (currTime > this.lastCheckTime || (c.alwaysOn && !c.ambushing && !c.dayNightVanishing && !c.sleeping) || this.lastCheckTime == 0f)) { bool flag = false; if (!c.sleeping && !c.dayNightVanishing && !c.missing && !c.ambushing && !c.hasActions && c.IsSentient() && !c.vanished && !Records.x.removeControls && !this.deactivating && !c.ghostVanishing && !c.ignoreNodeIDs && this.hasTimePoint == -1 && !this.vipFollow) { this.lastCheckTime = currTime + Random.Range(5f, 10f); Vector3 currentPosition = c.currentPosition; if (this.isDay || this.walkNodesNight.Count == 0) { for (int i = 0; i < this.walkPointsDay.Count; i++) { if ((this.walkPointsDay[i].position - currentPosition).sqrMagnitude < 1600f) { flag = true; break; } } } else { for (int j = 0; j < this.walkPointsNight.Count; j++) { if ((this.walkPointsNight[j].position - currentPosition).sqrMagnitude < 1600f) { flag = true; break; } } } if (!flag) { c.alwaysOn = true; if (c.inactive) { c.TurnScriptsOn(); return; } } else { c.alwaysOn = false; } } } } // Token: 0x06000554 RID: 1364 RVA: 0x00075584 File Offset: 0x00073784 public float NearestPatrolPoint(Vector3 pt) { float num = 100000f; if (this.isDay || this.walkNodesNight.Count == 0) { int num2 = this.walkPointsDay.Count; for (int i = 0; i < num2; i++) { float sqrMagnitude = (this.walkPointsDay[i].position - pt).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; } } } else { int num2 = this.walkPointsNight.Count; for (int j = 0; j < num2; j++) { float sqrMagnitude2 = (this.walkPointsNight[j].position - pt).sqrMagnitude; if (sqrMagnitude2 < num) { num = sqrMagnitude2; } } } return num; } // Token: 0x06000555 RID: 1365 RVA: 0x00075638 File Offset: 0x00073838 private void Update() { if (Links.x.gaia.sceneLoaded && Links.x.gaia.pathfindingReady) { if (this.sailing && !this.creatures.isCreatureGroupLeader) { return; } if (Links.x.gaia.loadingCharacterCreation) { return; } if (this.stopPatrolTemporarily) { return; } if (Records.x.dialogue || Records.x.miniGame) { return; } if (this.waitingForDelay) { bool flag = false; for (int i = 0; i < this.delays.Count; i++) { if (!flag) { if (this.delays[i] > 0f) { if (Links.x.gameplay.seconds > this.startDelayTime + this.delays[i]) { this.FinishDelay(i); } } else if (this.delays[i] == -1f) { this.characters.Add(null); string text = ""; if (i < this.states.Count) { text = this.states[i]; } if (this.walkNodesDay.Count == 0) { this.GetPointNodes(); } this.InstanceCreature(i, this.thisName, false, (Vector3)this.GetWalkIndex(i).position, text); this.delays[i] = 0f; flag = true; } } } return; } if (this.waitingForPrompt) { base.enabled = false; return; } if (this.summons) { return; } if (this.characters.Count == 0) { return; } bool flag2 = false; if (this.deactivating) { Character firstCharacter = this.GetFirstCharacter(); if (firstCharacter) { if (firstCharacter.sleeping) { firstCharacter.WakeUp(); } if (!firstCharacter.moving && firstCharacter.IsSentient()) { GraphNode graphNode = this.deactivationNode; if ((firstCharacter.tr.position - (Vector3)graphNode.position).sqrMagnitude > 4f && graphNode != null) { if (!firstCharacter.nodeConstraint.Suitable(graphNode)) { graphNode = firstCharacter.NearNode((Vector3)this.deactivationNode.position, true, 0, -1, 0); if (graphNode == null) { graphNode = this.deactivationNode; } } if (firstCharacter.waitingForPath != 1 && firstCharacter.blockedTime == 0f && firstCharacter.NodesCount() == 0 && !firstCharacter.hasActions) { this.MakeNormalPath(graphNode, true, firstCharacter); } } } } return; } if ((this.hasTimePoint > -1 || this.CurrentPointsCount() == 1) && !this.vipFollow) { bool flag3 = false; for (int j = 0; j < this.characters.Count; j++) { if (this.characters[j] && this.characters[j].dayNightVanishing && this.hasTimePoint == -1) { flag3 = true; } } if (Time.timeSinceLevelLoad > this.standTime + 0.25f || flag3) { for (int k = 0; k < this.characters.Count; k++) { Character character = this.characters[k]; if (character && !character.dead && !character.inactive && !character.stunned && ((character.dayNightVanishing && !character.hasActions) || (!character.inactive && character.animID != 1 && !character.searching && !character.fleeing && !character.inCombat && character.CanMakePath() && character.IsSentient()))) { Vector3 vector = (Vector3)this.GetWalkNodeIndex(0).position; GraphNode graphNode2 = this.GetWalkNodeIndex(0); Vector3 vector2 = this.GetWalkTurnIndex(0); if (this.hasTimePoint > -1) { vector = (Vector3)this.timeNode.position; graphNode2 = this.timeNode; vector2 = this.timeRot.eulerAngles; } this.CheckSleep(character); if (character.dayNightVanishing && this.hasTimePoint == -1) { vector = (Vector3)this.vanishNode.position; if (character.nodeConstraint.Suitable(this.vanishNode)) { graphNode2 = this.vanishNode; } else { graphNode2 = character.NearNode((Vector3)this.vanishNode.position, true, 0, -1, 0); if (graphNode2 == null) { graphNode2 = this.vanishNode; } vector = (Vector3)graphNode2.position; } } if (character.dayNightVanishing && (this.characters[k].tr.position - (Vector3)this.vanishNode.position).sqrMagnitude <= 4f) { if (this.disappearDay && this.disappearNight) { if (!character.inactive) { this.VanishMapExit(this.characters[k], k); } } else if (!character.inactive) { this.VanishDisappear(this.characters[k]); } } if ((character.tr.position - vector).sqrMagnitude > 0.25f && graphNode2 != null && !character.moving && character.blockedTime == 0f && (character.waitingForPath != 1 || character.waitingForPath == 3)) { if (!character.dayNightVanishing) { character.doTurn = true; character.endTurn = vector2; } this.MakeNormalPath(graphNode2, false, character); } } } this.standTime = Time.timeSinceLevelLoad; } } if (this.CurrentPointsCount() > 1 && !this.vipFollow && this.hasTimePoint == -1) { float num = this.creatures.patrolDelay; if (this.waitTime <= 0f && this.CurrentPointsCount() != 0) { int num2 = 0; for (int l = 0; l < this.characters.Count; l++) { Character character2 = this.characters[l]; if (character2 && !character2.inactive && !character2.missing) { if (character2.dayNightVanishing) { num = 0.1f; if ((character2.tr.position - (Vector3)this.vanishNode.position).sqrMagnitude < 9f) { if (this.disappearDay && this.disappearNight) { this.VanishMapExit(character2, l); } else { this.VanishDisappear(character2); } } } if ((character2.NodesCount() > 0 || character2.IsWalking()) && !character2.inCombat && !character2.searching) { num2++; } } } if (num2 == 0) { flag2 = true; } } if (flag2 && this.waitTime == 0f) { this.waitTime = Time.timeSinceLevelLoad + num; } if (this.waitTime != 0f && Time.timeSinceLevelLoad > this.waitTime) { for (int m = 0; m < this.characters.Count; m++) { Character character3 = this.characters[m]; if (character3 && !character3.inactive && !character3.missing && !character3.hasActions && !character3.inCombat && !Records.x.pocketPause && (!character3.IsWalking() || (character3.dayNightVanishing && !character3.moving))) { this.CheckSleep(character3); if (!character3.sleeping && !character3.fleeing) { this.WalkToNextPoint(character3); this.waitTime = 0f; } } } } } if (this.vipFollow && this.characters.Count > 0 && Links.x.hasMain) { Character character4 = this.characters[0]; if (character4 && Links.x.main.node != null && character4.node != null && character4.IsSentient()) { float sqrMagnitude = (Links.x.main.currentPosition - character4.currentPosition).sqrMagnitude; if (!character4.vipFollow && sqrMagnitude < 2500f && Links.x.main.node.Area == character4.node.Area) { if (!character4.vipFollow) { character4.GetHealthBar(); } character4.vipFollow = true; character4.StartQuip("Let's go"); } if (character4.vipFollow) { if (Links.x.main.node.Area != character4.node.Area || sqrMagnitude > 3600f) { Links.x.fellowship.JumpPosition(Links.x.main, 5, character4); return; } if ((!character4.hasActions || !Records.x.InCombat(false)) && (sqrMagnitude > 225f || (Links.x.main.moving && sqrMagnitude > 100f))) { bool flag4 = false; if (!character4.moving && character4.moveNode == null && character4.slideNode == null && !character4.movingOutOfWay && character4.NodesCount() == 0 && character4.CanMakePath() && Links.x.gaia.sceneLoaded && Links.x.gaia.pathfindingReady && character4.blockedTime == 0f && !character4.inCombat) { flag4 = true; } if ((Links.x.main.physicsMove || Links.x.main.moving) && character4.savedFollowNode != null && character4.waitingForPath != 1 && character4.savedPathTarget != null && character4.CanMakePath() && character4.slideNode == null && !character4.movingOutOfWay && Links.x.gaia.sceneLoaded && Links.x.gaia.pathfindingReady && !character4.inCombat && !character4.justMoved && !character4.turning && Time.timeSinceLevelLoad > this.repathTime + 2f) { flag4 = true; } if (flag4) { GraphNode formationPosition = Links.x.fellowship.GetFormationPosition(Links.x.main.node, character4, true); if (formationPosition != null && ((Vector3)formationPosition.position - character4.currentPosition).sqrMagnitude > 16f) { this.repathTime = Time.timeSinceLevelLoad; character4.savedFollowNode = Links.x.main.savedPathTarget; character4.ClearPathUpdates(); character4.pathTargPosition = (Vector3)formationPosition.position; character4.MakePath(formationPosition, 500, false, false, true); } } } } } } } } // Token: 0x06000556 RID: 1366 RVA: 0x00076185 File Offset: 0x00074385 public void ReturnFromCombat() { this.waitTime = 0.1f; } // Token: 0x06000557 RID: 1367 RVA: 0x00076194 File Offset: 0x00074394 private void GhostPath(Character character) { if (character.ghost && !character.moving && character.blockedTime == 0f && (character.waitingForPath == 0 || character.waitingForPath == 3) && !character.hasActions) { if (character.ghostVanishing) { if ((character.tr.position - Links.x.diorama.ghostPoint.transform.position).sqrMagnitude < 9f) { character.ghostVanishing = false; character.alwaysOn = false; return; } this.MakeNormalPath(Links.x.diorama.ghostNode, true, character); return; } else { this.MakeRandomPath(this.randomNodeCenter, false, character); } } } // Token: 0x06000558 RID: 1368 RVA: 0x00076255 File Offset: 0x00074455 private void MakeRandomPath(GraphNode n, bool run, Character character) { character.ClearMoveTargets(); character.ClearPathUpdates(); character.running = run; character.MakePath(n, 10, false, true, false); character.movingToPatrolNode = false; } // Token: 0x06000559 RID: 1369 RVA: 0x00076280 File Offset: 0x00074480 public void MakeNormalPath(GraphNode n, bool run, Character character) { character.ClearMoveTargets(); character.ClearPathUpdates(); character.running = run; int num = 500; if (character.dayNightVanishing) { num = 30; } character.MakePath(n, num, false, false, false); character.movingToPatrolNode = false; } // Token: 0x0600055A RID: 1370 RVA: 0x000762C3 File Offset: 0x000744C3 public void LeaderFollowerPaths() { if (Time.timeSinceLevelLoad > this.standTime && this.followerCoroutine == null) { this.followerCoroutine = this.LeaderFollowerPath(); base.StartCoroutine(this.followerCoroutine); } } // Token: 0x0600055B RID: 1371 RVA: 0x000762F3 File Offset: 0x000744F3 private IEnumerator LeaderFollowerPath() { if (this.creatures.isCreatureGroupLeader) { this.standTime = Time.timeSinceLevelLoad + Random.Range(1f, 4f); Character character = this.characters[0]; if (!character.moving && character.moveNode == null && character.slideNode == null && !character.movingOutOfWay && character.NodesCount() == 0 && character.CanMakePath() && Links.x.gaia.sceneLoaded && Links.x.gaia.pathfindingReady && character.blockedTime == 0f && !character.hasActions && !character.inactive) { int num = character.patrolNode + 1; if (num > this.walkNodesDay.Count - 1 || num < 0) { num = 0; character.patrolNode = -1; } GraphNode graphNode = this.walkNodesDay[num]; if (graphNode != null) { character.ClearMoveTargets(); character.ClearPathUpdates(); character.MakePath(graphNode, 100, false, false, true); character.movingToPatrolNode = true; } } } else { this.standTime = Time.timeSinceLevelLoad + Random.Range(0.1f, 0.5f); if (!this.groupLeader) { this.groupLeader = this.GetLeader(); } int num3; for (int i = 0; i < this.characters.Count; i = num3 + 1) { Character c = this.characters[i]; 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 && !c.hasActions && !c.inactive) { Vector3 position = c.sphere.transform.position; float sqrMagnitude = (c.tr.position - this.groupLeader.tr.position).sqrMagnitude; float sqrMagnitude2 = (c.tr.position - position).sqrMagnitude; float num2 = 2f + (float)i / 2f; if ((sqrMagnitude2 > 9f && c.savedPathTarget != null) || sqrMagnitude > num2 * num2) { GraphNode moveNode = c.savedPathTarget; if (c.node != null) { if (sqrMagnitude > num2 * num2) { GraphNode graphNode2 = c.NearNode(this.groupLeader.tr.position, true, 0, -1, 0); if (graphNode2 != null) { moveNode = graphNode2; } } ABPath p = ABPath.ConstructFast(c.node, moveNode, null); p.nnConstraint = c.nodeConstraint; AstarPath.StartPath(p, false); yield return base.StartCoroutine(p.WaitForPath()); p.Claim(this); bool flag = false; if (!p.error) { flag = true; } p.Release(this, false); if (flag) { c.ClearPathUpdates(); c.pathTargPosition = (Vector3)moveNode.position; c.MakePath(moveNode, 500, false, false, false); } yield return new WaitForSeconds(0.1f); p = null; } moveNode = null; } } c = null; num3 = i; } } this.followerCoroutine = null; yield break; } // Token: 0x0600055C RID: 1372 RVA: 0x00076304 File Offset: 0x00074504 public void FinishDelay(int delayIndex) { if (this.temporaryStartNode != null && Links.x.gaia.pathfindingReady) { int num = this.temporaryStartNode.AllConnectionsFreeParty(0, 0, Links.x.main.ConnectionNumber(), 0); if (this.positions.Count > 0) { this.positions[delayIndex] = (Vector3)this.temporaryStartNode.position; } if (this.walkPointsDay.Count == 0 || this.walkNodesDay.Count == 0) { this.walkPointsDay.Clear(); this.walkPointsNight.Clear(); this.GetPoints(false, true); } if (this.temporary) { for (int i = 0; i < this.walkPointsDay.Count; i++) { this.walkPointsDay[i].position = (Vector3)this.temporaryStartNode.position; this.walkNodesDay[i] = this.temporaryStartNode; } for (int j = 0; j < this.walkPointsNight.Count; j++) { this.walkPointsNight[j].position = (Vector3)this.temporaryStartNode.position; this.walkNodesNight[j] = this.temporaryStartNode; } } foreach (object obj in this.tr) { Transform transform = (Transform)obj; if (transform.gameObject.name.Contains("Day")) { this.day = transform; } if (transform.gameObject.name.Contains("Night")) { this.night = transform; } } if (this.day) { foreach (object obj2 in this.day) { Transform transform2 = (Transform)obj2; if (transform2 != this.tr) { transform2.position = (Vector3)this.temporaryStartNode.position; } } if (this.day.childCount == 0) { this.day.transform.position = (Vector3)this.temporaryStartNode.position; } } else { base.gameObject.transform.position = (Vector3)this.temporaryStartNode.position; } if (this.night) { foreach (object obj3 in this.night) { Transform transform3 = (Transform)obj3; if (transform3 != this.tr) { transform3.position = (Vector3)this.temporaryStartNode.position; } } if (this.night.childCount == 0) { this.night.transform.position = (Vector3)this.temporaryStartNode.position; } } else { base.gameObject.transform.position = (Vector3)this.temporaryStartNode.position; } if (num != 0 && num != 10000) { List list = Links.x.diorama.characters; int count = list.Count; int k = 0; while (k < count) { Character character = list[k]; if (character.nodeStationaryID == num || character.nodeMovingID == num) { GraphNode graphNode = character.FindSlideNode(character, (Vector3)this.temporaryStartNode.position + new Vector3(1f, 0f, 1f), true, false); if (graphNode != null && graphNode != character.node && ((Vector3)graphNode.position - character.tr.position).sqrMagnitude < 25f && graphNode.Area == character.node.Area) { Debug.Log(graphNode.Area.ToString() + " " + character.node.Area.ToString()); character.SlideTo(graphNode); this.delays[delayIndex] = 0f; this.characters.Add(null); string text = ""; if (delayIndex < this.states.Count) { text = this.states[delayIndex]; } this.InstanceCreature(delayIndex, this.thisName, false, (Vector3)this.temporaryStartNode.position, text); break; } break; } else { k++; } } } else if (num == 10000) { Debug.Log(Vector3.Distance((Vector3)this.temporaryStartNode.position, Links.x.main.tr.position)); if (Vector3.Distance((Vector3)this.temporaryStartNode.position, Links.x.main.tr.position) < 1f) { GraphNode graphNode2 = Links.x.main.FindSlideNode(Links.x.main, (Vector3)this.temporaryStartNode.position + new Vector3(1f, 0f, 1f), true, false); if (graphNode2 != null && graphNode2 != Links.x.main.node && ((Vector3)graphNode2.position - Links.x.main.tr.position).sqrMagnitude < 25f && graphNode2.Area == Links.x.main.node.Area) { Links.x.main.SlideTo(graphNode2); this.delays[delayIndex] = 0f; this.characters.Add(null); string text2 = ""; if (delayIndex < this.states.Count) { text2 = this.states[delayIndex]; } this.InstanceCreature(delayIndex, this.thisName, false, (Vector3)this.temporaryStartNode.position, text2); } } } else { this.delays[delayIndex] = 0f; this.characters.Add(null); string text3 = ""; if (delayIndex < this.states.Count) { text3 = this.states[delayIndex]; } this.InstanceCreature(delayIndex, this.thisName, false, (Vector3)this.temporaryStartNode.position, text3); } } else { this.delays[delayIndex] = 0f; this.characters.Add(null); string text4 = ""; if (delayIndex < this.states.Count) { text4 = this.states[delayIndex]; } this.InstanceCreature(delayIndex, this.thisName, false, (Vector3)this.temporaryStartNode.position, text4); } bool flag = true; for (int l = 0; l < this.delays.Count; l++) { if (this.delays[l] > 0f) { flag = false; } } if (flag) { this.waitingForDelay = false; } } // Token: 0x0600055D RID: 1373 RVA: 0x00076ABC File Offset: 0x00074CBC public void ReturnToPatrol(Character character) { if (this.CurrentPointsCount() != 0) { this.WalkToNextPoint(character); } } // Token: 0x0600055E RID: 1374 RVA: 0x00076AD0 File Offset: 0x00074CD0 public void WalkToNextPoint(Character character) { int num = character.patrolNode + 1; if (num > this.GetWalkCount() - 1 || num < 0) { num = 0; character.patrolNode = 0; } if (!character.searching && !character.inCombat) { GraphNode graphNode = this.GetWalkNodeIndex(num); Vector3 walkTurnIndex = this.GetWalkTurnIndex(num); if (character.dayNightVanishing) { if (character.nodeConstraint.Suitable(this.vanishNode)) { graphNode = this.vanishNode; } else { graphNode = character.NearNode((Vector3)this.vanishNode.position, true, 0, -1, 0); if (graphNode == null) { graphNode = this.vanishNode; } } } if (graphNode != null) { if (!character.dayNightVanishing) { character.doTurn = true; character.endTurn = walkTurnIndex; } character.ClearMoveTargets(); character.ClearPathUpdates(); int num2 = 500; if (character.dayNightVanishing) { num2 = 30; } character.MakePath(graphNode, num2, false, false, true); character.movingToPatrolNode = true; } } } // Token: 0x0600055F RID: 1375 RVA: 0x00076BB8 File Offset: 0x00074DB8 public void SetGroupDialogue() { foreach (Character character in this.characters) { if (character && character.stats.initiateDialogue != 0 && character.stats.initiateDialogue != 10) { if (character.stats.initiateDialogue >= 10) { character.stats.initiateDialogue = 10; } else { character.stats.initiateDialogue = 0; } } } } // Token: 0x06000560 RID: 1376 RVA: 0x00076C54 File Offset: 0x00074E54 public void RemoveFromScene() { } // Token: 0x06000561 RID: 1377 RVA: 0x00076C58 File Offset: 0x00074E58 public void Unsummon(bool immediate) { for (int i = 0; i < this.characters.Count; i++) { if (this.characters[i]) { if (this.xmlName.Contains("Acorn") || immediate) { this.characters[i].DestroyCharacter(); } else { this.characters[i].DestroyCharacterWait(); } } } } // Token: 0x06000562 RID: 1378 RVA: 0x00076CC6 File Offset: 0x00074EC6 public Vector3 GetPoint() { if (this.characters.Count > 0) { return this.characters[0].tr.position; } return Vector3.zero; } // Token: 0x06000563 RID: 1379 RVA: 0x00076CF2 File Offset: 0x00074EF2 public TileEffects GetTileEffect() { return this.tileEffect; } // Token: 0x06000564 RID: 1380 RVA: 0x00076CFA File Offset: 0x00074EFA public void SetTileEffect(TileEffects t) { this.tileEffect = t; } // Token: 0x06000565 RID: 1381 RVA: 0x00076D04 File Offset: 0x00074F04 public Character GetLeader() { Character character = null; Transform parent = base.gameObject.transform.parent; if (parent.gameObject != Links.x.diorama.creatures) { foreach (object obj in parent) { CreatureActions component = ((Transform)obj).gameObject.GetComponent(); if (component && component.creatures.isCreatureGroupLeader) { character = component.GetFirstCharacter(); } } } return character; } // Token: 0x06000566 RID: 1382 RVA: 0x00076DAC File Offset: 0x00074FAC public void SetNewFirstLeader(Character c) { Debug.Log("New leader " + ((c != null) ? c.ToString() : null)); for (int i = 0; i < this.characters.Count; i++) { if (this.characters[i] && !this.characters[i].dead && !this.characters[i].stunned) { if (c == this.characters[i]) { this.Leader(c); this.characters[i].stats.defendMainInCombat = false; this.characters[i].stats.defendingCharacter = null; } else { this.Follower(this.characters[i], c); this.characters[i].stats.defendMainInCombat = true; this.characters[i].stats.defendingCharacter = c; } } } } // Token: 0x06000567 RID: 1383 RVA: 0x00076EC0 File Offset: 0x000750C0 public void LeaderDied(Character leader) { MasterAudio.PlaySound3DAtVector3AndForget("Interactives", Links.x.main.tr.position, 1f, new float?(1f), 0.5f, "Chest Break", null); for (int i = 0; i < this.characters.Count; i++) { if (this.characters[i] && !this.characters[i].dead && !this.characters[i].stunned) { Effects existingEffect = this.characters[i].stats.GetExistingEffect("Follower"); if (existingEffect && existingEffect.source == leader) { existingEffect.Healed(false, true); this.characters[i].stats.defendMainInCombat = false; this.characters[i].stats.defendingCharacter = null; } } } } // Token: 0x06000568 RID: 1384 RVA: 0x00076FCE File Offset: 0x000751CE public void SparkleFriends(Character leader) { if (this.creatures.pickOneLeader) { base.StartCoroutine(this.Followers(leader)); } } // Token: 0x06000569 RID: 1385 RVA: 0x00076FEB File Offset: 0x000751EB private IEnumerator Followers(Character leader) { yield return new WaitForSeconds(0.1f); if (leader.actions) { leader.actions.CheckIfRunningAI(); leader.ClearNodePath(); leader.actions.ai.SkipWatch(); leader.actions.ai.busy = true; } int count = 0; int num; for (int i = 0; i < this.characters.Count; i = num + 1) { if (this.characters[i] && !this.characters[i].dead && !this.characters[i].stunned && !this.characters[i].stats.isLeader && !leader.dead && !leader.stunned && !this.characters[i].stats.HasEffect("Follower")) { if ((this.characters[i].currentPosition - Links.x.main.currentPosition).sqrMagnitude < 900f) { MasterAudio.PlaySoundAndForget("Feedback", Random.Range(0.3f, 0.5f), new float?(1f), 0f, "Song Learned", null); } leader.SetRotation(Quaternion.LookRotation(this.characters[i].currentPosition - leader.currentPosition), false, true); GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(87); pooledGameObject.transform.position = this.characters[i].body.HeadPosition(0f); pooledGameObject.SetActive(true); this.Follower(this.characters[i], leader); this.characters[i].stats.defendMainInCombat = true; this.characters[i].stats.defendingCharacter = leader; yield return new WaitForSeconds(0.35f); num = count; count = num + 1; leader.actions.CheckIfRunningAI(); leader.ClearNodePath(); if (count % 2 == 0) { leader.actions.ai.SkipWatch(); } } num = i; } if (leader.actions) { Links.x.combat.GetNextAction(leader); leader.actions.ai.busy = false; } yield break; } // Token: 0x0600056A RID: 1386 RVA: 0x00077004 File Offset: 0x00075204 public Character GetFirstAsLeader(Character c) { Character character = null; if (this.characters.Count > 0) { character = this.characters[0]; if (character) { if (!character.dead && !character.stunned && character != c) { return character; } if (character == c && character != null) { this.Leader(c); character = null; } } } return character; } // Token: 0x0600056B RID: 1387 RVA: 0x00077070 File Offset: 0x00075270 private void Follower(Character c, Character leader) { Effects effects = c.gameObject.AddComponent(); Links.x.cellar.AddEffects(effects); effects.source = leader; effects.target = c; effects.effectName = "Follower"; effects.sourceLevel = (float)c.combatLevel; effects.Inflicted(false); } // Token: 0x0600056C RID: 1388 RVA: 0x000770C8 File Offset: 0x000752C8 private void Leader(Character c) { c.stats.isLeader = true; Effects effects = c.gameObject.AddComponent(); Links.x.cellar.AddEffects(effects); effects.source = c; effects.target = c; effects.effectName = "Leader"; effects.sourceLevel = (float)c.combatLevel; effects.Inflicted(false); } // Token: 0x0600056D RID: 1389 RVA: 0x0007712C File Offset: 0x0007532C public void AddDroppedItemToList(int id, int amt, int socket1, int socket2, int socket3, int socket4, int socket5, int socket6, int dur1, int dur2) { if (this.items == null) { this.items = new List(); } this.items.Add(id); this.items.Add(amt); this.items.Add(socket1); this.items.Add(socket2); this.items.Add(socket3); this.items.Add(socket4); this.items.Add(socket5); this.items.Add(socket6); this.items.Add(dur1); this.items.Add(dur2); this.items.Add(0); this.MakeItemSaveString(); } // Token: 0x0600056E RID: 1390 RVA: 0x000771E0 File Offset: 0x000753E0 public void MakeItemSaveString() { if (this.str == null) { this.str = new StringFast(64); } int count = this.items.Count; int num = 0; this.str.Clear(); for (int i = 0; i < count; i++) { if (num == 0) { Library.Inventory invRow = Links.x.library.GetInvRow(this.items[i]); this.str.Append(invRow._Name); } else { this.str.Append(this.items[i]); } if (i != this.items.Count - 1) { this.str.Append(","); } num++; if (num == 11) { num = 0; } } this.savedItems = this.str.ToString(); } // Token: 0x0600056F RID: 1391 RVA: 0x000772B0 File Offset: 0x000754B0 public void UpdateItems() { if (this.items == null) { this.items = new List(); } this.items.Clear(); List list = Links.x.merchant.items; for (int i = 0; i < list.Count; i++) { global::Item item = list[i]; this.items.Add(item.ID); this.items.Add(item.stackSize); this.items.Add((int)item.socketA.x); this.items.Add((int)item.socketA.y); this.items.Add((int)item.socketA.z); this.items.Add((int)item.socketB.x); this.items.Add((int)item.socketB.y); this.items.Add((int)item.socketB.z); this.items.Add((int)item.durability.x); this.items.Add((int)item.durability.y); this.items.Add((int)item.durability.z); } this.MakeItemSaveString(); } // Token: 0x06000570 RID: 1392 RVA: 0x00077404 File Offset: 0x00075604 public GraphNode NearNode(Vector3 pos) { if (Links.x.gaia.noAstar) { return null; } this.nodeConstraint.constrainWalkability = true; this.nodeConstraint.walkable = true; this.nodeConstraint.constrainTags = false; this.nodeConstraint.checkCircleID = 0; this.nodeConstraint.passID = 0; this.nodeConstraint.passID2 = 0; this.nodeConstraint.constrainPenalty = 0; this.nodeConstraint.checkConnections = 0; this.nodeConstraint.constrainToArea = -1; if (this.sailing) { this.nodeConstraint.constrainToEnvironment = 2; this.nodeConstraint.checkConnections = 8; } else if (this.movesOnWater) { this.nodeConstraint.constrainToEnvironment = 2; } else if (!this.hasFirstNode) { this.nodeConstraint.constrainToEnvironment = -1; } else { this.nodeConstraint.constrainToEnvironment = 1; } GraphNode node = AstarPath.active.GetNearest(pos, this.nodeConstraint).node; if (!this.hasFirstNode && node != null) { this.hasFirstNode = true; if (node.environment == 2 && !this.sailing && !this.creatureBoat && !this.xmlName.Contains("Boro")) { this.movesOnWater = true; } } return node; } // Token: 0x06000571 RID: 1393 RVA: 0x0007754C File Offset: 0x0007574C public void GetPoints(bool questSwap, bool getNodes) { Transform transform = this.tr; if (this.creatures.hasTimedLocations) { this.ClearTimePoints(); } if (questSwap) { this.walkPointsDay.Clear(); this.walkNodesDay.Clear(); this.vanishPointsDay.Clear(); this.vanishNodesDay.Clear(); this.walkPointsNight.Clear(); this.walkNodesNight.Clear(); this.vanishPointsNight.Clear(); this.vanishNodesNight.Clear(); this.day = null; this.night = null; this.dayVanish = null; this.nightVanish = null; this.hasDayNightCycle = false; this.daySleep = false; this.nightSleep = false; if (!this.tr) { this.tr = base.gameObject.transform; } transform = this.tr; foreach (object obj in transform) { Transform transform2 = (Transform)obj; if (transform2 && transform2.gameObject.name.Contains("Quest")) { transform = transform2; } } } this.hasDayNightCycle = true; foreach (object obj2 in transform) { Transform transform3 = (Transform)obj2; if (transform3) { if (transform3.gameObject.name.Contains("Day") && !transform3.gameObject.name.Contains("Vanish")) { this.day = transform3; } if (transform3.gameObject.name.Contains("Night") && !transform3.gameObject.name.Contains("Vanish")) { this.night = transform3; } if (transform3.gameObject.name.Contains("Day") && transform3.gameObject.name.Contains("Vanish")) { this.dayVanish = transform3; this.disappearDay = true; } if (transform3.gameObject.name.Contains("Night") && transform3.gameObject.name.Contains("Vanish")) { this.nightVanish = transform3; this.disappearNight = true; } if (transform3.gameObject.name.Contains("DaySleep")) { this.daySleep = true; } if (transform3.gameObject.name.Contains("NightSleep")) { this.nightSleep = true; } if (transform3.gameObject.name.Contains("DayNight")) { this.hasDayNightCycle = false; } if (transform3.gameObject.name.Contains("Activation")) { this.activation = transform3; } if (transform3.gameObject.name.Contains("Deactivation")) { this.deactivation = transform3; } } } if (this.dayVanish) { foreach (object obj3 in this.dayVanish) { Transform transform4 = (Transform)obj3; if (transform4 != transform) { this.vanishPointsDay.Add(transform4); } } if (this.dayVanish.childCount == 0) { this.vanishPointsDay.Add(this.dayVanish); } } if (this.nightVanish) { foreach (object obj4 in this.nightVanish) { Transform transform5 = (Transform)obj4; if (transform5 != transform) { this.vanishPointsNight.Add(transform5); } } if (this.nightVanish.childCount == 0) { this.vanishPointsNight.Add(this.nightVanish); } } if (this.day) { foreach (object obj5 in this.day) { Transform transform6 = (Transform)obj5; bool flag = true; if (this.creatures.hasTimedLocations) { flag = this.CheckForTimePoint(transform6); } if (transform6 != transform && flag) { this.walkPointsDay.Add(transform6); } } if (this.day.childCount == 0) { this.walkPointsDay.Add(this.day); } } else if (this.dayVanish && this.vanishPointsDay.Count > 0) { this.walkPointsDay.Add(this.vanishPointsDay[0]); } else { Debug.Log("No points for day for " + ((this != null) ? this.ToString() : null)); this.walkPointsDay.Add(base.gameObject.transform); } if (this.night) { foreach (object obj6 in this.night) { Transform transform7 = (Transform)obj6; bool flag2 = true; if (this.creatures.hasTimedLocations) { flag2 = this.CheckForTimePoint(transform7); } if (transform7 != transform && flag2) { this.walkPointsNight.Add(transform7); } } if (this.night.childCount == 0) { this.walkPointsNight.Add(this.night); } } else if (this.nightVanish && this.vanishPointsNight.Count > 0) { this.walkPointsNight.Add(this.vanishPointsNight[0]); } else { Debug.Log("No points for night for " + ((this != null) ? this.ToString() : null)); this.walkPointsNight.Add(base.gameObject.transform); } for (int i = 0; i < this.characters.Count; i++) { if (this.characters[i]) { this.characters[i].patrolNode = i; } } if (getNodes) { this.GetPointNodes(); this.waitTime = 0f; bool dayNight = this.GetDayNight(false); for (int j = 0; j < this.characters.Count; j++) { if (dayNight) { this.StartDay(true); } else { this.StartNight(true); } this.CheckSleep(this.characters[j]); } } } // Token: 0x06000572 RID: 1394 RVA: 0x00077C74 File Offset: 0x00075E74 public void SetWaitTime() { if (this.waitTime > 0f) { this.waitTime = Time.timeSinceLevelLoad + this.creatures.patrolDelay; } } // Token: 0x06000573 RID: 1395 RVA: 0x00077C9C File Offset: 0x00075E9C private void ClearTimePoints() { this.morning1 = null; this.morning2 = null; this.morning3 = null; this.morning4 = null; this.morning5 = null; this.morning6 = null; this.afternoon1 = null; this.afternoon2 = null; this.afternoon3 = null; this.afternoon4 = null; this.afternoon5 = null; this.afternoon6 = null; this.evening1 = null; this.evening2 = null; this.evening3 = null; this.evening4 = null; this.evening5 = null; this.evening6 = null; this.night1 = null; this.night2 = null; this.night3 = null; this.night4 = null; this.night5 = null; this.night6 = null; } // Token: 0x06000574 RID: 1396 RVA: 0x00077D54 File Offset: 0x00075F54 private bool CheckForTimePoint(Transform t) { string name = t.gameObject.name; if (name == "Morning1") { this.morning1 = t; return false; } if (name == "Morning2") { this.morning2 = t; return false; } if (name == "Morning3") { this.morning3 = t; return false; } if (name == "Morning4") { this.morning4 = t; return false; } if (name == "Morning5") { this.morning5 = t; return false; } if (name == "Morning6") { this.morning6 = t; return false; } if (name == "Afternoon1") { this.afternoon1 = t; return false; } if (name == "Afternoon2") { this.afternoon2 = t; return false; } if (name == "Afternoon3") { this.afternoon3 = t; return false; } if (name == "Afternoon4") { this.afternoon4 = t; return false; } if (name == "Afternoon5") { this.afternoon5 = t; return false; } if (name == "Afternoon6") { this.afternoon6 = t; return false; } if (name == "Evening1") { this.evening1 = t; return false; } if (name == "Evening2") { this.evening2 = t; return false; } if (name == "Evening3") { this.evening3 = t; return false; } if (name == "Evening4") { this.evening4 = t; return false; } if (name == "Evening5") { this.evening5 = t; return false; } if (name == "Evening6") { this.evening6 = t; return false; } if (name == "Night1") { this.night1 = t; return false; } if (name == "Night2") { this.night2 = t; return false; } if (name == "Night3") { this.night3 = t; return false; } if (name == "Night4") { this.night4 = t; return false; } if (name == "Night5") { this.night5 = t; return false; } if (name == "Night6") { this.night6 = t; return false; } return true; } // Token: 0x06000575 RID: 1397 RVA: 0x00077F80 File Offset: 0x00076180 public void CheckIfHasTimeLocation(bool timeJump) { if (this.creatures.hasTimedLocations) { bool flag = false; int num = (int)Mathf.Floor(Links.x.gameplay.gameHours); if (num == 22 && this.morning1) { this.HasTimedLocation(this.morning1, num); flag = true; } if (num == 23 && this.morning2) { this.HasTimedLocation(this.morning2, num); flag = true; } if (num == 0 && this.morning3) { this.HasTimedLocation(this.morning3, num); flag = true; } if (num == 1 && this.morning4) { this.HasTimedLocation(this.morning4, num); flag = true; } if (num == 2 && this.morning5) { this.HasTimedLocation(this.morning5, num); flag = true; } if (num == 3 && this.morning6) { this.HasTimedLocation(this.morning6, num); flag = true; } if (num == 4 && this.afternoon1) { this.HasTimedLocation(this.afternoon1, num); flag = true; } if (num == 5 && this.afternoon2) { this.HasTimedLocation(this.afternoon2, num); flag = true; } if (num == 6 && this.afternoon3) { this.HasTimedLocation(this.afternoon3, num); flag = true; } if (num == 7 && this.afternoon4) { this.HasTimedLocation(this.afternoon4, num); flag = true; } if (num == 8 && this.afternoon5) { this.HasTimedLocation(this.afternoon5, num); flag = true; } if (num == 9 && this.afternoon6) { this.HasTimedLocation(this.afternoon6, num); flag = true; } if (num == 10 && this.evening1) { this.HasTimedLocation(this.evening1, num); flag = true; } if (num == 11 && this.evening2) { this.HasTimedLocation(this.evening2, num); flag = true; } if (num == 12 && this.evening3) { this.HasTimedLocation(this.evening3, num); flag = true; } if (num == 13 && this.evening4) { this.HasTimedLocation(this.evening4, num); flag = true; } if (num == 14 && this.evening5) { this.HasTimedLocation(this.evening5, num); flag = true; } if (num == 15 && this.evening6) { this.HasTimedLocation(this.evening6, num); flag = true; } if (num == 16 && this.night1) { this.HasTimedLocation(this.night1, num); flag = true; } if (num == 17 && this.night2) { this.HasTimedLocation(this.night2, num); flag = true; } if (num == 18 && this.night3) { this.HasTimedLocation(this.night3, num); flag = true; } if (num == 19 && this.night4) { this.HasTimedLocation(this.night4, num); flag = true; } if (num == 20 && this.night5) { this.HasTimedLocation(this.night5, num); flag = true; } if (num == 21 && this.night6) { this.HasTimedLocation(this.night6, num); flag = true; } if (!flag) { this.hasTimePoint = -1; if (this.questTimePoint) { if (timeJump) { this.questTimePoint.instantFinish = true; } if (this.questTimePoint.busy || this.questTimePoint.instantFinish) { this.questTimePoint.destroyOnComplete = true; return; } this.questTimePoint.Ending(); Object.Destroy(this.questTimePoint); return; } } } else { this.hasTimePoint = -1; } } // Token: 0x06000576 RID: 1398 RVA: 0x00078330 File Offset: 0x00076530 private void HasTimedLocation(Transform pt, int hr) { if (this.hasTimePoint != hr && this.characters.Count > 0 && this.characters[0]) { Character character = this.characters[0]; bool flag = true; if (this.creatures.changePointsFromQuest != Creatures.Adventures.None && this.creatures.changePointsFromQuest == Creatures.Adventures.C6_Willowmaid && (hr == 17 || hr == 20)) { Library.Inventory inventory = Links.x.library.GetInvRowFromName("DryadFlower"); int num = this.characters[0].HasItem(inventory._ID); int num2 = -1; if (num == -1 && hr == 20) { inventory = Links.x.library.GetInvRowFromName("DryadFlowerDead"); num2 = this.characters[0].HasItem(inventory._ID); } if (num > -1 && hr == 20 && num2 == -1) { flag = false; this.hasTimePoint = -1; } if (num <= -1 && hr == 17) { flag = false; this.hasTimePoint = -1; } } if (flag) { this.hasTimePoint = hr; this.timeNode = this.NearNode(pt.position); this.timeRot = pt.rotation; if (Records.x.editor) { string text = "Found time node for "; Character character2 = character; Debug.Log(text + ((character2 != null) ? character2.ToString() : null) + " " + hr.ToString()); } if (this.timeNode == null) { this.hasTimePoint = -1; return; } if (!this.questTimePoint) { if (!character.hasActions) { character.ClearNodePath(); character.TargetReached(); } this.questTimePoint = base.gameObject.AddComponent(); this.questTimePoint.character = character; this.questTimePoint.hour = hr; this.questTimePoint.destination = (Vector3)this.timeNode.position; this.questTimePoint.creatures = this; this.questTimePoint.Setup(this.characterRow); } } } } // Token: 0x06000577 RID: 1399 RVA: 0x0007852C File Offset: 0x0007672C private void GetPointNodes() { if (this.walkNodesDay.Count != this.walkPointsDay.Count) { for (int i = 0; i < this.walkPointsDay.Count; i++) { GraphNode graphNode = this.NearNode(this.walkPointsDay[i].position); this.walkNodesDay.Add(graphNode); if (graphNode != null) { this.walkPointsDay[i].position = (Vector3)graphNode.position; } if (Records.x.editor && !this.summons && graphNode == null) { Debug.Log(string.Concat(new string[] { (this != null) ? this.ToString() : null, " has null day node at index ", i.ToString(), ", position is: ", this.walkPointsDay[i].transform.position.ToString(), ", is sailing: ", this.sailing.ToString() })); } } for (int j = 0; j < this.walkPointsNight.Count; j++) { GraphNode graphNode2 = this.NearNode(this.walkPointsNight[j].position); this.walkNodesNight.Add(graphNode2); if (graphNode2 != null) { this.walkPointsNight[j].position = (Vector3)graphNode2.position; } } if (this.dayVanish) { for (int k = 0; k < this.vanishPointsDay.Count; k++) { GraphNode graphNode3 = this.NearNode(this.vanishPointsDay[k].position); this.vanishNodesDay.Add(graphNode3); if (graphNode3 != null) { this.vanishPointsDay[k].position = (Vector3)graphNode3.position; } } } if (this.nightVanish) { for (int l = 0; l < this.vanishPointsNight.Count; l++) { GraphNode graphNode4 = this.NearNode(this.vanishPointsNight[l].position); this.vanishNodesNight.Add(graphNode4); if (graphNode4 != null) { this.vanishPointsNight[l].position = (Vector3)graphNode4.position; } } } } } // Token: 0x06000578 RID: 1400 RVA: 0x00078784 File Offset: 0x00076984 public void CheckQuestSwap() { if (this.creatures.changePointsFromQuest != Creatures.Adventures.None) { string text = this.creatures.changePointsFromQuest.ToString(); QuestState questState = QuestLog.GetQuestState(text); QuestState questState2 = Records.x.StringToQuestState(this.creatures.changePointsFromQuestState.ToString()); if (questState == questState2) { if (Records.x.editor) { Debug.Log(string.Concat(new string[] { (this != null) ? this.ToString() : null, " checking for point swap for quest: ", text, ", state is ", questState.ToString(), ", looking for ", questState2.ToString() })); } this.questPointSwap = true; this.GetPoints(this.questPointSwap, true); } else if (this.questPointSwap) { this.questPointSwap = false; this.GetPoints(this.questPointSwap, true); } } if (!this.deactivating) { QuestState questState3 = QuestLog.GetQuestState(this.creatures.deactivateFromQuest.ToString()); string text2 = this.creatures.deactivateQuestState.ToString(); QuestState questState4 = Records.x.StringToQuestState(text2); if (questState3 == questState4 && this.creatures.deactivateQuestState != Creatures.AdventureStates.NotApplicable) { this.CheckDeactivation(); } } } // Token: 0x06000579 RID: 1401 RVA: 0x000788E0 File Offset: 0x00076AE0 public void EveryoneLeave() { for (int i = 0; i < this.characters.Count; i++) { if (this.characters[i] && !this.characters[i].dead && !this.characters[i].missing) { this.characters[i].Missing(); } } this.creatures.promptHasSetThisAsMissing = true; } // Token: 0x0600057A RID: 1402 RVA: 0x0007895C File Offset: 0x00076B5C public bool CheckDeactivation() { Character firstCharacter = this.GetFirstCharacter(); if (!firstCharacter) { return false; } if (!this.deactivating && this.deactivation) { Transform child = this.deactivation; if (this.deactivation.childCount > 0) { child = this.deactivation.GetChild(0); } this.deactivationNode = firstCharacter.NearNode(child.position, false, 0, -1, 0); this.deactivating = true; } if (!firstCharacter.deactivating && this.deactivation) { firstCharacter.LeaveToDeactivationPoint(); } if (firstCharacter.dayNightVanishing) { firstCharacter.dayNightVanishing = false; } if (firstCharacter.vanished) { firstCharacter.TurnScriptsOn(); firstCharacter.vanished = false; } if (this.deactivation) { firstCharacter.alwaysOn = true; float sqrMagnitude = ((Vector3)this.deactivationNode.position - firstCharacter.tr.position).sqrMagnitude; if (Records.x.editor) { Debug.Log("distance to deactivate: " + ((this != null) ? this.ToString() : null) + " " + sqrMagnitude.ToString()); } if (sqrMagnitude < 20f) { return true; } } else { foreach (Character character in this.characters) { character.Leave(true); string text = "Character fleeing to leave scene "; Character character2 = character; Debug.Log(text + ((character2 != null) ? character2.ToString() : null)); } } return false; } // Token: 0x0600057B RID: 1403 RVA: 0x00078AF0 File Offset: 0x00076CF0 public void CheckVIP() { if (this.creatures.vipQuest != Creatures.Adventures.None) { string text = this.creatures.vipQuest.ToString(); QuestState questState = QuestLog.GetQuestState(text); string text2 = this.creatures.vipQuestStartState.ToString(); QuestState questState2 = Records.x.StringToQuestState(text2); string text3 = this.creatures.vipQuestEndState.ToString(); QuestState questState3 = Records.x.StringToQuestState(text3); if (questState == questState2 && this.creatures.vipQuestStartState != Creatures.AdventureStates.NotApplicable) { this.vipFollow = true; if (Links.x.main && this.characters.Count > 0) { Character character = this.characters[0]; if (character) { float sqrMagnitude = (Links.x.main.tr.position - character.tr.position).sqrMagnitude; if (Links.x.main.node != null && character.node != null && character.hostility != 2 && sqrMagnitude < 3600f && Links.x.main.node.Area == character.node.Area) { if (!character.vipFollow) { character.GetHealthBar(); } character.vipFollow = true; GraphNode graphNode = character.NearNode(Vector3.Lerp(character.tr.position, Links.x.main.tr.position, 0.8f), true, 0, -1, 0); if (graphNode != null) { character.running = true; character.MoveBackEmpty(); character.MakePath(graphNode, 200, false, false, true); } } } } } if (questState == questState3 && this.creatures.vipQuestEndState != Creatures.AdventureStates.NotApplicable) { Debug.Log(string.Concat(new string[] { "ended vip from from quest: ", (this != null) ? this.ToString() : null, " ", text, " ", Records.x.StringToQuestState(this.creatures.activateQuestState.ToString()).ToString(), " ", questState.ToString() })); if (this.vipFollow) { this.CheckQuestSwap(); this.vipFollow = false; if (this.characters.Count > 0 && this.characters[0]) { this.characters[0].vipFollow = false; return; } } } else if (this.characters.Count > 0 && this.characters[0] && this.characters[0].hostility > 1) { this.characters[0].vipFollow = false; } } } // Token: 0x0600057C RID: 1404 RVA: 0x00078E00 File Offset: 0x00077000 public void VIPFail() { this.vipFollow = false; if (this.characters.Count > 0) { Character character = this.characters[0]; if (character) { Character character2 = character; Debug.Log(((character2 != null) ? character2.ToString() : null) + " vip fail"); character.vipFollow = false; character.ReturnHealthBar(); if (character.stats.characterRow._SetQuestStateOnDeath != "") { QuestLog.SetQuestState(character.stats.characterRow._Quest, Records.x.StringToQuestState(character.stats.characterRow._SetQuestStateOnDeath)); } } } } // Token: 0x0600057D RID: 1405 RVA: 0x00078EB0 File Offset: 0x000770B0 public bool CanActivate() { if (this.creatures.promptHasSetThisAsMissing) { return false; } if (this.creatures.activateFromQuest == Creatures.Adventures.None) { return true; } string text = this.creatures.activateFromQuest.ToString(); QuestState questState = QuestLog.GetQuestState(text); string text2 = this.creatures.activateQuestState.ToString(); QuestState questState2 = Records.x.StringToQuestState(text2); string text3 = this.creatures.activateQuestStateComplete.ToString(); QuestState questState3 = Records.x.StringToQuestState(text3); bool flag = false; if ((questState == questState2 && this.creatures.activateQuestState != Creatures.AdventureStates.NotApplicable) || (questState == questState3 && this.creatures.activateQuestStateComplete != Creatures.AdventureStates.NotApplicable)) { flag = true; } if (Links.x.diorama.sceneName.Contains("D5") && this.creatures.characterName.ToString().Contains("RozafirDolki") && questState == QuestState.WaitingForExileIsland) { flag = true; } if (flag) { if (Records.x.editor) { Debug.Log(string.Concat(new string[] { "activating creature from quest: ", (this != null) ? this.ToString() : null, " ", text, " ", Records.x.StringToQuestState(this.creatures.activateQuestState.ToString()).ToString(), " ", questState.ToString() })); } return true; } return false; } // Token: 0x0600057E RID: 1406 RVA: 0x00079055 File Offset: 0x00077255 public Transform GetActivation() { if (!this.activation) { return this.walkPointsDay[0]; } if (this.activation.childCount == 0) { return this.activation; } return this.activation.GetChild(0); } // Token: 0x0600057F RID: 1407 RVA: 0x00079094 File Offset: 0x00077294 public void GetMorningNightHours() { if (this.creatures.dayHour == Creatures.hours.Morning1) { this.morningHour = 22; } if (this.creatures.dayHour == Creatures.hours.Morning2) { this.morningHour = 23; } if (this.creatures.dayHour == Creatures.hours.Morning3) { this.morningHour = 0; } if (this.creatures.dayHour == Creatures.hours.Morning4) { this.morningHour = 1; } if (this.creatures.dayHour == Creatures.hours.Morning5) { this.morningHour = 2; } if (this.creatures.dayHour == Creatures.hours.Morning6) { this.morningHour = 3; } if (this.creatures.dayHour == Creatures.hours.Afternoon1) { this.morningHour = 4; } if (this.creatures.dayHour == Creatures.hours.Afternoon2) { this.morningHour = 5; } if (this.creatures.dayHour == Creatures.hours.Afternoon3) { this.morningHour = 6; } if (this.creatures.dayHour == Creatures.hours.Afternoon4) { this.morningHour = 7; } if (this.creatures.dayHour == Creatures.hours.Afternoon5) { this.morningHour = 8; } if (this.creatures.dayHour == Creatures.hours.Afternoon6) { this.morningHour = 9; } if (this.creatures.dayHour == Creatures.hours.Evening1) { this.morningHour = 10; } if (this.creatures.dayHour == Creatures.hours.Evening2) { this.morningHour = 11; } if (this.creatures.dayHour == Creatures.hours.Evening3) { this.morningHour = 12; } if (this.creatures.dayHour == Creatures.hours.Evening4) { this.morningHour = 13; } if (this.creatures.dayHour == Creatures.hours.Evening5) { this.morningHour = 14; } if (this.creatures.dayHour == Creatures.hours.Evening6) { this.morningHour = 15; } if (this.creatures.dayHour == Creatures.hours.Night1) { this.morningHour = 16; } if (this.creatures.dayHour == Creatures.hours.Night2) { this.morningHour = 17; } if (this.creatures.dayHour == Creatures.hours.Night3) { this.morningHour = 18; } if (this.creatures.dayHour == Creatures.hours.Night4) { this.morningHour = 19; } if (this.creatures.dayHour == Creatures.hours.Night5) { this.morningHour = 20; } if (this.creatures.dayHour == Creatures.hours.Night6) { this.morningHour = 21; } if (this.creatures.nightHour == Creatures.hours.Morning1) { this.nightHour = 22; } if (this.creatures.nightHour == Creatures.hours.Morning2) { this.nightHour = 23; } if (this.creatures.nightHour == Creatures.hours.Morning3) { this.nightHour = 0; } if (this.creatures.nightHour == Creatures.hours.Morning4) { this.nightHour = 1; } if (this.creatures.nightHour == Creatures.hours.Morning5) { this.nightHour = 2; } if (this.creatures.nightHour == Creatures.hours.Morning6) { this.nightHour = 3; } if (this.creatures.nightHour == Creatures.hours.Afternoon1) { this.nightHour = 4; } if (this.creatures.nightHour == Creatures.hours.Afternoon2) { this.nightHour = 5; } if (this.creatures.nightHour == Creatures.hours.Afternoon3) { this.nightHour = 6; } if (this.creatures.nightHour == Creatures.hours.Afternoon4) { this.nightHour = 7; } if (this.creatures.nightHour == Creatures.hours.Afternoon5) { this.nightHour = 8; } if (this.creatures.nightHour == Creatures.hours.Afternoon6) { this.nightHour = 9; } if (this.creatures.nightHour == Creatures.hours.Evening1) { this.nightHour = 10; } if (this.creatures.nightHour == Creatures.hours.Evening2) { this.nightHour = 11; } if (this.creatures.nightHour == Creatures.hours.Evening3) { this.nightHour = 12; } if (this.creatures.nightHour == Creatures.hours.Evening4) { this.nightHour = 13; } if (this.creatures.nightHour == Creatures.hours.Evening5) { this.nightHour = 14; } if (this.creatures.nightHour == Creatures.hours.Evening6) { this.nightHour = 15; } if (this.creatures.nightHour == Creatures.hours.Night1) { this.nightHour = 16; } if (this.creatures.nightHour == Creatures.hours.Night2) { this.nightHour = 17; } if (this.creatures.nightHour == Creatures.hours.Night3) { this.nightHour = 18; } if (this.creatures.nightHour == Creatures.hours.Night4) { this.nightHour = 19; } if (this.creatures.nightHour == Creatures.hours.Night5) { this.nightHour = 20; } if (this.creatures.nightHour == Creatures.hours.Night6) { this.nightHour = 21; } } // Token: 0x04000808 RID: 2056 [Header("Info")] public Creatures creatures; // Token: 0x04000809 RID: 2057 public string xmlName; // Token: 0x0400080A RID: 2058 public bool temporary; // Token: 0x0400080B RID: 2059 public bool onlyTemporary; // Token: 0x0400080C RID: 2060 public bool hunting; // Token: 0x0400080D RID: 2061 public bool canJoinParty; // Token: 0x0400080E RID: 2062 public string originalScene; // Token: 0x0400080F RID: 2063 public string temporaryState = ""; // Token: 0x04000810 RID: 2064 public Transform creatureHolder; // Token: 0x04000811 RID: 2065 public List characters = new List(); // Token: 0x04000812 RID: 2066 public bool disappearDay; // Token: 0x04000813 RID: 2067 public bool disappearNight; // Token: 0x04000814 RID: 2068 public bool hasDayNightCycle; // Token: 0x04000815 RID: 2069 public bool movesOnWater; // Token: 0x04000816 RID: 2070 public float waitTime; // Token: 0x04000817 RID: 2071 private TileEffects tileEffect; // Token: 0x04000818 RID: 2072 private float startDelayTime; // Token: 0x04000819 RID: 2073 public bool waitingForDelay; // Token: 0x0400081A RID: 2074 public GraphNode temporaryStartNode; // Token: 0x0400081B RID: 2075 public float futureDelay; // Token: 0x0400081C RID: 2076 public CreatureBoat creatureBoat; // Token: 0x0400081D RID: 2077 public bool sailing; // Token: 0x0400081E RID: 2078 public Character groupLeader; // Token: 0x0400081F RID: 2079 private string thisName; // Token: 0x04000820 RID: 2080 public int morningHour; // Token: 0x04000821 RID: 2081 public int nightHour; // Token: 0x04000822 RID: 2082 public bool isDay = true; // Token: 0x04000823 RID: 2083 public bool inGroup; // Token: 0x04000824 RID: 2084 public bool deactivating; // Token: 0x04000825 RID: 2085 public bool activating; // Token: 0x04000826 RID: 2086 public bool ambush; // Token: 0x04000827 RID: 2087 public bool noSleep; // Token: 0x04000828 RID: 2088 public bool stopPatrolTemporarily; // Token: 0x04000829 RID: 2089 public bool miniGameCreature; // Token: 0x0400082A RID: 2090 public bool vipFollow; // Token: 0x0400082B RID: 2091 [Header("Points")] public List walkPointsDay = new List(); // Token: 0x0400082C RID: 2092 private List walkNodesDay = new List(); // Token: 0x0400082D RID: 2093 public List vanishPointsDay = new List(); // Token: 0x0400082E RID: 2094 private List vanishNodesDay = new List(); // Token: 0x0400082F RID: 2095 public List walkPointsNight = new List(); // Token: 0x04000830 RID: 2096 private List walkNodesNight = new List(); // Token: 0x04000831 RID: 2097 public List vanishPointsNight = new List(); // Token: 0x04000832 RID: 2098 private List vanishNodesNight = new List(); // Token: 0x04000833 RID: 2099 private Transform morning1; // Token: 0x04000834 RID: 2100 private Transform morning2; // Token: 0x04000835 RID: 2101 private Transform morning3; // Token: 0x04000836 RID: 2102 private Transform morning4; // Token: 0x04000837 RID: 2103 private Transform morning5; // Token: 0x04000838 RID: 2104 private Transform morning6; // Token: 0x04000839 RID: 2105 private Transform afternoon1; // Token: 0x0400083A RID: 2106 private Transform afternoon2; // Token: 0x0400083B RID: 2107 private Transform afternoon3; // Token: 0x0400083C RID: 2108 private Transform afternoon4; // Token: 0x0400083D RID: 2109 private Transform afternoon5; // Token: 0x0400083E RID: 2110 private Transform afternoon6; // Token: 0x0400083F RID: 2111 private Transform evening1; // Token: 0x04000840 RID: 2112 private Transform evening2; // Token: 0x04000841 RID: 2113 private Transform evening3; // Token: 0x04000842 RID: 2114 private Transform evening4; // Token: 0x04000843 RID: 2115 private Transform evening5; // Token: 0x04000844 RID: 2116 private Transform evening6; // Token: 0x04000845 RID: 2117 private Transform night1; // Token: 0x04000846 RID: 2118 private Transform night2; // Token: 0x04000847 RID: 2119 private Transform night3; // Token: 0x04000848 RID: 2120 private Transform night4; // Token: 0x04000849 RID: 2121 private Transform night5; // Token: 0x0400084A RID: 2122 private Transform night6; // Token: 0x0400084B RID: 2123 private Transform day; // Token: 0x0400084C RID: 2124 private Transform night; // Token: 0x0400084D RID: 2125 private Transform dayVanish; // Token: 0x0400084E RID: 2126 private Transform nightVanish; // Token: 0x0400084F RID: 2127 private Transform activation; // Token: 0x04000850 RID: 2128 private Transform deactivation; // Token: 0x04000851 RID: 2129 public bool daySleep; // Token: 0x04000852 RID: 2130 public bool nightSleep; // Token: 0x04000853 RID: 2131 public int hasTimePoint = -1; // Token: 0x04000854 RID: 2132 private MapExitActions mapExitDay; // Token: 0x04000855 RID: 2133 private MapExitActions mapExitNight; // Token: 0x04000856 RID: 2134 public Transform tr; // Token: 0x04000857 RID: 2135 private NNConstraint nodeConstraint = new NNConstraint(); // Token: 0x04000858 RID: 2136 private GraphNode vanishNode; // Token: 0x04000859 RID: 2137 private GraphNode deactivationNode; // Token: 0x0400085A RID: 2138 private bool questPointSwap; // Token: 0x0400085B RID: 2139 private IEnumerator followerCoroutine; // Token: 0x0400085C RID: 2140 public GraphNode randomNodeCenter; // Token: 0x0400085D RID: 2141 public GraphNode timeNode; // Token: 0x0400085E RID: 2142 private QuestTimePoint questTimePoint; // Token: 0x0400085F RID: 2143 private Quaternion timeRot; // Token: 0x04000860 RID: 2144 private float lastCheckTime; // Token: 0x04000861 RID: 2145 private float repathTime; // Token: 0x04000862 RID: 2146 [Header("Save Data")] private ES3File saveFile; // Token: 0x04000863 RID: 2147 public List initiateDialogue = new List(); // Token: 0x04000864 RID: 2148 public List health = new List(); // Token: 0x04000865 RID: 2149 public List states = new List(); // Token: 0x04000866 RID: 2150 public List temperaments = new List(); // Token: 0x04000867 RID: 2151 public List positions = new List(); // Token: 0x04000868 RID: 2152 public List maps = new List(); // Token: 0x04000869 RID: 2153 public List data = new List(); // Token: 0x0400086A RID: 2154 public List effects = new List(); // Token: 0x0400086B RID: 2155 public List doorID = new List(); // Token: 0x0400086C RID: 2156 private List items; // Token: 0x0400086D RID: 2157 public string savedItems; // Token: 0x0400086E RID: 2158 public string savedBagItems; // Token: 0x0400086F RID: 2159 private string saveScene; // Token: 0x04000870 RID: 2160 public float timeSinceWipeOut; // Token: 0x04000871 RID: 2161 public float standTime; // Token: 0x04000872 RID: 2162 private bool hasSaveFile; // Token: 0x04000873 RID: 2163 private bool hasFirstNode; // Token: 0x04000874 RID: 2164 private string[] rawlines; // Token: 0x04000875 RID: 2165 private Library.Characters characterRow; // Token: 0x04000876 RID: 2166 public int temporaryIndex; // Token: 0x04000877 RID: 2167 private List delays; // Token: 0x04000878 RID: 2168 private List movingFromMap; // Token: 0x04000879 RID: 2169 private StringFast str; // Token: 0x0400087A RID: 2170 [Header("States")] public bool waitingForPrompt; // Token: 0x0400087B RID: 2171 public bool summons; // Token: 0x0400087C RID: 2172 public bool alliedToParty; }