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

3745 lines
107 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using DarkTonic.MasterAudio;
using Pathfinding;
using PixelCrushers.DialogueSystem;
using UnityEngine;
// Token: 0x02000044 RID: 68
public class PuzzleActions : MonoBehaviour
{
// Token: 0x06000872 RID: 2162 RVA: 0x000B8670 File Offset: 0x000B6870
private void Start()
{
if (!this.puzzle)
{
this.puzzle = base.gameObject.GetComponent<Puzzle>();
}
this.id = this.puzzle.puzzleID;
if (this.id == "Break Circle" && !this.hasCollider)
{
this.LoadPuzzleInfo();
}
}
// Token: 0x06000873 RID: 2163 RVA: 0x000B86CC File Offset: 0x000B68CC
public void CombatSheen(int num)
{
}
// Token: 0x06000874 RID: 2164 RVA: 0x000B86D0 File Offset: 0x000B68D0
private void Update()
{
if (this.id == "C6_WeightPuzzle" || this.id == "D5_WeightPuzzle")
{
int count = this.listenersUp.Count;
for (int i = 0; i < count; i++)
{
this.listenersUp[i].CheckItems();
}
this.CheckWeightCharacters();
if (this.updateWeight > 0)
{
this.ChangeWeight();
this.updateWeight++;
if (this.updateWeight > 20)
{
this.updateWeight = 0;
}
}
}
if (this.id == "WestRuinsFort" && Links.x.gaia.sceneLoaded && !Records.x.removeControls && this.loaded && (!this.hasClearedFort || !this.alliesAreGone || !this.rousedFort))
{
bool flag = this.SeenByFortCreature();
if (flag && !this.inFort)
{
this.StartFort();
}
if (!flag && this.inFort)
{
this.FortChecks();
this.EndFort();
}
if (flag)
{
this.FortChecks();
}
else if (this.rousedFort && Links.x.gameplay.seconds > this.timeSinceLeftCombat + 10000f)
{
this.rousedFort = false;
this.gaveWarning = false;
if (this.lookout)
{
this.lookout.hostility = 1;
}
Debug.Log("Lookout returned to non-hostile state");
}
if (this.hasClearedFort && !this.alliesAreGone && !this.inFort)
{
this.CheckIfAlliesShouldLeave();
}
}
}
// Token: 0x06000875 RID: 2165 RVA: 0x000B8868 File Offset: 0x000B6A68
public void SetLayers(int x)
{
if (x == 6)
{
if (this.layers == null)
{
this.layers = new List<int>();
for (int i = 0; i < this.renderers.Length; i++)
{
if (this.renderers[i])
{
this.layers.Add(this.renderers[i].gameObject.layer);
if (this.renderers[i].gameObject.layer != 29)
{
this.renderers[i].gameObject.layer = 6;
}
}
else
{
this.layers.Add(0);
}
}
return;
}
}
else
{
for (int j = 0; j < this.renderers.Length; j++)
{
if (this.renderers[j])
{
this.renderers[j].gameObject.layer = this.layers[j];
}
}
}
}
// Token: 0x06000876 RID: 2166 RVA: 0x000B894C File Offset: 0x000B6B4C
public void Clicked(Character party)
{
if (this.id == "ChalkRubbing")
{
if (!Records.x.InCombat(false))
{
Links.x.dialogue.puzzleActions = this;
Links.x.gameplay.StartDialogue(party, party, null, null, "Party/ChalkRubbing");
}
else
{
Links.x.gameFeed.ShowNotice("Not during combat");
}
}
if (this.id.Contains("Bell"))
{
if (this.callForHelp)
{
this.callForHelp.CallForHelp();
}
base.gameObject.transform.GetChild(0).gameObject.GetComponent<HannahAnimatorSimple>().PlayAgain();
Links.x.main.PlayAnimation("Kick", 0f);
MasterAudio.PlaySound3DAtVector3AndForget("Interactives", Links.x.main.currentPosition, 1.75f, new float?(1f), 0f, "Bell", null);
}
if (this.id == "Birch")
{
if (!Records.x.InCombat(false))
{
Links.x.dialogue.puzzleActions = this;
Links.x.gameplay.StartDialogue(party, party, null, null, "Party/BirchTree");
}
else
{
Links.x.gameFeed.ShowNotice("Not during combat");
}
}
if (this.id == "ForfeitsBoard")
{
if (!Records.x.InCombat(false))
{
Links.x.forfeits.StartMenu();
}
else
{
Links.x.gameFeed.ShowNotice("Not during combat");
}
}
if (this.id == "Text")
{
string displayText = this.puzzle.displayText;
string text = "";
if (displayText == "RozafirSign1")
{
text = "Rozafir lies east";
}
if (displayText == "RozafirSign2")
{
text = "Southeast to Din Sera";
}
if (displayText == "RozafirSign3")
{
text = "Lazure Lighthouse is north of here";
}
if (displayText == "RozafirSign4")
{
text = "The Forten lies straight west";
}
if (displayText == "WaterfallsSign1")
{
text = "Rozafir to the west";
}
if (displayText == "WaterfallsSign2")
{
text = "South to Din Sera";
}
if (displayText == "WaterfallsSign3")
{
text = "East to Din Varens";
}
if (text != "")
{
Links.x.main.StartQuip(text);
}
this.HoverOut();
}
if (this.id.Contains("SemizenStatue"))
{
if (!Records.x.InCombat(false))
{
Links.x.dialogue.puzzleActions = this;
Links.x.gameplay.StartDialogue(party, party, null, null, "Party/SemizenStatue_" + this.puzzle.sceneName);
}
else
{
Links.x.gameFeed.ShowNotice("Not during combat");
}
}
if (this.id == "Revive")
{
if (this.clickActionCoroutine != null)
{
base.StopCoroutine(this.clickActionCoroutine);
}
this.clickActionCoroutine = this.ClickActions(party, true);
base.StartCoroutine(this.clickActionCoroutine);
}
if (this.id == "Break Circle")
{
Links.x.fellowship.BreakCircle(false);
}
if (this.id.Contains("FairyCircle"))
{
if (this.clickActionCoroutine != null)
{
base.StopCoroutine(this.clickActionCoroutine);
}
this.clickActionCoroutine = this.ClickActions(party, true);
base.StartCoroutine(this.clickActionCoroutine);
}
if (this.id.Contains("C6_Tomb_") || this.id.Contains("D5_Tomb_"))
{
if (this.clickActionCoroutine != null)
{
base.StopCoroutine(this.clickActionCoroutine);
}
this.clickActionCoroutine = this.ClickActions(party, true);
base.StartCoroutine(this.clickActionCoroutine);
}
}
// Token: 0x06000877 RID: 2167 RVA: 0x000B8D2C File Offset: 0x000B6F2C
public void ClickedFromPrompt(PromptActions prompt)
{
if (this.id.Contains("FairyCircle"))
{
this.promptActions = prompt;
if (this.clickActionCoroutine != null)
{
base.StopCoroutine(this.clickActionCoroutine);
}
this.clickActionCoroutine = this.ClickActions(Links.x.main, true);
base.StartCoroutine(this.clickActionCoroutine);
}
if (this.id.Contains("Fence") || this.id.Contains("Password"))
{
this.promptActions = prompt;
if (this.clickActionCoroutine != null)
{
base.StopCoroutine(this.clickActionCoroutine);
}
this.clickActionCoroutine = this.ClickActions(Links.x.main, true);
base.StartCoroutine(this.clickActionCoroutine);
}
if (this.id.Contains("GoblinHole"))
{
this.promptActions = prompt;
if (this.clickActionCoroutine == null)
{
this.clickActionCoroutine = this.ClickActions(prompt.hitCharacters[0], true);
base.StartCoroutine(this.clickActionCoroutine);
}
}
if (this.id.Contains("C6_Cave_ShroomerMushes"))
{
this.promptActions = prompt;
if (this.clickActionCoroutine != null)
{
base.StopCoroutine(this.clickActionCoroutine);
}
this.clickActionCoroutine = this.ClickActions(Links.x.main, false);
base.StartCoroutine(this.clickActionCoroutine);
}
if (this.id.Contains("C6_DryadFlower") && QuestLog.GetQuestState("C6_DryadWitchFlower") == QuestState.ActivePart2)
{
this.promptActions = prompt;
if (this.clickActionCoroutine != null)
{
base.StopCoroutine(this.clickActionCoroutine);
}
this.clickActionCoroutine = this.ClickActions(Links.x.main, false);
base.StartCoroutine(this.clickActionCoroutine);
}
}
// Token: 0x06000878 RID: 2168 RVA: 0x000B8EE8 File Offset: 0x000B70E8
private bool FairyShout(string keyWord1, string keyWord2, string keyWord3)
{
string text = Records.x.recentShout.ToLower();
return text.Contains(keyWord1) && text.Contains(keyWord2) && text.Contains(keyWord3) && Time.timeSinceLevelLoad < Records.x.lastShoutTime + 10f;
}
// Token: 0x06000879 RID: 2169 RVA: 0x000B8F3A File Offset: 0x000B713A
private bool Password(string keyWord1)
{
return Records.x.recentShout.ToLower().Contains(keyWord1) && Time.timeSinceLevelLoad < Records.x.lastShoutTime + 3f;
}
// Token: 0x0600087A RID: 2170 RVA: 0x000B8F6D File Offset: 0x000B716D
private IEnumerator ClickActions(Character party, bool waitToTurn)
{
if (waitToTurn)
{
party.SetRotation(Quaternion.LookRotation(base.transform.position - party.tr.position), false, false);
yield return new WaitForEndOfFrame();
while (party.turning)
{
yield return null;
}
}
if (this.id == "Revive")
{
Links.x.qte.playing = true;
Links.x.qte.quickStart = true;
Links.x.qte.StartQTE("Revive", 1f);
while (Links.x.qte.playing)
{
yield return null;
}
if (Links.x.qte.completed && Links.x.qte.bonus > 0f)
{
yield return new WaitForSeconds(1f);
this.currentHealth = (int)Links.x.qte.bonus;
this.interactCharacter.PartyResurrect(this.currentHealth);
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(105);
float num = this.interactCharacter.torsoPosition.y - this.interactCharacter.currentPosition.y;
num = Mathf.Clamp(num, 0.5f, 1f);
pooledGameObject.transform.position = this.interactCharacter.currentPosition + new Vector3(0f, num, 0f);
pooledGameObject.transform.localScale = Vector3.one * this.interactCharacter.stats.characterRow._Height;
pooledGameObject.SetActive(true);
pooledGameObject.transform.SetParent(this.interactCharacter.tr, true);
pooledGameObject.GetComponent<Animator>().Play("Pickup");
}
}
if (this.id.Contains("FairyCircle"))
{
bool stop = false;
string keyword = "";
string keyword2 = "";
string keyword3 = "";
if (Links.x.diorama.sceneName.Contains("C6"))
{
keyword = "ila";
keyword2 = "por";
keyword3 = "vex";
}
else if (Links.x.diorama.sceneName.Contains("C5"))
{
keyword = "lis";
keyword2 = "fal";
keyword3 = "ero";
}
else if (Links.x.diorama.sceneName.Contains("E6"))
{
keyword = "sea";
keyword2 = "mar";
keyword3 = "fin";
}
while (!this.FairyShout(keyword, keyword2, keyword3) && Links.x.GetNearestParty(this.promptActions.gameObject.transform.position, null, 400f))
{
yield return null;
}
if (!Links.x.GetNearestParty(this.promptActions.gameObject.transform.position, null, 400f))
{
stop = true;
}
if (!this.FairyShout(keyword, keyword2, keyword3))
{
stop = true;
}
if (!stop)
{
yield return new WaitForSeconds(1f);
while (Records.x.inMenus)
{
yield return null;
}
this.promptActions.state = 1;
if (Links.x.diorama.sceneName.Contains("C6") && QuestLog.GetQuestState("C6_Fairy") == QuestState.Unassigned)
{
QuestLog.SetQuestState("C6_Fairy", "active");
Links.x.diorama.CheckQuestActivations();
}
if (Links.x.diorama.sceneName.Contains("C5") && QuestLog.GetQuestState("C5_Fairy") == QuestState.Unassigned)
{
QuestLog.SetQuestState("C5_Fairy", "active");
Links.x.diorama.CheckQuestActivations();
}
if (Links.x.diorama.sceneName.Contains("E6") && QuestLog.GetQuestState("E6_Fairy") == QuestState.Unassigned)
{
QuestLog.SetQuestState("E6_Fairy", "active");
Links.x.diorama.CheckQuestActivations();
}
Character fairy = Links.x.diorama.FindCharacterAnyState("Fairy");
Links.x.gameplay.TogglePause(false);
fairy.ignoreNodeIDs = true;
fairy.ignoreRemoveControls = true;
Records.x.RemoveControls(true);
Links.x.main.ClearNodePath();
Links.x.main.alwaysTurn = true;
Links.x.main.inAction = true;
Links.x.main.inActionTime = Links.x.gameplay.seconds;
Links.x.main.SetRotation(Quaternion.LookRotation(fairy.tr.position - party.tr.position), false, false);
fairy.SetPosition(fairy.creatures.GetActivation().position, null);
fairy.SetMeshState(true);
fairy.body.SetMeshState(true, true);
fairy.ambushing = true;
fairy.SetPosition(fairy.creatures.GetActivation().position, null);
Links.x.rtsCamera.Follow(this.promptActions.gameObject.transform, null, false);
Links.x.rtsCamera.Zoom(true, "");
float timeToLerp = 0.25f;
float percentage = 0f;
float startTime = Time.time;
while (percentage < 1f)
{
percentage = (Time.time - startTime) / timeToLerp;
fairy.SetPosition(fairy.creatures.GetActivation().position, null);
yield return null;
}
MasterAudio.PlaySoundAndForget("Feedback", 0.5f, new float?(1f), 0f, "Song Learned", null);
Vector3 pt = (Vector3)fairy.creatures.GetWalkNodeIndex(0).position;
fairy.Jump(fairy.creatures.GetWalkNodeIndex(0), pt, false, false);
fairy.SetMeshState(true);
fairy.body.SetMeshState(true, true);
yield return new WaitForSeconds(0.5f);
GameObject spellCasterFX = Links.x.cellar.GetPooledGameObject(69);
spellCasterFX.transform.position = pt + new Vector3(0f, 0.5f, 0f);
spellCasterFX.SetActive(true);
yield return new WaitForSeconds(2f);
fairy.ambushing = false;
Links.x.dialogue.puzzleActions = this;
Links.x.gameplay.StartDialogue(fairy, party, null, null, "Party/FairyCircle");
while (Records.x.dialogue)
{
yield return null;
}
fairy.Missing();
Links.x.cellar.ReturnPooledGameObject(69, spellCasterFX);
Links.x.rtsCamera.Zoom(false, "");
Records.x.RemoveControls(false);
Links.x.main.inAction = false;
fairy = null;
pt = default(Vector3);
spellCasterFX = null;
}
keyword = null;
keyword2 = null;
keyword3 = null;
}
else if (this.id.Contains("Fence") || this.id.Contains("Password"))
{
bool stop = false;
string keyword3 = "";
if (Links.x.diorama.sceneName.Contains("D6"))
{
keyword3 = "anthramin";
}
Debug.Log("Password listen");
while (!this.Password(keyword3) && Links.x.GetNearestParty(this.promptActions.gameObject.transform.position, null, 400f))
{
yield return null;
}
if (!Links.x.GetNearestParty(this.promptActions.gameObject.transform.position, null, 400f))
{
stop = true;
}
if (!this.Password(keyword3))
{
stop = true;
}
Debug.Log(stop);
if (!stop)
{
while (Records.x.inMenus)
{
yield return null;
}
this.promptActions.state = 1;
string text = "";
if (this.id.Contains("D6_Fence"))
{
text = "RozafirUndergroundMerchant";
}
Character fairy = Links.x.diorama.FindCharacterAnyState(text);
if (fairy)
{
Links.x.gameplay.TogglePause(false);
Records.x.RemoveControls(true);
Links.x.main.ClearNodePath();
Links.x.main.alwaysTurn = true;
Links.x.main.SetRotation(Quaternion.LookRotation(fairy.tr.position - party.tr.position), false, false);
Links.x.rtsCamera.Follow(this.promptActions.gameObject.transform, null, false);
Links.x.rtsCamera.Zoom(true, "");
yield return new WaitForSeconds(1f);
MasterAudio.PlaySoundAndForget("Feedback", 0.5f, new float?(1f), 0f, "Song Learned", null);
GameObject spellCasterFX = Links.x.cellar.GetPooledGameObject(69);
spellCasterFX.transform.position = fairy.tr.position + new Vector3(0f, 0.5f, 0f);
spellCasterFX.SetActive(true);
if (this.id.Contains("D6_Fence"))
{
fairy.StartQuip("Let's do business, friend");
}
yield return new WaitForSeconds(2f);
if (this.id.Contains("D6_Fence"))
{
Links.x.dialogue.Peddler(fairy);
QuestLog.SetQuestState("D6_Fence", QuestState.Active);
}
if (false)
{
Links.x.dialogue.puzzleActions = this;
Links.x.gameplay.StartDialogue(fairy, party, null, null, "Party/FairyCircle");
while (Records.x.dialogue)
{
yield return null;
}
}
this.completed = true;
if (this.coll)
{
this.coll.enabled = false;
}
Links.x.cellar.ReturnPooledGameObject(69, spellCasterFX);
Links.x.rtsCamera.Zoom(false, "");
Records.x.RemoveControls(false);
spellCasterFX = null;
}
fairy = null;
}
keyword3 = null;
}
else if (this.id.Contains("C6_Tomb_") || this.id.Contains("D5_Tomb_"))
{
this.partyList = Links.x.portraitOrder;
string text2 = "LazureTombKeyBlue";
if (this.id.Contains("Green"))
{
text2 = "LazureTombKeyGreen";
}
if (this.id.Contains("White"))
{
text2 = "LazureTombKeyWhite";
}
int invRowID = Links.x.library.GetInvRowID(text2);
bool flag = false;
foreach (Character character in this.partyList)
{
if (!flag && character.HasItem(invRowID) > -1)
{
flag = true;
}
}
if (flag)
{
if (this.puzzle.animator.GetCurrentAnimatorStateInfo(0).IsName("LachoGear_activate"))
{
this.puzzle.animator.Play("LachoGear_deactivate");
this.completed = false;
}
else
{
this.puzzle.animator.Play("LachoGear_activate");
this.completed = true;
}
this.UpdateAstar(4.5f, true);
}
else
{
party.StartQuip("Looks like a tumbler lock");
}
}
else if (this.id.Contains("C6_Cave_ShroomerMushes"))
{
List<TileEffects> tileEffects = new List<TileEffects>();
BreakableActions breakie = GameObject.Find("Breaky_ShroomerPuzzle").GetComponent<BreakableActions>();
breakie.GetDifferentRenderers(this.puzzle.animator.gameObject);
float startTime = (float)breakie.currentHealth;
while (!Links.x.gaia.sceneLoaded)
{
yield return null;
}
while (this.promptActions.HitCharacterCount() > 0 && breakie.currentHealth > 0)
{
int num2 = 0;
for (int i = 0; i < tileEffects.Count; i++)
{
if (tileEffects[i])
{
num2++;
}
}
if (num2 < 10 && !Records.x.pocketPause)
{
NNConstraint nnconstraint = new NNConstraint();
nnconstraint.constrainWalkability = true;
nnconstraint.walkable = true;
nnconstraint.constrainTags = true;
nnconstraint.checkCircleID = 0;
nnconstraint.passID = 0;
nnconstraint.passID2 = 0;
nnconstraint.constrainPenalty = 0;
nnconstraint.checkConnections = 0;
nnconstraint.constrainToArea = (int)Links.x.main.node.Area;
nnconstraint.constrainToEnvironment = 1;
GraphNode graphNode = AstarPath.active.GetNearest(Links.x.main.tr.position + new Vector3(Random.Range(-5f, 5f), 0f, Random.Range(-5f, 5f)), nnconstraint).node;
if (graphNode != null)
{
this.puzzle.animator.Play("MushHeart_PumpEnemy");
TileEffects tileEffects2 = Links.x.tileEffects.AddComponent<TileEffects>();
string text3 = "MushroomTrap";
string text4 = "PaganScroll7";
if ((float)breakie.currentHealth / (float)breakie.breakable.health < 0.5f && Random.Range(0, 4) == 0)
{
text3 = "MushroomTrapDifficult";
text4 = "PaganScroll8";
}
Library.Pagan paganRow = Links.x.library.GetPaganRow(text3);
tileEffects.Add(tileEffects2);
tileEffects2.startNode = graphNode;
tileEffects2.gameObject.SetActive(true);
tileEffects2.severity = 0f;
tileEffects2.spellIndex = 7;
tileEffects2.paganRow = paganRow;
tileEffects2.mainSkill = "Fauna";
tileEffects2.tether = 20f;
tileEffects2.sourceLevel = 0f;
tileEffects2.doSpellScroll = true;
tileEffects2.spellScroll = Links.x.library.GetInvRowFromName(text4);
tileEffects2.Setup(Links.x.library.GetAbilityRow(text3), null, null, null, null, null);
MasterAudio.PlaySound3DAtVector3AndForget("Swarm", (Vector3)graphNode.position, 1f, new float?(1f), 0f, "", null);
}
}
float percentage = Random.Range(30f, 100f);
float timeToLerp = 0f;
float startTime2 = Links.x.gameplay.seconds;
while (timeToLerp < 1f && breakie.currentHealth > 0)
{
timeToLerp = (Links.x.gameplay.seconds - startTime2) / percentage;
if (startTime != (float)breakie.currentHealth)
{
this.puzzle.animator.Play("MushHeart_Hit");
}
startTime = (float)breakie.currentHealth;
yield return null;
}
}
if (breakie.currentHealth <= 0)
{
this.promptActions.state = 1;
this.puzzle.animator.gameObject.SetActive(false);
}
tileEffects = null;
breakie = null;
}
else if (this.id.Contains("C6_DryadFlower"))
{
Debug.Log("start dryad flower cinematic");
Links.x.characterSheet.StartEndMenu(false, true);
Links.x.gameplay.TogglePause(false);
Records.x.RemoveControls(true);
yield return new WaitForSeconds(0.5f);
Links.x.rtsCamera.Zoom(true, "Dialogue");
yield return new WaitForSeconds(1f);
MasterAudio.PlaySound3DAtVector3AndForget("SpellcastingVol", Links.x.main.tr.position, 1f, new float?(1f), 0.25f, "", null);
GameObject spellCasterFX = Links.x.cellar.GetPooledGameObject(69);
spellCasterFX.transform.position = Links.x.main.tr.position + new Vector3(0f, 0.2f, 0f);
spellCasterFX.SetActive(true);
yield return new WaitForSeconds(3f);
Links.x.main.StartQuip("It'll need a little time to grow");
MasterAudio.PlaySoundAndForget("Feedback", 0.5f, new float?(1f), 0f, "Song Learned", null);
Links.x.gameFeed.AddFeed("<color=#FFFFFF>A seed is planted</color>");
string text5 = "C6_DryadWitchFlower";
string text6 = "activePart2";
string text7 = "success";
int num3 = 6;
bool flag2 = false;
Records.x.AddQuestToTimer(text5, (float)num3, text6, text7, flag2);
this.promptActions.state = 1;
yield return new WaitForSeconds(3f);
if (spellCasterFX)
{
Links.x.cellar.ReturnPooledGameObject(69, spellCasterFX);
spellCasterFX = null;
}
Links.x.rtsCamera.Zoom(false, "Dialogue");
Records.x.RemoveControls(false);
spellCasterFX = null;
}
else if (this.id.Contains("GoblinHole"))
{
while (Records.x.inMenus || Links.x.combat.inPocketAttack || Records.x.removeControls || Records.x.saving)
{
yield return null;
}
Character fairy = party;
Links.x.combat.EndCombat(true);
if (Links.x.main != fairy)
{
fairy.SetAsLeader();
}
yield return new WaitForSeconds(0.01f);
Links.x.gameplay.TogglePause(false);
Records.x.RemoveControls(true);
fairy.ClearNodePath();
fairy.alwaysTurn = true;
fairy.SetRotation(Quaternion.LookRotation(this.promptActions.gameObject.transform.position - fairy.tr.position), false, false);
Links.x.rtsCamera.Follow(this.promptActions.gameObject.transform, null, false);
Links.x.rtsCamera.Zoom(true, "");
fairy.animator.Play("Jump_start");
Vector3 pt = this.promptActions.gameObject.transform.position;
Vector3 jumpPointDown = pt;
jumpPointDown.y -= 8f;
Vector3 startPosition = fairy.tr.position;
AudioClip slide = Resources.Load<AudioClip>("Dialogue Sounds/Slide");
AudioSource audioSource = base.gameObject.AddComponent<AudioSource>();
audioSource.spatialBlend = 1f;
audioSource.loop = false;
audioSource.playOnAwake = false;
audioSource.maxDistance = 40f;
audioSource.volume = Links.x.options.soundVolume;
audioSource.priority = 1;
audioSource.clip = slide;
audioSource.Play();
float startTime = 0.25f;
float startTime2 = 0f;
float timeToLerp = Time.time;
while (startTime2 < 1f)
{
startTime2 = (Time.time - timeToLerp) / startTime;
Vector3 vector = Vector3.Lerp(startPosition, pt, startTime2);
fairy.SetPosition(vector, null);
yield return null;
}
startPosition = fairy.tr.position;
startTime = 0.5f;
startTime2 = 0f;
timeToLerp = Time.time;
while (startTime2 < 1f)
{
startTime2 = (Time.time - timeToLerp) / startTime;
Vector3 vector2 = Vector3.Lerp(startPosition, jumpPointDown, startTime2);
fairy.SetPosition(vector2, null);
yield return null;
}
Links.x.gaia.PlayFade("Out", "Scaled");
startPosition = fairy.tr.position;
jumpPointDown.y -= 8f;
startTime = 0.5f;
startTime2 = 0f;
timeToLerp = Time.time;
while (startTime2 < 1f)
{
startTime2 = (Time.time - timeToLerp) / startTime;
Vector3 vector3 = Vector3.Lerp(startPosition, jumpPointDown, startTime2);
fairy.SetPosition(vector3, null);
yield return null;
}
fairy.ClearMoveTargets();
fairy.body.SetMagicaClothState(false);
fairy.animator.Play("Idle");
fairy.animID = 0;
int num4 = 1;
string text8 = "interior_GoblinCave";
int desiredGraph = fairy.desiredGraph;
string doorID = fairy.doorID;
fairy.desiredGraph = num4;
fairy.doorID = text8;
fairy.lastDoorID = text8;
GraphNode graphNode2 = fairy.NearNode(this.promptActions.transform.GetChild(0).position, true, 0, num4, 0);
fairy.SetPosition((Vector3)graphNode2.position, null);
Quaternion q = this.promptActions.transform.GetChild(0).rotation;
Vector3 vector4 = q.eulerAngles;
q.x = 0f;
q.z = 0f;
vector4.y += 180f;
Vector3 vector5 = Quaternion.Euler(vector4) * Vector3.forward * -1f;
fairy.ClearNodePath();
fairy.SetRotation(Quaternion.Euler(vector5), false, true);
fairy.ClaimNode(graphNode2, (Vector3)graphNode2.position, true);
fairy.sphere.transform.position = fairy.tr.position;
if (fairy.circleTr)
{
fairy.circleTr.position = fairy.tr.position;
}
fairy.SetMoveFollowPosition((Vector3)graphNode2.position);
fairy.savedFollowNode = fairy.node;
fairy.savedPathTarget = fairy.node;
if (num4 == 1)
{
if (Links.x.diorama.GetIndoorView())
{
fairy.indoorID = Links.x.diorama.GetIndoorView().GetInteriorBoundsName((Vector3)graphNode2.position);
}
else
{
fairy.indoorID = "?";
}
}
else
{
fairy.indoorID = "";
}
fairy.ChangeTorchLight();
if (Records.x.circle)
{
Links.x.fellowship.BreakCircle(false);
}
fairy.FirstPosition(graphNode2);
List<Character> allParty = Links.x.party;
Links.x.rtsCamera.JumpTo(fairy.tr, true);
foreach (Character character2 in allParty)
{
if (character2 && !character2.mainSelected)
{
Links.x.fellowship.TeleportParty(false);
}
}
fairy.body.SetMagicaClothState(true);
fairy.selectedBeforeDoor = false;
fairy.EndQuip();
yield return new WaitForSeconds(1f);
MasterAudio.PlaySound3DAtVector3AndForget("Body Fall", fairy.currentPosition, 1f, new float?(1f), 0f, "", null);
vector4 = q.eulerAngles;
vector4.x = 0f;
vector4.z = 0f;
vector4.y += Random.Range(0f, 180f);
fairy.SetRotation(Quaternion.Euler(vector4), false, true);
fairy.Bounce(fairy, "Normal Hit", 1f);
fairy.animator.Play("Hit_bounce");
foreach (Character c in allParty)
{
if (c && c != fairy)
{
float num5 = Random.Range(0.05f, 0.1f);
yield return new WaitForSeconds(num5);
vector4 = q.eulerAngles;
vector4.x = 0f;
vector4.z = 0f;
vector4.y += Random.Range(0f, 180f);
c.SetRotation(Quaternion.Euler(vector4), false, true);
c.Bounce(c, "Normal Hit", 1f);
c.SetMeshState(true);
c.body.SetMeshState(true, false);
c.meshAlwaysOn = true;
c.animator.Play("Hit_bounce");
MasterAudio.PlaySound3DAtVector3AndForget("Body Fall", fairy.currentPosition, 1f, new float?(1f), 0f, "", null);
}
c = null;
}
List<Character>.Enumerator enumerator2 = default(List<Character>.Enumerator);
Links.x.gaia.PlayFade("In", "Scaled");
yield return new WaitForSeconds(1.5f);
fairy.StartQuip("Ouch.");
Links.x.rtsCamera.Zoom(false, "");
Records.x.RemoveControls(false);
if (slide != null)
{
Resources.UnloadAsset(slide);
}
Object.Destroy(audioSource);
foreach (Character character3 in allParty)
{
if (character3)
{
character3.meshAlwaysOn = false;
}
}
fairy = null;
pt = default(Vector3);
jumpPointDown = default(Vector3);
startPosition = default(Vector3);
slide = null;
audioSource = null;
q = default(Quaternion);
allParty = null;
}
else
{
yield return new WaitForSeconds(0.5f);
}
this.clickActionCoroutine = null;
yield break;
yield break;
}
// Token: 0x0600087B RID: 2171 RVA: 0x000B8F8C File Offset: 0x000B718C
public void HoverIn()
{
if (this.hasCollider)
{
if (this.id != "Revive" && this.id != "Break Circle")
{
Links.x.hoverObject = base.gameObject;
if (!this.lightPoint)
{
Shader.SetGlobalVector("_DoorLightPosition", this.coll.bounds.center + Links.x.rtsCamera.gameObject.transform.forward * -2f);
}
else
{
Shader.SetGlobalVector("_DoorLightPosition", this.lightPoint.position + Links.x.rtsCamera.gameObject.transform.forward * -2f);
}
Records.x.hoverLightColor = Color.white * 1f;
Shader.SetGlobalFloat("_DoorLightRange", 6f);
}
int num = 0;
if (this.coll)
{
this.bounds = this.coll.bounds;
}
else
{
this.bounds = default(Bounds);
if (this.renderers.Length != 0 && this.renderers[0])
{
this.bounds = this.renderers[0].bounds;
if (this.renderers.Length > 1)
{
int i = 1;
int num2 = this.renderers.Length;
while (i < num2)
{
if (this.renderers[i] && this.renderers[i].gameObject.layer != 29)
{
this.bounds.Encapsulate(this.renderers[i].bounds);
}
i++;
}
}
}
}
if (this.id == "Birch" && Links.x.worldCamera.orthographic)
{
this.bounds.Expand(new Vector3(-15f, -6f, -15f));
}
if (!this.bracket)
{
this.bracket = Links.x.cellar.GetBracket(num, this.bounds);
return;
}
Links.x.cellar.SetBracketMaterial(num, this.bracket);
}
}
// Token: 0x0600087C RID: 2172 RVA: 0x000B91DC File Offset: 0x000B73DC
public void HoverOut()
{
if (this.hasCollider)
{
if (Links.x.hoverObject == base.gameObject || Links.x.hoverObject == null)
{
Links.x.hoverObject = null;
}
if (this.bracket)
{
Links.x.cellar.ReturnPooledGameObject(61, this.bracket);
this.bracket = null;
}
}
}
// Token: 0x0600087D RID: 2173 RVA: 0x000B9250 File Offset: 0x000B7450
public void ClickToBreak()
{
}
// Token: 0x0600087E RID: 2174 RVA: 0x000B9252 File Offset: 0x000B7452
public void Damage()
{
}
// Token: 0x0600087F RID: 2175 RVA: 0x000B9254 File Offset: 0x000B7454
public void InRange()
{
if (this.hasCollider)
{
if (this.id == "Birch")
{
Links.x.gaia.SetPlaylist("Fairies", true, 0f);
}
if (this.id == "SemizenStatue")
{
Links.x.gaia.SetPlaylist("Semizen", true, 0f);
}
}
}
// Token: 0x06000880 RID: 2176 RVA: 0x000B92C4 File Offset: 0x000B74C4
public void OutOfRange()
{
if (this.hasCollider)
{
if (this.id == "Birch" && Links.x.soundtrack.currentSoundtrack == "Fairies" && Links.x.hasMain)
{
Links.x.gaia.SetEnvironmentPlaylist(Links.x.gameplay.sailing, Links.x.main.inTown, true);
}
if (this.id == "SemizenStatue" && Links.x.soundtrack.currentSoundtrack == "Semizen" && Links.x.hasMain)
{
Links.x.gaia.SetEnvironmentPlaylist(Links.x.gameplay.sailing, Links.x.main.inTown, true);
}
}
}
// Token: 0x06000881 RID: 2177 RVA: 0x000B93AC File Offset: 0x000B75AC
public void StartPuzzle()
{
if (this.id == "ChalkRubbing")
{
this.StartChalkRubbing();
}
if (this.id == "Birch")
{
Links.x.spellcrafting.StartMenu(false, Links.x.main);
}
if (this.id.Contains("SemizenStatue"))
{
if (!Links.x.dialogue.GiveXP())
{
Links.x.characterSheet.enchanting = true;
Links.x.characterSheet.StartMenu(false);
Links.x.inventory.enchantMenu.OpenMenu(Links.x.main);
return;
}
Links.x.questEnd.OpenPuzzleAfter(this);
}
}
// Token: 0x06000882 RID: 2178 RVA: 0x000B9470 File Offset: 0x000B7670
public void LoadPuzzleInfo()
{
bool flag = true;
if (this.id == "Birch" || this.id.Contains("SemizenStatue") || this.id == "Revive" || this.id == "Break Circle" || this.id.Contains("Bell") || this.id == "ForfeitsBoard" || this.id == "Text")
{
flag = false;
}
if (flag)
{
string text = Records.x.openBook + "/Puzzles_" + this.puzzle.sceneName + ".es3";
this.firstTimeOnScene = true;
if (ES3.FileExists(text))
{
this.saveFile = new ES3File(text);
this.firstTimeOnScene = false;
if (this.id.Contains("WeightPuzzle"))
{
this.completed = false;
if (this.id.Contains("C6"))
{
if (this.saveFile.KeyExists("C6_WeightPuzzle_Complete"))
{
this.completed = this.saveFile.Load<bool>("C6_WeightPuzzle_Complete");
}
}
else if (this.id.Contains("D5") && this.saveFile.KeyExists("D5_WeightPuzzle_Complete"))
{
this.completed = this.saveFile.Load<bool>("D5_WeightPuzzle_Complete");
}
if (this.completed)
{
this.WeightPuzzleComplete(true);
}
else
{
this.WeightPuzzleIncomplete();
}
if (this.puzzle.animator)
{
this.puzzle.animator.enabled = false;
}
}
if (this.id.Contains("Fort"))
{
string text2 = this.id + "_Hostages";
if (this.saveFile.KeyExists(text2))
{
this.hasRescuedHostages = this.saveFile.Load<bool>(text2);
}
text2 = this.id + "_Fort";
if (this.saveFile.KeyExists(text2))
{
this.hasClearedFort = this.saveFile.Load<bool>(text2);
}
text2 = this.id + "_Leader";
if (this.saveFile.KeyExists(text2))
{
this.hasKilledLeader = this.saveFile.Load<bool>(text2);
}
text2 = this.id + "_RousedFort";
if (this.saveFile.KeyExists(text2))
{
this.rousedFort = this.saveFile.Load<bool>(text2);
}
text2 = this.id + "_Warning";
if (this.saveFile.KeyExists(text2))
{
this.gaveWarning = this.saveFile.Load<bool>(text2);
if (this.gaveWarning)
{
this.timeSinceWarning = Links.x.gameplay.seconds + 1000f;
}
}
}
if (this.id.Contains("Fence"))
{
this.completed = false;
if (this.saveFile.KeyExists(this.id + "_Complete"))
{
this.completed = this.saveFile.Load<bool>(this.id + "_Complete");
}
}
if (this.id.Contains("FairyCircle"))
{
this.completed = false;
if (this.saveFile.KeyExists(this.id + "_Complete"))
{
this.completed = this.saveFile.Load<bool>(this.id + "_Complete");
}
}
if (this.id.Contains("C6_Tomb_") || this.id.Contains("D5_Tomb_"))
{
this.completed = false;
if (this.saveFile.KeyExists(this.id + "_Complete"))
{
this.completed = this.saveFile.Load<bool>(this.id + "_Complete");
}
}
if (this.id == "C6_Cave_ShroomerMushes")
{
this.completed = false;
if (this.saveFile.KeyExists(this.id + "_Complete"))
{
this.completed = this.saveFile.Load<bool>(this.id + "_Complete");
}
if (this.completed)
{
this.SetupBreakablePuzzle();
this.BreakablePuzzle(true);
}
else
{
this.SetupBreakablePuzzle();
}
}
if (this.id == "FrogGameC6")
{
this.completed = false;
if (this.saveFile.KeyExists(this.id + "_Score"))
{
this.savedScore = this.saveFile.Load<int>(this.id + "_Score");
}
}
}
}
if (this.firstTimeOnScene)
{
if (this.id.Contains("WeightPuzzle"))
{
this.WeightPuzzleIncomplete();
if (this.puzzle.animator)
{
this.puzzle.animator.enabled = false;
}
}
if (this.id == "C6_Cave_ShroomerMushes")
{
this.SetupBreakablePuzzle();
}
}
if (this.id == "ChalkRubbing" || this.id == "Birch" || this.id.Contains("SemizenStatue") || this.id.Contains("C6_Tomb_") || this.id.Contains("D5_Tomb_") || this.id == "Revive" || this.id == "Break Circle" || this.id.Contains("Bell") || this.id == "ForfeitsBoard" || this.id == "Text")
{
this.coll = base.gameObject.GetComponent<Collider>();
if (this.coll)
{
this.coll.gameObject.layer = 16;
this.coll.enabled = true;
}
this.hasCollider = true;
this.lightPoint = null;
foreach (object obj in base.transform)
{
Transform transform = (Transform)obj;
if (transform.gameObject.name.Contains("oint"))
{
this.lightPoint = transform;
}
}
this.interactionPointY = 2f;
if (this.id == "Birch")
{
this.interactionPointY = 5f;
}
if (this.id == "ChalkRubbing")
{
this.interactionPointY = 2f;
}
if (this.id.Contains("SemizenStatue"))
{
this.interactionPointY = 6f;
}
}
if (this.id.Contains("C6_Tomb_") || this.id.Contains("D5_Tomb_"))
{
foreach (Collider collider in base.gameObject.GetComponentsInChildren<Collider>(true))
{
if (collider != this.coll && collider.gameObject.layer != 29)
{
this.puzzleColliders.Add(collider);
}
}
if (this.firstTimeOnScene || !this.completed)
{
this.puzzle.animator.Play("LachoGear_deactivate", -1, 1f);
this.UpdateAstar(0.5f, true);
}
else
{
this.puzzle.animator.Play("LachoGear_activate", -1, 1f);
this.UpdateAstar(0.5f, true);
}
}
if (this.id == "WestRuinsFort")
{
this.enemyPrompt = GameObject.Find("Prompt_CampCleared_D5_RobberBarronFort").GetComponent<PromptActions>();
this.enemyCreatures = this.enemyPrompt.prompt.campCreatures;
this.allyPrompt = GameObject.Find("Prompt_CampCleared_D5_DuraScouts1").GetComponent<PromptActions>();
this.allyCreatures = this.allyPrompt.prompt.campCreatures;
}
if (this.id.Contains("Bell"))
{
this.callForHelp = GameObject.Find("PuzzleFortFight").GetComponent<PuzzleActions>();
}
this.loaded = true;
}
// Token: 0x06000883 RID: 2179 RVA: 0x000B9CCC File Offset: 0x000B7ECC
public void SavePuzzleInfo()
{
if (this.id == "Birch" || this.id.Contains("SemizenStatue"))
{
return;
}
string text = Records.x.openBook + "/Puzzles_" + Links.x.diorama.sceneName + ".es3";
this.saveFile = new ES3File(text);
if (this.id == "C6_WeightPuzzle")
{
this.saveFile.Save<bool>("C6_WeightPuzzle_Complete", this.completed);
}
if (this.id == "D5_WeightPuzzle")
{
this.saveFile.Save<bool>("D5_WeightPuzzle_Complete", this.completed);
}
if (this.id.Contains("FairyCircle"))
{
this.saveFile.Save<bool>(this.id + "_Complete", this.completed);
}
if (this.id.Contains("Fence"))
{
this.saveFile.Save<bool>(this.id + "_Complete", this.completed);
}
if (this.id.Contains("C6_Tomb") || this.id.Contains("D5_Tomb_"))
{
this.saveFile.Save<bool>(this.id + "_Complete", this.completed);
}
if (this.id.Contains("C6_Cave_ShroomerMushes"))
{
this.saveFile.Save<bool>(this.id + "_Complete", this.completed);
}
if (this.id == "FrogGameC6")
{
this.saveFile.Save<int>(this.id + "_Score", this.savedScore);
}
if (this.id.Contains("Fort"))
{
string text2 = this.id + "_Hostages";
this.saveFile.Save<bool>(text2, this.hasRescuedHostages);
text2 = this.id + "_Fort";
this.saveFile.Save<bool>(text2, this.hasClearedFort);
text2 = this.id + "_Leader";
this.saveFile.Save<bool>(text2, this.hasKilledLeader);
text2 = this.id + "_RousedFort";
this.saveFile.Save<bool>(text2, this.rousedFort);
text2 = this.id + "_Warning";
this.saveFile.Save<bool>(text2, this.gaveWarning);
}
this.saveFile.Sync();
}
// Token: 0x06000884 RID: 2180 RVA: 0x000B9F64 File Offset: 0x000B8164
public void SetupBreakablePuzzle()
{
int childCount = base.gameObject.transform.childCount;
foreach (object obj in base.transform)
{
Transform transform = (Transform)obj;
if (transform != base.transform)
{
Animator component = transform.gameObject.GetComponent<Animator>();
this.animators.Add(component);
component.enabled = false;
}
}
}
// Token: 0x06000885 RID: 2181 RVA: 0x000B9FF4 File Offset: 0x000B81F4
public void BreakablePuzzle(bool fromLoad)
{
if (this.id == "C6_Cave_ShroomerMushes")
{
this.completed = true;
QuestLog.SetQuestState("C6_Mushrooms", QuestState.Success);
if (!fromLoad)
{
base.StartCoroutine(this.MushroomBreakable());
}
else
{
int count = this.animators.Count;
for (int i = 0; i < count; i++)
{
this.animators[i].gameObject.SetActive(false);
this.UpdateAstarAtLocation(this.animators[i].gameObject.transform.position);
}
this.puzzle.animator.gameObject.SetActive(false);
}
Links.x.sceneMap.CheckQuests();
}
}
// Token: 0x06000886 RID: 2182 RVA: 0x000BA0AF File Offset: 0x000B82AF
private IEnumerator MushroomBreakable()
{
while (Records.x.inMenus || Links.x.combat.inPocketAttack)
{
yield return null;
}
Links.x.gameplay.TogglePause(false);
Records.x.RemoveControls(true);
Links.x.gameplay.PocketPause(true);
yield return new WaitForSeconds(0.5f);
yield return new WaitForSeconds(0.5f);
int childCount = this.animators.Count;
GameObject hov = Links.x.hoverObject;
int num;
for (int i = 0; i < childCount; i = num + 1)
{
this.animators[i].enabled = true;
this.animators[i].Play("ThickShroomGone");
Links.x.gameFeed.AddFeed("Mushroom is drying");
yield return new WaitForSeconds(0.06f);
this.UpdateAstarAtLocation(this.animators[i].gameObject.transform.position);
if (this.animators[i].gameObject.name.Contains("Jump") || this.animators[i].gameObject.name.Contains("jump"))
{
MasterAudio.PlaySound3DAtVector3AndForget("Interactives", this.animators[i].gameObject.transform.position, 1f, new float?(1f), 0f, "Mushroom Drying", null);
Links.x.rtsCamera.puzzleSnapCamera = true;
Links.x.rtsCamera.puzzleLerp = false;
Links.x.fadeAnimator.Play("CinematicQuickFade");
yield return new WaitForSecondsRealtime(0.14f);
Links.x.rtsCamera.puzzleTarget = this.animators[i].gameObject;
Shader.SetGlobalVector("_CinematicRevealPosition", this.animators[i].gameObject.transform.position);
Shader.SetGlobalVector("_DoorLightPosition", this.animators[i].gameObject.transform.position + new Vector3(0f, 3f, 0f));
Records.x.hoverLightColor = Color.white * 0.5f;
Links.x.hoverObject = this.animators[i].gameObject;
Shader.SetGlobalFloat("_DoorLightRange", 30f);
yield return new WaitForSeconds(1f);
}
num = i;
}
yield return new WaitForSeconds(0.5f);
Links.x.fadeAnimator.Play("CinematicQuickFade");
yield return new WaitForSeconds(0.12f);
Shader.SetGlobalVector("_CinematicRevealPosition", new Vector3(-100000f, -100000f, -100000f));
Links.x.rtsCamera.puzzleTarget = Links.x.main.gameObject;
Links.x.rtsCamera.puzzleLerp = false;
yield return new WaitForSeconds(0.01f);
Links.x.rtsCamera.puzzleTarget = null;
Links.x.rtsCamera.puzzleLerp = false;
Links.x.rtsCamera.puzzleSnapCamera = true;
if (!hov)
{
Links.x.hoverObject = null;
}
else
{
Links.x.hoverObject = hov;
if (Links.x.gameplay.intersectingExit)
{
Links.x.gameplay.intersectingExit.Near(true);
}
}
Links.x.gameplay.PocketPause(false);
Records.x.RemoveControls(false);
Links.x.fellowship.AddXP(50, null, true);
Links.x.cameraEffects.gameFade.enabled = false;
MasterAudio.PlaySoundAndForget("Feedback", 0.4f, new float?(1f), 0f, "DialogueStatPass", null);
yield break;
}
// Token: 0x06000887 RID: 2183 RVA: 0x000BA0C0 File Offset: 0x000B82C0
private void WeightPuzzleComplete(bool fromSave)
{
if (this.completed && !fromSave)
{
return;
}
this.puzzle.door.locked = false;
this.puzzle.door.lockable = false;
this.puzzle.door.GetComponent<DoorActions>().SetSprites();
if (!fromSave)
{
base.StartCoroutine(this.TombOpened());
}
else
{
this.puzzle.door.gameObject.SetActive(false);
if (this.puzzle.animator)
{
this.puzzle.animator.enabled = false;
}
}
if (fromSave)
{
this.SetupWeightPuzzleColliders();
}
this.completed = true;
}
// Token: 0x06000888 RID: 2184 RVA: 0x000BA16B File Offset: 0x000B836B
private IEnumerator TombOpened()
{
while (Links.x.combat.inPocketAttack)
{
yield return null;
}
Records.x.RemoveControls(true);
yield return new WaitForSeconds(0.5f);
Links.x.rtsCamera.puzzleTarget = this.puzzle.door.gameObject;
Links.x.rtsCamera.puzzleLerp = true;
this.puzzle.animator.enabled = true;
yield return new WaitForSeconds(1f);
MasterAudio.PlaySound3DAtVector3AndForget("Interactives", Links.x.main.tr.position, 1f, new float?(1f), 0f, "Opening Door", null);
this.puzzle.animator.Play("PuzzleDoor");
yield return new WaitForSeconds(1f);
MasterAudio.PlaySoundAndForget("Feedback", 0.4f, new float?(1f), 0f, "DialogueStatPass", null);
yield return new WaitForSeconds(1f);
this.puzzle.door.connectedExit.GetComponent<MapExitActions>().Hover(true);
Links.x.gameFeed.AddFeed("A door has been opened");
this.puzzle.door.gameObject.SetActive(false);
yield return new WaitForSeconds(1f);
Links.x.rtsCamera.puzzleTarget = null;
yield return new WaitForSeconds(1f);
Links.x.rtsCamera.puzzleLerp = false;
this.puzzle.animator.enabled = false;
Records.x.RemoveControls(false);
yield break;
}
// Token: 0x06000889 RID: 2185 RVA: 0x000BA17A File Offset: 0x000B837A
private void WeightPuzzleIncomplete()
{
this.puzzle.door.locked = true;
this.puzzle.door.lockable = true;
if (!base.gameObject.GetComponent<MapExit>())
{
this.SetupWeightPuzzleColliders();
}
}
// Token: 0x0600088A RID: 2186 RVA: 0x000BA1B8 File Offset: 0x000B83B8
private void SetupWeightPuzzleColliders()
{
Transform transform = base.gameObject.transform;
int num = 0;
foreach (object obj in transform)
{
Transform transform2 = (Transform)obj;
this.objects.Add(transform2.gameObject);
bool flag = false;
if (this.id.Contains("C6"))
{
if (num == 3)
{
flag = true;
}
if (num == 4)
{
flag = true;
}
if (num == 5)
{
flag = true;
}
if (num == 11)
{
flag = true;
}
if (num == 13)
{
flag = true;
}
if (num == 17)
{
flag = true;
}
if (num == 22)
{
flag = true;
}
if (num == 23)
{
flag = true;
}
}
else if (this.id.Contains("D5"))
{
if (num == 2)
{
flag = true;
}
if (num == 7)
{
flag = true;
}
if (num == 16)
{
flag = true;
}
if (num == 9)
{
flag = true;
}
}
this.lookingFor.Add(flag);
this.status.Add(false);
foreach (object obj2 in transform2)
{
Transform transform3 = (Transform)obj2;
foreach (object obj3 in transform3)
{
BoxCollider component = ((Transform)obj3).gameObject.GetComponent<BoxCollider>();
if (component)
{
if (transform3.gameObject.name.Contains("State_Up"))
{
PuzzleListener puzzleListener = component.gameObject.AddComponent<PuzzleListener>();
this.collidersUp.Add(component);
this.listenersUp.Add(puzzleListener);
this.originalPositions.Add(component.gameObject.transform.parent.gameObject.transform.position);
puzzleListener.puzzleID = this.id;
puzzleListener.coll = component;
puzzleListener.puzzleActions = this;
}
else
{
this.downPositions.Add(component.gameObject.transform.parent.gameObject.transform.position);
component.transform.parent.gameObject.SetActive(false);
}
}
}
}
num++;
}
foreach (PuzzleListener puzzleListener2 in this.listenersUp)
{
puzzleListener2.Setup();
puzzleListener2.coll.isTrigger = true;
puzzleListener2.coll.gameObject.AddComponent<Rigidbody>().isKinematic = true;
}
if (!this.firstTimeOnScene)
{
this.ChangeWeight();
}
this.updateWeight = 1;
}
// Token: 0x0600088B RID: 2187 RVA: 0x000BA4E0 File Offset: 0x000B86E0
public void ChangeWeight()
{
int num = 1;
bool flag = false;
if (this.id == "C6_WeightPuzzle" || this.id == "D5_WeightPuzzle")
{
num = 1;
flag = false;
}
int count = this.collidersUp.Count;
for (int i = 0; i < count; i++)
{
this.CheckWeightStatus(i, num, flag);
}
bool flag2 = true;
for (int j = 0; j < count; j++)
{
if (this.status[j] != this.lookingFor[j])
{
flag2 = false;
}
}
if (flag2 && this.lookingFor.Count > 0)
{
this.WeightPuzzleComplete(false);
}
}
// Token: 0x0600088C RID: 2188 RVA: 0x000BA588 File Offset: 0x000B8788
private void CheckWeightStatus(int index, int amountNeeded, bool hasToBeExact)
{
int hitObjectCount = this.listenersUp[index].GetHitObjectCount();
float num = this.listenersUp[index].coll.bounds.center.y + this.listenersUp[index].coll.bounds.extents.y;
float num2 = this.originalPositions[index].y - this.downPositions[index].y;
if (hitObjectCount < amountNeeded || (hasToBeExact && hitObjectCount > amountNeeded))
{
if (this.listenersUp[index].gameObject.transform.parent.gameObject.transform.position != this.originalPositions[index])
{
num += num2;
}
}
else if (this.listenersUp[index].gameObject.transform.parent.gameObject.transform.position != this.downPositions[index])
{
num -= num2;
}
this.listenersUp[index].SetHeight(num);
if (hitObjectCount < amountNeeded || (hasToBeExact && hitObjectCount > amountNeeded))
{
this.listenersUp[index].gameObject.transform.parent.gameObject.transform.position = this.originalPositions[index];
if (this.status[index] && Links.x.gaia.sceneLoaded && Mathf.Abs(num2) > 0.1f)
{
MasterAudio.PlaySound3DAtVector3AndForget("Stone", this.listenersUp[index].coll.bounds.max, 1f, new float?(1f), 0f, "", null);
}
this.status[index] = false;
return;
}
this.listenersUp[index].gameObject.transform.parent.gameObject.transform.position = this.downPositions[index];
if (!this.status[index] && Links.x.gaia.sceneLoaded && Mathf.Abs(num2) > 0.1f)
{
MasterAudio.PlaySound3DAtVector3AndForget("Stone", this.listenersUp[index].coll.bounds.max, 1f, new float?(1f), 0f, "", null);
}
this.status[index] = true;
}
// Token: 0x0600088D RID: 2189 RVA: 0x000BA83C File Offset: 0x000B8A3C
public void CheckIfCharacterIsOnAnotherSpot(PuzzleListener excludeListener, Character c)
{
for (int i = 0; i < this.listenersUp.Count; i++)
{
if (this.listenersUp[i] != excludeListener)
{
this.listenersUp[i].CheckToRemoveCharacter(c);
}
}
this.ChangeWeight();
}
// Token: 0x0600088E RID: 2190 RVA: 0x000BA88C File Offset: 0x000B8A8C
public void CheckWeightCharacters()
{
bool flag = false;
for (int i = 0; i < this.hitCharacters.Count; i++)
{
Character character = this.hitCharacters[i];
PuzzleListener puzzleListener = null;
if (character)
{
float num = float.PositiveInfinity;
for (int j = 0; j < this.listenersUp.Count; j++)
{
Vector3 top = this.listenersUp[j].top;
top.y = character.tr.position.y;
float sqrMagnitude = (character.tr.position - top).sqrMagnitude;
if (sqrMagnitude < 6.25f && sqrMagnitude < num)
{
num = sqrMagnitude;
puzzleListener = this.listenersUp[j];
}
}
if (puzzleListener && !character.dead)
{
this.CheckIfCharacterIsOnAnotherSpot(puzzleListener, character);
puzzleListener.AddCharacter(character);
this.ChangeWeight();
}
else
{
this.CheckIfCharacterIsOnAnotherSpot(null, character);
flag = true;
this.hitCharacters[i] = null;
this.ChangeWeight();
this.updateWeight = 1;
}
}
else
{
flag = true;
this.hitCharacters[i] = null;
this.ChangeWeight();
this.updateWeight = 1;
}
}
if (flag)
{
this.hitCharacters.RemoveAll((Character item) => item == null);
}
}
// Token: 0x0600088F RID: 2191 RVA: 0x000BA9F2 File Offset: 0x000B8BF2
public void AddWeightCharacter(Character c)
{
if (!this.hitCharacters.Contains(c))
{
this.hitCharacters.Add(c);
}
this.CheckWeightCharacters();
this.updateWeight = 1;
}
// Token: 0x06000890 RID: 2192 RVA: 0x000BAA1B File Offset: 0x000B8C1B
public void UsedFairy()
{
this.completed = true;
if (this.coll)
{
this.coll.enabled = false;
}
}
// Token: 0x06000891 RID: 2193 RVA: 0x000BAA3D File Offset: 0x000B8C3D
public void StartChalkRubbing()
{
Links.x.hudControl.OpenChalkRubbing();
}
// Token: 0x06000892 RID: 2194 RVA: 0x000BAA4E File Offset: 0x000B8C4E
public void MiniGame(Character character, Character npc, int lastReward)
{
if (this.puzzle.puzzleID == "FrogGameC6")
{
base.StartCoroutine(this.FrogMiniGame(character, npc, true, lastReward));
}
}
// Token: 0x06000893 RID: 2195 RVA: 0x000BAA78 File Offset: 0x000B8C78
private void RestartMinigame(Character character, Character npc, int lastReward)
{
if (this.puzzle.puzzleID == "FrogGameC6")
{
base.StartCoroutine(this.FrogMiniGame(character, npc, false, lastReward));
}
}
// Token: 0x06000894 RID: 2196 RVA: 0x000BAAA2 File Offset: 0x000B8CA2
private IEnumerator FrogMiniGame(Character character, Character npc, bool fromBeginning, int lastReward)
{
List<Character> miniGameCharacters = Links.x.combat.miniGameCharacters;
List<Character> party = Links.x.portraitOrder;
this.scoreCap1 = 15;
this.scoreCap2 = 50;
this.scoreCap3 = 100;
Links.x.hudControl.JoyBox(false);
this.spawned.Clear();
this.prevSeconds = 0;
if (fromBeginning)
{
Records.x.RemoveControls(true);
Records.x.miniGame = true;
Links.x.gaia.PlayFade("Out", "Scaled");
yield return new WaitForSeconds(0.5f);
Records.x.RemoveControls(true);
List<CreatureActions> creatureActions = Links.x.diorama.creatureActions;
this.creature = null;
for (int i = 0; i < creatureActions.Count; i++)
{
if (creatureActions[i].gameObject.name == "Normal Frogs")
{
this.creature = creatureActions[i];
}
}
this.spots = new List<Transform>();
this.spotsAlt = new List<Transform>();
Transform transform = null;
Transform transform2 = null;
Transform transform3 = null;
this.spotPlayer = null;
Transform transform4 = null;
Transform transform5 = base.gameObject.transform;
this.originalPlayerSpot = character.currentPosition;
foreach (object obj in transform5)
{
Transform transform6 = (Transform)obj;
if (transform6 != transform5)
{
string name = transform6.gameObject.name;
if (name.Contains("Frog"))
{
if (name.Contains("Lane"))
{
this.spotsAlt.Add(transform6);
}
else
{
this.spots.Add(transform6);
}
}
else if (name.Contains("Spot"))
{
if (name.Contains("1"))
{
transform = transform6;
}
if (name.Contains("2"))
{
transform2 = transform6;
}
if (name.Contains("3"))
{
transform3 = transform6;
}
if (name.Contains("Player"))
{
this.spotPlayer = transform6;
}
if (name.Contains("Dryad"))
{
transform4 = transform6;
}
if (name.Contains("Return"))
{
this.originalPlayerSpot = transform6.position;
}
}
}
}
character.SetPosition(this.spotPlayer.position, null);
character.FirstPosition(null);
npc.SetPosition(transform4.position, null);
npc.FirstPosition(null);
npc.SetRotation(Quaternion.LookRotation(this.spotPlayer.position - transform4.position), false, true);
character.SetRotation(Quaternion.LookRotation(this.spotPlayer.position - npc.currentPosition), false, true);
int num = 0;
for (int j = 0; j < party.Count; j++)
{
if (party[j] && party[j] != character && party[j].party)
{
if (num == 0)
{
party[j].SetPosition(transform.position, null);
party[j].SetRotation(Quaternion.LookRotation(this.spotPlayer.position - transform.position), false, true);
}
if (num == 1)
{
party[j].SetPosition(transform2.position, null);
party[j].SetRotation(Quaternion.LookRotation(this.spotPlayer.position - transform2.position), false, true);
}
if (num == 2)
{
party[j].SetPosition(transform3.position, null);
party[j].SetRotation(Quaternion.LookRotation(this.spotPlayer.position - transform3.position), false, true);
}
party[j].FirstPosition(null);
num++;
}
}
miniGameCharacters.Clear();
miniGameCharacters.Add(character);
Links.x.fellowship.SingleSelected(character);
character.AddToSelected(false, true);
character.SetAsLeader();
Links.x.rtsCamera.Follow(character.tr, character, true);
Links.x.rtsCamera.Jump(character.tr.position);
foreach (Character character2 in this.creature.characters)
{
character2.vanished = true;
character2.TurnScriptsOff();
}
this.ui = Object.Instantiate<GameObject>(Links.x.cellar.miniGameUI, Vector3.zero, Quaternion.Euler(Vector3.zero), Links.x.miscCanvas.gameObject.transform);
this.minigame = this.ui.GetComponent<Minigame>();
this.minigame.animator.enabled = false;
this.minigame.SetVolume();
this.minigame.puzzle = this;
Links.x.minigame = this.minigame;
this.minigame.constantScoreText.enabled = false;
this.minigame.constantScoreText.text = "0";
this.minigame.gameObject.GetComponent<RectTransform>().anchoredPosition3D = Vector3.zero;
this.minigame.score = 0;
this.minigame.targetScoreText.enabled = false;
yield return new WaitForSeconds(0.5f);
Records.x.RemoveControls(true);
Links.x.gaia.PlayFade("In", "Scaled");
}
else
{
character.SetPosition(this.spotPlayer.position, null);
character.FirstPosition(null);
character.SetRotation(Quaternion.LookRotation(this.spotPlayer.position - npc.currentPosition), false, true);
Links.x.rtsCamera.Jump(character.tr.position);
this.minigame.score = 0;
miniGameCharacters.Clear();
miniGameCharacters.Add(character);
this.minigame.constantScoreText.enabled = false;
this.minigame.constantScoreText.text = "0";
this.minigame.targetScoreText.enabled = false;
Links.x.gaia.PlayFade("In", "Scaled");
}
this.targetScore = this.scoreCap1;
if (this.savedScore >= this.scoreCap1)
{
this.targetScore = this.scoreCap2;
}
if (this.savedScore >= this.scoreCap2)
{
this.targetScore = this.scoreCap3;
}
int treasureScore = this.scoreCap1;
if (lastReward >= 2)
{
treasureScore = this.scoreCap2;
}
if (lastReward >= 3)
{
treasureScore = this.scoreCap3;
}
this.minigame.animator.enabled = true;
this.minigame.animator.Play("MiniGameStart");
this.retry = false;
this.end = false;
Records.x.RemoveControls(true);
this.minigame.targetScoreText.text = "Target score: " + this.targetScore.ToString();
yield return new WaitForSeconds(3f);
Records.x.RemoveControls(false);
this.minigame.constantScoreText.enabled = true;
this.minigame.targetScoreText.enabled = true;
float jumpFrogSpawn = Links.x.gameplay.seconds;
float timeSinceSpawn = 0f;
NNConstraint nodeConstraint = new NNConstraint();
int startingHitCount = character.stats.hitCount;
int startingHealth = character.stats.HealthCurrent();
Vector3 startPosition = Vector3.zero;
Vector3 vector = Vector3.zero;
Vector3 endPosition = Vector3.zero;
bool dbl = false;
int dblLane = -1;
while (character.stats.hitCount == startingHitCount)
{
float num2 = 5f;
int num3 = 0;
for (int k = 0; k < this.spawned.Count; k++)
{
if (this.spawned[k] && this.spawned[k].tilesMoved == -1)
{
num3++;
}
}
num2 -= (float)num3 * 0.5f;
if ((timeSinceSpawn == 0f || Links.x.gameplay.seconds > timeSinceSpawn + num2 || dbl) && character.node != null)
{
bool laneFrog = true;
if (Links.x.gameplay.seconds > jumpFrogSpawn + 200f && num3 < 10)
{
laneFrog = false;
jumpFrogSpawn = Links.x.gameplay.seconds;
}
int num4;
if (laneFrog)
{
num4 = Random.Range(0, this.spotsAlt.Count - 1);
if (dbl)
{
num4 = dblLane;
dbl = false;
}
else if (Random.Range(0, 4) == 0)
{
dbl = true;
dblLane = num4;
}
startPosition = this.spotsAlt[num4].position;
vector = this.spotsAlt[num4].GetChild(0).position;
endPosition = this.spotsAlt[num4].GetChild(1).position;
}
else
{
laneFrog = false;
num4 = -1;
int num5 = Random.Range(0, this.spots.Count - 1);
startPosition = this.spots[num5].position;
vector = Vector3.Lerp(startPosition, character.currentPosition, 0.15f);
}
GraphNode node = null;
nodeConstraint.constrainWalkability = true;
nodeConstraint.walkable = true;
nodeConstraint.constrainTags = true;
if (laneFrog)
{
nodeConstraint.constrainTags = false;
}
nodeConstraint.checkConnections = 0;
nodeConstraint.constrainToEnvironment = -1;
nodeConstraint.constrainToArea = (int)character.node.Area;
nodeConstraint.checkCircleID = 0;
if (character.node.GraphIndex == 0U)
{
node = Links.x.gaia.exteriorGraph.GetNearestForce(vector, nodeConstraint).node;
}
else
{
node = Links.x.gaia.interiorGraph.GetNearestForce(vector, nodeConstraint).node;
}
GraphNode destination = null;
if (laneFrog)
{
nodeConstraint.constrainWalkability = true;
nodeConstraint.walkable = true;
nodeConstraint.constrainTags = false;
nodeConstraint.checkConnections = 0;
nodeConstraint.constrainToEnvironment = -1;
nodeConstraint.constrainToArea = (int)character.node.Area;
if (character.node.GraphIndex == 0U)
{
destination = Links.x.gaia.exteriorGraph.GetNearestForce(endPosition, nodeConstraint).node;
}
else
{
destination = Links.x.gaia.interiorGraph.GetNearestForce(endPosition, nodeConstraint).node;
}
}
if (node != null && this.spawned.Count < 40)
{
string text = "SmallJumpingFrogs";
if (!laneFrog)
{
text = "SmallBlueJumpingFrogs";
}
Quaternion r = Quaternion.LookRotation(character.currentPosition - base.transform.position);
bool flag = false;
CreatureActions creature = Links.x.gaia.CreateCreature((Vector3)node.position, r, text, flag, 0f, 1);
Character summon = creature.GetFirstCharacter();
this.spawned.Add(summon);
miniGameCharacters.Add(summon);
if (laneFrog)
{
summon.hostility = 1;
creature.creatures.temperament = Creatures.temperamentState.FightsIfAttacked;
}
summon.ignoreRemoveControls = true;
summon.ignoreNodeIDs = true;
summon.SetPosition(startPosition, null);
summon.SetRotation(r, false, true);
summon.SetMeshState(true);
summon.body.SetMeshState(true, true);
summon.ambushing = true;
summon.SetPosition(startPosition, null);
summon.ignoreNodeIDs = true;
summon.tilesMoved = num4;
summon.name = "Frog " + this.spawned.Count.ToString();
float timeToLerp = 0.1f;
float percentage = 0f;
float startTime = Time.time;
while (percentage < 1f && character.stats.hitCount == startingHitCount)
{
this.DoFrogChecks(character);
percentage = (Time.time - startTime) / timeToLerp;
summon.SetPosition(startPosition, null);
summon.SetRotation(r, false, true);
yield return null;
}
summon.Jump(node, (Vector3)node.position, false, false);
summon.SetMeshState(true);
summon.body.SetMeshState(true, true);
timeToLerp = 0.5f;
percentage = 0f;
startTime = Time.time;
while (percentage < 1f && character.stats.hitCount == startingHitCount)
{
this.DoFrogChecks(character);
percentage = (Time.time - startTime) / timeToLerp;
if (!summon.jumping && laneFrog)
{
summon.SetRotation(Quaternion.LookRotation((Vector3)destination.position - (Vector3)node.position), false, true);
}
yield return null;
}
summon.ambushing = false;
creature.miniGameCreature = true;
summon.jumpingPosition = false;
if (!laneFrog)
{
summon.hostility = 2;
summon.UpdateLKP(Links.x.main, Links.x.main.node, "Attack", true);
if (!Records.x.InCombat(false))
{
Links.x.combat.StartCombat(Links.x.main, summon, false, true);
}
Links.x.combat.AddParty(summon, false, Links.x.main, true);
}
else
{
summon.SetRotation(Quaternion.LookRotation((Vector3)destination.position - (Vector3)node.position), false, true);
summon.MakePath(destination, 30, false, false, true);
}
timeToLerp = 1f;
percentage = 0f;
startTime = Time.time;
bool moving = false;
while (percentage < 1f && character.stats.hitCount == startingHitCount && laneFrog && !moving)
{
this.DoFrogChecks(character);
percentage = (Time.time - startTime) / timeToLerp;
if (summon.moving && !summon.jumping)
{
moving = true;
}
if (!summon.moving && summon.waitingForPath == 0)
{
summon.ignoreNodeIDs = true;
summon.ambushing = false;
summon.MakePath(destination, 30, false, false, true);
}
yield return null;
}
if (Random.Range(0, 4) == 0 || timeSinceSpawn == 0f)
{
int num6 = Random.Range(0, 4);
if (party[num6] != character && party[num6].party && !party[num6].summoned)
{
Debug.Log("quip");
int num7 = Random.Range(0, 5);
if (num7 == 0)
{
party[num6].StartQuip("You've got this!");
}
if (num7 == 1)
{
party[num6].StartQuip("Come on, " + character.stats.GetName() + "!");
}
if (num7 == 2)
{
party[num6].StartQuip("You can do it!");
}
if (num7 == 3)
{
party[num6].StartQuip("Go " + character.stats.GetName() + "!");
}
if (num7 == 4)
{
party[num6].StartQuip(character.stats.GetName() + "! " + character.stats.GetName() + "!");
}
}
}
r = default(Quaternion);
creature = null;
summon = null;
}
timeSinceSpawn = Links.x.gameplay.seconds;
node = null;
destination = null;
}
this.DoFrogChecks(character);
yield return null;
}
Records.x.RemoveControls(true);
this.minigame.constantScoreText.enabled = false;
this.minigame.targetScoreText.enabled = false;
this.minigame.animator.Play("MiniGameDone");
this.minigame.scoreText.text = "score: " + this.minigame.score.ToString();
int score = this.savedScore;
if (this.minigame.score > score)
{
score = this.minigame.score;
}
this.minigame.highScoreText.text = "Target score: " + this.targetScore.ToString() + "\nHigh score: " + score.ToString();
this.savedScore = score;
if (this.minigame.score > treasureScore || score > treasureScore)
{
this.minigame.endButtonText.text = "Treasure";
}
else
{
this.minigame.endButtonText.text = "Quit";
}
while (!this.retry && !this.end)
{
yield return null;
}
Links.x.gaia.PlayFade("Out", "Scaled");
yield return new WaitForSeconds(0.5f);
for (int l = 0; l < this.spawned.Count; l++)
{
if (this.spawned[l])
{
CreatureActions creatures = this.spawned[l].creatures;
this.spawned[l].Missing();
if (creatures)
{
Object.Destroy(creatures.gameObject);
}
}
}
this.spawned.Clear();
if (Records.x.InCombat(false))
{
Links.x.combat.EndCombat(false);
}
character.isHit = false;
character.downed = false;
character.PlayAnimation("Idle", 0f);
if (this.end)
{
this.minigame.endButtonText.text = "Return";
Object.Destroy(this.ui);
Links.x.hudControl.JoyBox(false);
character.SetPosition(this.originalPlayerSpot, null);
character.FirstPosition(null);
character.stats.SetHealth(startingHealth, false);
Links.x.rtsCamera.Follow(character.tr, character, true);
yield return new WaitForSeconds(0.5f);
foreach (Character character3 in this.creature.characters)
{
character3.vanished = false;
character3.TurnScriptsOn();
}
Links.x.gaia.PlayFade("In", "Scaled");
Records.x.miniGame = false;
Records.x.RemoveControls(false);
Links.x.dialogue.SetMiniGameVariables(this.savedScore, this);
Links.x.gameplay.StartDialogue(npc, character, null, null, "LazureCaves/FrogPatch");
}
else
{
Links.x.gaia.PlayFade("Out", "Scaled");
yield return new WaitForSeconds(0.5f);
this.minigame.animator.enabled = false;
this.RestartMinigame(character, npc, lastReward);
}
yield break;
}
// Token: 0x06000895 RID: 2197 RVA: 0x000BAAD0 File Offset: 0x000B8CD0
private void DoFrogChecks(Character player)
{
bool flag = false;
for (int i = 0; i < this.spawned.Count; i++)
{
if (this.spawned[i] && (this.spawned[i].tilesMoved >= 0 || this.spawned[i].tilesMoved == -2) && this.spawned[i].ambushing && !this.spawned[i].jumping && !this.spawned[i].moving && this.spawned[i].tilesMoved == -2)
{
CreatureActions creatures = this.spawned[i].creatures;
this.spawned[i].Missing();
if (creatures)
{
Object.Destroy(creatures.gameObject);
}
flag = true;
}
}
if (flag)
{
this.spawned.RemoveAll((Character item) => item == null);
}
for (int j = 0; j < this.spawned.Count; j++)
{
if (this.spawned[j] && this.spawned[j].tilesMoved >= 0 && !this.spawned[j].jumping && !this.spawned[j].ambushing)
{
Vector3 position = this.spotsAlt[this.spawned[j].tilesMoved].GetChild(1).position;
float sqrMagnitude = (this.spawned[j].tr.position - position).sqrMagnitude;
if (sqrMagnitude < 0.5625f || (sqrMagnitude < 4f && !this.spawned[j].moving))
{
this.spawned[j].ClearNodePath();
this.spawned[j].ambushing = true;
this.spawned[j].Jump(player.node, this.spotsAlt[this.spawned[j].tilesMoved].GetChild(2).position, false, false);
this.spawned[j].tilesMoved = -2;
this.spawned[j].SetMeshState(false);
this.spawned[j].body.SetMeshState(false, true);
}
}
}
Vector3 position2 = player.tr.position;
for (int k = 0; k < this.spawned.Count; k++)
{
if (this.spawned[k] && (this.spawned[k].tr.position - position2).sqrMagnitude < 2.25f)
{
player.stats.hitCount++;
this.spawned[k].AddDamage(player, 1f, true, false, true, "None", 0f, 0f);
}
}
if ((int)Links.x.gameplay.seconds > this.prevSeconds + 10 || this.prevSeconds == 0)
{
if (Links.x.minigame)
{
Links.x.minigame.AddScore();
}
this.prevSeconds = (int)Links.x.gameplay.seconds;
}
}
// Token: 0x06000896 RID: 2198 RVA: 0x000BAE98 File Offset: 0x000B9098
private bool SeenByFortCreature()
{
bool flag = false;
bool flag2 = false;
if (this.id == "WestRuinsFort")
{
flag = true;
flag2 = true;
}
if (!this.hasList)
{
this.portraitOrder = Links.x.portraitOrder;
if (this.enemies == null)
{
this.enemies = new List<CreatureActions>();
foreach (Creatures creatures in this.enemyCreatures)
{
CreatureActions component = creatures.gameObject.GetComponent<CreatureActions>();
this.enemies.Add(component);
if (flag2 && component.xmlName.Contains("Lookout"))
{
this.characters = component.characters;
for (int i = 0; i < this.characters.Count; i++)
{
Character character = this.characters[i];
this.lookout = character;
if (character && !this.hasRescuedHostages && !this.hasKilledLeader)
{
character.hostility = 1;
character.willBeHostile = true;
}
}
}
if (this.id == "WestRuinsFort" && component.xmlName.Contains("RobberBaron"))
{
this.leader = component.GetFirstCharacter();
this.middleOfFort = component.GetWalkTransform(0).position;
}
}
this.allies = new List<CreatureActions>();
foreach (Creatures creatures2 in this.allyCreatures)
{
CreatureActions component2 = creatures2.gameObject.GetComponent<CreatureActions>();
if (component2)
{
this.allies.Add(component2);
if (flag && creatures2.gameObject.name.Contains("Hostage"))
{
this.characters = component2.characters;
for (int j = 0; j < this.characters.Count; j++)
{
Character character2 = this.characters[j];
if (character2)
{
character2.stats.SetHostageAllegiance(this.hasRescuedHostages);
}
}
}
if (this.id == "WestRuinsFort")
{
if (component2.xmlName.Contains("Hostage1"))
{
this.hostage1 = component2.GetFirstCharacter();
if (!this.hasRescuedHostages && this.hostage1)
{
this.hostage1.isHostage = true;
}
}
if (component2.xmlName.Contains("Hostage2"))
{
this.hostage2 = component2.GetFirstCharacter();
if (!this.hasRescuedHostages && this.hostage2)
{
this.hostage2.isHostage = true;
}
}
if (component2.xmlName.Contains("Hostage3"))
{
this.hostage3 = component2.GetFirstCharacter();
if (!this.hasRescuedHostages && this.hostage3)
{
this.hostage3.isHostage = true;
}
}
}
}
}
this.hasList = true;
}
if (this.id == "WestRuinsFort")
{
GameObject gameObject = GameObject.Find("Door_Use_Wooden_Swingy_Exterior_prisoners");
this.hostageLock = gameObject.GetComponent<DoorActions>();
}
}
if (flag)
{
if (!this.hasRescuedHostages && this.hostageLock)
{
if (this.hostageLock.door.locked)
{
if (Links.x.gameplay.seconds > this.lastHostageAttackTime + 100f && Records.x.InCombat(false) && this.panCoroutine == null && this.rousedFort)
{
Character character3 = null;
Character character4 = null;
int num = Random.Range(0, 3);
if (num == 0)
{
character4 = this.hostage1;
}
if (num == 1)
{
character4 = this.hostage2;
}
if (num == 2)
{
character4 = this.hostage3;
}
if (character4 && !character4.IsSentient())
{
character4 = null;
}
if (!character4)
{
if (this.hostage1 && this.hostage1.IsSentient())
{
character4 = this.hostage1;
}
if (this.hostage2 && this.hostage2.IsSentient())
{
character4 = this.hostage2;
}
if (this.hostage3 && this.hostage3.IsSentient())
{
character4 = this.hostage3;
}
}
if (character4)
{
float num2 = 900f;
for (int k = 0; k < this.enemies.Count; k++)
{
this.characters = this.enemies[k].characters;
for (int l = 0; l < this.characters.Count; l++)
{
Character character5 = this.characters[l];
if (character5 && character5.IsSentient() && !character5.stats.pinned && !character5.stats.pinning && !character5.inAction && character5.stats.xmlName.Contains("Archer"))
{
float sqrMagnitude = (character5.currentPosition - character4.currentPosition).sqrMagnitude;
if (sqrMagnitude < num2)
{
character3 = character5;
num2 = sqrMagnitude;
}
}
}
}
if (character3)
{
if (!character3.actions)
{
Links.x.combat.AddParty(character3, false, Links.x.main, true);
if (character3.actions)
{
character3.actions.AddTarget(character4);
if (character3.actions)
{
character3.actions.StartAction("Attack");
}
}
}
else
{
character3.actions.CheckIfRunningAI();
character3.actions.AddTarget(character4);
character3.actions.StartAction("Attack");
character3.meshAlwaysOn = true;
character3.SetMeshState(true);
}
if (character3.actions)
{
character3.actions.doBubbleAttack = true;
if (!this.firstHostageAttack)
{
character3.actions.bubbleAttackStopsGameplay = true;
}
else
{
character3.actions.bubbleAttackStopsGameplay = false;
}
this.firstHostageAttack = true;
character3.actions.bubbleTarget = character4;
this.lastHostageAttackTime = Links.x.gameplay.seconds;
}
}
}
}
}
else
{
this.hasRescuedHostages = true;
Character character6 = this.hostage1;
if (!character6)
{
character6 = this.hostage2;
}
if (!character6)
{
character6 = this.hostage3;
}
if (character6)
{
if (this.panCoroutine != null)
{
base.StopCoroutine(this.panCoroutine);
}
this.panCoroutine = this.CameraPanAndQuip(character6, "Hostages");
base.StartCoroutine(this.panCoroutine);
}
}
}
if (this.hasRescuedHostages)
{
bool flag3 = false;
if (this.id == "WestRuinsFort" && (QuestLog.GetQuestState("D5_Hostages") == QuestState.Success || QuestLog.GetQuestState("D5_Hostages") == QuestState.Failure))
{
flag3 = true;
}
if (!flag3)
{
bool flag4 = false;
bool flag5 = true;
for (int m = 0; m < 3; m++)
{
Character character7 = this.hostage1;
if (m == 1)
{
character7 = this.hostage2;
}
if (m == 2)
{
character7 = this.hostage3;
}
if (character7)
{
if (!character7.dead && !character7.missing)
{
flag4 = true;
}
else
{
GraphNode graphNode;
if (character7.creatures.daySleep)
{
graphNode = character7.creatures.GetWalkNodeDay(0);
}
else
{
graphNode = character7.creatures.GetWalkNodeNight(0);
}
if ((character7.currentPosition - (Vector3)graphNode.position).sqrMagnitude < 36f)
{
character7.stats.SetHostageAllegiance(true);
}
else
{
flag5 = false;
}
}
}
}
if (!flag4)
{
QuestLog.SetQuestState("D5_Hostages", QuestState.Failure);
}
else if (flag5)
{
QuestLog.SetQuestState("D5_Hostages", QuestState.Success);
}
}
}
else if (QuestLog.GetQuestState("D5_Hostages") != QuestState.Failure)
{
bool flag6 = false;
for (int n = 0; n < 3; n++)
{
Character character8 = this.hostage1;
if (n == 1)
{
character8 = this.hostage2;
}
if (n == 2)
{
character8 = this.hostage3;
}
if (character8 && !character8.dead && !character8.missing)
{
flag6 = true;
}
}
if (!flag6)
{
QuestLog.SetQuestState("D5_Hostages", QuestState.Failure);
}
}
}
for (int num3 = 0; num3 < this.enemies.Count; num3++)
{
this.characters = this.enemies[num3].characters;
for (int num4 = 0; num4 < this.characters.Count; num4++)
{
Character character9 = this.characters[num4];
if (character9 && character9.IsSentient() && !character9.missing && character9.HasSomeoneInSight())
{
return true;
}
}
}
return false;
}
// Token: 0x06000897 RID: 2199 RVA: 0x000BB7E0 File Offset: 0x000B99E0
private void StartFort()
{
if (Records.x.editor)
{
Debug.Log("Start fort");
}
this.inFort = true;
if (this.id.Contains("WestRuins"))
{
Character character = null;
for (int i = 0; i < this.enemies.Count; i++)
{
this.characters = this.enemies[i].characters;
for (int j = 0; j < this.characters.Count; j++)
{
Character character2 = this.characters[j];
if (character2 && !character2.stunned && !character2.sleeping && !character2.dead && !character2.missing && !character2.downed && character2.HasSomeoneInSight() && character2.stats.xmlName.Contains("Lookout") && !character2.stats.pinned && character2.stats.Confuse() == 0)
{
character = character2;
}
}
}
if (character)
{
if (this.hasKilledLeader)
{
this.lookout.hostility = 2;
return;
}
if ((Links.x.gameplay.seconds > this.timeSinceWarning + 400f || this.timeSinceWarning == 0f) && this.panCoroutine == null)
{
this.panCoroutine = this.CameraPanAndQuip(character, "Warning");
base.StartCoroutine(this.panCoroutine);
this.timeSinceWarning = Links.x.gameplay.seconds;
this.gaveWarning = true;
return;
}
}
else if (this.lookout)
{
this.lookout.hostility = 2;
}
}
}
// Token: 0x06000898 RID: 2200 RVA: 0x000BB98C File Offset: 0x000B9B8C
private void EndFort()
{
if (Records.x.editor)
{
Debug.Log("End fort");
}
this.inFort = false;
if (this.rousedFort)
{
this.timeSinceLeftCombat = Links.x.gameplay.seconds;
}
if (this.hasRescuedHostages)
{
if (this.hostage1)
{
this.hostage1.stats.SetHostageAllegiance(true);
}
if (this.hostage2)
{
this.hostage2.stats.SetHostageAllegiance(true);
}
if (this.hostage3)
{
this.hostage3.stats.SetHostageAllegiance(true);
}
}
if (this.hasKilledLeader)
{
Debug.Log("Set fort cleared quest as success");
if (QuestLog.GetQuestState("D5_RobberFortCleared") != QuestState.Success)
{
QuestLog.SetQuestState("D5_RobberFortCleared", QuestState.Success);
for (int i = 0; i < this.enemies.Count; i++)
{
this.characters = this.enemies[i].characters;
for (int j = 0; j < this.characters.Count; j++)
{
Character character = this.characters[j];
if (character && !character.dead && !character.missing && !character.stunned)
{
string text = "Flee ";
Character character2 = character;
Debug.Log(text + ((character2 != null) ? character2.ToString() : null));
if (character.stats.characterRow._Quest != "")
{
QuestLog.SetQuestState(character.stats.characterRow._Quest, QuestState.Fled);
}
character.alwaysOn = true;
character.ignoreNodeIDs = true;
if (character.inactive)
{
character.TurnScriptsOn();
}
if (character.sleeping)
{
character.WakeUp();
}
character.creatures.CheckQuestSwap();
}
}
}
Records.x.CheckStunnedStates();
}
}
this.ReturnHelp();
}
// Token: 0x06000899 RID: 2201 RVA: 0x000BBB84 File Offset: 0x000B9D84
private void CheckIfAlliesShouldLeave()
{
if (this.hasClearedFort && QuestLog.GetQuestState("D5_DuraPoints") == QuestState.Unassigned && (QuestLog.GetQuestState("D5_Hostages") == QuestState.Failure || QuestLog.GetQuestState("D5_Hostages") == QuestState.Success))
{
Debug.Log("Dura camp can leave");
this.alliesAreGone = true;
QuestLog.SetQuestState("D5_DuraPoints", QuestState.Complete);
}
}
// Token: 0x0600089A RID: 2202 RVA: 0x000BBBE0 File Offset: 0x000B9DE0
private void FortChecks()
{
if (this.gaveWarning && !this.rousedFort && this.lookout)
{
this.middleOfFort.y = this.lookout.currentPosition.y;
float num = Vector3.Distance(this.middleOfFort, this.lookout.currentPosition) - 10f;
float num2 = 100000f;
float num3 = 100000f;
Vector3 currentPosition = this.lookout.currentPosition;
for (int i = 0; i < this.portraitOrder.Count; i++)
{
if (this.lookout.CanSee(this.portraitOrder[i]) && !this.lookout.stats.pinned)
{
this.middleOfFort.y = this.portraitOrder[i].currentPosition.y;
float num4 = (this.middleOfFort - this.portraitOrder[i].currentPosition).sqrMagnitude;
if (num4 < num2)
{
num2 = num4;
}
currentPosition.y = this.portraitOrder[i].currentPosition.y;
num4 = (currentPosition - this.portraitOrder[i].currentPosition).sqrMagnitude;
if (num4 < num3)
{
num3 = num4;
}
}
}
if (num3 < 1600f && !this.lookout.stats.pinned && (this.lookout.hasActions || num2 < num * num))
{
this.rousedFort = true;
if (this.panCoroutine != null)
{
base.StopCoroutine(this.panCoroutine);
}
this.panCoroutine = this.CameraPanAndQuip(this.lookout, "AlertLookout");
base.StartCoroutine(this.panCoroutine);
}
}
if (!this.rousedFort && this.leader && this.leader.HasSomeoneInSight())
{
this.rousedFort = true;
if (this.panCoroutine != null)
{
base.StopCoroutine(this.panCoroutine);
}
this.panCoroutine = this.CameraPanAndQuip(this.leader, "AlertAlternative");
base.StartCoroutine(this.panCoroutine);
}
if (!this.hasKilledLeader && this.leader)
{
bool flag = false;
if (QuestLog.GetQuestState("D5_RobberBaron") == QuestState.PerpIsDead)
{
flag = true;
}
bool flag2 = false;
if (QuestLog.GetQuestState("D5_RobberBaron") == QuestState.ExileIsland || QuestLog.GetQuestState("D5_RobberBaron") == QuestState.WaitingForExileIsland)
{
flag2 = true;
}
if (flag)
{
QuestLog.SetQuestState("D5_RobberFort", QuestState.Success);
this.hasKilledLeader = true;
}
if (flag2)
{
QuestLog.SetQuestState("D5_RobberFort", QuestState.Success);
this.hasKilledLeader = true;
}
if (flag || flag2)
{
Debug.Log("Set leader gone and robber fort as success");
this.hasClearedFort = true;
}
}
}
// Token: 0x0600089B RID: 2203 RVA: 0x000BBEBC File Offset: 0x000BA0BC
public void CallForHelp()
{
if (this.inFort)
{
Debug.Log("Called for help");
Links.x.dialogue.SetVariableBool("D5_UsedBell", true);
QuestLog.SetQuestState("D5_DuraPoints", QuestState.Active);
for (int i = 0; i < this.allies.Count; i++)
{
this.characters = this.allies[i].characters;
for (int j = 0; j < this.characters.Count; j++)
{
Character character = this.characters[j];
if (character && !character.dead && !character.missing && character != this.hostage1 && character != this.hostage2 && character != this.hostage3)
{
Character character2 = character;
Debug.Log(((character2 != null) ? character2.ToString() : null) + " calling for help");
character.alwaysOn = true;
if (character.inactive)
{
character.TurnScriptsOn();
}
character.creatures.noSleep = true;
if (character.sleeping)
{
character.WakeUp();
}
character.creatures.CheckQuestSwap();
character.TransferLKP(Links.x.main);
GraphNode graphNode;
if (character.creatures.daySleep)
{
graphNode = character.creatures.GetWalkNodeNight(0);
}
else
{
graphNode = character.creatures.GetWalkNodeDay(0);
}
character.ignoreNodeIDs = true;
character.creatures.MakeNormalPath(graphNode, false, character);
}
}
}
}
}
// Token: 0x0600089C RID: 2204 RVA: 0x000BC054 File Offset: 0x000BA254
private Character FirstEnemy(Character v)
{
float num = float.PositiveInfinity;
Character character = null;
for (int i = 0; i < this.enemies.Count; i++)
{
this.characters = this.enemies[i].characters;
for (int j = 0; j < this.characters.Count; j++)
{
Character character2 = this.characters[j];
if (character2 && !character2.dead && !character2.missing && !character2.stunned)
{
float sqrMagnitude = (character2.currentPosition - v.currentPosition).sqrMagnitude;
if (sqrMagnitude < num)
{
num = sqrMagnitude;
character = character2;
}
}
}
}
return character;
}
// Token: 0x0600089D RID: 2205 RVA: 0x000BC110 File Offset: 0x000BA310
public void ReturnHelp()
{
if (QuestLog.GetQuestState("D5_DuraPoints") == QuestState.Active)
{
QuestLog.SetQuestState("D5_DuraPoints", QuestState.Unassigned);
for (int i = 0; i < this.allies.Count; i++)
{
this.characters = this.allies[i].characters;
for (int j = 0; j < this.characters.Count; j++)
{
Character character = this.characters[j];
if (character && !character.dead && !character.missing && character != this.hostage1 && character != this.hostage2 && character != this.hostage3)
{
character.alwaysOn = true;
if (character.inactive)
{
character.TurnScriptsOn();
}
character.creatures.CheckQuestSwap();
GraphNode graphNode;
if (character.creatures.daySleep)
{
graphNode = character.creatures.GetWalkNodeNight(0);
}
else
{
graphNode = character.creatures.GetWalkNodeDay(0);
}
character.creatures.MakeNormalPath(graphNode, true, character);
}
}
}
}
}
// Token: 0x0600089E RID: 2206 RVA: 0x000BC238 File Offset: 0x000BA438
private IEnumerator CameraPanAndQuip(Character npc, string type)
{
while (Records.x.saving || Records.x.inMenus || Links.x.combat.inPocketAttack)
{
yield return null;
}
Links.x.gameplay.TogglePause(false);
Records.x.RemoveControls(true);
if (npc)
{
npc.meshAlwaysOn = true;
npc.SetMeshState(true);
npc.SetRotation(Quaternion.LookRotation(Links.x.main.currentPosition - npc.currentPosition), true, false);
}
float timeToLerp = 0.5f;
float percentage = 0f;
float startTime = Time.time;
while (percentage < 1f)
{
percentage = (Time.time - startTime) / timeToLerp;
yield return null;
}
GameObject hov = Links.x.hoverObject;
Links.x.rtsCamera.puzzleSnapCamera = true;
Links.x.rtsCamera.puzzleLerp = false;
if (this.id == "WestRuinsFort")
{
Links.x.rtsCamera.puzzleSnapCamera = false;
}
if (!(this.id == "WestRuinsFort"))
{
Links.x.fadeAnimator.Play("CinematicQuickFade");
yield return new WaitForSecondsRealtime(0.14f);
}
Links.x.rtsCamera.puzzleTarget = npc.gameObject;
Shader.SetGlobalVector("_CinematicRevealPosition", npc.gameObject.transform.position);
Shader.SetGlobalVector("_DoorLightPosition", npc.gameObject.transform.position + new Vector3(0f, 3f, 0f));
Records.x.hoverLightColor = Color.white * 0.5f;
Links.x.hoverObject = npc.gameObject;
Shader.SetGlobalFloat("_DoorLightRange", 30f);
if (this.id == "WestRuinsFort")
{
npc.SetMeshState(true);
npc.SetRotation(Quaternion.LookRotation(Links.x.main.currentPosition - npc.currentPosition), true, false);
npc.alwaysLookAtParty = true;
npc.meshAlwaysOn = true;
if (type == "Warning")
{
Links.x.rtsCamera.Zoom(true, "");
MasterAudio.PlaySound3DAtVector3AndForget("Feedback", npc.gameObject.transform.position, 1f, new float?(1f), 0f, "Caught", null);
npc.StartQuipAlways("Scurry away, weasels, or I'll rouse the fort!");
timeToLerp = 1f;
percentage = 0f;
startTime = Time.time;
while (percentage < 1f)
{
percentage = (Time.time - startTime) / timeToLerp;
yield return null;
}
Links.x.gameplay.confirmText.SetActive(true);
Links.x.gameplay.SetConfirmText("Skip");
timeToLerp = 4f;
percentage = 0f;
startTime = Time.time;
while (percentage < 1f)
{
if (this.Clicked())
{
break;
}
percentage = (Time.time - startTime) / timeToLerp;
yield return null;
}
while (this.Clicked())
{
yield return null;
}
}
else if (type == "Hostages")
{
this.hostageLock.PlayDoorOpen();
MasterAudio.PlaySound3DAtVector3AndForget("Feedback", npc.gameObject.transform.position, 1f, new float?(1f), 0f, "Song Learned", null);
Links.x.rtsCamera.Zoom(true, "MainCharacterQTE");
yield return new WaitForSeconds(0.5f);
Links.x.rtsCamera.puzzleTarget = this.hostageLock.gameObject;
Shader.SetGlobalVector("_CinematicRevealPosition", npc.gameObject.transform.position);
Shader.SetGlobalVector("_DoorLightPosition", npc.gameObject.transform.position + new Vector3(0f, 3f, 0f));
Links.x.hoverObject = npc.gameObject;
npc.StartQuipAlways("The door is unlocked, run!");
QuestLog.SetQuestState("D5_HostagePoints", QuestState.Active);
int num;
for (int i = 0; i < 3; i = num + 1)
{
if (i == 0)
{
npc = this.hostage1;
}
if (i == 1)
{
npc = this.hostage2;
}
if (i == 2)
{
npc = this.hostage3;
}
if (npc)
{
if (npc.sleeping)
{
npc.WakeUp();
}
npc.isHostage = false;
npc.creatures.CheckQuestSwap();
npc.ignoreRemoveControls = true;
npc.ignoreNodeIDs = true;
npc.running = true;
npc.forceNodePath = true;
GraphNode graphNode;
if (npc.creatures.daySleep)
{
graphNode = npc.creatures.GetWalkNodeDay(0);
}
else
{
graphNode = npc.creatures.GetWalkNodeNight(0);
}
npc.creatures.MakeNormalPath(graphNode, true, npc);
yield return new WaitForSeconds(0.2f);
}
num = i;
}
timeToLerp = 1f;
percentage = 0f;
startTime = Time.time;
while (percentage < 1f)
{
percentage = (Time.time - startTime) / timeToLerp;
yield return null;
}
timeToLerp = 1.5f;
percentage = 0f;
startTime = Time.time;
while (percentage < 1f)
{
if (this.Clicked())
{
break;
}
percentage = (Time.time - startTime) / timeToLerp;
yield return null;
}
while (this.Clicked())
{
yield return null;
}
}
else if (type.Contains("Alert"))
{
MasterAudio.PlaySound3DAtVector3AndForget("Feedback", npc.gameObject.transform.position, 1f, new float?(1f), 0f, "Caught", null);
Links.x.gaia.SetPlaylist("Combat", true, 0.75f);
for (int j = 0; j < this.enemies.Count; j++)
{
this.characters = this.enemies[j].characters;
for (int k = 0; k < this.characters.Count; k++)
{
Character character = this.characters[k];
if (character && !character.dead && !character.missing && character.indoorID == Links.x.main.indoorID)
{
if (character.inactive)
{
character.TurnScriptsOn();
character.alwaysOn = true;
}
if (character.sleeping && type.Contains("Lookout"))
{
character.WakeUp();
character.ignoreRemoveControls = true;
GraphNode graphNode2;
if (character.creatures.daySleep)
{
graphNode2 = character.creatures.GetWalkNodeNight(0);
}
else
{
graphNode2 = character.creatures.GetWalkNodeDay(0);
}
character.creatures.MakeNormalPath(graphNode2, true, character);
}
if (type.Contains("Lookout"))
{
if (character.stats.xmlName.Contains("Skilpi"))
{
character.ignoreRemoveControls = true;
}
Links.x.combat.AddParty(character, true, Links.x.main, true);
}
if (type.Contains("Lookout"))
{
character.running = true;
character.ignoreNodeIDs = true;
}
character.meshAlwaysOn = true;
character.SetMeshState(true);
if (character != npc)
{
character.SetRotation(Quaternion.LookRotation(npc.currentPosition - character.currentPosition), true, false);
}
}
}
}
for (int l = 0; l < this.allies.Count; l++)
{
this.characters = this.allies[l].characters;
for (int m = 0; m < this.characters.Count; m++)
{
Character character2 = this.characters[m];
if (character2 && !character2.dead && !character2.missing && (character2 == this.hostage1 || character2 == this.hostage2 || character2 == this.hostage3))
{
if (character2.inactive)
{
character2.TurnScriptsOn();
character2.alwaysOn = true;
}
character2.meshAlwaysOn = true;
character2.SetMeshState(true);
}
}
}
if (type.Contains("Lookout"))
{
npc.PlayAnimation("Heard", 0f);
npc.StartQuipAlways("Intruders! Everyone to arms!");
Links.x.rtsCamera.Zoom(true, "MainCharacterQTE");
timeToLerp = 1f;
percentage = 0f;
startTime = Time.time;
while (percentage < 1f)
{
percentage = (Time.time - startTime) / timeToLerp;
yield return null;
}
Links.x.gameplay.confirmText.SetActive(true);
Links.x.gameplay.SetConfirmText("Skip");
timeToLerp = 2.75f;
percentage = 0f;
startTime = Time.time;
while (percentage < 1f)
{
if (this.Clicked())
{
break;
}
percentage = (Time.time - startTime) / timeToLerp;
yield return null;
}
while (this.Clicked())
{
yield return null;
}
MasterAudio.PlaySoundAndForget("Dome Open", 1f, new float?(1f), 0f, "", null);
MasterAudio.PlaySoundAndForget("Combat Starts", 1f, new float?(1f), 0f, "", null);
MasterAudio.PlaySoundAndForget("Combat Start", 1f, new float?(1f), 0f, "", null);
timeToLerp = 0.5f;
percentage = 0f;
startTime = Time.time;
while (percentage < 1f)
{
percentage = (Time.time - startTime) / timeToLerp;
yield return null;
}
}
if (type.Contains("Lookout"))
{
Links.x.rtsCamera.Zoom(false, "");
}
else
{
Links.x.rtsCamera.Zoom(true, "");
}
Links.x.rtsCamera.puzzleTarget = this.leader.gameObject;
Links.x.rtsCamera.puzzleSnapCamera = true;
Shader.SetGlobalVector("_CinematicRevealPosition", this.leader.gameObject.transform.position);
Shader.SetGlobalVector("_DoorLightPosition", this.leader.gameObject.transform.position + new Vector3(0f, 3f, 0f));
Links.x.hoverObject = this.leader.gameObject;
this.leader.PlayAnimation("Combat Start", 0f);
if (!this.hasRescuedHostages)
{
if (type.Contains("Alternative"))
{
this.leader.StartQuipAlways("Lazure has infiltrated! Kill the hostages!");
}
else
{
this.leader.StartQuipAlways("Intruders at the gate! Kill the hostages!");
}
}
else
{
this.leader.StartQuipAlways("Intruders! Kill them all!");
}
timeToLerp = 4f;
percentage = 0f;
startTime = Time.time;
while (percentage < 1f)
{
if (this.Clicked())
{
break;
}
percentage = (Time.time - startTime) / timeToLerp;
yield return null;
}
while (this.Clicked())
{
yield return null;
}
Character hostage = this.hostage1;
if (!hostage)
{
hostage = this.hostage2;
}
if (!hostage)
{
hostage = this.hostage3;
}
if (hostage && !this.hasRescuedHostages)
{
if (this.hostage1 && this.hostage1.IsSentient())
{
this.hostage1.SetRotation(Quaternion.LookRotation(npc.currentPosition - this.hostage1.currentPosition), true, false);
}
timeToLerp = 0.2f;
percentage = 0f;
startTime = Time.time;
while (percentage < 1f && !this.Clicked())
{
percentage = (Time.time - startTime) / timeToLerp;
yield return null;
}
if (this.hostage2 && this.hostage2.IsSentient())
{
this.hostage2.PlayAnimation("Block", 0f);
}
timeToLerp = 0.3f;
percentage = 0f;
startTime = Time.time;
while (percentage < 1f && !this.Clicked())
{
percentage = (Time.time - startTime) / timeToLerp;
yield return null;
}
Links.x.rtsCamera.Zoom(true, "MainCharacterQTE");
Links.x.rtsCamera.puzzleTarget = hostage.gameObject;
Shader.SetGlobalVector("_CinematicRevealPosition", hostage.gameObject.transform.position);
Shader.SetGlobalVector("_DoorLightPosition", hostage.gameObject.transform.position + new Vector3(0f, 3f, 0f));
Links.x.hoverObject = hostage.gameObject;
if (this.hostage3 && this.hostage3.IsSentient())
{
this.hostage3.PlayAnimation("Distress", 0f);
}
timeToLerp = 2.5f;
percentage = 0f;
startTime = Time.time;
while (percentage < 1f)
{
if (this.Clicked())
{
break;
}
percentage = (Time.time - startTime) / timeToLerp;
yield return null;
}
while (this.Clicked())
{
yield return null;
}
}
this.lastHostageAttackTime = Links.x.gameplay.seconds + 50f;
hostage = null;
}
Links.x.rtsCamera.Zoom(false, "");
}
Links.x.gameplay.confirmText.SetActive(false);
if (!(this.id == "WestRuinsFort"))
{
Links.x.fadeAnimator.Play("CinematicQuickFade");
yield return new WaitForSeconds(0.12f);
}
Shader.SetGlobalVector("_CinematicRevealPosition", new Vector3(-100000f, -100000f, -100000f));
Links.x.rtsCamera.puzzleTarget = Links.x.main.gameObject;
Links.x.rtsCamera.puzzleLerp = false;
yield return new WaitForSeconds(0.01f);
Links.x.rtsCamera.puzzleTarget = null;
Links.x.rtsCamera.puzzleLerp = false;
Links.x.rtsCamera.puzzleSnapCamera = true;
if (this.id == "WestRuinsFort")
{
Links.x.rtsCamera.puzzleSnapCamera = false;
yield return new WaitForSeconds(0.5f);
}
if (!hov)
{
Links.x.hoverObject = null;
}
else
{
Links.x.hoverObject = hov;
if (Links.x.gameplay.intersectingExit)
{
Links.x.gameplay.intersectingExit.Near(true);
}
}
if (this.id == "WestRuinsFort")
{
if (type.Contains("Alert"))
{
for (int n = 0; n < this.enemies.Count; n++)
{
this.characters = this.enemies[n].characters;
for (int num2 = 0; num2 < this.characters.Count; num2++)
{
Character character3 = this.characters[num2];
if (character3 && !character3.dead && !character3.missing)
{
character3.alwaysOn = false;
character3.meshAlwaysOn = false;
character3.ignoreNodeIDs = false;
character3.ignoreRemoveControls = false;
}
}
}
}
if (type == "Hostages")
{
for (int num3 = 0; num3 < 3; num3++)
{
if (num3 == 0)
{
npc = this.hostage1;
}
if (num3 == 1)
{
npc = this.hostage2;
}
if (num3 == 2)
{
npc = this.hostage3;
}
if (npc)
{
npc.ignoreRemoveControls = false;
npc.ignoreNodeIDs = true;
}
}
}
}
if (npc)
{
npc.meshAlwaysOn = false;
}
Records.x.RemoveControls(false);
Links.x.cameraEffects.gameFade.enabled = false;
this.panCoroutine = null;
yield break;
}
// Token: 0x0600089F RID: 2207 RVA: 0x000BC258 File Offset: 0x000BA458
private bool Clicked()
{
if (Links.x.joy)
{
if (Links.x.gameplay.cancelStart || Links.x.gameplay.actionStart || Links.x.gameplay.interactStart)
{
return true;
}
}
else if (Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(1) || Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.Return))
{
return true;
}
return false;
}
// Token: 0x060008A0 RID: 2208 RVA: 0x000BC2CB File Offset: 0x000BA4CB
public void RetryMinigame()
{
this.retry = true;
}
// Token: 0x060008A1 RID: 2209 RVA: 0x000BC2D4 File Offset: 0x000BA4D4
public void EndMinigame()
{
this.end = true;
}
// Token: 0x060008A2 RID: 2210 RVA: 0x000BC2E0 File Offset: 0x000BA4E0
public void UpdateAstarAtLocation(Vector3 pt)
{
if (!Physics.Raycast(pt + new Vector3(0f, 100f, 0f), Vector3.up * -1f, 400f, 1073741824))
{
Links.x.fogOfWar.UpdateGrid(pt, 10f);
}
else
{
Links.x.fogOfWarInterior.UpdateGrid(pt, 10f);
}
AstarPath.active.UpdateGraphs(new Bounds(pt, new Vector3(5f, 100f, 5f)));
}
// Token: 0x060008A3 RID: 2211 RVA: 0x000BC377 File Offset: 0x000BA577
public void UpdateAstar(float waitTime, bool toggleUseCollider)
{
base.enabled = true;
base.StartCoroutine(this.UpdatePath(waitTime, toggleUseCollider));
}
// Token: 0x060008A4 RID: 2212 RVA: 0x000BC38F File Offset: 0x000BA58F
private IEnumerator UpdatePath(float waitTime, bool toggleUseCollider)
{
if (toggleUseCollider)
{
this.coll.gameObject.layer = 9;
}
yield return new WaitForSeconds(waitTime);
if (!Links.x.gaia.sceneLoaded)
{
yield return new WaitForSecondsRealtime(Random.Range(0.2f, 0.5f));
}
while (!Links.x.gaia.pathfindingReady)
{
yield return null;
}
for (int i = 0; i < this.puzzleColliders.Count; i++)
{
Vector3 center = this.puzzleColliders[i].bounds.center;
if (!Physics.Raycast(center + new Vector3(0f, 100f, 0f), Vector3.up * -1f, 400f, 1073741824))
{
Links.x.fogOfWar.UpdateGrid(center, 10f);
}
else
{
Links.x.fogOfWarInterior.UpdateGrid(center, 10f);
}
AstarPath.active.UpdateGraphs(new Bounds(center, new Vector3(10f, 100f, 10f)));
}
if (toggleUseCollider)
{
this.coll.gameObject.layer = 16;
}
yield break;
}
// Token: 0x04000D39 RID: 3385
[Header("INFO")]
public Puzzle puzzle;
// Token: 0x04000D3A RID: 3386
public string id;
// Token: 0x04000D3B RID: 3387
private bool firstTimeOnScene;
// Token: 0x04000D3C RID: 3388
private ES3File saveFile;
// Token: 0x04000D3D RID: 3389
public bool completed;
// Token: 0x04000D3E RID: 3390
private Collider coll;
// Token: 0x04000D3F RID: 3391
private Transform lightPoint;
// Token: 0x04000D40 RID: 3392
public bool canBreak;
// Token: 0x04000D41 RID: 3393
public bool destroyed;
// Token: 0x04000D42 RID: 3394
private PromptActions promptActions;
// Token: 0x04000D43 RID: 3395
public int currentHealth;
// Token: 0x04000D44 RID: 3396
[Header("Weight Puzzle")]
public List<BoxCollider> collidersUp = new List<BoxCollider>();
// Token: 0x04000D45 RID: 3397
public List<GameObject> objects = new List<GameObject>();
// Token: 0x04000D46 RID: 3398
public List<bool> status = new List<bool>();
// Token: 0x04000D47 RID: 3399
public List<bool> lookingFor = new List<bool>();
// Token: 0x04000D48 RID: 3400
public List<bool> lookingForD5 = new List<bool>();
// Token: 0x04000D49 RID: 3401
public List<PuzzleListener> listenersUp = new List<PuzzleListener>();
// Token: 0x04000D4A RID: 3402
public List<Vector3> originalPositions = new List<Vector3>();
// Token: 0x04000D4B RID: 3403
public List<Vector3> downPositions = new List<Vector3>();
// Token: 0x04000D4C RID: 3404
public List<Character> hitCharacters = new List<Character>();
// Token: 0x04000D4D RID: 3405
public MeshRenderer[] renderers = new MeshRenderer[0];
// Token: 0x04000D4E RID: 3406
private List<Animator> animators = new List<Animator>();
// Token: 0x04000D4F RID: 3407
public int updateWeight;
// Token: 0x04000D50 RID: 3408
private Material[] mats;
// Token: 0x04000D51 RID: 3409
[Header("Interactables")]
private bool hasCollider;
// Token: 0x04000D52 RID: 3410
private List<Character> partyList;
// Token: 0x04000D53 RID: 3411
private List<Collider> puzzleColliders = new List<Collider>();
// Token: 0x04000D54 RID: 3412
private IEnumerator clickActionCoroutine;
// Token: 0x04000D55 RID: 3413
public float interactionPointY = 2f;
// Token: 0x04000D56 RID: 3414
public GameObject bracket;
// Token: 0x04000D57 RID: 3415
private Bounds bounds;
// Token: 0x04000D58 RID: 3416
private List<int> layers;
// Token: 0x04000D59 RID: 3417
public GraphNode node;
// Token: 0x04000D5A RID: 3418
public Character interactCharacter;
// Token: 0x04000D5B RID: 3419
[Header("Minigame")]
private bool retry;
// Token: 0x04000D5C RID: 3420
private bool end;
// Token: 0x04000D5D RID: 3421
private CreatureActions creature;
// Token: 0x04000D5E RID: 3422
private GameObject ui;
// Token: 0x04000D5F RID: 3423
private Minigame minigame;
// Token: 0x04000D60 RID: 3424
private Vector3 originalPlayerSpot;
// Token: 0x04000D61 RID: 3425
private List<Transform> spots;
// Token: 0x04000D62 RID: 3426
private List<Transform> spotsAlt;
// Token: 0x04000D63 RID: 3427
public int savedScore;
// Token: 0x04000D64 RID: 3428
public int targetScore;
// Token: 0x04000D65 RID: 3429
public int scoreCap1;
// Token: 0x04000D66 RID: 3430
public int scoreCap2;
// Token: 0x04000D67 RID: 3431
public int scoreCap3;
// Token: 0x04000D68 RID: 3432
public int prevSeconds;
// Token: 0x04000D69 RID: 3433
private Transform spotPlayer;
// Token: 0x04000D6A RID: 3434
private List<Character> spawned = new List<Character>();
// Token: 0x04000D6B RID: 3435
[Header("Camps & Forts")]
private bool inFort;
// Token: 0x04000D6C RID: 3436
private PromptActions enemyPrompt;
// Token: 0x04000D6D RID: 3437
private PromptActions allyPrompt;
// Token: 0x04000D6E RID: 3438
private List<Creatures> enemyCreatures;
// Token: 0x04000D6F RID: 3439
private List<Creatures> allyCreatures;
// Token: 0x04000D70 RID: 3440
private List<CreatureActions> enemies;
// Token: 0x04000D71 RID: 3441
private List<CreatureActions> allies;
// Token: 0x04000D72 RID: 3442
private List<Character> characters;
// Token: 0x04000D73 RID: 3443
private bool hasList;
// Token: 0x04000D74 RID: 3444
private bool gaveWarning;
// Token: 0x04000D75 RID: 3445
private bool rousedFort;
// Token: 0x04000D76 RID: 3446
public bool hasRescuedHostages;
// Token: 0x04000D77 RID: 3447
public bool hasKilledLeader;
// Token: 0x04000D78 RID: 3448
public bool hasClearedFort;
// Token: 0x04000D79 RID: 3449
public bool alliesAreGone;
// Token: 0x04000D7A RID: 3450
private Character lookout;
// Token: 0x04000D7B RID: 3451
private Character leader;
// Token: 0x04000D7C RID: 3452
private Character hostage1;
// Token: 0x04000D7D RID: 3453
private Character hostage2;
// Token: 0x04000D7E RID: 3454
private Character hostage3;
// Token: 0x04000D7F RID: 3455
private float timeSinceWarning;
// Token: 0x04000D80 RID: 3456
private float timeSinceLeftCombat;
// Token: 0x04000D81 RID: 3457
private float lastHostageAttackTime;
// Token: 0x04000D82 RID: 3458
private Vector3 middleOfFort;
// Token: 0x04000D83 RID: 3459
private List<Character> portraitOrder;
// Token: 0x04000D84 RID: 3460
private IEnumerator panCoroutine;
// Token: 0x04000D85 RID: 3461
private DoorActions hostageLock;
// Token: 0x04000D86 RID: 3462
private PuzzleActions callForHelp;
// Token: 0x04000D87 RID: 3463
private bool firstHostageAttack;
// Token: 0x04000D88 RID: 3464
private bool loaded;
}