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

1010 lines
30 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using DarkTonic.MasterAudio;
using Pathfinding;
using UnityEngine;
// Token: 0x0200001D RID: 29
public class ChestActions : MonoBehaviour
{
// Token: 0x06000466 RID: 1126 RVA: 0x00065D1C File Offset: 0x00063F1C
private void Start()
{
this.saveName = base.gameObject.name;
this.tr = base.transform;
this.GetObjects();
this.coll.gameObject.layer = 16;
this.currentHealth = this.chest.health;
}
// Token: 0x06000467 RID: 1127 RVA: 0x00065D70 File Offset: 0x00063F70
public void LoadGameSetup(int x)
{
this.currentHealth = x;
if (x > 0)
{
this.destroyed = false;
this.open = false;
return;
}
if (x == 0)
{
this.open = false;
this.ClickToOpen(null, true);
return;
}
if (x < 0)
{
this.ClickToBreak(null, true);
this.destroyed = true;
return;
}
}
// Token: 0x06000468 RID: 1128 RVA: 0x00065DC0 File Offset: 0x00063FC0
public void GetObjects()
{
if (!this.mainCollider)
{
this.renderers = base.gameObject.GetComponentsInChildren<MeshRenderer>(false);
foreach (object obj in this.tr)
{
Transform transform = (Transform)obj;
GameObject gameObject = transform.gameObject;
string name = gameObject.name;
if (name == "Animation")
{
this.anim = gameObject;
using (IEnumerator enumerator2 = transform.GetEnumerator())
{
while (enumerator2.MoveNext())
{
object obj2 = enumerator2.Current;
Transform transform2 = (Transform)obj2;
if (transform2 != transform)
{
this.animationObjects.Add(transform2.gameObject);
}
}
continue;
}
}
if (name.Contains("ollider"))
{
this.coll = gameObject;
this.mainCollider = gameObject.GetComponent<BoxCollider>();
}
else if (name.Contains("oint"))
{
this.point = gameObject;
}
else
{
this.meshes = gameObject;
}
}
}
}
// Token: 0x06000469 RID: 1129 RVA: 0x00065F00 File Offset: 0x00064100
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: 0x0600046A RID: 1130 RVA: 0x00065FE4 File Offset: 0x000641E4
public void HoverIn(bool isMainHover)
{
if (!this.destroyed)
{
if (!this.mainCollider)
{
this.GetObjects();
}
if (this.mainCollider)
{
this.bounds = this.mainCollider.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 num = this.renderers.Length;
while (i < num)
{
if (this.renderers[i] && this.renderers[i].gameObject.layer != 29)
{
this.bounds.Encapsulate(this.renderers[i].bounds);
}
i++;
}
}
}
}
this.bounds.Expand(0.25f);
int num2 = 0;
if (Records.x.pocketPause)
{
num2 = 2;
}
if (this.chest.owner)
{
Character firstCharacter = this.chest.owner.GetComponent<CreatureActions>().GetFirstCharacter();
if (firstCharacter && !firstCharacter.stunned && !firstCharacter.dead)
{
num2 = 1;
}
}
if (isMainHover)
{
Links.x.hoverObject = base.gameObject;
Shader.SetGlobalVector("_DoorLightPosition", this.bounds.center + Links.x.rtsCamera.gameObject.transform.forward * -2f);
Records.x.hoverLightColor = Color.white * 0.25f;
Shader.SetGlobalFloat("_DoorLightRange", 3f);
if (Records.x.pocketPause && !Links.x.gameplay.attackingCharacter.CanAttack())
{
bool rallyWheelOpen = Links.x.pocketWheel.rallyWheelOpen;
}
}
if (!this.bracket)
{
this.bracket = Links.x.cellar.GetBracket(num2, this.bounds);
return;
}
Links.x.cellar.SetBracketMaterial(num2, this.bracket);
}
}
// Token: 0x0600046B RID: 1131 RVA: 0x0006621C File Offset: 0x0006441C
public void HoverOut()
{
if (Links.x.hoverObject == base.gameObject)
{
Links.x.hoverObject = null;
}
if (this.multiHover)
{
this.multiHover = false;
Links.x.combat.MultiHitCharacters(false);
Links.x.combat.MultiHitObjects(false, base.gameObject.transform.position, null, this, null);
Links.x.gameplay.CheckIfAnythingShouldRedoMultiTargetHover();
}
if (this.bracket)
{
Links.x.cellar.ReturnPooledGameObject(61, this.bracket);
this.bracket = null;
}
}
// Token: 0x0600046C RID: 1132 RVA: 0x000662C8 File Offset: 0x000644C8
public void CombatSheen(int num)
{
if (this.destroyed && num == 3)
{
return;
}
bool flag = false;
if (num == 3)
{
flag = true;
}
this.combatTargetID = num;
for (int i = 0; i < this.renderers.Length; i++)
{
this.mats = this.renderers[i].materials;
foreach (Material material in this.mats)
{
this.sheen = 0f;
if (flag)
{
this.sheen = 1f;
}
material.SetFloat("_InCombatBubble", this.sheen);
}
}
}
// Token: 0x0600046D RID: 1133 RVA: 0x00066358 File Offset: 0x00064558
public void Damage(Character party)
{
this.AlertOwner(true, party);
}
// Token: 0x0600046E RID: 1134 RVA: 0x00066364 File Offset: 0x00064564
public void Bend()
{
if (this.currentHealth < this.chest.health && !this.destroyed && this.currentHealth > 0)
{
if (this.timeSinceHeal == 0f)
{
this.timeSinceHeal = Links.x.gameplay.seconds;
}
if (Links.x.gameplay.seconds > this.timeSinceHeal + 100f)
{
this.timeSinceHeal = Links.x.gameplay.seconds;
float num = (float)this.chest.health / 5f;
this.currentHealth += Mathf.RoundToInt(num);
Vector3 position = this.mainCollider.gameObject.transform.position;
Vector3 vector = Links.x.worldCamera.WorldToScreenPoint(position);
vector.z = 0f;
vector.x = vector.x * (1920f / (float)Screen.width) - 960f;
vector.y = vector.y * (Links.x.canvasRT.sizeDelta.y / (float)Screen.height) - Links.x.canvasRT.sizeDelta.y / 2f;
Links.x.repairFX.localPosition = vector;
Links.x.repairFX.gameObject.SetActive(true);
Links.x.repairFX.gameObject.GetComponent<HannahAnimator>().Play("Idle");
string text = "Repair 1";
if (Random.Range(0, 2) == 0)
{
text = "Repair 2";
}
if (Random.Range(0, 3) == 0)
{
text = "Repair 3";
}
MasterAudio.PlaySound3DAtVector3AndForget("Interactives", base.gameObject.transform.position, Random.Range(0.7f, 0.9f), new float?(1f), 0f, text, null);
if (this.currentHealth == this.chest.health)
{
this.timeSinceHeal = 0f;
}
}
}
}
// Token: 0x0600046F RID: 1135 RVA: 0x0006657B File Offset: 0x0006477B
public void ClickToBreak(Character party, bool fromSave)
{
if (!this.destroyed)
{
this.HoverOut();
this.destroyed = true;
base.StartCoroutine(this.Breaking(party, fromSave));
}
}
// Token: 0x06000470 RID: 1136 RVA: 0x000665A1 File Offset: 0x000647A1
private IEnumerator Breaking(Character party, bool fromSave)
{
if (!this.mainCollider)
{
this.GetObjects();
}
if (this.openRoutine != null)
{
base.StopCoroutine(this.openRoutine);
this.openRoutine = null;
}
if (!fromSave && party)
{
Links.x.sensory.LookAtObject(base.transform, 15f, false, party, 4f, 0.5f, null, 0);
this.HoverOut();
}
if (!fromSave)
{
while (Links.x.combat.rallyTarget)
{
yield return null;
}
}
if (!fromSave)
{
Links.x.sensory.AddNoise(party.gameObject, party.node, "Break", party);
}
if (this.anim)
{
this.anim.SetActive(false);
}
if (!fromSave)
{
this.SpillInsides(fromSave, party);
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(133);
pooledGameObject.GetComponent<Gore>().Break(this.tr.position);
pooledGameObject.transform.position = this.tr.position;
MasterAudio.PlaySound3DAtVector3AndForget("Interactives", base.gameObject.transform.position, 1f, new float?(1f), 0f, "Chest Break", null);
this.CombatSheen(0);
this.HoverOut();
}
this.currentHealth = -1;
if (this.interactiveCharacterObject)
{
Object.Destroy(this.interactiveCharacterObject);
}
Links.x.hudControl.AddRemoveInteraction(false, null, null, this, null, null, null, null);
Links.x.combat.AddRemoveInteraction(false, null, this, null, null);
if (Records.x.pocketPause && party.mainSelected)
{
Links.x.gameplay.PocketPause(false);
}
this.mainCollider.enabled = false;
yield return new WaitForSeconds(0.25f);
yield break;
}
// Token: 0x06000471 RID: 1137 RVA: 0x000665BE File Offset: 0x000647BE
public void ClickToOpen(Character party, bool fromSave)
{
if (!this.open && this.openRoutine == null)
{
this.openRoutine = this.Opening(party, fromSave);
base.StartCoroutine(this.openRoutine);
}
}
// Token: 0x06000472 RID: 1138 RVA: 0x000665EC File Offset: 0x000647EC
public bool HasKey(Character party)
{
Links.x.SetFormationOrder();
bool flag = false;
string text = this.chest.keyItem.ToString();
if (this.partyList == null)
{
this.formationList = Links.x.formationOrder;
this.partyList.Clear();
this.partyList.Add(party);
for (int i = 0; i < this.formationList.Count; i++)
{
if (this.formationList[i] != party)
{
this.partyList.Add(this.formationList[i]);
}
}
}
if (text != "")
{
int invRowID = Links.x.library.GetInvRowID(text);
for (int j = 0; j < this.partyList.Count; j++)
{
if (!flag && this.partyList[j] && this.partyList[j].HasItem(invRowID) > -1)
{
flag = true;
break;
}
}
}
return flag;
}
// Token: 0x06000473 RID: 1139 RVA: 0x000666F6 File Offset: 0x000648F6
private IEnumerator Opening(Character party, bool fromSave)
{
if (!fromSave && party)
{
while (party.moving)
{
yield return null;
}
party.SetRotation(Quaternion.LookRotation(base.gameObject.transform.position - party.tr.position), false, true);
party.PlayAnimation("Use", 0f);
Links.x.sensory.LookAtObject(base.transform, 15f, false, party, 4f, 0.5f, null, 0);
}
bool canOpen = true;
if (!fromSave && party)
{
canOpen = false;
StringFast str = new StringFast(64);
if (this.chest.locked)
{
Links.x.SetFormationOrder();
this.formationList = Links.x.formationOrder;
this.partyList.Clear();
this.partyList.Add(party);
for (int k = 0; k < this.formationList.Count; k++)
{
if (this.formationList[k] != party)
{
this.partyList.Add(this.formationList[k]);
}
}
int num;
if (this.HasKey(party))
{
str.Clear();
str.Append(Links.x.gameFeed.GetPartyColorText(party));
str.Append(party.stats.GetName());
str.Append("</color>");
str.Append(" opened chest with a key");
Links.x.gameFeed.AddFeed(str.ToString());
canOpen = true;
this.currentHealth = 0;
this.chest.locked = false;
this.open = true;
Links.x.hudControl.AddRemoveInteraction(false, null, null, this, null, null, null, null);
Links.x.combat.AddRemoveInteraction(false, null, this, null, null);
MasterAudio.PlaySound3DAtVector3AndForget("Interactives", base.gameObject.transform.position, 1f, new float?(1f), 0f, "Key", null);
yield return new WaitForSeconds(0.5f);
MasterAudio.PlaySound3DAtVector3AndForget("Interactives", base.gameObject.transform.position, 1f, new float?(1f), 0f, "Chest Open", null);
if (this.interactiveCharacterObject)
{
Object.Destroy(this.interactiveCharacterObject);
}
int totalAnimObjects = this.animationObjects.Count;
int current = 0;
for (int i = 0; i < totalAnimObjects; i = num + 1)
{
for (int l = 0; l < totalAnimObjects; l++)
{
if (l == current)
{
this.animationObjects[l].SetActive(true);
}
else
{
this.animationObjects[l].SetActive(false);
}
}
num = current;
current = num + 1;
yield return new WaitForSeconds(0.1f);
num = i;
}
this.AlertOwner(false, party);
this.SpillInsides(fromSave, party);
this.mainCollider.enabled = false;
this.HoverOut();
}
for (int current = 0; current < this.partyList.Count; current = num + 1)
{
if (!canOpen && this.partyList[current] && this.partyList[current].IsSentient() && this.partyList[current].mainSelected)
{
float lockpickRoll = this.partyList[current].stats.Lockpicking(false);
string lockpickRollString = this.partyList[current].stats.LockpickingCalculation(false);
string lockDifficultyString = this.partyList[current].stats.LockDifficultyString((float)this.chest.lockDifficulty);
if (this.partyList[current] != party)
{
this.partyList[current].TargetReached();
while (this.partyList[current].moving)
{
yield return null;
}
this.partyList[current].SetRotation(Quaternion.LookRotation(this.point.transform.position - this.partyList[current].tr.position), false, true);
this.partyList[current].PlayAnimation("Use", 0f);
}
bool flag = false;
if (lockpickRoll + 1f >= (float)this.chest.lockDifficulty && Random.Range(0, 5) == 0)
{
flag = true;
}
if (lockpickRoll >= (float)this.chest.lockDifficulty || flag)
{
str.Clear();
str.Append(Links.x.gameFeed.GetPartyColorText(this.partyList[current]));
str.Append(this.partyList[current].stats.GetName());
str.Append("</color>");
str.Append(" picked the lock");
if (Records.x.showRulesetInfo)
{
str.Append(" <color #857C6C>... ");
str.Append(lockpickRollString);
str.Append(" vs. ");
str.Append(lockDifficultyString);
str.Append("</color>");
}
Links.x.gameFeed.AddFeed(str.ToString());
canOpen = true;
this.chest.locked = false;
this.currentHealth = 0;
this.open = true;
Links.x.hudControl.AddRemoveInteraction(false, null, null, this, null, null, null, null);
Links.x.combat.AddRemoveInteraction(false, null, this, null, null);
MasterAudio.PlaySound3DAtVector3AndForget("Interactives", base.gameObject.transform.position, 1f, new float?(1f), 0f, "Chest Open", null);
yield return new WaitForSeconds(0.3f);
MasterAudio.PlaySound3DAtVector3AndForget("Skills", base.gameObject.transform.position, 1f, new float?(1f), 0f, "GenericBuff", null);
MasterAudio.PlaySoundAndForget("Feedback", 0.6f, new float?(1f), 0f, "Song Learned", null);
GameObject go = Links.x.cellar.GetPooledGameObject(10);
go.transform.position = this.partyList[current].body.headBone.position + new Vector3(0f, 1.5f, 0f);
go.SetActive(true);
if (this.interactiveCharacterObject)
{
Object.Destroy(this.interactiveCharacterObject);
}
this.AlertOwner(false, this.partyList[current]);
this.partyList[current].stats.AddSkillProgress(20, (float)this.chest.lockDifficulty * 2f, null);
Links.x.itemPickupFX.gameObject.SetActive(true);
Links.x.itemPickupFX.gameObject.GetComponent<HannahAnimator>().Play("Idle");
Vector3 position = this.mainCollider.gameObject.transform.position;
Vector3 vector = Links.x.worldCamera.WorldToScreenPoint(position);
vector.z = 0f;
vector.x = vector.x * (1920f / (float)Screen.width) - 960f;
vector.y = vector.y * (Links.x.canvasRT.sizeDelta.y / (float)Screen.height) - Links.x.canvasRT.sizeDelta.y / 2f;
Links.x.itemPickupFX.localPosition = vector;
int totalAnimObjects = this.animationObjects.Count;
int i = 0;
for (int j = 0; j < totalAnimObjects; j = num + 1)
{
for (int m = 0; m < totalAnimObjects; m++)
{
if (m == i)
{
this.animationObjects[m].SetActive(true);
}
else
{
this.animationObjects[m].SetActive(false);
}
}
num = i;
i = num + 1;
yield return new WaitForSeconds(0.1f);
num = j;
}
this.HoverOut();
this.SpillInsides(fromSave, this.partyList[current]);
yield return new WaitForSeconds(1f);
Links.x.cellar.ReturnPooledGameObject(10, go);
go = null;
}
else
{
str.Clear();
str.Append(Links.x.gameFeed.GetPartyColorText(this.partyList[current]));
str.Append(this.partyList[current].stats.GetName());
str.Append("</color>");
str.Append(" failed to lockpick");
if (Records.x.showRulesetInfo)
{
str.Append(" <color #857C6C>... ");
str.Append(lockpickRollString);
str.Append(" vs. ");
str.Append(lockDifficultyString);
str.Append("</color>");
}
Links.x.gameFeed.AddFeed(str.ToString());
this.AlertOwner(false, this.partyList[current]);
GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(58);
if (pooledGameObject)
{
pooledGameObject.transform.position = this.partyList[current].body.headBone.position + new Vector3(0f, 2f, 0f);
pooledGameObject.SetActive(true);
}
float num2 = (float)this.chest.lockDifficulty - lockpickRoll;
if (num2 <= 1f)
{
this.partyList[current].StartQuip("Nearly got it");
}
else if (num2 > 1f && num2 < 3f)
{
this.partyList[current].StartQuip("With a little more skill...");
}
else if (num2 >= 3f)
{
this.partyList[current].StartQuip("Too hard for me...");
}
MasterAudio.PlaySound3DAtVector3AndForget("Skills", base.gameObject.transform.position, 1f, new float?(1f), 0f, "Fail", null);
}
lockpickRollString = null;
lockDifficultyString = null;
}
num = current;
}
}
else
{
this.currentHealth = 0;
this.open = true;
Links.x.hudControl.AddRemoveInteraction(false, null, null, this, null, null, null, null);
Links.x.combat.AddRemoveInteraction(false, null, this, null, null);
MasterAudio.PlaySound3DAtVector3AndForget("Interactives", base.gameObject.transform.position, 1f, new float?(1f), 0f, "Chest Open", null);
yield return new WaitForSeconds(0.3f);
MasterAudio.PlaySound3DAtVector3AndForget("Skills", base.gameObject.transform.position, 1f, new float?(1f), 0f, "GenericBuff", null);
if (this.interactiveCharacterObject)
{
Object.Destroy(this.interactiveCharacterObject);
}
this.AlertOwner(false, party);
Links.x.itemPickupFX.gameObject.SetActive(true);
Links.x.itemPickupFX.gameObject.GetComponent<HannahAnimator>().Play("Idle");
Vector3 position2 = this.mainCollider.gameObject.transform.position;
Vector3 vector2 = Links.x.worldCamera.WorldToScreenPoint(position2);
vector2.z = 0f;
vector2.x = vector2.x * (1920f / (float)Screen.width) - 960f;
vector2.y = vector2.y * (Links.x.canvasRT.sizeDelta.y / (float)Screen.height) - Links.x.canvasRT.sizeDelta.y / 2f;
Links.x.itemPickupFX.localPosition = vector2;
int current = this.animationObjects.Count;
int i = 0;
int num;
for (int totalAnimObjects = 0; totalAnimObjects < current; totalAnimObjects = num + 1)
{
for (int n = 0; n < current; n++)
{
if (n == i)
{
this.animationObjects[n].SetActive(true);
}
else
{
this.animationObjects[n].SetActive(false);
}
}
num = i;
i = num + 1;
yield return new WaitForSeconds(0.1f);
num = totalAnimObjects;
}
this.SpillInsides(fromSave, party);
}
str = null;
}
else
{
int count = this.animationObjects.Count;
int num3 = this.animationObjects.Count - 1;
for (int num4 = 0; num4 < count; num4++)
{
for (int num5 = 0; num5 < count; num5++)
{
if (num5 == num3)
{
this.animationObjects[num5].SetActive(true);
}
else
{
this.animationObjects[num5].SetActive(false);
}
}
num3++;
}
this.mainCollider.enabled = false;
this.open = true;
Links.x.hudControl.AddRemoveInteraction(false, null, null, this, null, null, null, null);
Links.x.combat.AddRemoveInteraction(false, null, this, null, null);
}
if (this.open)
{
this.CombatSheen(0);
this.HoverOut();
}
this.openRoutine = null;
yield break;
}
// Token: 0x06000474 RID: 1140 RVA: 0x00066714 File Offset: 0x00064914
public void SpillInsides(bool fromSave, Character party)
{
if (!fromSave)
{
if (this.chest.effect != Chest.EffectTypes.none)
{
base.StartCoroutine(this.FindNodes(this.chest.effect.ToString(), base.transform.position, party));
}
this.itemsAlwaysInside.Clear();
if (this.chest.item1 != SceneItem.xmlNames.None)
{
this.itemsAlwaysInside.Add(this.chest.item1);
this.itemsAlwaysInsideStackSize.Add(this.chest.itemStack1);
}
if (this.chest.item2 != SceneItem.xmlNames.None)
{
this.itemsAlwaysInside.Add(this.chest.item2);
this.itemsAlwaysInsideStackSize.Add(this.chest.itemStack2);
}
if (this.chest.item3 != SceneItem.xmlNames.None)
{
this.itemsAlwaysInside.Add(this.chest.item3);
this.itemsAlwaysInsideStackSize.Add(this.chest.itemStack3);
}
if (this.chest.item4 != SceneItem.xmlNames.None)
{
this.itemsAlwaysInside.Add(this.chest.item4);
this.itemsAlwaysInsideStackSize.Add(this.chest.itemStack4);
}
if (this.chest.item5 != SceneItem.xmlNames.None)
{
this.itemsAlwaysInside.Add(this.chest.item5);
this.itemsAlwaysInsideStackSize.Add(this.chest.itemStack5);
}
if (this.chest.item6 != SceneItem.xmlNames.None)
{
this.itemsAlwaysInside.Add(this.chest.item6);
this.itemsAlwaysInsideStackSize.Add(this.chest.itemStack6);
}
if (this.chest.item7 != SceneItem.xmlNames.None)
{
this.itemsAlwaysInside.Add(this.chest.item7);
this.itemsAlwaysInsideStackSize.Add(this.chest.itemStack7);
}
if (this.chest.item8 != SceneItem.xmlNames.None)
{
this.itemsAlwaysInside.Add(this.chest.item8);
this.itemsAlwaysInsideStackSize.Add(this.chest.itemStack8);
}
if (this.chest.item9 != SceneItem.xmlNames.None)
{
this.itemsAlwaysInside.Add(this.chest.item9);
this.itemsAlwaysInsideStackSize.Add(this.chest.itemStack9);
}
if (this.chest.item10 != SceneItem.xmlNames.None)
{
this.itemsAlwaysInside.Add(this.chest.item10);
this.itemsAlwaysInsideStackSize.Add(this.chest.itemStack10);
}
for (int i = 0; i < this.itemsAlwaysInside.Count; i++)
{
string text = this.itemsAlwaysInside[i].ToString();
Library.Inventory invRowFromName = Links.x.library.GetInvRowFromName(text);
if (invRowFromName != null)
{
int num = -1;
if (this.node != null)
{
num = (int)this.node.Area;
}
Item item = Links.x.inventory.groundBag.DropLoot(invRowFromName._ID, this.itemsAlwaysInsideStackSize[i], Vector3.zero, Vector3.zero, new Vector4((float)invRowFromName._DurabilityMax, 0f, 0f, 0f), null, base.gameObject.transform.position, false, false, num);
if (item)
{
item.tr.position = (Vector3)item.dropNode.position;
Links.x.diorama.AddItem(item);
}
}
}
}
this.mainCollider.enabled = false;
}
// Token: 0x06000475 RID: 1141 RVA: 0x00066ACC File Offset: 0x00064CCC
public void AlertOwner(bool madeNoise, Character character)
{
if (this.chest.owner)
{
Character firstCharacter = this.chest.owner.GetComponent<CreatureActions>().GetFirstCharacter();
if (firstCharacter)
{
bool flag = false;
if (!firstCharacter.stunned && !firstCharacter.dead && (!firstCharacter.sleeping || madeNoise) && (firstCharacter.tr.position - character.tr.position).sqrMagnitude < firstCharacter.stats.SightRadius(false, false, false) * firstCharacter.stats.SightRadius(false, false, false) && !character.body.sneaking && !Physics.Linecast(firstCharacter.raycastPosition, character.raycastPosition, Links.x.sightBlockers))
{
if (firstCharacter.sleeping)
{
firstCharacter.WakeUp();
}
if (!Links.x.main.InSporeForest() && !Links.x.sensory.ProofState(firstCharacter))
{
Records.x.AddBribeBadge(firstCharacter, "Seen", false, character);
}
Links.x.sensory.AddPlayerFromDamage(firstCharacter, Links.x.main);
flag = true;
}
if (!flag)
{
Character character2 = null;
int num = Links.x.combat.NPCCount(true);
int num3;
int num2 = Links.x.sensory.NonHostileAttacked(null, base.gameObject.transform.position, character, false, madeNoise, out character2, out num3);
int num4 = Links.x.combat.NPCCount(true);
string[] array = new string[10];
array[0] = "Alert owner non-hostile seen count ";
array[1] = num2.ToString();
array[2] = " made noise ";
array[3] = madeNoise.ToString();
array[4] = " offended character ";
int num5 = 5;
Character character3 = character2;
array[num5] = ((character3 != null) ? character3.ToString() : null);
array[6] = " start npc count ";
array[7] = num.ToString();
array[8] = " current npc count ";
array[9] = num4.ToString();
Debug.Log(string.Concat(array));
if (num2 == 0 && num4 == 0 && num3 == 0)
{
if (!this.chest.locked)
{
character.StartQuip("None the wiser");
}
else
{
character.StartQuip("At least I was not seen");
}
}
if (character2 && num == 0 && !character2.party && !character2.stats.animal && !Links.x.main.InSporeForest() && !Links.x.sensory.ProofState(firstCharacter))
{
Records.x.AddBribeBadge(character2, "Seen", false, character);
}
}
}
}
}
// Token: 0x06000476 RID: 1142 RVA: 0x00066D59 File Offset: 0x00064F59
private IEnumerator FindNodes(string abilityName, Vector3 startPosition, Character party)
{
if (abilityName == "oil")
{
abilityName = "Oil";
}
if (abilityName == "sap")
{
abilityName = "Sap";
}
Library.Effects effectRow = Links.x.library.GetEffectRow(abilityName);
this.pickedGroundNodes.Clear();
this.SetNodeConstraint(false, 0);
GraphNode targetNode = AstarPath.active.GetNearest(startPosition, this.nodeConstraint).node;
float num = (float)effectRow._TileRadius;
float max = (num * Records.x.nodeSize + 0.1f) * (num * Records.x.nodeSize + 0.1f);
if (Links.x.gaia.pathfindingReady)
{
ConstantPath constPath = null;
this.nodeConstraint.constrainWalkability = false;
constPath = ConstantPath.ConstructFast(targetNode, Records.x.GetConstantPathRadius((int)num), null);
constPath.nnConstraint = this.nodeConstraint;
AstarPath.StartPath(constPath, false);
yield return base.StartCoroutine(constPath.WaitForPath());
int num2 = 0;
this.nodeConstraint.constrainWalkability = true;
constPath.Claim(this);
this.allNodes = constPath.allNodes;
int count = this.allNodes.Count;
int num3 = 0;
for (int i = 0; i < count; i++)
{
if (this.allNodes[i].Walkable && ((Vector3)this.allNodes[i].position - (Vector3)targetNode.position).sqrMagnitude < max)
{
this.pickedGroundNodes.Add(this.allNodes[i]);
num3++;
num2++;
}
}
constPath.Release(this, false);
int num4 = this.pickedGroundNodes.IndexOf(targetNode);
if (num4 > -1)
{
this.pickedGroundNodes.RemoveAt(num4);
}
this.pickedGroundNodes.Add(targetNode);
num2++;
if (this.pickedGroundNodes.Count > 0)
{
TileEffects tileEffects = Links.x.tileEffects.AddComponent<TileEffects>();
tileEffects.gameObject.SetActive(true);
tileEffects.Setup(null, effectRow, null, null, this, party);
}
this.pickedGroundNodes.Clear();
constPath = null;
}
yield break;
}
// Token: 0x06000477 RID: 1143 RVA: 0x00066D80 File Offset: 0x00064F80
public void SetNodeConstraint(bool constrainTags, int uniqueID)
{
this.nodeConstraint.constrainWalkability = true;
this.nodeConstraint.walkable = true;
this.nodeConstraint.constrainPenalty = 0;
this.nodeConstraint.constrainTags = constrainTags;
this.nodeConstraint.checkCircleID = 0;
this.nodeConstraint.passID = 0;
this.nodeConstraint.passID2 = 0;
this.nodeConstraint.checkConnections = 0;
this.nodeConstraint.constrainToArea = -1;
}
// Token: 0x0400071F RID: 1823
public Chest chest;
// Token: 0x04000720 RID: 1824
public int currentHealth;
// Token: 0x04000721 RID: 1825
public GraphNode node;
// Token: 0x04000722 RID: 1826
public MeshRenderer[] renderers = new MeshRenderer[0];
// Token: 0x04000723 RID: 1827
private GameObject anim;
// Token: 0x04000724 RID: 1828
private GameObject coll;
// Token: 0x04000725 RID: 1829
private GameObject meshes;
// Token: 0x04000726 RID: 1830
public Transform tr;
// Token: 0x04000727 RID: 1831
public bool destroyed;
// Token: 0x04000728 RID: 1832
public bool open;
// Token: 0x04000729 RID: 1833
public GameObject point;
// Token: 0x0400072A RID: 1834
private List<SceneItem.xmlNames> itemsAlwaysInside = new List<SceneItem.xmlNames>();
// Token: 0x0400072B RID: 1835
private List<int> itemsAlwaysInsideStackSize = new List<int>();
// Token: 0x0400072C RID: 1836
public BoxCollider mainCollider;
// Token: 0x0400072D RID: 1837
public Character interactiveCharacterObject;
// Token: 0x0400072E RID: 1838
private List<GameObject> animationObjects = new List<GameObject>();
// Token: 0x0400072F RID: 1839
public List<GraphNode> pickedGroundNodes = new List<GraphNode>();
// Token: 0x04000730 RID: 1840
private NNConstraint nodeConstraint = new NNConstraint();
// Token: 0x04000731 RID: 1841
private List<GraphNode> allNodes;
// Token: 0x04000732 RID: 1842
private IEnumerator openRoutine;
// Token: 0x04000733 RID: 1843
public string saveName;
// Token: 0x04000734 RID: 1844
private List<Character> formationList;
// Token: 0x04000735 RID: 1845
private List<Character> partyList = new List<Character>();
// Token: 0x04000736 RID: 1846
private Material[] mats;
// Token: 0x04000737 RID: 1847
public GameObject bracket;
// Token: 0x04000738 RID: 1848
private Bounds bounds;
// Token: 0x04000739 RID: 1849
private List<int> layers;
// Token: 0x0400073A RID: 1850
private bool multiHover;
// Token: 0x0400073B RID: 1851
public int combatTargetID;
// Token: 0x0400073C RID: 1852
public float sheen;
// Token: 0x0400073D RID: 1853
private float timeSinceHeal;
}