using System; using System.Collections.Generic; using Pathfinding; using PixelCrushers.DialogueSystem; using UnityEngine; // Token: 0x020000AC RID: 172 public class GroundBag : MonoBehaviour { // Token: 0x06000FB1 RID: 4017 RVA: 0x0012F0D0 File Offset: 0x0012D2D0 public void Setup() { if (this.worldItem != null) { for (int i = 0; i < 50; i++) { GameObject gameObject = Object.Instantiate(this.worldItem, Vector3.zero, Quaternion.identity); gameObject.transform.SetParent(this.labelsParent.transform, true); gameObject.transform.localPosition = Vector3.zero; gameObject.transform.localRotation = Quaternion.identity; gameObject.transform.localScale = new Vector3(1f, 1f, 1f); GroundItemText component = gameObject.GetComponent(); this.worldItemOpen.Add(component); component.TurnOff(); gameObject.SetActive(true); } } } // Token: 0x06000FB2 RID: 4018 RVA: 0x0012F18B File Offset: 0x0012D38B public void AddPopItem(global::Item item) { if (!this.justAddedItems.Contains(item)) { this.justAddedItems.Add(item); } } // Token: 0x06000FB3 RID: 4019 RVA: 0x0012F1A7 File Offset: 0x0012D3A7 public void RemovePopItem(global::Item item) { if (this.justAddedItems.Contains(item)) { this.justAddedItems.Remove(item); } } // Token: 0x06000FB4 RID: 4020 RVA: 0x0012F1C4 File Offset: 0x0012D3C4 public bool IsPopItem(global::Item item) { return this.justAddedItems.Contains(item); } // Token: 0x06000FB5 RID: 4021 RVA: 0x0012F1D8 File Offset: 0x0012D3D8 public void RemovePopItems() { if (Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Show Items"))) { return; } int count = this.justAddedItems.Count; for (int i = 0; i < count; i++) { this.tempPopItems.Add(this.justAddedItems[i]); } this.justAddedItems.Clear(); this.tempPopItems.Clear(); } // Token: 0x06000FB6 RID: 4022 RVA: 0x0012F24B File Offset: 0x0012D44B public bool ItemInList(global::Item item) { return this.hitScreenItems.Contains(item); } // Token: 0x06000FB7 RID: 4023 RVA: 0x0012F25C File Offset: 0x0012D45C public void HitItem(global::Item item, bool adding) { int num = this.hitItems.IndexOf(item); if (num == -1 && adding) { this.hitItems.Add(item); } if (num > -1 && !adding) { this.hitItems.RemoveAt(num); } } // Token: 0x06000FB8 RID: 4024 RVA: 0x0012F2A0 File Offset: 0x0012D4A0 public void HitScreenItem(global::Item item, bool adding) { int num = this.hitScreenItems.IndexOf(item); if (num == -1 && adding) { this.hitScreenItems.Add(item); } if (num > -1 && !adding) { if (this.justAddedItems.Count > 0 && this.justAddedItems.Contains(item)) { return; } this.hitScreenItems.RemoveAt(num); num = this.inRangeItems.IndexOf(item); if (num > -1) { if (item.label) { this.RemoveItemLabel(item.label); return; } this.inRangeItems.RemoveAt(num); } } } // Token: 0x06000FB9 RID: 4025 RVA: 0x0012F338 File Offset: 0x0012D538 public void HoverItems(global::Item item, bool adding) { if (this.justAddedItems.Count > 0) { if (this.justAddedItems.Contains(item)) { return; } if (adding) { this.RemovePopItems(); } } int num = this.hoverItems.IndexOf(item); if (num == -1 && adding) { this.hoverItems.Add(item); } if (num > -1 && !adding) { this.hoverItems.RemoveAt(num); } } // Token: 0x06000FBA RID: 4026 RVA: 0x0012F3A4 File Offset: 0x0012D5A4 public bool PartyClose(Character character, Vector3 point, float dist) { point.y = character.tr.position.y; return (character.tr.position - point).sqrMagnitude < dist * dist; } // Token: 0x06000FBB RID: 4027 RVA: 0x0012F3E9 File Offset: 0x0012D5E9 public void SetCollectorUpdateFromTrigger() { this.collectorUpdateFromTrigger = true; } // Token: 0x06000FBC RID: 4028 RVA: 0x0012F3F2 File Offset: 0x0012D5F2 public void SetCollectorUpdate() { this.collectorUpdate = true; } // Token: 0x06000FBD RID: 4029 RVA: 0x0012F3FC File Offset: 0x0012D5FC public void UpdateLabels() { for (int i = 0; i < this.inRangeItems.Count; i++) { if (this.inRangeItems[i].label) { this.inRangeItems[i].label.Set(); } } } // Token: 0x06000FBE RID: 4030 RVA: 0x0012F44D File Offset: 0x0012D64D public int HoverItemCount() { return this.hoverItems.Count; } // Token: 0x06000FBF RID: 4031 RVA: 0x0012F45C File Offset: 0x0012D65C public void CheckGroundAndClicks(bool always) { if (Links.x.gaia.sceneLoaded) { bool flag = false; if (this.savedMain != Links.x.main) { flag = true; } this.savedMain = Links.x.main; this.canOpen = false; if (this.toggle || (this.timerItems && this.justAddedItems.Count > 0) || this.hoverItems.Count > 0) { this.canOpen = true; } if (Records.x.secrets && Input.GetKey(KeyCode.B)) { Debug.Log(string.Concat(new string[] { this.toggle.ToString(), " ", this.canOpen.ToString(), " ", Links.x.inventory.dragging.ToString(), " ", Records.x.dialogue.ToString(), " ", Records.x.MenusCount().ToString(), " ", Links.x.characterSheet.open.ToString(), " ", this.hitItems.Count.ToString(), " ", this.hoverItems.Count.ToString(), " ", this.timerItems.ToString() })); } if (!Links.x.inventory.dragging && !Records.x.dialogue && Records.x.MenusCount() == 0 && (always || Time.timeSinceLevelLoad > this.checkTime + 0.1f) && this.canOpen && !Links.x.characterSheet.open) { if (Records.x.secrets && Input.GetKey(KeyCode.B)) { Debug.Log(string.Concat(new string[] { this.toggle.ToString(), " ", this.hoverItems.Count.ToString(), " ", this.timerItems.ToString(), " ", this.justAddedItems.Count.ToString() })); } if (!this.toggle && (this.hoverItems.Count > 0 || (this.timerItems && this.justAddedItems.Count > 0))) { for (int i = 0; i < this.hoverItems.Count; i++) { global::Item item = this.hoverItems[i]; if (item) { if (item.label) { if (flag) { item.label.ItemText(); } } else if (this.worldItemOpen.Count > 0) { if (!this.inRangeItems.Contains(item)) { this.inRangeItems.Add(item); } GroundItemText groundItemText = this.worldItemOpen[0]; this.worldItemOpen.RemoveAt(0); groundItemText.item = item; item.label = groundItemText; groundItemText.worldPosition = Vector3.zero; groundItemText.screenPosition = Vector3.zero; groundItemText.gameObject.transform.SetParent(this.labelsParent.transform, false); groundItemText.Set(); item.InRange(); } } } for (int j = 0; j < this.hitItems.Count; j++) { global::Item item = this.hitItems[j]; if (this.justAddedItems.Contains(item) && item) { if (item.label) { if (flag) { item.label.ItemText(); } } else if (this.worldItemOpen.Count > 0) { if (!this.inRangeItems.Contains(item)) { this.inRangeItems.Add(item); } GroundItemText groundItemText2 = this.worldItemOpen[0]; this.worldItemOpen.RemoveAt(0); groundItemText2.item = item; item.label = groundItemText2; groundItemText2.worldPosition = Vector3.zero; groundItemText2.screenPosition = Vector3.zero; groundItemText2.gameObject.transform.SetParent(this.labelsParent.transform, false); groundItemText2.Set(); item.InRange(); } } } if (this.timerItems) { for (int k = 0; k < this.justAddedItems.Count; k++) { global::Item item = this.justAddedItems[k]; if (item) { if (item.label || item.destroying) { if (flag) { item.label.ItemText(); } } else if (Links.x.main && item.tr && this.PartyClose(Links.x.main, item.tr.position, this.itemCollectorSize) && this.worldItemOpen.Count > 0) { if (!this.inRangeItems.Contains(item)) { this.inRangeItems.Add(item); } GroundItemText groundItemText3 = this.worldItemOpen[0]; this.worldItemOpen.RemoveAt(0); groundItemText3.item = item; item.label = groundItemText3; groundItemText3.worldPosition = Vector3.zero; groundItemText3.screenPosition = Vector3.zero; groundItemText3.gameObject.transform.SetParent(this.labelsParent.transform, false); groundItemText3.Set(); item.InRange(); } } } } this.offTime = 0f; } else { this.offTime = 0f; for (int l = 0; l < this.hitScreenItems.Count; l++) { global::Item item = this.hitScreenItems[l]; if (item) { if (item.label || item.destroying) { if (flag) { item.label.ItemText(); } } else if (this.worldItemOpen.Count > 0) { if (!this.inRangeItems.Contains(item)) { this.inRangeItems.Add(item); } GroundItemText groundItemText4 = this.worldItemOpen[0]; this.worldItemOpen.RemoveAt(0); groundItemText4.item = item; item.label = groundItemText4; groundItemText4.worldPosition = Vector3.zero; groundItemText4.screenPosition = Vector3.zero; groundItemText4.gameObject.transform.SetParent(this.labelsParent.transform, false); groundItemText4.Set(); item.InRange(); } } } if (this.timerItems) { for (int m = 0; m < this.justAddedItems.Count; m++) { global::Item item = this.justAddedItems[m]; if (item) { if (item.label || item.destroying) { if (flag) { item.label.ItemText(); } } else if (Links.x.main && item.tr && this.PartyClose(Links.x.main, item.tr.position, this.itemCollectorSize) && this.worldItemOpen.Count > 0) { if (!this.inRangeItems.Contains(item)) { this.inRangeItems.Add(item); } GroundItemText groundItemText5 = this.worldItemOpen[0]; this.worldItemOpen.RemoveAt(0); groundItemText5.item = item; item.label = groundItemText5; groundItemText5.worldPosition = Vector3.zero; groundItemText5.screenPosition = Vector3.zero; groundItemText5.gameObject.transform.SetParent(this.labelsParent.transform, false); groundItemText5.Set(); item.InRange(); } } } } } this.checkTime = Time.timeSinceLevelLoad; return; } if (this.offTime == 0f && !this.canOpen) { this.offTime = Time.realtimeSinceStartup; this.itemLabelGrid.Close(); } if (Time.realtimeSinceStartup > this.offTime + 0.1f && this.offTime > 0f && !this.canOpen && this.itemLabelGrid.canvasGroup.alpha < 0.05f) { if (!this.toggle && !this.timerItems && this.hoverItems.Count == 0 && this.inRangeItems.Count > 0) { this.offTime = 0f; this.RemoveLabels(); return; } } else if (this.offTime > 0f) { bool flag2 = this.canOpen; return; } } else if (!this.toggle && this.hoverItems.Count == 0 && this.inRangeLabels.Count > 0) { this.RemoveLabels(); } } // Token: 0x06000FC0 RID: 4032 RVA: 0x0012FDC0 File Offset: 0x0012DFC0 public void JoyRemoveToggle() { for (int i = 0; i < this.inRangeItems.Count; i++) { if (this.inRangeItems[i] && !this.hoverItems.Contains(this.inRangeItems[i])) { if (this.inRangeItems[i]) { this.inRangeItems[i].PostFXRenderers(false); } if (this.inRangeItems[i].label) { this.worldItemOpen.Add(this.inRangeItems[i].label); } if (this.inRangeItems[i].label) { this.inRangeItems[i].label.TurnOff(); } this.inRangeItems[i].label = null; } } this.inRangeItems.RemoveAll((global::Item item) => item == null); } // Token: 0x06000FC1 RID: 4033 RVA: 0x0012FEE0 File Offset: 0x0012E0E0 public void RemoveLabels() { if ((!this.timerItems && !this.toggle) || Records.x.dialogue || Records.x.inMenus || Records.x.removeControls) { for (int i = 0; i < this.inRangeItems.Count; i++) { if (this.inRangeItems[i]) { this.inRangeItems[i].PostFXRenderers(false); } if (this.inRangeItems[i].label) { this.worldItemOpen.Add(this.inRangeItems[i].label); } if (this.inRangeItems[i].label) { this.inRangeItems[i].label.TurnOff(); } this.inRangeItems[i].label = null; } this.inRangeItems.Clear(); } } // Token: 0x06000FC2 RID: 4034 RVA: 0x0012FFE4 File Offset: 0x0012E1E4 public void RemoveItemLabel(GroundItemText gim) { if (gim.item && !gim.item.inRange) { gim.item.OutOfRange(); } if (this.inRangeItems.Contains(gim.item)) { this.inRangeItems.Remove(gim.item); } gim.TurnOff(); this.worldItemOpen.Add(gim); } // Token: 0x06000FC3 RID: 4035 RVA: 0x00130050 File Offset: 0x0012E250 public void ShowHoverTooltip() { if (this.hoverItems.Count > 0 && this.hoverItems[0] && !this.hoverItems[0].forSale) { Links.x.hudControl.OpenTooltip(this.hoverItems[0], false); } } // Token: 0x06000FC4 RID: 4036 RVA: 0x001300B0 File Offset: 0x0012E2B0 public void RemoveHoverTooltip() { if (this.hoverItems.Count > 0) { if (this.hoverItems[0] && !this.hoverItems[0].forSale) { Links.x.hudControl.CloseTooltip(); return; } } else { Links.x.hudControl.CloseTooltip(); } } // Token: 0x06000FC5 RID: 4037 RVA: 0x00130110 File Offset: 0x0012E310 public void UpdateGroundList(global::Item item, bool adding) { int num = this.worldItems.IndexOf(item); if (adding) { if (num == -1) { this.worldItems.Add(item); return; } } else if (num > -1) { this.worldItems.RemoveAt(num); } } // Token: 0x06000FC6 RID: 4038 RVA: 0x00130150 File Offset: 0x0012E350 public bool CheckForGroundStack(int id, int amt, Vector3 pos) { int num = -1; for (int i = 0; i < this.worldItems.Count; i++) { if (this.worldItems[i] && this.worldItems[i].ID == id && this.worldItems[i].invRow._Stackable && amt + this.worldItems[i].stackSize <= this.worldItems[i].invRow._MaxStackSize) { float sqrMagnitude = (pos - this.worldItems[i].tr.position).sqrMagnitude; if (sqrMagnitude < float.PositiveInfinity) { num = i; } } } if (num > -1) { this.worldItems[num].stackSize += amt; if (this.worldItems[num].slotItem) { this.worldItems[num].slotItem.stackSize = this.worldItems[num].stackSize; this.worldItems[num].slotItem.CheckStackSize(); } return true; } return false; } // Token: 0x06000FC7 RID: 4039 RVA: 0x00130294 File Offset: 0x0012E494 public global::Item DropLoot(int id, int amt, Vector3 socketA, Vector3 socketB, Vector4 dur, Character dropCharacter, Vector3 pos, bool canCombineStack, bool forSale, int setArea) { if (false) { return null; } Vector3 vector = pos; if (dropCharacter) { vector = dropCharacter.nodePoint; } GraphNode graphNode = null; RaycastHit raycastHit; if (Physics.Linecast(vector + new Vector3(0f, 2.5f, 0f), vector + new Vector3(0f, -10f, 0f), out raycastHit, 4194321)) { vector = raycastHit.point; } if (dropCharacter && dropCharacter.node != null && dropCharacter.node.item == 0) { graphNode = dropCharacter.node; } if (graphNode == null) { graphNode = this.NearNode(vector, false, false, true, setArea); } if (graphNode == null) { graphNode = this.NearNode(vector, false, false, false, setArea); } if (graphNode == null && dropCharacter) { graphNode = dropCharacter.node; } if (graphNode != null) { graphNode.item = 1; GraphNode graphNode2 = graphNode; graphNode2.item = 1; if (amt == 0) { amt = 1; } if (amt < 0) { amt *= -1; } global::Item item = this.SpawnGroundItem(id, amt, socketA, socketB, dur); if (item) { item.forSale = forSale; item.gameObject.transform.position = pos; item.StartGround(graphNode, graphNode2); Vector3 vector2 = (Vector3)graphNode2.position; if (dropCharacter && graphNode2 == dropCharacter.node) { vector2.y = vector.y; item.gameObject.transform.position = vector2; } if (dropCharacter && !dropCharacter.dead && dropCharacter.creatures) { item.linkedCreatures = dropCharacter.creatures.creatures; item.linkedCreatureID = dropCharacter.creatures.GetCharacterIndex(dropCharacter); } Links.x.diorama.AddItem(item); if (item.invRow._SetQuestOnDrop != "" && item.invRow._Name == "DryadSeed" && Links.x.diorama.sceneName.Contains("FortenLazure")) { PromptActions promptWithQuest = Links.x.diorama.GetPromptWithQuest("C6_DryadWitchFlower"); if (promptWithQuest.hitCharacters.Contains(Links.x.main) && QuestLog.GetQuestState(item.invRow._SetQuestOnDrop) == QuestState.Active) { QuestLog.SetQuestState(item.invRow._SetQuestOnDrop, Records.x.StringToQuestState(item.invRow._SetQuestState)); promptWithQuest.prompt.puzzle.GetComponent().ClickedFromPrompt(promptWithQuest); item.DestroyItem(false, false); item = null; } } this.CheckGroundAndClicks(true); this.SetCollectorUpdate(); } return item; } Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(id); string[] array = new string[8]; array[0] = "No node for item "; array[1] = invRowByIndex._Name; array[2] = ", "; array[3] = id.ToString(); array[4] = ", from "; array[5] = ((dropCharacter != null) ? dropCharacter.ToString() : null); array[6] = ", pos "; int num = 7; Vector3 vector3 = pos; array[num] = vector3.ToString(); Debug.Log(string.Concat(array)); return null; } // Token: 0x06000FC8 RID: 4040 RVA: 0x001305D0 File Offset: 0x0012E7D0 public global::Item SpawnGroundItem(int id, int amt, Vector3 socketA, Vector3 socketB, Vector4 dur) { global::Item item = null; Library.Inventory inventory = Links.x.library.GetInvRowByIndex(id); if (id <= 0) { return null; } if (inventory == null) { return null; } if (inventory._UIModel == "") { return null; } if (inventory._ArmorID == -1) { return null; } if (inventory._Name == "Jar") { inventory = Links.x.library.GetInvRowFromName("Globe"); id = inventory._ID; } GameObject itemPrefab = Links.x.archives.GetItemPrefab("None", Links.x.diorama.gameObject.transform); if (itemPrefab) { item = itemPrefab.GetComponent(); if (!item) { item = itemPrefab.AddComponent(); } if (Records.x.editor) { item.name = inventory._DisplayName + "_" + Random.Range(1, 100).ToString(); } if (!itemPrefab.activeSelf) { itemPrefab.SetActive(true); } itemPrefab.transform.localScale = Vector3.one; GameObject gameObject = item.gameObject; item.Reset(); item.durability = dur; if (inventory._DurabilityMax > 0 && item.durability.x > (float)inventory._DurabilityMax) { item.durability.x = (float)inventory._DurabilityMax; } if (inventory._Contraband > 0) { item.durability.w = 1f; } item.stackSize = amt; if (amt > inventory._MaxStackSize) { item.stackSize = inventory._MaxStackSize; } item.ID = id; item.equipSlot = inventory._EquipSlotID; item.socketA = socketA; item.socketB = socketB; item.stackable = inventory._Stackable; item.itemTag = inventory._Tag; int num = inventory._SocketMax; if (num > 0 && ((int)socketA.x == -1 || (int)socketA.y == -1)) { num = 0; if (socketA.x > -1f) { num++; } if (socketA.y > -1f) { num++; } } item.socketMax = num; item.invRow = inventory; if (item.stackSize == 0) { item.stackSize = 1; } } return item; } // Token: 0x06000FC9 RID: 4041 RVA: 0x001307FC File Offset: 0x0012E9FC public GraphNode NearNode(Vector3 pos, bool checkEmpty, bool combat, bool checkItem, int setArea) { this.nodeConstraint.constrainWalkability = true; this.nodeConstraint.walkable = true; this.nodeConstraint.constrainTags = false; this.nodeConstraint.checkCircleID = 0; this.nodeConstraint.constrainItem = checkItem; this.nodeConstraint.passID = 0; this.nodeConstraint.constrainPenalty = 0; this.nodeConstraint.checkConnections = 0; this.nodeConstraint.constrainToArea = setArea; GraphNode node = AstarPath.active.GetNearest(pos, this.nodeConstraint).node; if (node != null) { return node; } return null; } // Token: 0x040019FF RID: 6655 [Header("Ground Items")] public float checkTime; // Token: 0x04001A00 RID: 6656 public List inRangeItems = new List(); // Token: 0x04001A01 RID: 6657 public List inRangeLabels = new List(); // Token: 0x04001A02 RID: 6658 private List inRangeItemsTemp = new List(); // Token: 0x04001A03 RID: 6659 public List hitItems = new List(); // Token: 0x04001A04 RID: 6660 public List hitScreenItems = new List(); // Token: 0x04001A05 RID: 6661 public List hoverItems = new List(); // Token: 0x04001A06 RID: 6662 private List dioramaItems; // Token: 0x04001A07 RID: 6663 private List inRangeLabelsTemp = new List(); // Token: 0x04001A08 RID: 6664 public List worldItems = new List(); // Token: 0x04001A09 RID: 6665 public List groundItemSpots = new List(); // Token: 0x04001A0A RID: 6666 public Character character; // Token: 0x04001A0B RID: 6667 public GameObject worldItem; // Token: 0x04001A0C RID: 6668 public List worldItemOpen = new List(); // Token: 0x04001A0D RID: 6669 public Vector3 droppedPos; // Token: 0x04001A0E RID: 6670 private bool canHover; // Token: 0x04001A0F RID: 6671 public bool toggle; // Token: 0x04001A10 RID: 6672 public bool canOpen; // Token: 0x04001A11 RID: 6673 private NNConstraint nodeConstraint = new NNConstraint(); // Token: 0x04001A12 RID: 6674 public bool collectorUpdate; // Token: 0x04001A13 RID: 6675 public bool collectorUpdateFromTrigger; // Token: 0x04001A14 RID: 6676 public Color forSaleColor; // Token: 0x04001A15 RID: 6677 public Color tooExpensiveColor; // Token: 0x04001A16 RID: 6678 public Color stealColor; // Token: 0x04001A17 RID: 6679 public RuntimeAnimatorController groundItemController; // Token: 0x04001A18 RID: 6680 public bool firstOpen; // Token: 0x04001A19 RID: 6681 private Character savedMain; // Token: 0x04001A1A RID: 6682 public float startPosY; // Token: 0x04001A1B RID: 6683 public List justAddedItems = new List(); // Token: 0x04001A1C RID: 6684 private List tempPopItems = new List(); // Token: 0x04001A1D RID: 6685 public bool timerItems; // Token: 0x04001A1E RID: 6686 public float offTime; // Token: 0x04001A1F RID: 6687 public ItemLabelGrid itemLabelGrid; // Token: 0x04001A20 RID: 6688 public float itemCollectorSize; // Token: 0x04001A21 RID: 6689 [Header("Refs")] public GameObject groundItemsParent; // Token: 0x04001A22 RID: 6690 public Transform labelsParent; // Token: 0x04001A23 RID: 6691 public AnimateButton hudButton; }