using System; using System.Collections.Generic; using DarkTonic.MasterAudio; using PixelCrushers.DialogueSystem; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.InputSystem; using UnityEngine.UI; // Token: 0x020000B3 RID: 179 public class Inventory : MonoBehaviour { // Token: 0x06001094 RID: 4244 RVA: 0x0013C108 File Offset: 0x0013A308 public void Setup() { this.GetGrid(); this.ToggleEquipmentHover(false); GameObject gameObject = new GameObject("Inventory Look At"); this.lookAt = gameObject.transform; this.lookAt.SetParent(Links.x.camera3D.gameObject.transform, true); this.groundItems = this.groundBag.worldItems; if (this.allSockets.Count == 0) { this.GetSockets(); } this.splitter.CloseMenu(); Links.x.arrowKit.gameObject.SetActive(false); this.peddlerFX.gameObject.SetActive(false); } // Token: 0x06001095 RID: 4245 RVA: 0x0013C1B0 File Offset: 0x0013A3B0 public void GetSockets() { int count = Links.x.library.sockets.Count; List list = Links.x.library.sockets; for (int i = 0; i < count; i++) { this.allSockets.Add(list[i]); if (this.allSockets[i]._SocketLevel >= 1) { if (this.allSockets[i]._Category == "Gun") { this.socketLevel1Range.Add(this.allSockets[i]); } else if (this.allSockets[i]._Category == "Melee") { this.socketLevel1Melee.Add(this.allSockets[i]); } else { this.socketLevel1Armor.Add(this.allSockets[i]); } } if (this.allSockets[i]._SocketLevel >= 2) { if (this.allSockets[i]._Category == "Gun") { this.socketLevel2Range.Add(this.allSockets[i]); } else if (this.allSockets[i]._Category == "Melee") { this.socketLevel2Melee.Add(this.allSockets[i]); } else { this.socketLevel2Armor.Add(this.allSockets[i]); } } if (this.allSockets[i]._SocketLevel >= 3) { if (this.allSockets[i]._Category == "Range") { this.socketLevel3Range.Add(this.allSockets[i]); } else if (this.allSockets[i]._Category == "Melee") { this.socketLevel3Melee.Add(this.allSockets[i]); } else { this.socketLevel3Armor.Add(this.allSockets[i]); } } } } // Token: 0x06001096 RID: 4246 RVA: 0x0013C3D8 File Offset: 0x0013A5D8 public void GetGrid() { if (this.gridImg.Count == 0) { foreach (object obj in this.gridTr) { Transform transform = (Transform)obj; if (transform != this.gridTr) { this.gridImg.Add(transform.gameObject.GetComponent()); this.gridTrs.Add(transform); this.gridState.Add(false); transform.gameObject.GetComponent().sprite = this.emptySprite; } } } } // Token: 0x06001097 RID: 4247 RVA: 0x0013C48C File Offset: 0x0013A68C public global::Item GetBagItem(int index) { return this.bagItems[index]; } // Token: 0x06001098 RID: 4248 RVA: 0x0013C49C File Offset: 0x0013A69C public global::Item GetBagItem(int index, Character party) { InventoryContainer inventoryContainer = null; this.tempBagItems = this.bagItems; if (party == this.bag1.character) { inventoryContainer = this.bag1; } if (party == this.bag2.character) { inventoryContainer = this.bag2; } if (party == this.bag3.character) { inventoryContainer = this.bag3; } if (party == this.bag4.character) { inventoryContainer = this.bag4; } this.bagItems = inventoryContainer.bagItems; global::Item item = this.bagItems[index]; this.bagItems = this.tempBagItems; return item; } // Token: 0x06001099 RID: 4249 RVA: 0x0013C543 File Offset: 0x0013A743 public int GetBagIndex(global::Item item) { return this.bagItems.IndexOf(item); } // Token: 0x0600109A RID: 4250 RVA: 0x0013C554 File Offset: 0x0013A754 public int GetBagIndex(global::Item item, Character party) { InventoryContainer inventoryContainer = null; this.tempBagItems = this.bagItems; if (party == this.bag1.character) { inventoryContainer = this.bag1; } if (party == this.bag2.character) { inventoryContainer = this.bag2; } if (party == this.bag3.character) { inventoryContainer = this.bag3; } if (party == this.bag4.character) { inventoryContainer = this.bag4; } this.bagItems = inventoryContainer.bagItems; int num = this.bagItems.IndexOf(item); this.bagItems = this.tempBagItems; return num; } // Token: 0x0600109B RID: 4251 RVA: 0x0013C5FC File Offset: 0x0013A7FC public void SetBagSockets(global::Item item) { int num = this.bagItems.IndexOf(item); this.socketA[num] = item.socketA; this.socketB[num] = item.socketB; } // Token: 0x0600109C RID: 4252 RVA: 0x0013C63C File Offset: 0x0013A83C public void SetBagSocketsEquipped(ItemEquipped itemEquipped) { int equipIndex = itemEquipped.equipIndex; this.socketA[equipIndex] = itemEquipped.socketA; this.socketB[equipIndex] = itemEquipped.socketB; } // Token: 0x0600109D RID: 4253 RVA: 0x0013C674 File Offset: 0x0013A874 public int GetEquippedID(ItemEquipped itemEquipped) { return itemEquipped.equipIndex; } // Token: 0x0600109E RID: 4254 RVA: 0x0013C67C File Offset: 0x0013A87C public int GetBagAmt(int index) { if (index < this.bagAmount.Count) { return 0; } return this.bagAmount[index]; } // Token: 0x0600109F RID: 4255 RVA: 0x0013C69A File Offset: 0x0013A89A public void SetBagAmt(int index, int num, Character character) { if (character.inventoryBag) { character.inventoryBag.SetBagAmt(index, num); } } // Token: 0x060010A0 RID: 4256 RVA: 0x0013C6B6 File Offset: 0x0013A8B6 public void SetBagAmt(global::Item item, int num, Character character) { if (character.inventoryBag) { character.inventoryBag.SetBagAmt(item, num); } } // Token: 0x060010A1 RID: 4257 RVA: 0x0013C6D4 File Offset: 0x0013A8D4 public void SwitchCharacter() { if (this.openBag) { this.openBag.Close(); } this.bag1.Close(); this.bag2.Close(); this.bag3.Close(); this.bag4.Close(); this.ReleaseGroundList(); this.UpdateMisc(); this.GetBagLists(Links.x.characterSheet.character); if (this.openBag) { this.openBag.Open(); this.openBag.UpdateItemInteractableState(true); } this.CheckForExtras(); for (int i = 0; i < this.equipImages.Length; i++) { if (this.equipImages[i]) { this.equipImages[i].enabled = false; } } this.DeleteRacks(); this.repairing = false; this.repairItem = null; this.repairType = ""; if (Links.x.characterSheet.repairInstructions) { Links.x.characterSheet.repairInstructions.enabled = false; } this.OpenGroundList(); if (this.selectedPlayer.inventoryTime > 0f && Records.x.InCombat(false)) { this.selectedPlayer.characterSheetPortrait.time.SetActive(true); this.selectedPlayer.characterSheetPortrait.timeText.text = this.selectedPlayer.inventoryTime.ToString(); return; } this.selectedPlayer.characterSheetPortrait.time.SetActive(false); } // Token: 0x060010A2 RID: 4258 RVA: 0x0013C864 File Offset: 0x0013AA64 public void DeleteRacks() { if (this.slotAmmo1.childCount > 0) { GameObject gameObject = this.slotAmmo1.GetChild(0).gameObject; ItemEquipped component = gameObject.GetComponent(); string text = component.invRow._CharacterModel; text += "_clump"; component.ReturnToArchives(); Links.x.archives.RecycleItemBody(gameObject, text); } if (this.slotAmmo2.childCount > 0) { GameObject gameObject2 = this.slotAmmo2.GetChild(0).gameObject; ItemEquipped component2 = gameObject2.GetComponent(); string text2 = component2.invRow._CharacterModel; text2 += "_clump"; component2.ReturnToArchives(); Links.x.archives.RecycleItemBody(gameObject2, text2); } if (this.slotAmmo3.childCount > 0) { GameObject gameObject3 = this.slotAmmo3.GetChild(0).gameObject; ItemEquipped component3 = gameObject3.GetComponent(); string text3 = component3.invRow._CharacterModel; text3 += "_clump"; component3.ReturnToArchives(); Links.x.archives.RecycleItemBody(gameObject3, text3); } if (this.slotAlt1.childCount > 0) { GameObject gameObject4 = this.slotAlt1.GetChild(0).gameObject; ItemEquipped component4 = gameObject4.GetComponent(); string characterModel = component4.invRow._CharacterModel; component4.ReturnToArchives(); Links.x.archives.RecycleItemBody(gameObject4, characterModel); } if (this.slotAlt2.childCount > 0) { GameObject gameObject5 = this.slotAlt2.GetChild(0).gameObject; ItemEquipped component5 = gameObject5.GetComponent(); string characterModel2 = component5.invRow._CharacterModel; component5.ReturnToArchives(); Links.x.archives.RecycleItemBody(gameObject5, characterModel2); } if (this.slotAlt3.childCount > 0) { GameObject gameObject6 = this.slotAlt3.GetChild(0).gameObject; ItemEquipped component6 = gameObject6.GetComponent(); string characterModel3 = component6.invRow._CharacterModel; component6.ReturnToArchives(); Links.x.archives.RecycleItemBody(gameObject6, characterModel3); } } // Token: 0x060010A3 RID: 4259 RVA: 0x0013CA5B File Offset: 0x0013AC5B public void CreateFist(int equipIndex, bool getlists, Character party, Transform par, bool updateCharacter) { if (party.inventoryBag) { party.inventoryBag.CreateFist(equipIndex, par, updateCharacter); } } // Token: 0x060010A4 RID: 4260 RVA: 0x0013CA7A File Offset: 0x0013AC7A public void UpdateEquipmentSlots() { } // Token: 0x060010A5 RID: 4261 RVA: 0x0013CA7C File Offset: 0x0013AC7C public void UpdateGroundListGrid() { this.groundGrid.cellSize = new Vector2(22.1f, 31f); this.groundGrid.cellSize = new Vector2(22f, 31f); } // Token: 0x060010A6 RID: 4262 RVA: 0x0013CAB4 File Offset: 0x0013ACB4 private void Update() { if (!Records.x.removeControls && Links.x.gaia.sceneLoaded) { Vector2 vector = new Vector2(Input.mousePosition.x / (float)Screen.width, Input.mousePosition.y / (float)Screen.height); float num = 0.01f; if (Input.GetMouseButtonDown(0)) { this.movedMouse = true; this.clickCount++; if (this.clickCount == 2) { if (Time.realtimeSinceStartup < this.clickTime + 0.3f && Vector2.Distance(vector, this.prevClickPosition) < num) { this.doubleClick = true; this.clickTime = Time.realtimeSinceStartup; } else { this.clickCount = 0; this.doubleClick = false; } } else if (this.clickCount == 1) { this.clickTime = Time.realtimeSinceStartup; this.prevClickPosition = vector; } } if (Vector2.Distance(vector, this.prevClickPosition) >= num && Input.GetMouseButton(0)) { this.movedMouse = true; } if ((this.clickCount > 0 || this.doubleClick) && (Time.realtimeSinceStartup >= this.clickTime + 0.3f || Vector2.Distance(vector, this.prevClickPosition) >= num)) { this.doubleClick = false; this.clickCount = 0; } if (this.selectedPlayer && !Links.x.characterSheet.levelingUp && !Links.x.characterSheet.minstrel) { global::Item item = null; if (Links.x.joy) { bool flag = false; GameObject currentEventObject = Links.x.gameplay.currentEventObject; global::Item item2 = null; if (currentEventObject) { string name = Links.x.gameplay.currentEventObject.name; bool flag2 = false; if (name.Contains("_Grid_")) { if (Links.x.gameplay.currentEventObject.transform.parent.gameObject.name.Contains("Merchant") && this.gridTrsMisc != null) { flag2 = true; int num2 = this.gridTrsMisc.IndexOf(currentEventObject.transform); if (num2 > -1) { this.merchantItems = Links.x.merchant.items; for (int i = 0; i < this.merchantItems.Count; i++) { if (!flag && this.merchantItems[i]) { this.localImg = this.merchantItems[i].gridImg; for (int j = 0; j < this.localImg.Count; j++) { if (this.localImg[j] == num2) { flag = true; item2 = this.merchantItems[i]; break; } } } } } } else { int num3 = this.gridTrs.IndexOf(currentEventObject.transform); if (num3 > -1) { for (int k = 0; k < this.bagItems.Count; k++) { if (!flag && this.bagItems[k]) { this.localImg = this.bagItems[k].gridImg; for (int l = 0; l < this.localImg.Count; l++) { if (this.localImg[l] == num3) { flag = true; item2 = this.bagItems[k]; break; } } } } } } } item = item2; if (item2) { bool flag3 = true; if (this.dragging && this.dragItem) { flag3 = false; if (item2.isEquipped) { flag3 = true; } if (this.draggingSocket && !this.fromSecondaryBag && this.CheckSocket(this.dragItem, item2)) { Debug.Log("Can drag hover"); flag3 = true; } if (this.dragItem.invRow._Stackable && item2.invRow._Stackable && !this.dragItem.forSale && !item2.forSale && item2.ID == this.dragItem.ID && item2.stackSize + this.dragItem.stackSize <= item2.invRow._MaxStackSize && !item2.inGroundMenu && !item2.forSale) { flag3 = true; } } if (!flag3) { item2 = null; } if (item2) { this.hitItem = item2; if ((this.mineralizing || this.repairing) && (Links.x.characterSheet.pagan || Links.x.characterSheet.blacksmith)) { this.SetRepairMessage(); } if (this.hitItem != this.prevHitItem && !this.hitItem.noDrag) { if (this.hitItem != this.prevDragItem) { this.prevDragItem = null; } if (this.prevHitItem != null) { this.prevHitItem.InventoryHoverOut(this.prevHitItem.forSale); if (!this.prevHitItem.inGroundMenu) { Color color = this.prevHitItem.backImage.color; color.a = 0.4f; this.prevHitItem.backImage.color = color; } } Links.x.inventory.SetDragMessageText("Hover", this.hitItem); this.hitItem.InventoryHoverIn(this.hitItem.forSale); if (!this.hitItem.inGroundMenu) { Color color2 = this.hitItem.backImage.color; color2.a = 0.55f; this.hitItem.backImage.color = color2; } if (item2 != this.prevDragItem) { this.OpenTooltip(this.hitItem); } } else { this.prevDragItem = null; } this.prevHitItem = this.hitItem; Links.x.gameplay.uiCanClick = true; if (!this.dragging && Links.x.gameplay.actionStart && !this.repairing && !this.mineralizing && !this.splitter.open) { if (!flag2) { this.startDragObjectScript = this.hitItem.bag; this.fromSecondaryBag = false; } else { this.startDragObjectScript = this.merchantBag; this.fromSecondaryBag = true; } this.PrepareDrag(); this.swapping = false; this.repairing = false; this.mineralizing = false; } } else { this.hitItem = null; this.prevHitItem = null; } } else { this.hitItem = null; if (this.prevHitItem) { if (this.dragging) { this.SetDragMessageText("Dragging", this.prevHitItem); } else { this.SetDragMessageText("", this.prevHitItem); } this.prevHitItem.InventoryHoverOut(this.prevHitItem.forSale); if (!this.prevHitItem.inGroundMenu) { Color color3 = this.prevHitItem.backImage.color; color3.a = 0.4f; this.prevHitItem.backImage.color = color3; } this.CloseTooltip(); this.prevHitItem = null; } } } else { if (this.prevHitItem) { if (Links.x.inventory.dragging) { Links.x.inventory.SetDragMessageText("Dragging", this.prevHitItem); } else { Links.x.inventory.SetDragMessageText("", this.prevHitItem); } this.prevHitItem.InventoryHoverOut(this.prevHitItem.forSale); if (!this.prevHitItem.inGroundMenu) { Color color4 = this.prevHitItem.backImage.color; color4.a = 0.4f; this.prevHitItem.backImage.color = color4; } Links.x.inventory.CloseTooltip(); } this.hitItem = null; } if (Links.x.joy) { if (!this.dragging && !this.hitItem && !this.hitEquipped && Links.x.joy) { Links.x.inventory.SetDragMessageText("", null); } float num4 = Links.x.fellowship.direction.x; if (Mathf.Abs(num4) > 0.2f && !this.inSlider) { float num5 = 150f; num4 *= -4f; num5 *= num4; Links.x.characterSheet.body.transform.Rotate(new Vector3(0f, num5 * Time.unscaledDeltaTime, 0f)); } } } if (Links.x.mk || Links.x.joy) { if (Links.x.mk) { if (EventSystem.current.IsPointerOverGameObject() && !this.splitter.open && !this.spinning && !Links.x.characterSheet.rulesetOpen && !Links.x.characterSheet.statusEffectsOpen) { global::Item item3 = this.CheckGridHover(); if (!item3 && this.hitGroundItem) { item3 = this.hitGroundItem; } if (item3) { this.hitItem = item3; if (this.hitItem != this.prevHitItem && !this.hitItem.noDrag) { if (this.hitItem != this.prevDragItem) { this.prevDragItem = null; } if (this.prevHitItem != null) { this.prevHitItem.HoverOut(); } this.hitItem.HoverIn(); if ((this.mineralizing || this.repairing) && (Links.x.characterSheet.pagan || Links.x.characterSheet.blacksmith)) { this.SetRepairMessage(); } if (item3 != this.prevDragItem && !this.dragging) { this.str.Clear(); this.OpenTooltip(this.hitItem); } } else { this.prevDragItem = null; } this.prevHitItem = this.hitItem; Links.x.gameplay.uiCanClick = true; } else { if (this.waitToEndHover == 0f && this.prevHitItem) { this.waitToEndHover = Time.realtimeSinceStartup; } this.hitItem = null; } } else { if (this.waitToEndHover == 0f && this.prevHitItem) { this.waitToEndHover = Time.realtimeSinceStartup; } this.hitItem = null; this.prevDragItem = null; } if (this.waitToEndHover > 0f && Time.realtimeSinceStartup > this.waitToEndHover + 0.05f) { Links.x.gameplay.uiCanClick = false; if (!this.hitItem) { this.CloseTooltip(); } this.waitToEndHover = 0f; if (this.prevHitItem) { this.SetBackSprite("Normal", this.prevHitItem.backImage, this.prevHitItem); } this.prevHitItem = null; } bool flag4 = false; if (this.hitItem && (this.hitItem.invRow._Tag == "Weapon" || (this.hitItem.invRow._Tag == "Jewelry" && !this.hitItem.invRow._Effect.Contains("Cure"))) && this.hitItem.socketA.x <= 0f && Links.x.characterSheet.enchanting) { flag4 = true; } if (Input.GetMouseButtonDown(0)) { this.downClickTime = Time.realtimeSinceStartup; if (this.hitItem && !this.mineralizing && !this.repairing && !flag4) { Vector3 vector2 = Links.x.menuCamera.ScreenToWorldPoint(Input.mousePosition); this.offset = this.hitItem.transform.position - vector2; this.itemToDrag = this.hitItem; if (!this.hitItem.onGround && !this.hitItem.forSale) { this.startDragObjectScript = this.hitItem.bag; } } } } this.hitEquipped = null; if (((EventSystem.current.IsPointerOverGameObject() && Links.x.mk) || Links.x.joy) && !this.splitter.open && !this.spinning) { this.currentHover = Links.x.gameplay.currentEventObject; if (Links.x.mk) { this.pointer = new PointerEventData(EventSystem.current); this.pointer.position = Input.mousePosition; this.raycastResults.Clear(); EventSystem.current.RaycastAll(this.pointer, this.raycastResults); if (this.raycastResults.Count > 0) { int num6 = 0; foreach (RaycastResult raycastResult in this.raycastResults) { if (num6 == 0) { this.currentHover = raycastResult.gameObject; } if (Input.GetKey(KeyCode.T) && Records.x.editor) { Debug.Log(raycastResult.gameObject); } num6++; } } } if (this.currentHover) { this.hitEquipped = this.currentHover.GetComponent(); if (this.hitEquipped) { if (this.hitWeaponRack) { this.rack.sharedMaterial = this.rackNormalMaterial; this.hitWeaponRack = false; } if (this.hitArrowRack) { this.arrowRack.sharedMaterial = this.rackNormalMaterial; this.hitArrowRack = false; } if ((this.mineralizing || this.repairing) && (Links.x.characterSheet.pagan || Links.x.characterSheet.blacksmith)) { this.SetRepairMessage(); } if (this.hitEquipped != this.prevHitEquipped) { this.hitEquippedIndex = this.hitEquipped.equipIndex; if (this.hitEquipped.invRow != null) { if (this.hitEquipped.invRow._EquipSlotID != 9) { if (this.hitEquipped.buddyItemEquipped3D && this.hitEquipped.buddyItemEquipped3D.itemRenderer) { this.hitEquipped.buddyItemEquipped3D.itemRenderer.material.SetFloat("_Hover", 1f); } } else if (this.hitEquipped.invRow._ArmorID != -1) { Links.x.characterSheet.body.HoverArmor(true); } this.str.Clear(); this.str.Append(this.hitEquipped.invRow._DisplayName); this.str.Append(" "); this.str.Append("See Details"); if (this.hitEquipped.invRow._RightClickAction != "" || this.hitEquipped.invRow._Tag == "Note" || this.hitEquipped.invRow._Tag == "ArrowKit" || (this.repairing && (this.hitEquipped.invRow._Tag == "Shield" || this.hitEquipped.invRow._Tag == "Weapon"))) { this.str.Append(" "); if (this.repairing) { this.str.Append("Repair"); } else if (this.hitEquipped.invRow._Tag == "Open") { this.str.Append("Use"); } else { this.str.Append("Use"); } } this.SetDragMessageText(this.str.ToString(), null); } if (this.prevHitEquipped) { if (this.prevHitEquipped.invRow._EquipSlotID != 9) { if (this.prevHitEquipped.buddyItemEquipped3D && this.prevHitEquipped.buddyItemEquipped3D.itemRenderer) { this.prevHitEquipped.buddyItemEquipped3D.itemRenderer.material.SetFloat("_Hover", 0f); } } else if (this.prevHitEquipped.invRow._ArmorID != -1) { Links.x.characterSheet.body.HoverArmor(false); } } } if (this.hitEquipped != this.prevHitEquipped && this.hitEquipped.buddyItemEquipped3D) { this.OpenTooltip(this.hitEquipped); } Links.x.gameplay.uiCanClick = true; this.prevHitEquipped = this.hitEquipped; bool flag5 = this.dragging; bool flag6 = false; if (this.hitEquipped && this.hitEquipped.invRow != null && (this.hitEquipped.invRow._Tag == "Weapon" || (this.hitEquipped.invRow._Tag == "Jewelry" && !this.hitEquipped.invRow._Effect.Contains("Cure"))) && this.hitEquipped.socketA.x <= 0f && Links.x.characterSheet.enchanting) { flag6 = true; } if (((Links.x.mk && Input.GetMouseButtonDown(0)) || (Links.x.joy && Links.x.gameplay.interactStart)) && !this.dragging && !this.repairing && !this.mineralizing && flag6 && this.hitEquipped.invRow != null) { this.enchantMenu.SelectedItem(null, this.hitEquipped); } if (((Links.x.mk && Input.GetMouseButtonDown(1)) || (Links.x.joy && Links.x.gameplay.interactStart)) && !this.dragging && this.hitEquipped.invRow != null && this.hitEquipped.invRow._RightClickAction != "" && this.hitEquipped.invRow._RightClickAction == "Consume" && !Records.x.InCombat(false)) { this.UseItem(null, this.hitEquipped, this.selectedPlayer); } if (((!flag6 && !this.mineralizing && !this.repairing && Input.GetMouseButtonDown(0) && !Links.x.characterSheet.rulesetOpen && !Links.x.characterSheet.statusEffectsOpen) || (Links.x.joy && Links.x.gameplay.actionStart)) && this.hitEquipped.invRow != null) { this.downClickTime = Time.realtimeSinceStartup; if (this.hitEquipped) { this.itemEquippedToDrag = this.hitEquipped; } } } } } bool flag7 = false; if (this.hitEquipped && !this.hitEquipped.buddyItemEquipped3D && this.itemTooltipOpen) { flag7 = true; } if ((!this.hitEquipped && this.prevHitEquipped) || flag7) { this.ToggleEquipmentHover(false); if (this.prevHitEquipped.invRow._EquipSlotID != 9) { if (this.prevHitEquipped.buddyItemEquipped3D && this.prevHitEquipped.buddyItemEquipped3D.itemRenderer) { this.prevHitEquipped.buddyItemEquipped3D.itemRenderer.material.SetFloat("_Hover", 0f); } } else if (this.prevHitEquipped.invRow._ArmorID != -1) { Links.x.characterSheet.body.HoverArmor(false); } this.prevHitEquipped = null; this.CloseTooltip(); Links.x.gameplay.uiCanClick = false; } if (this.itemEquippedToDrag && ((Links.x.mk && Input.GetMouseButton(0) && !Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift)) || (Links.x.joy && Links.x.gameplay.actionStart && !this.repairing && !this.mineralizing)) && (Links.x.joy || this.movedMouse || Time.realtimeSinceStartup > this.downClickTime + 0.3f) && this.itemEquippedToDrag && !this.dragging && !this.repairing && !this.mineralizing) { this.hitEquipped = this.itemEquippedToDrag; if (this.hitEquipped.buddyItemEquipped3D) { this.PrepareDragEquipped(); } this.itemEquippedToDrag = null; } if (this.itemToDrag && Input.GetMouseButton(0) && !Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift) && (this.movedMouse || Time.realtimeSinceStartup > this.downClickTime + 0.3f) && !this.spinning && !this.dragging && this.itemToDrag != null && !this.itemToDrag.noDrag) { this.hitItem = this.itemToDrag; this.itemToDrag = null; if (!this.repairing && !this.mineralizing) { this.PrepareDrag(); this.swapping = false; } } if (Input.GetMouseButtonUp(0)) { this.itemEquippedToDrag = null; this.itemToDrag = null; } } if (Links.x.joy) { if ((item || this.hitEquipped) && !this.dragging) { if (Links.x.gameplay.actionStart) { Library.Inventory inventory; if (item) { inventory = item.invRow; } else { inventory = this.hitEquipped.invRow; } if (this.repairing && (inventory._Tag == "Weapon" || inventory._Tag == "Shield" || (inventory._Tag == "Armor" && (Links.x.characterSheet.blacksmith || Links.x.characterSheet.pagan)))) { if (Links.x.characterSheet.blacksmith || Links.x.characterSheet.pagan) { if (item) { this.RepairFromMerchant(item, null); } else { this.RepairFromMerchant(null, this.hitEquipped); } } else if (item) { this.RepairItem(item, null); } else { this.RepairItem(null, this.hitEquipped); } } else if (this.mineralizing && this.IsGemMatch(inventory._Name)) { this.GrindGem(item); } } else { Library.Inventory inventory2; if (item) { inventory2 = item.invRow; } else { inventory2 = this.hitEquipped.invRow; } if (Links.x.gameplay.interactStart) { if (inventory2._RightClickAction == "Repair" && item && !this.repairing && !this.mineralizing) { this.repairing = true; this.repairItem = item; Links.x.hudControl.MenuText(); } if (inventory2._RightClickAction == "GemRepair" && item && !this.repairing && !this.mineralizing) { this.mineralizing = true; Debug.Log("Mineralizing"); this.repairItem = item; Links.x.hudControl.MenuText(); } else if (inventory2._Tag == "Note" && !this.repairing && !this.mineralizing) { Links.x.characterSheet.OpenNote(inventory2); if (Records.x.InCombat(false)) { Links.x.inventory.AddCombatTime(Links.x.characterSheet.character, "Short"); } } else if (!this.repairing && !this.mineralizing) { if (item) { this.UseItem(item, null, this.selectedPlayer); } else { this.UseItem(null, this.hitEquipped, this.selectedPlayer); } this.CloseTooltip(); } if (inventory2._Tag == "ArrowKit" && item && !this.repairing && !this.mineralizing && !this.enchantMenu.open && !Links.x.characterSheet.blacksmith && !Links.x.characterSheet.pagan) { Links.x.arrowKit.OpenMenu(item); } float num7 = 0f; if (item) { num7 = item.socketA.x; } if (this.hitEquipped) { num7 = this.hitEquipped.socketA.x; } if (!this.repairing && !this.mineralizing && (inventory2._Tag == "Weapon" || inventory2._Tag == "Shield" || (inventory2._Tag == "Jewelry" && !inventory2._Effect.Contains("Cure"))) && num7 <= 0f && Links.x.characterSheet.enchanting) { if (item) { this.enchantMenu.SelectedItem(item, null); } else { this.enchantMenu.SelectedItem(null, this.hitEquipped); } } } else if (item && !this.repairing && !this.mineralizing && inventory2._Stackable && Links.x.gameplay.allMenusStart && !item.forSale && !item.inGroundMenu) { this.splitter.OpenMenu(item); } } } if (this.dragItem || item || this.hitEquipped) { if (item && !this.dragging && !this.hitEquipped && item.gameObject.activeSelf) { Links.x.hudControl.SetJoyBox(item.rt, Vector4.zero, true, true); } if (this.dragItem) { Links.x.hudControl.SetJoyBox(this.dragItem.rt, Vector4.zero, true, true); } } else { GameObject currentEventObject2 = Links.x.gameplay.currentEventObject; if (currentEventObject2 && (currentEventObject2.transform.parent == this.gridTr || currentEventObject2.transform.parent == Links.x.characterSheet.contentPanel)) { Links.x.hudControl.SetJoyBox(currentEventObject2.GetComponent(), Vector4.zero, false, true); } } } if (this.dragging && this.open) { this.DragListen(); } else if (this.dragging && !this.open) { if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragging = false; this.draggingSocket = false; this.dragItem = null; this.dragGo = null; Debug.Log("null"); } if (!this.dragging && !this.hitEquipped && this.spinning && Links.x.mk) { float num8 = this.mouseStart.x - Input.mousePosition.x; float num9 = 20f; if (Records.x.windows) { num9 *= 2f; } if (Links.x.characterSheet.body) { Links.x.characterSheet.body.transform.Rotate(new Vector3(0f, num8 * num9 * Time.unscaledDeltaTime, 0f)); } this.mouseStart = Input.mousePosition; } if (!this.spinning) { this.lookAt.position = Links.x.camera3D.ScreenToWorldPoint(Input.mousePosition); } if (Links.x.mk) { if (Input.GetMouseButtonDown(1)) { if (this.dragging) { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; } if (this.hitItem && !this.repairing && !this.mineralizing) { if (this.hitItem.invRow._RightClickAction == "Repair") { this.repairing = true; this.repairItem = this.hitItem; } if (this.hitItem.invRow._RightClickAction == "GemRepair") { this.mineralizing = true; this.repairItem = this.hitItem; } else if (this.hitItem.invRow._Tag == "Note") { Links.x.characterSheet.OpenNote(this.hitItem.invRow); if (Records.x.InCombat(false)) { Links.x.inventory.AddCombatTime(Links.x.characterSheet.character, "Short"); } } else if (this.hitItem.invRow._Tag == "ArrowKit" && !this.enchantMenu.open && !Links.x.characterSheet.blacksmith && !Links.x.characterSheet.pagan) { Links.x.arrowKit.OpenMenu(this.hitItem); } else { this.UseItem(this.hitItem, null, this.selectedPlayer); } } } if (Input.GetMouseButtonDown(0)) { bool flag8 = false; if (this.hitItem && (this.hitItem.invRow._Tag == "Weapon" || (this.hitItem.invRow._Effect != "Cure" && this.hitItem.invRow._Tag == "Jewelry")) && this.hitItem.socketA.x <= 0f && Links.x.characterSheet.enchanting) { flag8 = true; } if (this.repairing && this.hitItem) { if (this.repairing && (this.hitItem.invRow._Tag == "Shield" || this.hitItem.invRow._Tag == "Weapon" || (this.hitItem.invRow._Tag == "Armor" && (Links.x.characterSheet.blacksmith || Links.x.characterSheet.pagan)))) { if (Links.x.characterSheet.blacksmith || Links.x.characterSheet.pagan) { this.RepairFromMerchant(this.hitItem, null); } else { this.RepairItem(this.hitItem, null); } } } else if (this.repairing && this.hitEquipped) { if (this.repairing && (this.hitEquipped.invRow._Tag == "Shield" || this.hitEquipped.invRow._Tag == "Weapon" || (this.hitEquipped.invRow._Tag == "Armor" && (Links.x.characterSheet.blacksmith || Links.x.characterSheet.pagan)))) { if (Links.x.characterSheet.blacksmith || Links.x.characterSheet.pagan) { this.RepairFromMerchant(null, this.hitEquipped); } else { this.RepairItem(null, this.hitEquipped); } } } else if (this.mineralizing && this.hitItem) { if (this.mineralizing && this.IsGemMatch(this.hitItem.invRow._Name)) { this.GrindGem(this.hitItem); } } else if (!this.repairing && !this.mineralizing && flag8) { this.enchantMenu.SelectedItem(this.hitItem, null); } } if (Input.GetMouseButtonUp(0) && !this.dragging && (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))) { if (this.hitItem && this.hitItem.stackable && this.hitItem.stackSize > 1 && !this.hitItem.forSale && !this.hitItem.inGroundMenu) { this.splitter.OpenMenu(this.hitItem); } this.clickStartTime = -2f; } if ((this.repairing || this.mineralizing) && (Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(0)) && !this.hitItem && !this.hitEquipped) { this.doubleClick = false; this.repairing = false; this.mineralizing = false; this.repairItem = null; this.repairType = ""; if (Links.x.characterSheet.repairInstructions) { Links.x.characterSheet.repairInstructions.enabled = false; } } } else if (this.repairing || this.mineralizing) { bool cancelStart = Links.x.gameplay.cancelStart; } } } if (!this.dragging && this.dragItem) { this.dragItem = null; } } // Token: 0x060010A7 RID: 4263 RVA: 0x0013EE54 File Offset: 0x0013D054 public global::Item GetNearItem(Vector3 center) { float num = float.PositiveInfinity; int num2 = -1; int count = this.bagItems.Count; for (int i = 0; i < count; i++) { if (this.bagItems[i] && this.bagItems[i] != this.hitItem) { float sqrMagnitude = (this.bagItems[i].tr.position - center).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; num2 = i; } } } if (num2 > -1) { return this.bagItems[num2]; } return null; } // Token: 0x060010A8 RID: 4264 RVA: 0x0013EEFC File Offset: 0x0013D0FC public void RemovePrevEquipped() { if (this.prevHitEquipped) { if (this.prevHitEquipped.invRow._EquipSlotID != 9) { if (this.prevHitEquipped.buddyItemEquipped3D) { this.prevHitEquipped.buddyItemEquipped3D.itemRenderer.material.SetFloat("_Hover", 0f); } } else if (this.prevHitEquipped.invRow._ArmorID != -1) { Links.x.characterSheet.body.HoverArmor(false); } } this.hitEquipped = null; } // Token: 0x060010A9 RID: 4265 RVA: 0x0013EF94 File Offset: 0x0013D194 public int EquippedItemNumber() { int num = this.equippedItems.Length; int num2 = 0; for (int i = 0; i < num; i++) { if (this.equippedItems[i]) { num2++; } } return num2; } // Token: 0x060010AA RID: 4266 RVA: 0x0013EFCC File Offset: 0x0013D1CC private int ButtonIndex(Button b) { int num = this.equippedButtons.Length; for (int i = 0; i < num; i++) { if (this.equippedButtons[i] == b) { return i; } } return -1; } // Token: 0x060010AB RID: 4267 RVA: 0x0013F004 File Offset: 0x0013D204 public void PrepareDragEquipped() { this.ToggleEquipmentHover(false); this.CloseTooltip(); int equipIndex = this.hitEquipped.equipIndex; this.bagItems[equipIndex] = null; this.bagID[equipIndex] = 0; this.bagAmount[equipIndex] = 0; this.socketA[equipIndex] = Vector3.zero; this.socketB[equipIndex] = Vector3.zero; this.bagPos[equipIndex] = -1; this.durabilities[equipIndex] = Vector4.zero; this.dragTime = Time.realtimeSinceStartup; if (this.hitEquipped.ID == Links.x.library.torchID || this.hitEquipped.ID == Links.x.library.incenseTorchID) { this.EndTorchTime(this.hitEquipped); } global::Item item = this.SpawnItem(null, true, this.hitEquipped.ID, this.hitEquipped.stackSize, this.hitEquipped.socketA, this.hitEquipped.socketB, this.hitEquipped.durability, Vector3.zero, this.openBag.transform); item.durability = this.hitEquipped.durability; item.equipIndex = equipIndex; item.bagGridID = -1; item.ToggleBackImage(false); item.AddSocketImgs(); item.img.enabled = true; this.dragging = true; this.ToggleCharacterSheetButtonStateForDrag(true); MasterAudio.PlaySoundAndForget("Inventory", Random.Range(0.3f, 0.45f), new float?(1f), 0f, item.invRow._Sound, null); this.savedPosition = Vector3.zero; Links.x.menuCamera.ScreenToWorldPoint(Input.mousePosition); this.offset = Vector3.zero; if (Links.x.joy) { this.groundContainerBtn.enabled = true; this.groundContainerBtnImg.enabled = true; } this.canEndDrag = false; this.dragFromGround = false; item.gameObject.GetComponent().raycastTarget = false; this.dragParent = null; item.gameObject.transform.SetParent(this.itemDrag, false); this.dragItem = item; this.prevItem = item; this.prevBagGridID = item.bagGridID; this.sizeX = this.dragItem.invRow._SizeX; this.sizeY = this.dragItem.invRow._SizeY; this.dragGo = item.gameObject; this.StartDrag(this.fromSecondaryBag); this.openBag.UpdateItemInteractableState(false); this.groundContainer.UpdateItemInteractableState(false); if (Links.x.joy) { Links.x.characterSheet.SetSlotButtons(true); Links.x.characterSheet.DraggingButtons(true); this.SetColorsForEquipButtons(true); } if (this.clickStartTime == -1f) { this.clickStartTime = Time.realtimeSinceStartup; } else { this.clickStartTime = -1f; } this.ClearDrag(); this.selectedPlayer.UpdateListsFromInv(true); this.SetupEquippedItems(Links.x.characterSheet.body, false, equipIndex, false); this.selectedPlayer.CreateEquippedItems(this.bagID[equipIndex], this.bagAmount[equipIndex], this.socketA[equipIndex], this.socketB[equipIndex], equipIndex * 2, true); this.hitEquipped = null; this.prevHitEquipped = null; Links.x.gameplay.uiCanClick = false; this.dragItem.InventoryHoverOut(false); this.controllerOffset = Vector3.zero; Links.x.characterSheet.body.HoverArmor(false); if (Links.x.joy) { this.startDragObjectScript = Links.x.inventory.equipBag; } } // Token: 0x060010AC RID: 4268 RVA: 0x0013F3E4 File Offset: 0x0013D5E4 public void EndTorchTime(ItemEquipped torch) { float z = torch.durability.z; float seconds = Links.x.gameplay.seconds; torch.durability.z = 0f; torch.durability.x = torch.durability.x - (seconds - z); } // Token: 0x060010AD RID: 4269 RVA: 0x0013F438 File Offset: 0x0013D638 public void StartDrag(bool inSecondary) { this.inSecondaryBag = false; this.localImg = this.dragItem.gridImg; this.dragSaveImg.Clear(); this.groundContainer.btn.interactable = true; this.groundContainer.img.enabled = true; this.groundContainer.img.raycastTarget = true; if (Links.x.mk) { for (int i = 0; i < this.groundSlotsList.Count; i++) { this.groundSlotsList[i].img.raycastTarget = false; } } this.hitGroundItem = null; if (inSecondary) { this.gridTrsMisc = this.secondaryBag.gridTrs; this.gridStateMisc = this.secondaryBag.gridState; this.gridImgMisc = this.secondaryBag.gridImg; for (int j = 0; j < this.localImg.Count; j++) { this.dragSaveImg.Add(this.localImg[j]); this.gridImgMisc[this.localImg[j]].sprite = this.emptySprite; this.gridStateMisc[this.localImg[j]] = false; } this.secondaryDragSave = true; } else { for (int k = 0; k < this.localImg.Count; k++) { this.dragSaveImg.Add(this.localImg[k]); this.gridImg[this.localImg[k]].sprite = this.emptySprite; this.gridState[this.localImg[k]] = false; } this.secondaryDragSave = false; } this.pickUpTiles = new Vector2(0f, 0f); if (this.dragItem.invRow._SizeX == 1 && this.dragItem.invRow._SizeY == 1) { return; } Vector3 vector = Links.x.menuCamera.ScreenToWorldPoint(Input.mousePosition) + this.offset; float num = float.PositiveInfinity; int num2 = 0; int num3 = 0; for (int l = 0; l < this.localImg.Count; l++) { int num4 = this.localImg[l]; if (inSecondary) { if (num4 < this.gridTrsMisc.Count) { this.gridTrsMisc = this.secondaryBag.gridTrs; vector.z = this.gridTrsMisc[num4].position.z; float num5 = this.SubtractVectors(this.gridTrsMisc[num4].position, vector).sqrMagnitude; if (num5 < num) { num = num5; this.pickUpTiles = new Vector2((float)num2, (float)num3); } } } else if (num4 < this.gridTrs.Count) { vector.z = this.gridTrs[num4].position.z; float num5 = this.SubtractVectors(this.gridTrs[num4].position, vector).sqrMagnitude; if (num5 < num) { num = num5; this.pickUpTiles = new Vector2((float)num2, (float)num3); } } num3++; if (num3 > this.dragItem.invRow._SizeX) { num2++; num3 = 0; } } this.dragItem.img.raycastTarget = false; if (this.dragItem.isEquipped) { this.itemCenterOffset = this.OffsetToCornerEquipped(this.dragItem); return; } this.itemCenterOffset = this.OffsetToCornerEquipped(this.dragItem); } // Token: 0x060010AE RID: 4270 RVA: 0x0013F7EC File Offset: 0x0013D9EC public void PrepareDrag() { this.dragging = true; if (!Links.x.mk) { this.hitItem.ToggleBackImage(false); } this.ToggleCharacterSheetButtonStateForDrag(true); this.SetBackSprite("Normal", this.hitItem.backImage, this.hitItem); if (this.hitItem.invRow._Tag.Contains("Socket")) { this.draggingSocket = true; } else { this.draggingSocket = false; } MasterAudio.PlaySoundAndForget("Inventory", Random.Range(0.3f, 0.45f), new float?(1f), 0f, this.hitItem.invRow._Sound, null); this.prevDragItem = this.hitItem; this.hitItem.SetSprite(true); Links.x.characterTooltip.EndHoverText(this.hitItem.gameObject, false); this.savedPosition = this.hitItem.transform.localPosition; Links.x.menuCamera.ScreenToWorldPoint(Input.mousePosition); this.controllerOffset = Vector3.zero; if (Links.x.joy) { if (this.hitItem.forSale) { if (this.hitItem.bagGridID > -1 && this.hitItem.bagGridID < this.gridTrsMisc.Count) { this.controllerOffset = this.gridTrsMisc[this.hitItem.bagGridID].position - Links.x.gameplay.currentEventObject.transform.position; } else { this.controllerOffset = Vector3.zero; } } else if (this.hitItem.bagGridID > -1 && this.hitItem.bagGridID < this.gridTrs.Count && !this.hitItem.worldItem && Links.x.gameplay.currentEventObject) { this.controllerOffset = this.gridTrs[this.hitItem.bagGridID].position - Links.x.gameplay.currentEventObject.transform.position; } else { this.controllerOffset = Vector3.zero; } } this.canEndDrag = false; this.dragFromGround = false; this.dragTime = Time.realtimeSinceStartup; Image component = this.hitItem.gameObject.GetComponent(); if (Links.x.mk) { component.raycastTarget = false; } if (Links.x.joy) { this.groundContainerBtn.enabled = true; this.groundContainerBtnImg.enabled = true; } this.dragParent = this.hitItem.gameObject.transform.parent; this.hitItem.gameObject.transform.SetParent(this.itemDrag, false); this.dragItem = this.hitItem; this.prevItem = this.hitItem; this.prevBagGridID = this.hitItem.bagGridID; this.sizeX = this.dragItem.invRow._SizeX; this.sizeY = this.dragItem.invRow._SizeY; this.dragGo = this.hitItem.gameObject; this.StartDrag(this.fromSecondaryBag); if (this.clickStartTime == -1f) { this.clickStartTime = Time.realtimeSinceStartup; } else { this.clickStartTime = -1f; } this.ClearDrag(); this.openBag.UpdateItemInteractableState(false); this.groundContainer.UpdateItemInteractableState(false); if (Links.x.joy) { Links.x.characterSheet.SetSlotButtons(true); Links.x.characterSheet.DraggingButtons(true); this.SetColorsForEquipButtons(true); } this.localImg = this.dragItem.gridImg; this.localImg.Clear(); if (this.dragItem.inGroundMenu) { this.startDragObjectScript = this.groundContainer; this.dragItem.UpdateSocketLocations(); this.dragItem.ToggleSockets(true); } if (this.dragItem.inGroundMenu && Links.x.joy) { EventSystem.current.SetSelectedGameObject(this.groundContainer.gameObject); } else { bool joy = Links.x.joy; } this.dragItem.InventoryHoverOut(false); this.CloseTooltip(); if (Links.x.joy) { this.startPos = this.dragItem.transform.position; } } // Token: 0x060010AF RID: 4271 RVA: 0x0013FC80 File Offset: 0x0013DE80 public void ToggleCharacterSheetButtonStateForDrag(bool drag) { bool flag = true; if (drag) { flag = false; } if (Links.x.characterSheet.merchant || Links.x.characterSheet.blacksmith) { flag = false; } if (Links.x.mk) { flag = true; } if (this.enchantMenu.open) { flag = false; } if (Links.x.characterSheet.note.activeSelf) { flag = false; } if (Links.x.arrowKit.open) { flag = false; } for (int i = 0; i < this.draggingOffBtns.Count; i++) { this.draggingOffBtns[i].interactable = flag; } } // Token: 0x060010B0 RID: 4272 RVA: 0x0013FD28 File Offset: 0x0013DF28 public bool CheckGrid(bool mouse, global::Item item, Vector3 pt, Vector2 startTile, int gridSizeX, int gridSizeY, string type) { Vector3 vector = Links.x.menuCamera.ScreenToWorldPoint(Input.mousePosition) + this.offset - this.itemCenterOffset; if (Links.x.joy && type != "Hidden" && this.open) { if (Links.x.gameplay.currentEventObject) { vector = Links.x.gameplay.currentEventObject.transform.position; if (this.dropScript && (this.dropScript.bag || this.dropScript.merchantTake)) { vector += this.controllerOffset; } } else { vector = this.dragGo.transform.position; } } if (!mouse) { vector = pt; } bool flag = false; if (Links.x.characterSheet.merchant) { flag = true; } if ((type != "Hidden" && this.open && flag) || type == "Secondary") { this.gridTrsMisc = this.secondaryBag.gridTrs; this.gridStateMisc = this.secondaryBag.gridState; this.gridImgMisc = this.secondaryBag.gridImg; } int num = this.gridAmt - this.equippedGridAmt; if (this.startDragObjectScript && this.dropScript && type != "Hidden" && flag && !Records.x.selling && Records.x.atMerchant && !this.startDragObjectScript.merchantTake && this.dropScript.merchantTake) { return false; } float num2 = this.distThresh * this.distThresh; if (!mouse) { num2 = 100000000f; } if (this.dropScript && type != "Hidden" && (this.dropScript.portrait || this.dropScript.ground || this.dropScript.equip)) { return false; } if (!item) { return false; } if (this.hitItem && Links.x.mk && type != "Hidden") { return false; } this.sizeY = item.invRow._SizeY; this.sizeX = item.invRow._SizeX; int equipSlotID = item.invRow._EquipSlotID; if (this.sizeX == 1 && this.sizeY == 1 && mouse && !Links.x.joy) { vector = Links.x.menuCamera.ScreenToWorldPoint(Input.mousePosition); } if (this.hitItem && type != "Hidden" && (this.hitItem == this.dragItem || !this.hitItem.active)) { this.hitItem = null; } if (this.sizeX == 0 || this.sizeY == 0) { return false; } if (!mouse) { this.ClearDrag(); } bool flag2 = true; if (type == "Hidden") { flag2 = false; } float num3 = float.PositiveInfinity; if (type != "Secondary") { for (int i = 0; i < num; i++) { vector.z = this.gridTrs[i].position.z; if (!this.gridState[i] || flag2) { float num4 = this.SubtractVectors(this.gridTrs[i].position, vector).sqrMagnitude; if (num4 < num3 && num4 < num2) { bool flag3 = true; this.foundTiles.Clear(); this.sizeY = item.invRow._SizeY; this.sizeX = item.invRow._SizeX; for (int j = 0; j < this.sizeY; j++) { if (flag3) { int num5 = (i + j) % gridSizeY; if (num5 != 0 || (num5 == 0 && j == 0)) { if (!this.gridState[i + j] || flag2) { int num6 = i + j; for (int k = 0; k < this.sizeX; k++) { int num7 = num6 + k * gridSizeY; if (num7 < num) { if (!this.gridState[num7] || flag2) { if (this.foundTiles.Count == 0) { this.foundTiles.Add(num7); } else if (this.foundTiles.Count > 0) { this.foundTiles.Add(num7); } } else { flag3 = false; } } else { flag3 = false; } } } else { flag3 = false; } } else { flag3 = false; } } } if (this.draggingSocket && this.hitItem) { flag3 = false; } if (this.hitItem && type != "Hidden") { flag3 = false; } if (flag3 && this.foundTiles.Count > 0) { this.ClearDrag(); for (int l = 0; l < this.foundTiles.Count; l++) { this.dragHoverImg.Add(this.foundTiles[l]); if (mouse) { this.gridImg[this.foundTiles[l]].sprite = this.hoverSprite; } } this.inSecondaryBag = false; item.bagGridID = this.foundTiles[0]; num3 = num4; } } } } } if ((type != "Hidden" && flag && this.open) || type == "Secondary") { gridSizeX = this.secondaryBag.mainBagX; gridSizeY = this.secondaryBag.mainBagY; for (int m = 0; m < this.secondaryBag.gridAmt; m++) { if (m < this.gridTrsMisc.Count) { vector.z = this.gridTrsMisc[m].position.z; if (!this.gridStateMisc[m]) { float num4 = this.SubtractVectors(this.gridTrsMisc[m].position, vector).sqrMagnitude; if (num4 < num3 && num4 < num2) { bool flag4 = true; this.foundTiles.Clear(); for (int n = 0; n < this.sizeY; n++) { if (flag4) { int num8 = (m + n) % gridSizeY; if (num8 != 0 || (num8 == 0 && n == 0)) { if (!this.gridStateMisc[m + n]) { int num9 = m + n; for (int num10 = 0; num10 < this.sizeX; num10++) { int num11 = num9 + num10 * gridSizeY; if (num11 < this.secondaryBag.gridAmt) { if (!this.gridStateMisc[num11]) { this.foundTiles.Add(num11); } else { flag4 = false; } } else { flag4 = false; } } } else { flag4 = false; } } else { flag4 = false; } } } if (this.draggingSocket && this.hitItem) { flag4 = false; } if (flag4) { this.ClearDrag(); for (int num12 = 0; num12 < this.foundTiles.Count; num12++) { this.dragHoverImg.Add(this.foundTiles[num12]); if (mouse) { this.gridImgMisc[this.foundTiles[num12]].sprite = this.filledSprite; } } item.bagGridID = this.foundTiles[0]; num3 = num4; this.inSecondaryBag = true; } } } } } } if (this.dragHoverImg.Count == this.sizeX * this.sizeY) { if (this.copyGridList) { this.dragHoverImgCopy.Clear(); for (int num13 = 0; num13 < this.dragHoverImg.Count; num13++) { this.dragHoverImgCopy.Add(this.dragHoverImg[num13]); } this.copyGridList = false; } return true; } this.ClearDrag(); return false; } // Token: 0x060010B1 RID: 4273 RVA: 0x00140560 File Offset: 0x0013E760 public void ClearDrag() { if (!this.inSecondaryBag) { this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; } for (int i = 0; i < this.dragHoverImg.Count; i++) { int num = this.dragHoverImg[i]; if (!this.inSecondaryBag) { if (num < this.gridState.Count) { if (!this.gridState[num]) { if (this.gridImg[num].sprite != this.emptySprite) { this.gridImg[num].sprite = this.emptySprite; } } else if (this.gridImg[num].sprite != this.filledSprite) { this.gridImg[num].sprite = this.filledSprite; } } } else if (!this.gridStateMisc[num]) { if (this.gridImgMisc[num].sprite != this.emptySprite) { this.gridImgMisc[num].sprite = this.emptySprite; } } else if (this.gridImgMisc[num].sprite != this.filledSprite) { this.gridImgMisc[num].sprite = this.filledSprite; } } this.dragHoverImg.Clear(); } // Token: 0x060010B2 RID: 4274 RVA: 0x001406E8 File Offset: 0x0013E8E8 public void HoverOverGround() { if (this.inSecondaryBag) { this.gridTrsMisc = this.secondaryBag.gridTrs; this.gridStateMisc = this.secondaryBag.gridState; this.gridImgMisc = this.secondaryBag.gridImg; this.currGridImg = this.gridImgMisc; this.currGridTrs = this.gridTrsMisc; this.currGridState = this.gridStateMisc; } else { this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; } this.ClearDrag(); } // Token: 0x060010B3 RID: 4275 RVA: 0x00140780 File Offset: 0x0013E980 public bool SetupGridFromSave(global::Item item, int startRow, int startCol, int gridSizeX, int gridSizeY) { this.localImg = item.gridImg; this.localImg.Clear(); this.foundTiles.Clear(); this.sizeX = item.invRow._SizeX; this.sizeY = item.invRow._SizeY; for (int i = 0; i < this.sizeY; i++) { if (startRow + i < gridSizeX * (startRow + 1) - 1) { int num = startRow + i; for (int j = 0; j < this.sizeX; j++) { int num2 = num + j * gridSizeY; if (num2 < this.gridAmt) { this.foundTiles.Add(num2); } } } } for (int k = 0; k < this.foundTiles.Count; k++) { this.localImg.Add(this.foundTiles[k]); this.gridState[this.foundTiles[k]] = true; this.gridImg[this.foundTiles[k]].sprite = this.filledSprite; } if (this.foundTiles.Count == item.invRow._SizeX * item.invRow._SizeY) { this.SnapToGrid(item, "Hidden"); return true; } return false; } // Token: 0x060010B4 RID: 4276 RVA: 0x001408C8 File Offset: 0x0013EAC8 public bool FindOpenSpace(Vector3 pt, global::Item item, int gridSizeX, int gridSizeY, string type, InventoryContainer listBag) { if (!item) { return false; } if (this.open) { this.ClearDrag(); } if (type != "Secondary" && this.open) { this.CheckSlotImages(); this.UpdateSlotStates(listBag); } this.copyGridList = true; bool flag = this.CheckGrid(false, item, pt, new Vector2(0f, 0f), gridSizeX, gridSizeY, type); this.localImg = item.gridImg; if (type == "Secondary") { this.gridTrsMisc = this.secondaryBag.gridTrs; this.gridStateMisc = this.secondaryBag.gridState; this.gridImgMisc = this.secondaryBag.gridImg; this.currGridImg = this.gridImgMisc; this.currGridTrs = this.gridTrsMisc; this.currGridState = this.gridStateMisc; } else { this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; } if (this.dragHoverImgCopy.Count == item.invRow._SizeX * item.invRow._SizeY && flag) { this.localImg.Clear(); for (int i = 0; i < this.dragHoverImgCopy.Count; i++) { this.localImg.Add(this.dragHoverImgCopy[i]); if (type != "Hidden" || this.open) { this.currGridImg[this.dragHoverImgCopy[i]].sprite = this.filledSprite; } this.currGridState[this.dragHoverImgCopy[i]] = true; } if (this.localImg.Count > 0) { item.bagGridID = this.localImg[0]; } this.SnapToGrid(item, type); return true; } if (type != "Secondary") { Links.x.gameFeed.AddFeed("Bag is full. Cannot add item."); } for (int j = 0; j < this.dragHoverImgCopy.Count; j++) { this.currGridImg[this.dragHoverImgCopy[j]].sprite = this.emptySprite; this.currGridState[this.dragHoverImgCopy[j]] = false; } if (!this.open && type != "Secondary") { Links.x.gameFeed.ShowNotice("Bag is full"); Character character = this.selectedPlayer; Debug.Log(((character != null) ? character.ToString() : null) + " bag is full"); } if (Records.x.editor || Records.x.secrets) { Debug.Log(string.Concat(new string[] { "item space not found ", (item != null) ? item.ToString() : null, " ", gridSizeX.ToString(), " ", gridSizeY.ToString(), " ", type, " ", this.open.ToString() })); } return false; } // Token: 0x060010B5 RID: 4277 RVA: 0x00140BF4 File Offset: 0x0013EDF4 public void SetBackImageSize(Image img, global::Item item) { img.gameObject.transform.localScale = new Vector3(1f, 1f, 1f); if (item) { Vector3 position = item.transform.position; img.gameObject.transform.position = position; item.ToggleBackImage(true); if (!img.gameObject.activeSelf) { img.gameObject.SetActive(true); } if (item.worldItem) { img.gameObject.GetComponent().sizeDelta = new Vector3(19f, 19f, 1f); } else { img.gameObject.GetComponent().sizeDelta = new Vector3(19f * (float)item.invRow._SizeY, 19f * (float)item.invRow._SizeX, 1f); } this.SetBackSprite("Normal", img, item); } } // Token: 0x060010B6 RID: 4278 RVA: 0x00140CF8 File Offset: 0x0013EEF8 public void SetBackSprite(string type, Image img, global::Item item) { if (Links.x.characterSheet.merchant && item.durability.w >= 1f) { img.sprite = this.backUnavailable; return; } if (item.worldItem) { if (type == "Normal") { img.sprite = this.backGround; } if (type == "Hover") { img.sprite = this.backGroundHover; } if (type == "Unavailable") { img.sprite = this.backUnavailable; return; } } else { if (type == "Normal") { img.sprite = this.backNormal; } if (type == "Hover") { img.sprite = this.backHover; } if (type == "Unavailable") { img.sprite = this.backUnavailable; } } } // Token: 0x060010B7 RID: 4279 RVA: 0x00140DDC File Offset: 0x0013EFDC public void SnapToGrid(global::Item item, string type) { if (item) { this.localImg = item.gridImg; if (this.localImg.Count > 0) { item.bagGridID = this.localImg[0]; } Vector3 vector = Vector3.zero; int num = 0; bool flag = false; if (this.secondaryDragSave) { flag = true; } if ((type != "Hidden" && this.inSecondaryBag && flag) || type == "Secondary") { this.gridTrsMisc = this.secondaryBag.gridTrs; this.gridStateMisc = this.secondaryBag.gridState; this.gridImgMisc = this.secondaryBag.gridImg; this.currGridImg = this.gridImgMisc; this.currGridTrs = this.gridTrsMisc; this.currGridState = this.gridStateMisc; } else { this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; } for (int i = 0; i < this.localImg.Count; i++) { this.currGridState[this.localImg[i]] = true; vector += this.currGridTrs[this.localImg[i]].position; if (type != "Hidden" || this.open) { this.currGridImg[this.localImg[i]].sprite = this.filledSprite; } num++; } if (vector != Vector3.zero) { vector /= (float)num; } item.gameObject.transform.position = vector; this.SetBackImageSize(item.backImage, item); } } // Token: 0x060010B8 RID: 4280 RVA: 0x00140F9C File Offset: 0x0013F19C public Vector3 GetLocalGridPosition(global::Item item, int gridIndex, string type) { if (item) { bool flag = false; if ((type != "Hidden" && this.inSecondaryBag && flag) || type == "Secondary") { this.currGridTrs = this.gridTrsMisc; } else { this.currGridTrs = this.gridTrs; } this.localImg = item.gridImg; bool flag2 = false; Vector3 position = item.gameObject.transform.position; if (this.localImg.Count == 0 || item.inGroundMenu) { Vector3 vector = Vector3.zero; int num = 0; this.localImg = item.gridImg; this.localImg.Clear(); this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; int num2 = item.invRow._SizeX; int num3 = item.invRow._SizeY; int num4 = 0; for (int i = 0; i < item.invRow._SizeY; i++) { int num5 = (num4 + i) % this.mainBagY; if (num5 != 0 || (num5 == 0 && i == 0)) { int num6 = num4 + i; for (int j = 0; j < item.invRow._SizeX; j++) { int num7 = num6 + j * this.mainBagY; vector += this.currGridTrs[num7].position; this.localImg.Add(num7); num++; } } } if (vector != Vector3.zero) { vector /= (float)num; } item.gameObject.transform.position = vector; } Vector3 vector2; if (gridIndex > -1 && gridIndex < this.currGridTrs.Count) { if (gridIndex > -1 && gridIndex < this.localImg.Count) { if (this.localImg[gridIndex] < this.currGridTrs.Count && this.localImg[gridIndex] > -1) { vector2 = this.currGridTrs[this.localImg[gridIndex]].position; } else { vector2 = item.gameObject.transform.position; } } else { vector2 = item.gameObject.transform.position; } } else { vector2 = item.gameObject.transform.position; } if (flag2) { this.localImg.Clear(); item.gameObject.transform.position = position; } return vector2; } return new Vector3(10000f, 10000f, 0f); } // Token: 0x060010B9 RID: 4281 RVA: 0x0014122C File Offset: 0x0013F42C public Vector3 OffsetToCornerEquipped(global::Item item) { this.localImg = item.gridImg; Vector3 vector = Vector3.zero; int num = 0; this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; int num2 = item.invRow._SizeX * item.invRow._SizeY; int num3 = 0; for (int i = 0; i < item.invRow._SizeY; i++) { int num4 = (num3 + i) % this.mainBagY; if (num4 != 0 || (num4 == 0 && i == 0)) { int num5 = num3 + i; for (int j = 0; j < item.invRow._SizeX; j++) { int num6 = num5 + j * this.mainBagY; vector += this.currGridTrs[num6].position; num++; } } } if (vector != Vector3.zero) { vector /= (float)num; } if (num2 == 1) { if (this.localImg.Count == 1) { vector = this.currGridTrs[this.localImg[0]].position; } return vector - this.currGridTrs[this.localImg[0]].position; } return vector - this.currGridTrs[0].position; } // Token: 0x060010BA RID: 4282 RVA: 0x00141388 File Offset: 0x0013F588 public Vector3 OffsetToCorner(global::Item item) { this.localImg = item.gridImg; Vector3 vector = Vector3.zero; int num = 0; if (this.fromSecondaryBag) { this.currGridImg = this.gridImgMisc; this.currGridTrs = this.gridTrsMisc; this.currGridState = this.gridStateMisc; } else { this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; } for (int i = 0; i < this.localImg.Count; i++) { vector += this.currGridTrs[this.localImg[i]].position; num++; } if (vector != Vector3.zero) { vector /= (float)num; } if (this.localImg.Count == 1) { vector = this.currGridTrs[this.localImg[0]].position; } if (this.localImg.Count > 0) { return Vector3.zero; } return vector - this.currGridTrs[this.localImg[0]].position; } // Token: 0x060010BB RID: 4283 RVA: 0x001414B0 File Offset: 0x0013F6B0 public void EndDragging(bool failed) { if (this.secondaryDragSave) { this.currGridImg = this.gridImgMisc; this.currGridTrs = this.gridTrsMisc; this.currGridState = this.gridStateMisc; } else { this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; } if (Links.x.joy) { Links.x.inventory.SetDragMessageText("", null); } this.groundContainer.btn.interactable = false; this.groundContainer.img.raycastTarget = false; this.groundContainer.img.enabled = true; if (Links.x.joy) { this.groundContainerBtn.enabled = false; this.groundContainerBtnImg.enabled = false; } for (int i = 0; i < this.groundSlotsList.Count; i++) { this.groundSlotsList[i].img.raycastTarget = true; } if (this.dragItem) { if (this.dragItem.inGroundMenu) { if (failed) { this.dragItem.transform.SetAsFirstSibling(); } else { if (this.dragItem.transform.parent != this.groundBag.groundItemsParent.transform) { this.dragItem.LeaveGroundMenuList(); } if (!this.bagItems.Contains(this.dragItem) && this.dragItem.transform.parent != this.groundBag.groundItemsParent.transform) { this.ListsAddBagItem(this.dragItem); } } this.dragItem.ToggleBackImage(true); } else { this.dragItem.ToggleBackImage(true); } } if (this.dragItem) { Links.x.characterSheet.PlayRandomClick(); } if (failed) { if (this.dragItem) { for (int j = 0; j < this.dragSaveImg.Count; j++) { if (this.dragItem) { this.currGridImg[this.dragSaveImg[j]].sprite = this.filledSprite; } else { this.currGridImg[this.dragSaveImg[j]].sprite = this.filledSprite; } this.currGridState[this.dragSaveImg[j]] = true; } if (this.dragSaveImg.Count > 0 && this.dragItem) { this.dragItem.bagGridID = this.dragSaveImg[0]; } } } else { for (int k = 0; k < this.dragSaveImg.Count; k++) { this.currGridImg[this.dragSaveImg[k]].sprite = this.emptySprite; this.currGridState[this.dragSaveImg[k]] = false; } } if (this.inSecondaryBag) { this.currGridImg = this.gridImgMisc; this.currGridTrs = this.gridTrsMisc; this.currGridState = this.gridStateMisc; } else { this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; } this.dragging = false; this.ToggleCharacterSheetButtonStateForDrag(false); this.openBag.UpdateItemInteractableState(true); this.groundContainer.UpdateItemInteractableState(true); if (Links.x.joy) { Links.x.characterSheet.SetSlotButtons(false); Links.x.characterSheet.DraggingButtons(false); this.SetColorsForEquipButtons(false); } if (!failed) { if (this.dragItem) { this.localImg = this.dragItem.gridImg; this.localImg.Clear(); for (int l = 0; l < this.dragHoverImg.Count; l++) { this.localImg.Add(this.dragHoverImg[l]); if (this.inSecondaryBag) { this.currGridImg[this.dragHoverImg[l]].sprite = this.emptySprite; } else { this.currGridImg[this.dragHoverImg[l]].sprite = this.emptySprite; } this.currGridState[this.dragHoverImg[l]] = true; } if (this.dragHoverImg.Count > 0) { this.dragItem.bagGridID = this.dragHoverImg[0]; } } this.CheckSlotImages(); } else { for (int m = 0; m < this.dragHoverImg.Count; m++) { this.currGridImg[this.dragHoverImg[m]].sprite = this.emptySprite; this.currGridState[this.dragHoverImg[m]] = false; } } if (Links.x.joy && this.dragItem) { if (this.dragItem.inGroundMenu) { EventSystem.current.SetSelectedGameObject(this.dragItem.gameObject); } else { bool flag = this.hitEquipped && failed; } } this.ClearDrag(); this.UpdateMisc(); if (Links.x.arrowKit.open) { Links.x.arrowKit.UpdateFromInventoryChange(); } bool flag2 = this.enchantMenu.open; if (Links.x.characterSheet.booksMenu.open) { Links.x.characterSheet.booksMenu.doUpdate = true; } bool rulesetOpen = Links.x.characterSheet.rulesetOpen; } // Token: 0x060010BC RID: 4284 RVA: 0x00141A69 File Offset: 0x0013FC69 public void CheckEquippedState(global::Item item) { } // Token: 0x060010BD RID: 4285 RVA: 0x00141A6C File Offset: 0x0013FC6C public void HoveringOverItem(global::Item item, bool state, string type) { if (item.forSale && !Links.x.merchant.isBoro()) { float num = Mathf.Ceil((float)item.invRow._SellPrice * this.selectedPlayer.stats.PartyDispositionSell(Links.x.diorama.sceneName, Links.x.merchant.merchantCharacter)); num = Links.x.merchant.GetItemHistoryCount(item.invRow, num); if (item.invRow._NeedFullStack) { num *= 1f; } else { num *= (float)item.stackSize; } if (item.socketA.x > 0f) { num += item.socketB.y; } if (num > (float)this.emeralds) { return; } } this.localImg = item.gridImg; if (type == "Secondary") { this.currGridImg = this.gridImgMisc; this.currGridTrs = this.gridTrsMisc; this.currGridState = this.gridStateMisc; } else { this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; } if (item == this.dragItem) { return; } for (int i = 0; i < this.localImg.Count; i++) { if (state) { this.currGridImg[this.localImg[i]].sprite = this.hoverSprite; } else { this.currGridImg[this.localImg[i]].sprite = this.filledSprite; } } } // Token: 0x060010BE RID: 4286 RVA: 0x00141C10 File Offset: 0x0013FE10 public void RemoveItemSlots(global::Item item, bool overrideSecondary) { this.dragSaveImg.Clear(); if (item.forSale || (this.fromSecondaryBag && !overrideSecondary)) { this.currGridImg = this.gridImgMisc; this.currGridTrs = this.gridTrsMisc; this.currGridState = this.gridStateMisc; } else { this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; } this.localImg = item.gridImg; for (int i = 0; i < this.localImg.Count; i++) { if (this.localImg[i] < this.currGridImg.Count) { this.currGridImg[this.localImg[i]].sprite = this.emptySprite; this.currGridState[this.localImg[i]] = false; } else { Debug.Log(string.Concat(new string[] { "trouble with remove item slots: ", (item != null) ? item.ToString() : null, ", from secondary bag: ", this.fromSecondaryBag.ToString(), ", override secondary: ", overrideSecondary.ToString() })); } } this.localImg.Clear(); } // Token: 0x060010BF RID: 4287 RVA: 0x00141D60 File Offset: 0x0013FF60 public int GetSocketLine(int index) { for (int i = 0; i < this.allSockets.Count; i++) { if (this.allSockets[i]._ItemID == index) { return i; } } return -1; } // Token: 0x060010C0 RID: 4288 RVA: 0x00141D9C File Offset: 0x0013FF9C public bool CheckSocket(global::Item socketItem, global::Item hoveringItem) { if (!socketItem || !hoveringItem) { return false; } if (hoveringItem.invRow._SocketMax == 0 || hoveringItem.socketMax == 0) { return false; } int socketLine = this.GetSocketLine(socketItem.ID); if (socketLine <= -1) { return false; } Library.Sockets sockets = this.allSockets[socketLine]; if (hoveringItem.invRow._Tag.Contains("Armor")) { return !(sockets._Category != "Armor"); } if (hoveringItem.invRow._MainSkill == "Bow" || hoveringItem.invRow._MainSkill == "Sling" || hoveringItem.invRow._MainSkill.Contains("Elixir")) { return !(sockets._Category != "Range"); } return !(sockets._Category == "Range") && !(sockets._Category == "Armor"); } // Token: 0x060010C1 RID: 4289 RVA: 0x00141EAC File Offset: 0x001400AC public void DragListen() { if (this.pickingEquipItem) { this.ClearDrag(); return; } Vector3 vector = Vector3.zero + this.offset; if (Links.x.joy) { if (this.dragItem) { this.startPos += new Vector3(Links.x.fellowship.move.x, Links.x.fellowship.move.y, 0f) * Links.x.fellowship.move.magnitude; vector = this.startPos; if (Links.x.gameplay.currentEventObject == null) { EventSystem.current.SetSelectedGameObject(this.groundContainer.gameObject); } } } else { vector = Links.x.menuCamera.ScreenToWorldPoint(Input.mousePosition) + this.offset; } if (!this.open) { return; } this.addMoney = 0; if (Links.x.mk) { this.dragGo.transform.position = vector; if (Input.GetMouseButton(0) && this.dragItem && this.dragging && (this.clickCount == 0 || this.clickCount == 2) && this.dragItem.backImage.enabled) { this.dragItem.ToggleBackImage(false); } } else if (Links.x.gameplay.currentEventObject != null) { string name = Links.x.gameplay.currentEventObject.name; if (name.Contains("_Grid_")) { if (Links.x.gameplay.currentEventObject.transform.parent.gameObject.name.Contains("Merchant")) { this.dropScript = this.merchantBag; this.dropObject = this.merchantBag.gameObject; this.dropPosition = this.dragItem.transform.position; } else { this.dropScript = this.openBag; this.dropObject = this.openBag.gameObject; this.dropPosition = this.dragItem.transform.position; } } else if (name.Contains("Equip")) { this.dropScript = this.equipBag; this.dropObject = this.equipBag.gameObject; this.dropPosition = this.dragItem.transform.position; } else if (name.Contains("Ground")) { this.dropScript = this.groundContainer; this.dropObject = this.groundContainer.gameObject; this.dropPosition = this.dragItem.transform.position; } else if (name.Contains("Portrait")) { this.dropScript = Links.x.gameplay.currentEventObject.gameObject.GetComponent(); this.dropObject = this.dropScript.gameObject; this.dropPosition = this.dragItem.transform.position; } else if (name.Contains("Scrollbar")) { this.dropScript = null; this.dropObject = null; this.dropPosition = this.dragItem.transform.position; } else if (Links.x.gameplay.currentEventObject.transform.parent.gameObject.name == "Equip Slots") { this.dropScript = this.equipBag; this.dropObject = Links.x.gameplay.currentEventObject; this.dropPosition = this.dragItem.transform.position; } } this.prevPosition = vector; if (Links.x.gameplay.actionStart && Time.realtimeSinceStartup > this.dragTime + 0.2f && Time.realtimeSinceStartup > this.actionSelectTime + 0.2f) { this.releaseItem = true; } bool flag = false; int num = this.mainBagX; int num2 = this.mainBagY; string text = ""; this.hoveringOverEquipmentSlot = false; if (this.dropScript) { if (this.dropScript.merchantTake || this.dropScript.merchantGive) { num = this.secondaryBagX; num2 = this.secondaryBagY; text = "Secondary"; } if (this.dropScript.ground) { this.ClearDrag(); } } if (this.dragItem) { flag = this.CheckGrid(true, this.dragItem, Vector3.zero, this.pickUpTiles, num, num2, text); } if (Links.x.joy) { if (flag) { Vector3 vector2 = Vector3.zero; int num3 = 0; for (int i = 0; i < this.dragHoverImg.Count; i++) { if (this.dropScript == this.merchantBag) { vector2 += this.gridTrsMisc[this.dragHoverImg[i]].position; } else { vector2 += this.gridTrs[this.dragHoverImg[i]].position; } num3++; } if (vector2 != Vector3.zero) { vector2 /= (float)num3; } vector2.z = 0f; this.dragItem.gameObject.transform.position = vector2; } if (this.dropScript && Links.x.gameplay.currentEventObject) { if (this.dropScript.ground) { this.dragGo.transform.position = Links.x.gameplay.currentEventObject.transform.position; } if (this.dropScript.equip) { this.hoveringOverEquipmentSlot = true; this.dragGo.transform.position = Links.x.gameplay.currentEventObject.transform.position; } if (this.dropScript.portrait) { this.dragGo.transform.position = Links.x.gameplay.currentEventObject.transform.position; } if (this.dragItem) { this.dragItem.SetSprite(false); } } if (this.dropScript != this.merchantBag && this.dropScript != this.openBag) { this.ClearDrag(); } } float num4 = -20f; this.dragGo.transform.localPosition = new Vector3(this.dragGo.transform.localPosition.x, this.dragGo.transform.localPosition.y, num4); if (!this.dropScript) { this.HoverOverGround(); flag = false; } else if (this.hitItem && this.dropScript.bag) { if (this.hitItem.bag) { this.dropScript = this.hitItem.bag; } flag = false; this.ClearDrag(); } if (Links.x.joy && Links.x.gameplay.currentEventObject && Links.x.gameplay.currentEventObject.name.Contains("Grid Item Back Image")) { flag = false; this.hitItem = Links.x.gameplay.currentEventObject.GetComponent().GetItem(); this.dragGo.transform.position = this.hitItem.tr.position + new Vector3(0.1f, 0.1f, 0f); this.ClearDrag(); } if (Links.x.joy) { Links.x.inventory.SetDragMessageText("Dragging", null); } bool flag2 = false; if ((Links.x.mk && Input.GetMouseButtonUp(0)) || (Links.x.joy && this.releaseItem) || this.closing) { this.hoveringOverEquipmentSlot = false; this.releaseItem = false; bool flag3 = false; bool flag4 = false; if (Records.x.InCombat(false) && Links.x.sensory.CanBeSeen(this.selectedPlayer)) { flag2 = true; } if (!this.dropObject && this.draggingSocket && this.hitItem && this.CheckSocket(this.dragItem, this.hitItem)) { this.dropScript = this.openBag; this.dropObject = this.openBag.gameObject; this.dropPosition = this.dragItem.transform.position; Debug.Log("Found socket"); } if (this.dropScript && this.startDragObjectScript && this.dropScript.portrait && this.startDragObjectScript.ground) { flag3 = true; } if (!this.dropObject || flag3) { flag3 = true; flag4 = false; } else if (this.dropScript != null) { global::Item item = null; bool flag5 = false; if (this.dropScript.bag && !this.hitItem) { for (int j = 0; j < this.dragHoverImg.Count; j++) { for (int k = 0; k < this.bagItems.Count; k++) { if (this.bagItems[k] && this.bagItems[k] != this.dragItem && this.bagItems[k].HasGridSlot(this.dragHoverImg[j])) { if (Records.x.editor) { string[] array = new string[8]; array[0] = "has item in slot "; array[1] = this.dragHoverImg[j].ToString(); array[2] = " "; int num5 = 3; global::Item item2 = this.bagItems[k]; array[num5] = ((item2 != null) ? item2.ToString() : null); array[4] = " "; int num6 = 5; InventoryContainer inventoryContainer = this.startDragObjectScript; array[num6] = ((inventoryContainer != null) ? inventoryContainer.ToString() : null); array[6] = " "; int num7 = 7; InventoryContainer inventoryContainer2 = this.dropScript; array[num7] = ((inventoryContainer2 != null) ? inventoryContainer2.ToString() : null); Debug.Log(string.Concat(array)); } if (!item || this.bagItems[k] == item) { item = this.bagItems[k]; flag5 = true; } else { flag4 = true; flag5 = false; item = null; } } } } } if (this.startDragObjectScript && ((this.dropScript.portrait && this.startDragObjectScript.merchantTake) || (this.dropScript.portrait && !this.dropScript.character))) { Debug.Log("Portrait drag"); this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; return; } if (this.startDragObjectScript && (this.startDragObjectScript.merchantTake && !this.dropScript.merchantTake && flag)) { bool flag6 = Links.x.merchant.isBoro(); if (this.dragItem.durability.w == 1f && !Links.x.merchant.CanSellContraband() && !flag6) { string merchantText = Links.x.merchant.GetMerchantText("Contraband"); Links.x.characterSheet.StartQuip(merchantText, FaceAnimations.AnimationNames.Frown); Links.x.characterSheet.PlayVignetteAnimation("Shake Head"); flag3 = true; } else if (this.dragItem.durability.w == 3f && !flag6) { string merchantText2 = Links.x.merchant.GetMerchantText("MerchantGoods"); Links.x.characterSheet.StartQuip(merchantText2, FaceAnimations.AnimationNames.Frown); Links.x.characterSheet.PlayVignetteAnimation("Shake Head"); flag3 = true; } else if ((this.dragItem.invRow._ID == Links.x.library.spellbookIndex || this.dragItem.invRow._ID == Links.x.library.songbookIndex) && !flag6) { string merchantText3 = Links.x.merchant.GetMerchantText("Book"); Links.x.characterSheet.StartQuip(merchantText3, FaceAnimations.AnimationNames.Frown); Links.x.characterSheet.PlayVignetteAnimation("Shake Head"); flag3 = true; } else if (this.dragItem.invRow._NeedFullStack && this.dragItem.stackSize < this.dragItem.invRow._MaxStackSize && !flag6) { string merchantText4 = Links.x.merchant.GetMerchantText("Full Stack"); Links.x.characterSheet.StartQuip(merchantText4, FaceAnimations.AnimationNames.Frown); Links.x.characterSheet.PlayVignetteAnimation("Shake Head"); flag3 = true; } else { if (item || flag4 || flag3) { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; return; } bool flag7 = false; float num8 = 0f; if (!Links.x.merchant.isBoro()) { num8 = Mathf.Ceil((float)this.dragItem.invRow._SellPrice * this.selectedPlayer.stats.PartyDispositionSell(Links.x.diorama.sceneName, Links.x.merchant.merchantCharacter)); num8 = Links.x.merchant.GetItemHistoryCount(this.dragItem.invRow, num8); if (this.dragItem.invRow._NeedFullStack) { num8 *= 1f; } else { num8 *= (float)this.dragItem.stackSize; } if (this.dragItem.socketA.x > 0f) { num8 += this.dragItem.socketB.y; } } if ((float)this.emeralds >= num8 || Links.x.merchant.isBoro()) { flag7 = true; } if (flag7 || !this.dragItem.forSale) { if (this.dragItem.forSale && !Links.x.merchant.isBoro()) { this.emeralds -= (int)Mathf.Ceil(num8); Debug.Log(num8); } if (!Links.x.merchant.isBoro()) { this.peddlerFX.gameObject.SetActive(true); this.peddlerFX.Play("Peddler", -1, 0f); this.peddlerSellAmount.text = num8.ToString(); this.peddlerSellAmount.color = Color.white; this.peddlerFX.GetComponent().position = this.dragItem.gameObject.transform.position; MasterAudio.PlaySoundAndForget("Inventory", 1f, new float?(1f), 0.25f, "Coins", null); string merchantText5 = Links.x.merchant.GetMerchantText("Sell"); Links.x.characterSheet.StartQuip(merchantText5, FaceAnimations.AnimationNames.Smile); Links.x.characterSheet.PlayVignetteAnimation("Nod Head"); } this.dragItem.forSale = false; Links.x.merchant.RemoveItem(this.dragItem); } else { string merchantText6 = Links.x.merchant.GetMerchantText("Unavailable"); Links.x.characterSheet.StartQuip(merchantText6, FaceAnimations.AnimationNames.Frown); flag3 = true; Links.x.characterSheet.PlayVignetteAnimation("Shake Head"); } } } if (this.dropScript.equip) { bool flag8 = false; if (this.dragItem.equipSlot >= 0) { flag8 = true; } int num9 = 0; int num10 = 0; Body body = Links.x.characterSheet.body; if (Links.x.joy) { body.HoverArmor(false); } if (flag8) { num9 = this.bagItems.IndexOf(this.dragItem); num10 = this.dragItem.equipSlot; int num11 = num10; if (Links.x.mk) { num10 = this.GetEquipSlot(num11, this.dragItem); } else { num10 = this.GetEquipSlot(num11, this.dragItem); } if (this.hitEquipped) { int equipIndex = this.hitEquipped.equipIndex; int equipSlot = this.dragItem.equipSlot; if (equipSlot == 4) { if (equipIndex == 4 || equipIndex == 5 || equipIndex == 6) { num10 = this.hitEquipped.equipIndex; } } else if (equipSlot == 0) { if (equipIndex == 0 || equipIndex == 1 || equipIndex == 2 || equipIndex == 3 || equipIndex == 16 || equipIndex == 17 || equipIndex == 18 || equipIndex == 15) { num10 = this.hitEquipped.equipIndex; } } else if (equipSlot == 13) { if (equipIndex == 13) { num10 = this.hitEquipped.equipIndex; } if (equipIndex == 14) { num10 = this.hitEquipped.equipIndex; } if (equipIndex == 7) { num10 = this.hitEquipped.equipIndex; } } else if (equipSlot == equipIndex) { num10 = this.hitEquipped.equipIndex; } } if (this.dropObject.transform.parent.gameObject.name.Contains("Equip Slots")) { if ((this.dropObject.name == "Alt Hand 1" || this.dropObject.name == "Alt Hand 2") && (this.dragItem.equipSlot == 0 || this.dragItem.equipSlot == 1)) { this.hitWeaponRack = true; } if (this.dropObject.name.Contains("Ring 1") && this.dragItem.equipSlot == 10) { num10 = 10; } if (this.dropObject.name.Contains("Ring 2") && this.dragItem.equipSlot == 10) { num10 = 11; } if (this.dropObject.name.Contains("Belt Item 1") && (this.dragItem.equipSlot == 13 || this.dragItem.equipSlot == 7)) { num10 = 7; } if (this.dropObject.name.Contains("Belt Item 2") && (this.dragItem.equipSlot == 13 || this.dragItem.equipSlot == 7)) { num10 = 13; } if (this.dropObject.name.Contains("Belt Item 3") && (this.dragItem.equipSlot == 13 || this.dragItem.equipSlot == 7)) { num10 = 14; } if (this.dropObject.name.Contains("Ammo 1") && this.dragItem.equipSlot == 4) { num10 = 4; } if (this.dropObject.name.Contains("Ammo 2") && this.dragItem.equipSlot == 4) { num10 = 5; } if (this.dropObject.name.Contains("Ammo 3") && this.dragItem.equipSlot == 4) { num10 = 6; } if (this.dropObject.name.Contains("Off Hand") && this.dragItem.equipSlot == 0) { num10 = 1; } } if (this.hitWeaponRack) { int equipSlot2 = this.dragItem.equipSlot; if (equipSlot2 == 0) { if (this.dropObject.name == "Alt Hand 2" && !this.dragItem.invRow._MainSkill.Contains("Whip")) { num10 = 17; } else { num10 = 16; } if (body.GetItemEquipped(16)) { Library.Inventory invRow = body.GetItemEquipped(16).invRow; if (invRow._TwoHanded || !this.selectedPlayer.stats.canUseTwoWeapons || invRow._MainSkill == "Whip") { if (this.selectedPlayer.stats.race != "Yeti") { num10 = 16; } } else if (this.selectedPlayer.stats.race == "Yeti" || (!this.dragItem.invRow._TwoHanded && this.dragItem.invRow._MainSkill != "Whip")) { num10 = 17; } else { num10 = 16; } } } else if (equipSlot2 == 1) { if (body.GetItemEquipped(16)) { Library.Inventory invRow2 = body.GetItemEquipped(16).invRow; if ((this.selectedPlayer.stats.race != "Yeti" && invRow2._TwoHanded) || !this.selectedPlayer.stats.canUseTwoWeapons || (this.dragItem.invRow._EquipSlotID != 1 && invRow2._MainSkill == "Whip")) { Links.x.characterSheet.StartQuip("I can't use these together", FaceAnimations.AnimationNames.Frown); if (this.dragParent) { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; flag4 = true; return; } flag4 = true; flag3 = false; } } num10 = 17; } } for (int l = 0; l < 2; l++) { int num12 = 0; if (l == 1) { num12 = 16; } if (num10 == num12 && this.selectedPlayer.stats.race == "Yeti") { flag8 = false; if (this.dragItem.invRow._TwoHanded && !this.dragItem.invRow._MainSkill.Contains("Sling") && !this.dragItem.invRow._MainSkill.Contains("Bow") && !this.dragItem.invRow._MainSkill.Contains("Elixir")) { flag8 = true; } if (!flag8) { Links.x.characterSheet.StartQuip("Too small for Yeti", FaceAnimations.AnimationNames.Frown); if (this.dragParent) { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; flag4 = true; return; } flag4 = true; flag3 = false; } } if (num10 == 1 + num12) { if (this.selectedPlayer.stats.race == "Yeti") { flag8 = false; if (this.dragItem.invRow._MainSkill.Contains("Large")) { flag8 = true; } if (this.dragItem.invRow._TwoHanded && !this.dragItem.invRow._MainSkill.Contains("Sling") && !this.dragItem.invRow._MainSkill.Contains("Bow") && !this.dragItem.invRow._MainSkill.Contains("Elixir")) { flag8 = true; } if (!flag8) { Links.x.characterSheet.StartQuip("Too small for Yeti", FaceAnimations.AnimationNames.Frown); if (this.dragParent) { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; flag4 = true; return; } flag4 = true; flag3 = false; } } if (this.dragItem.invRow._MainSkill.Contains("Whip")) { if (body.GetItemEquipped(num12)) { flag8 = false; Links.x.characterSheet.StartQuip("I can't carry a whip in this hand", FaceAnimations.AnimationNames.Frown); if (this.dragParent) { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; return; } flag4 = true; flag3 = false; } else { num10 = num12; } } } } for (int m = 0; m < 2; m++) { if (flag8) { global::Item item3 = this.dragItem; int num13 = 0; if (m == 1) { num13 = 16; } if ((num10 == 1 + num13 || num10 == num13) && !this.selectedPlayer.stats.race.Contains("Yeti") && this.dragItem.invRow._TwoHanded && num10 == num13) { ItemEquipped itemEquipped = body.GetItemEquipped(1 + num13); if (itemEquipped) { this.RemoveEquippedItem(itemEquipped, -1, 1 + num13); this.dragItem = item3; } itemEquipped = body.GetItemEquipped(2 + num13); if (itemEquipped) { this.RemoveEquippedItem(itemEquipped, -1, 2 + num13); this.dragItem = item3; } int num14; if (m == 0) { num14 = 3; } else { num14 = 15; } itemEquipped = body.GetItemEquipped(num14); if (itemEquipped) { this.RemoveEquippedItem(itemEquipped, -1, num14); this.dragItem = item3; } } } } for (int n = 0; n < 2; n++) { int num15 = 0; if (n == 1) { num15 = 16; } if (flag8) { if (num10 == num15) { if (body.GetItemEquipped(num15) && num10 == 1 + num15) { Library.Inventory invRow3 = body.GetItemEquipped(num15).invRow; Debug.Log(invRow3._MainSkill + " " + this.dragItem.invRow._EquipSlotID.ToString()); if (this.selectedPlayer.stats.race != "Yeti" && (invRow3._TwoHanded || this.dragItem.invRow._TwoHanded)) { Debug.Log("Can't equip shield, returning"); flag8 = false; Links.x.characterSheet.StartQuip("I can't use these together", FaceAnimations.AnimationNames.Frown); if (this.dragParent) { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; flag4 = true; return; } flag4 = true; flag3 = false; } } if (body.GetItemEquipped(1 + num15) && num10 == num15) { Library.Inventory invRow4 = body.GetItemEquipped(1 + num15).invRow; if (this.selectedPlayer.stats.race != "Yeti" && (this.dragItem.invRow._TwoHanded || (!invRow4._Tag.Contains("Shield") && this.dragItem.invRow._MainSkill == "Whip"))) { Debug.Log("Can't equip weapon, returning " + num10.ToString()); flag8 = false; Links.x.characterSheet.StartQuip("I can't use these together", FaceAnimations.AnimationNames.Frown); if (this.dragParent) { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; flag4 = true; return; } flag4 = true; flag3 = false; } } } if (num10 == 1 + num15 && body.GetItemEquipped(num15)) { Library.Inventory invRow5 = body.GetItemEquipped(num15).invRow; if ((invRow5._TwoHanded && this.selectedPlayer.stats.race != "Yeti") || (invRow5._MainSkill == "Whip" && this.dragItem.invRow._EquipSlotID != 1)) { flag8 = false; Debug.Log("Can't equip shield, returning"); if (this.dragItem.equipSlot == 1) { Links.x.characterSheet.StartQuip("I can't use a shield with this weapon", FaceAnimations.AnimationNames.Frown); } else { Links.x.characterSheet.StartQuip("I can't use an extra weapon with this weapon", FaceAnimations.AnimationNames.Frown); } if (this.dragParent) { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; flag4 = true; return; } flag4 = true; flag3 = false; } } if (num10 == 1 + num15 && this.selectedPlayer.stats.race != "Yeti" && this.dragItem.invRow._TwoHanded) { if (!body.GetItemEquipped(num15)) { num10 = num15; } if (num10 == 1 + num15) { flag8 = false; Debug.Log("Can't equip, returning"); Links.x.characterSheet.StartQuip("I can't carry this weapon in this hand", FaceAnimations.AnimationNames.Frown); if (this.dragParent) { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; flag4 = true; return; } flag4 = true; flag3 = false; } } } } } bool flag9 = false; if (this.dragItem.invRow._MainSkill != "" && flag8 && !this.SkillCheck(this.dragItem.invRow) && !Records.x.filming && num10 != 7 && num10 != 13 && num10 != 14) { flag9 = true; int num16 = Random.Range(0, 3); string text2 = "This is unfamiliar"; if (num16 == 1) { text2 = "I've not trained with this"; } if (num16 == 2) { text2 = "I don't know how to use this"; } Links.x.characterSheet.StartQuip(text2, FaceAnimations.AnimationNames.Frown); } if (this.dragItem.invRow._Tag == "Ammunition" && (this.dragItem.invRow._Name.Contains("Dart") || this.dragItem.invRow._Name.Contains("Vial")) && (this.dragItem.ID > Links.x.library.dartsMin || (this.dragItem.ID > Links.x.library.vialsMin + 1 && this.dragItem.ID <= Links.x.library.vialsMax))) { flag8 = false; Debug.Log("Can't equip, returning"); Links.x.characterSheet.StartQuip("I should keep this in my bag until I need it", FaceAnimations.AnimationNames.Frown); if (this.dragParent) { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; flag4 = true; return; } flag4 = true; flag3 = false; } bool flag10 = false; global::Item item4 = this.dragItem; ItemEquipped itemEquipped2 = null; if (flag8) { if (this.bagID[num10] > 1) { itemEquipped2 = body.GetItemEquipped(num10); if (itemEquipped2) { flag10 = true; } } if (flag10 && itemEquipped2.invRow._Stackable && itemEquipped2.invRow._ID == this.dragItem.invRow._ID && ((itemEquipped2.socketA == this.dragItem.socketA && itemEquipped2.socketB == this.dragItem.socketB) || (itemEquipped2.socketA.x <= 0f && this.dragItem.socketA.x <= 0f))) { if (itemEquipped2.stackSize + this.dragItem.stackSize <= itemEquipped2.invRow._MaxStackSize) { Debug.Log("stacking " + itemEquipped2.stackSize.ToString() + " " + this.dragItem.stackSize.ToString()); itemEquipped2.stackSize += this.dragItem.stackSize; if (itemEquipped2.buddyItemEquipped2D) { itemEquipped2.buddyItemEquipped2D.stackSize = itemEquipped2.stackSize; itemEquipped2.buddyItemEquipped2D.UpdateStackSize(); } if (itemEquipped2.buddyItemEquipped3D) { itemEquipped2.buddyItemEquipped3D.stackSize = itemEquipped2.stackSize; itemEquipped2.buddyItemEquipped3D.UpdateStackSize(); } this.SetBagAmt(num10, itemEquipped2.stackSize, this.selectedPlayer); itemEquipped2.UpdateStackSize(); if (itemEquipped2.buddyItemEquipped2D) { itemEquipped2.buddyItemEquipped2D.UpdateStackSize(); } if (num9 > -1) { this.bagItems[num9] = null; this.bagID[num9] = 0; this.bagAmount[num9] = 0; this.socketA[num9] = Vector3.zero; this.socketB[num9] = Vector3.zero; this.bagPos[num9] = -1; this.durabilities[num9] = new Vector4(0f, 0f, 0f, 0f); } this.dragItem.gridImg.Clear(); this.dragItem.DestroyItem(false, false); this.dragItem = null; this.HoverOverGround(); this.EndDragging(false); this.prevHitItem = null; this.prevItem = null; this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.selectedPlayer.UpdateListsFromInv(true); this.selectedPlayer.portrait.skillBag.SetTrinketGrid(false); return; } if (itemEquipped2.stackSize < itemEquipped2.invRow._MaxStackSize) { int stackSize = itemEquipped2.stackSize; itemEquipped2.stackSize = itemEquipped2.invRow._MaxStackSize; this.dragItem.stackSize -= itemEquipped2.invRow._MaxStackSize - stackSize; this.SetBagAmt(this.dragItem, this.dragItem.stackSize, this.selectedPlayer); this.SetBagAmt(num10, itemEquipped2.stackSize, this.selectedPlayer); Debug.Log(string.Concat(new string[] { "stacking ", itemEquipped2.stackSize.ToString(), " ", this.dragItem.stackSize.ToString(), " ", itemEquipped2.invRow._MaxStackSize.ToString() })); itemEquipped2.UpdateStackSize(); if (itemEquipped2.buddyItemEquipped2D) { itemEquipped2.buddyItemEquipped2D.stackSize = itemEquipped2.stackSize; itemEquipped2.buddyItemEquipped2D.UpdateStackSize(); } if (itemEquipped2.buddyItemEquipped3D) { itemEquipped2.buddyItemEquipped3D.stackSize = itemEquipped2.stackSize; itemEquipped2.buddyItemEquipped3D.UpdateStackSize(); } this.dragItem.CheckStackSize(); this.selectedPlayer.UpdateListsFromInv(true); this.selectedPlayer.portrait.skillBag.SetTrinketGrid(false); flag4 = true; flag8 = false; } } } if (flag8) { if (this.dragItem.ID == Links.x.library.torchID || this.dragItem.ID == Links.x.library.incenseTorchID) { this.dragItem.durability.z = Links.x.gameplay.seconds; } global::Item item5 = null; if (flag10) { if (itemEquipped2.ID == Links.x.library.torchID || itemEquipped2.ID == Links.x.library.incenseTorchID) { this.EndTorchTime(itemEquipped2); } item5 = this.SpawnItem(null, true, itemEquipped2.ID, itemEquipped2.stackSize, itemEquipped2.socketA, itemEquipped2.socketB, itemEquipped2.durability, Vector3.zero, this.openBag.transform); item5.durability = itemEquipped2.durability; item5.equipIndex = this.dragItem.equipIndex; item5.bagGridID = -1; item5.img.enabled = true; this.dragItem = item4; } if (num9 > -1) { this.bagItems[num9] = null; this.bagID[num9] = 0; this.bagAmount[num9] = 0; this.socketA[num9] = Vector3.zero; this.socketB[num9] = Vector3.zero; this.bagPos[num9] = -1; this.durabilities[num9] = new Vector4(0f, 0f, 0f, 0f); } if (num10 == 8 || num10 == 10 || num10 == 11 || num10 == 12) { Links.x.characterSheet.StartQuip("EquipJewelry", FaceAnimations.AnimationNames.Smile); } if ((num10 <= 7 || num10 == 9 || num10 >= 13) && !flag9) { Links.x.characterSheet.StartQuip("EquipItem", FaceAnimations.AnimationNames.Smile); } if (num10 == 0 || num10 == 16) { this.selectedPlayer.portrait.skillBag.ResetWeapons(); } this.dragItem = item4; this.bagItems[num10] = null; this.bagID[num10] = this.dragItem.ID; this.bagAmount[num10] = this.dragItem.stackSize; this.socketA[num10] = this.dragItem.socketA; this.socketB[num10] = this.dragItem.socketB; this.bagPos[num10] = -1; this.durabilities[num10] = this.dragItem.durability; if ((this.dragItem.invRow._Life > 0 || this.dragItem.invRow._Effect.Contains("Cure")) && this.dragItem.invRow._Effect.Contains("Cure") && this.dragItem.durability.x <= 0f) { float num17 = (float)this.dragItem.invRow._Life; if (num17 == 0f) { num17 = 300f; } float num18 = Links.x.gameplay.seconds + num17; Vector4 durability = this.dragItem.durability; durability.x = num18; this.durabilities[num10] = durability; } if (this.dragItem.inGroundMenu) { this.dragItem.LeaveGroundMenuList(); } this.dragItem.gridImg.Clear(); this.dragItem.DestroyItem(false, false); this.dragItem = null; this.HoverOverGround(); this.EndDragging(false); this.prevHitItem = null; this.prevItem = null; this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.selectedPlayer.UpdateListsFromInv(true); Links.x.characterSheet.PlayRandomClick(); this.selectedPlayer.CreateEquippedItems(this.bagID[num10], this.bagAmount[num10], this.socketA[num10], this.socketB[num10], num10 * 2, true); this.SetupEquippedItems(body, false, num10, false); if (item5) { if (!this.FindOpenSpace(item5.transform.position, item5, this.mainBagX, this.mainBagY, "Hidden", this.openBag)) { int num19 = -1; if (this.selectedPlayer.node != null) { num19 = (int)this.selectedPlayer.node.Area; } this.groundBag.DropLoot(item5.ID, item5.stackSize, item5.socketA, item5.socketB, item5.durability, this.selectedPlayer, this.selectedPlayer.tr.position + new Vector3(Random.Range(-2f, 2f), 0f, Random.Range(-2f, 2f)), true, item5.forSale, num19); item5.DestroyItem(false, false); if (this.open) { this.UpdateGroundSlots(); } } else { this.inSecondaryBag = false; this.ListsAddBagItem(item5); if (item5.enabled) { int num20 = this.bagItems.IndexOf(item5); if (num20 > -1) { this.bagPos[num20] = item5.bagGridID; } item5.AddSocketImgs(); item5.CheckStackSize(); } item5.gameObject.transform.SetParent(this.openBag.transform); item5.SetSprite(false); item5.ToggleBackImage(false); this.SetBackImageSize(item5.backImage, item5); if (this.dragSaveImg.Count > 0 && item5) { item5.bagGridID = this.dragSaveImg[0]; } this.selectedPlayer.UpdateListsFromInv(true); } } if (Links.x.joy && Links.x.gameplay.currentEventObject.GetComponent()) { Links.x.hudControl.SetJoyBox(Links.x.gameplay.currentEventObject.GetComponent()); } this.CheckSlotImages(); this.UpdateSlotStates(this.openBag); if (flag2) { this.AddCombatTime(this.selectedPlayer, "Long"); } return; } if (this.dragParent) { flag4 = true; return; } flag4 = true; flag3 = false; } else { if (this.startDragObjectScript == this.dropScript && this.dropScript.bag && flag && !flag4) { bool flag11 = false; if (this.draggingSocket && this.hitItem && this.CheckSocket(this.dragItem, this.hitItem)) { flag11 = true; } if (this.hitItem) { string[] array2 = new string[6]; array2[0] = "Checking socket "; array2[1] = flag11.ToString(); array2[2] = " "; array2[3] = this.draggingSocket.ToString(); array2[4] = " "; int num21 = 5; global::Item item6 = this.hitItem; array2[num21] = ((item6 != null) ? item6.ToString() : null); Debug.Log(string.Concat(array2)); } if (flag11 && this.hitItem) { bool flag12 = this.hitItem.AddSocket(this.GetSocketLine(this.dragItem.ID)); string[] array3 = new string[7]; array3[0] = flag12.ToString(); array3[1] = " "; array3[2] = this.dragItem.ID.ToString(); array3[3] = " "; array3[4] = this.GetSocketLine(this.dragItem.ID).ToString(); array3[5] = " "; int num22 = 6; global::Item item7 = this.hitItem; array3[num22] = ((item7 != null) ? item7.ToString() : null); Debug.Log(string.Concat(array3)); if (!flag12) { this.draggingSocket = false; this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragGo = null; this.draggingSocket = false; this.dragging = false; Links.x.characterSheet.PlayRandomClick(); return; } this.UpdateSocketLists(this.hitItem); this.EndDragging(false); this.DestroyedItem(this.dragItem, this.selectedPlayer); if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragging = false; this.draggingSocket = false; this.dragItem = null; if (this.itemTooltipOpen) { this.CloseTooltip(); } if (flag2) { this.AddCombatTime(this.selectedPlayer, "Long"); } return; } else { if (this.draggingSocket && !flag11 && this.hitItem) { this.draggingSocket = false; this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragGo = null; this.draggingSocket = false; this.dragItem = null; this.dragging = false; Links.x.characterSheet.PlayRandomClick(); return; } this.dragGo.transform.SetParent(this.dropObject.transform, true); int num23 = this.bagItems.IndexOf(this.dragItem); if (num23 > -1) { this.bagPos[num23] = this.dragItem.bagGridID; this.selectedPlayer.SetBagPosition(num23, this.dragItem.bagGridID); } global::Item item8 = this.dragItem; this.EndDragging(false); this.SnapToGrid(this.dragItem, ""); if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragging = false; this.draggingSocket = false; this.CheckEquippedState(this.dragItem); this.dragItem = null; if (!flag5) { goto IL_505A; } if (Records.x.editor) { string text3 = "Starting swap "; global::Item item9 = item; Debug.Log(text3 + ((item9 != null) ? item9.ToString() : null)); } this.hitItem = item; this.PrepareDrag(); this.swapping = true; item.ToggleBackImage(false); item.bag = this.openBag; this.offset = Vector3.zero; if (Links.x.mk) { vector = Links.x.menuCamera.ScreenToWorldPoint(Input.mousePosition) + this.offset; this.dragItem.transform.position = vector; } this.controllerOffset = Vector3.zero; if (!item8) { goto IL_505A; } item8.bag = this.openBag; this.startDragObjectScript = this.openBag; List list = item8.gridImg; if (list.Count > 0) { item8.bagGridID = list[0]; } using (List.Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { int num24 = enumerator.Current; this.gridState[num24] = true; this.gridImg[num24].sprite = this.filledSprite; } goto IL_505A; } } } if (this.startDragObjectScript == this.dropScript && this.dropScript.bag && !flag && !flag4) { bool flag13 = false; if (this.draggingSocket && this.hitItem && this.CheckSocket(this.dragItem, this.hitItem)) { flag13 = true; } if (this.hitItem) { Debug.Log(flag13.ToString() + " " + this.draggingSocket.ToString()); } if (flag13 && this.hitItem) { bool flag14 = this.hitItem.AddSocket(this.GetSocketLine(this.dragItem.ID)); if (Records.x.editor) { string[] array4 = new string[8]; array4[0] = "Socketed: "; array4[1] = flag14.ToString(); array4[2] = " "; array4[3] = this.dragItem.ID.ToString(); array4[4] = " "; array4[5] = this.GetSocketLine(this.dragItem.ID).ToString(); array4[6] = " "; int num25 = 7; global::Item item10 = this.hitItem; array4[num25] = ((item10 != null) ? item10.ToString() : null); Debug.Log(string.Concat(array4)); } if (!flag14) { this.draggingSocket = false; this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragGo = null; this.draggingSocket = false; this.dragging = false; Links.x.characterSheet.PlayRandomClick(); return; } bool flag15 = false; this.UpdateSocketLists(this.hitItem); this.hitItem.ToggleSockets(true); if (this.dragItem.stackSize > 1) { this.dragItem.stackSize--; int num26 = this.bagItems.IndexOf(this.dragItem); this.bagAmount[num26] = this.dragItem.stackSize; this.dragItem.CheckStackSize(); this.selectedPlayer.UpdateListsFromInv(true); flag15 = true; } int num27 = this.bagItems.IndexOf(this.hitItem); if (num27 >= 0) { this.durabilities[num27] = this.hitItem.durability; } if (flag15) { this.draggingSocket = false; this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragGo = null; this.draggingSocket = false; this.dragging = false; } else { this.EndDragging(false); this.DestroyedItem(this.dragItem, this.selectedPlayer); if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragging = false; this.draggingSocket = false; this.dragItem = null; this.UpdateSlotStates(this.openBag); this.CheckSlotImages(); } this.selectedPlayer.UpdateListsFromInv(true); if (flag2) { this.AddCombatTime(this.selectedPlayer, "Short"); } return; } else { bool flag16 = false; bool flag17 = false; if (this.hitItem && this.dragItem != this.hitItem) { if (this.dragItem.invRow._Stackable && this.hitItem && this.hitItem && this.hitItem.ID == this.dragItem.ID && this.hitItem.invRow._Stackable) { if (this.hitItem.socketA.x == -1f) { this.hitItem.socketA = Vector3.zero; this.hitItem.socketB = Vector3.zero; } if (this.dragItem.socketA.x == -1f) { this.dragItem.socketA = Vector3.zero; this.dragItem.socketB = Vector3.zero; } if (this.hitItem.socketA == this.dragItem.socketA && this.hitItem.socketB == this.dragItem.socketB && this.hitItem.durability.w == this.dragItem.durability.w) { if (this.hitItem.stackSize + this.dragItem.stackSize <= this.hitItem.invRow._MaxStackSize) { this.hitItem.stackSize += this.dragItem.stackSize; this.hitItem.CheckStackSize(); this.SetBagAmt(this.hitItem, this.hitItem.stackSize, this.selectedPlayer); flag17 = true; flag16 = true; } else if (this.hitItem.stackSize < this.hitItem.invRow._MaxStackSize) { int stackSize2 = this.hitItem.stackSize; this.hitItem.stackSize = this.hitItem.invRow._MaxStackSize; this.dragItem.stackSize -= this.hitItem.invRow._MaxStackSize - stackSize2; this.SetBagAmt(this.dragItem, this.dragItem.stackSize, this.selectedPlayer); this.SetBagAmt(this.hitItem, this.hitItem.stackSize, this.selectedPlayer); this.hitItem.CheckStackSize(); this.dragItem.CheckStackSize(); flag16 = true; } } } if (!flag16) { this.draggingSocket = false; this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragGo = null; this.draggingSocket = false; this.dragItem = null; this.dragging = false; Links.x.characterSheet.PlayRandomClick(); this.ClearDrag(); this.prevHitItem = null; this.prevItem = null; return; } if (flag17) { this.dragItem.DestroyItem(true, false); this.dragItem = null; this.HoverOverGround(); this.EndDragging(true); } else { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); } } else { flag4 = true; } if (!flag4) { if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragGo = null; this.draggingSocket = false; this.dragging = false; if (this.dragItem) { this.CheckEquippedState(this.dragItem); } Links.x.characterSheet.PlayRandomClick(); this.selectedPlayer.UpdateListsFromInv(true); this.dragItem = null; return; } } } else if (this.startDragObject != this.dropScript && this.dropScript.portrait && this.dropScript.character != this.selectedPlayer) { this.dragItem.backImage.transform.SetParent(this.dropScript.linkedBag.transform); this.dragItem.ToggleBackImage(false); if (this.openBag) { this.openBag.RemoveImage(this.dragItem.backImage); } if (this.dragItem.inGroundMenu) { this.groundContainer.RemoveImage(this.dragItem.backImage); } this.dropScript.linkedBag.AddImage(this.dragItem.backImage, this.dragItem); this.dragGo.transform.SetParent(this.dropScript.linkedBag.transform, true); int num28 = this.bagItems.IndexOf(this.dragItem); Character character = this.openBag.character; this.selectedPlayer = this.dropScript.character; this.openBag = this.selectedPlayer.inventoryBag; this.bagItems = this.openBag.bagItems; this.bagID = this.openBag.bagID; this.bagAmount = this.openBag.bagAmount; this.socketA = this.openBag.socketA; this.socketB = this.openBag.socketB; this.bagPos = this.openBag.bagPos; this.durabilities = this.openBag.durability; bool flag18 = false; bool flag19 = false; if ((this.selectedPlayer.tr.position - character.tr.position).sqrMagnitude < 900f && this.selectedPlayer.indoorID == character.indoorID) { flag19 = true; } bool flag20 = false; if (this.selectedPlayer == character) { flag20 = true; } this.GetBagLists(this.selectedPlayer); if (flag19) { bool flag21; ItemEquipped itemEquipped3; this.AddedToStack(this.dragItem, this.selectedPlayer, out flag21, out itemEquipped3); if (!flag21) { flag18 = this.FindOpenSpace(this.dragItem.transform.position, this.dragItem, this.mainBagX, this.mainBagY, "Hidden", this.openBag); } else { flag18 = true; this.dragItem.InventoryHoverOut(false); this.localImg = this.dragItem.gridImg; this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; for (int num29 = 0; num29 < this.localImg.Count; num29++) { if (!this.currGridState[this.localImg[num29]]) { this.currGridImg[this.localImg[num29]].sprite = this.emptySprite; } } this.dragItem.DestroyItem(false, false); this.dragItem = null; } } if (this.dragItem) { this.dragItem.InventoryHoverOut(false); } if (!flag18) { InventoryContainer inventoryContainer3 = this.openBag; inventoryContainer3.RemoveImage(this.dragItem.backImage); if (!flag19) { this.selectedPlayer.characterSheetPortrait.TooFar(); } else if (!flag20) { this.selectedPlayer.characterSheetPortrait.FullBag(); } this.GetBagLists(character); this.dragItem.backImage.transform.SetParent(this.openBag.transform); this.dragItem.bag = this.openBag; this.dragItem.ToggleBackImage(true); this.openBag.AddImage(this.dragItem.backImage, this.dragItem); Image backImage = this.dragItem.backImage; global::Item item11 = this.dragItem; this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.SetBackImageSize(backImage, item11); inventoryContainer3.Close(); return; } if (this.dragItem) { if (this.dragItem.inGroundMenu) { this.dragItem.LeaveGroundMenuList(); } this.ListsAddBagItem(this.dragItem); this.dragItem.bag = this.openBag; int num30 = this.bagItems.IndexOf(this.dragItem); if (num30 > -1) { this.bagPos[num30] = this.dragItem.bagGridID; } this.dragItem.AddSocketImgs(); this.dragItem.ToggleSockets(false); } this.selectedPlayer.UpdateListsFromInv(true); this.selectedPlayer.characterSheetPortrait.ReceivedItem(); this.UpdateWeight(this.openBag, this.selectedPlayer); InventoryContainer inventoryContainer4 = this.openBag; this.selectedPlayer = character; this.openBag = this.selectedPlayer.inventoryBag; this.bagItems = this.openBag.bagItems; this.bagID = this.openBag.bagID; this.bagAmount = this.openBag.bagAmount; this.socketA = this.openBag.socketA; this.socketB = this.openBag.socketB; this.bagPos = this.openBag.bagPos; this.durabilities = this.openBag.durability; if (this.dragItem) { this.localImg = this.dragItem.gridImg; this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; for (int num31 = 0; num31 < this.localImg.Count; num31++) { if (!this.currGridState[this.localImg[num31]]) { this.currGridImg[this.localImg[num31]].sprite = this.emptySprite; } } } if (num28 > -1) { this.bagItems[num28] = null; this.bagID[num28] = 0; this.bagAmount[num28] = 0; this.socketA[num28] = Vector3.zero; this.socketB[num28] = Vector3.zero; this.bagPos[num28] = -1; this.durabilities[num28] = Vector4.zero; } this.UpdateSlots(true, this.openBag); this.ClearDrag(); if (num28 == 0) { this.CreateFist(0, false, this.selectedPlayer, this.openBag.transform, true); } this.selectedPlayer.UpdateListsFromInv(true); inventoryContainer4.Close(); if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragItem = null; this.EndDragging(false); if (Links.x.joy) { Links.x.characterSheet.SetSelectionButton(); } if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragging = false; this.draggingSocket = false; this.dragItem = null; if (flag2) { this.AddCombatTime(this.selectedPlayer, "Long"); } return; } else if (this.startDragObject != this.dropScript && this.dropScript.ground) { this.dragGo.transform.SetParent(this.groundBag.groundItemsParent.transform, true); int num32 = this.bagItems.IndexOf(this.dragItem); if (num32 > -1) { this.bagItems[num32] = null; this.bagID[num32] = 0; this.bagAmount[num32] = 0; this.socketA[num32] = Vector3.zero; this.socketB[num32] = Vector3.zero; this.bagPos[num32] = -1; this.durabilities[num32] = Vector4.zero; } this.dragItem.gridImg.Clear(); if (this.dragItem.bag) { this.dragItem.bag.RemoveImage(this.dragItem.backImage); } else { this.groundContainer.RemoveImage(this.dragItem.backImage); } this.groundContainer.AddImage(this.dragItem.backImage, this.dragItem); this.dragItem.backImage.transform.SetParent(this.dragItem.transform); this.dragItem.bag = this.groundContainer; bool flag22 = false; Image backImage2 = this.dragItem.backImage; if (!this.dragItem.inGroundMenu) { int num33 = -1; if (this.selectedPlayer.node != null) { num33 = (int)this.selectedPlayer.node.Area; } global::Item item12 = this.groundBag.DropLoot(this.dragItem.ID, this.dragItem.stackSize, this.dragItem.socketA, this.dragItem.socketB, this.dragItem.durability, this.selectedPlayer, this.selectedPlayer.tr.position + new Vector3(Random.Range(-2f, 2f), 0f, Random.Range(-2f, 2f)), true, this.dragItem.forSale, num33); if (!item12) { flag22 = true; } else { item12.slotItem = this.dragItem; } this.dragItem.worldItem = item12; this.dragItem.ToggleBackImage(true); this.ClearDrag(); } this.SetBackImageSize(this.dragItem.backImage, this.dragItem); if (num32 == 0) { this.CreateFist(0, false, this.selectedPlayer, this.openBag.transform, true); } this.prevHitItem = null; this.prevItem = null; if (!flag22) { this.dragItem.InGroundMenuList(); this.selectedPlayer.UpdateListsFromInv(true); this.UpdateMisc(); this.dragSaveImg.Clear(); this.EndDragging(false); if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragging = false; this.draggingSocket = false; this.CheckEquippedState(this.dragItem); this.dragGo = null; this.dragItem = null; if (flag2) { this.AddCombatTime(this.selectedPlayer, "Medium"); } if (Links.x.joy) { EventSystem.current.SetSelectedGameObject(backImage2.gameObject); } return; } this.dragItem.DestroyItem(true, false); this.dragItem = null; this.HoverOverGround(); this.EndDragging(true); this.selectedPlayer.UpdateListsFromInv(true); return; } else { if (!flag4 && flag && (this.dropScript.bag || this.dropScript.merchantTake)) { float weight = this.dropScript.weight; float weight2 = this.dragItem.invRow._Weight; this.dragGo = this.dragItem.gameObject; if (this.startDragObjectScript && this.dropScript.merchantTake && !this.startDragObjectScript.merchantTake) { if (!Links.x.merchant.isBoro()) { if (this.dragItem.durability.w == 1f && !Links.x.merchant.CanSellContraband()) { string merchantText7 = Links.x.merchant.GetMerchantText("Contraband"); Links.x.characterSheet.StartQuip(merchantText7, FaceAnimations.AnimationNames.Frown); Links.x.characterSheet.PlayVignetteAnimation("Shake Head"); this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; return; } if (this.dragItem.durability.w == 3f) { string merchantText8 = Links.x.merchant.GetMerchantText("MerchantGoods"); Links.x.characterSheet.StartQuip(merchantText8, FaceAnimations.AnimationNames.Frown); Links.x.characterSheet.PlayVignetteAnimation("Shake Head"); this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; return; } if (this.dragItem.invRow._ID == Links.x.library.spellbookIndex || this.dragItem.invRow._ID == Links.x.library.songbookIndex) { string merchantText9 = Links.x.merchant.GetMerchantText("Book"); Links.x.characterSheet.StartQuip(merchantText9, FaceAnimations.AnimationNames.Frown); Links.x.characterSheet.PlayVignetteAnimation("Shake Head"); this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; return; } if (this.dragItem.invRow._NeedFullStack && this.dragItem.stackSize < this.dragItem.invRow._MaxStackSize) { string merchantText10 = Links.x.merchant.GetMerchantText("Full Stack"); Links.x.characterSheet.StartQuip(merchantText10, FaceAnimations.AnimationNames.Frown); Links.x.characterSheet.PlayVignetteAnimation("Shake Head"); this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; return; } if (Links.x.merchant.onlySelling) { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; return; } this.dragItem.forSale = true; } else { if (weight2 + Records.x.boroWeight > Records.x.BoroMaxWeight()) { Links.x.gameFeed.ShowNotice("Too heavy"); this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; return; } if (this.dragItem.ID == Links.x.library.bombID) { Links.x.gameFeed.ShowNotice("Cannot stash this"); this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; return; } } } if (flag4 || flag3) { goto IL_4EAA; } if (this.startDragObjectScript && !this.dragFromGround && !this.startDragObjectScript.merchantTake) { this.UpdateContainer(this.dragItem, this.dropPosition, this.startDragObjectScript, this.startDragObjectScript, false, true); } if (this.dragItem.inGroundMenu) { this.dragItem.LeaveGroundMenuList(); } this.dragItem.backImage.transform.SetParent(this.dropScript.transform); this.openBag.RemoveImage(this.dragItem.backImage); if (this.dragItem.inGroundMenu) { this.groundContainer.RemoveImage(this.dragItem.backImage); } this.dropScript.AddImage(this.dragItem.backImage, this.dragItem); this.dragGo.transform.SetParent(this.dropObject.transform, true); this.dragGo.transform.localPosition = new Vector3(this.dragGo.transform.localPosition.x, this.dragGo.transform.localPosition.y, -20f); if (this.dropScript && !this.dropScript.merchantTake) { this.UpdateContainer(this.dragItem, this.dropPosition, this.dropScript, this.startDragObjectScript, true, true); } this.dragItem.gameObject.transform.localRotation = Quaternion.Euler(Vector3.zero); int id = this.dragItem.ID; if (this.startDragObjectScript && this.dropScript.merchantTake && !this.startDragObjectScript.merchantTake) { this.dragItem.forSale = true; if (!Links.x.merchant.isBoro()) { float num34 = this.selectedPlayer.stats.PartyDispositionSell(Links.x.diorama.sceneName, Links.x.merchant.merchantCharacter); this.addMoney = (int)Mathf.Ceil((float)this.dragItem.invRow._SellPrice * num34); this.addMoney = (int)Links.x.merchant.GetItemHistoryCount(this.dragItem.invRow, (float)this.addMoney); if (this.dragItem.invRow._NeedFullStack) { this.addMoney = this.addMoney; } else { this.addMoney *= this.dragItem.stackSize; } if (this.dragItem.socketA.x > 0f) { this.addMoney += (int)this.dragItem.socketB.y; } this.peddlerFX.gameObject.SetActive(true); this.peddlerFX.Play("Peddler", -1, 0f); this.peddlerSellAmount.text = this.addMoney.ToString(); this.peddlerSellAmount.color = new Color(0.41568628f, 0.6431373f, 0.20784314f, 1f); this.peddlerFX.GetComponent().position = this.dragItem.gameObject.transform.position; string merchantText11 = Links.x.merchant.GetMerchantText("Buy"); Links.x.characterSheet.StartQuip(merchantText11, FaceAnimations.AnimationNames.Smile); Links.x.characterSheet.PlayVignetteAnimation("Nod Head"); MasterAudio.PlaySoundAndForget("Inventory", 1f, new float?(1f), 0.25f, "Coins", null); } Links.x.merchant.AddItem(this.dragItem, this.dragItem.stackSize, this.dragItem.invRow._MaxStackSize, false); } if (this.dragItem && !flag3) { if (this.dragItem.gameObject.activeSelf) { this.EndDragging(false); } if (this.dragItem.bag) { this.dragItem.bag.RemoveImage(this.dragItem.backImage); } else { this.groundContainer.RemoveImage(this.dragItem.backImage); } this.dragItem.bag = this.dropScript; this.dragItem.bag.AddImage(this.dragItem.backImage, this.dragItem); if (this.dragItem) { this.dragItem.SetSprite(false); this.SnapToGrid(this.dragItem, ""); } this.dragGo = null; this.draggingSocket = false; this.dragging = false; this.ToggleCharacterSheetButtonStateForDrag(false); Links.x.characterSheet.PlayRandomClick(); } if (this.dragItem) { this.CheckEquippedState(this.dragItem); } global::Item item13 = this.dragItem; if (!flag5 || flag3) { goto IL_4EAA; } this.hitItem = item; this.PrepareDrag(); this.swapping = true; item.ToggleBackImage(false); this.offset = Vector3.zero; this.startDragObjectScript = this.openBag; this.controllerOffset = Vector3.zero; if (!item13) { goto IL_4EAA; } item13.bag = this.openBag; List list2 = item13.gridImg; if (list2.Count > 0) { item13.bagGridID = list2[0]; } using (List.Enumerator enumerator = list2.GetEnumerator()) { while (enumerator.MoveNext()) { int num35 = enumerator.Current; string text4 = "setting slot for "; string text5 = num35.ToString(); string text6 = " "; global::Item item14 = item13; Debug.Log(text4 + text5 + text6 + ((item14 != null) ? item14.ToString() : null)); this.gridState[num35] = true; this.gridImg[num35].sprite = this.filledSprite; } goto IL_4EAA; } } bool flag23 = false; bool flag24 = false; string[] array5 = new string[7]; int num36 = 0; global::Item item15 = this.hitItem; array5[num36] = ((item15 != null) ? item15.ToString() : null); array5[1] = " "; int num37 = 2; global::Item item16 = this.dragItem; array5[num37] = ((item16 != null) ? item16.ToString() : null); array5[3] = " "; int num38 = 4; InventoryContainer inventoryContainer5 = this.dropScript; array5[num38] = ((inventoryContainer5 != null) ? inventoryContainer5.ToString() : null); array5[5] = " "; int num39 = 6; InventoryContainer inventoryContainer6 = this.startDragObjectScript; array5[num39] = ((inventoryContainer6 != null) ? inventoryContainer6.ToString() : null); Debug.Log(string.Concat(array5)); if (this.hitItem && this.dragItem != this.hitItem) { if (this.dragItem.invRow._Stackable && this.hitItem && this.hitItem && this.hitItem.ID == this.dragItem.ID && this.hitItem.invRow._Stackable && this.hitItem.socketA == this.dragItem.socketA && this.hitItem.socketB == this.dragItem.socketB && this.hitItem.durability.w == this.dragItem.durability.w) { if (this.hitItem.stackSize + this.dragItem.stackSize <= this.hitItem.invRow._MaxStackSize) { this.hitItem.stackSize += this.dragItem.stackSize; this.hitItem.CheckStackSize(); this.SetBagAmt(this.hitItem, this.hitItem.stackSize, this.selectedPlayer); flag24 = true; flag23 = true; } else if (this.hitItem.stackSize < this.hitItem.invRow._MaxStackSize) { int stackSize3 = this.hitItem.stackSize; this.hitItem.stackSize = this.hitItem.invRow._MaxStackSize; this.dragItem.stackSize -= this.hitItem.invRow._MaxStackSize - stackSize3; this.SetBagAmt(this.dragItem, this.dragItem.stackSize, this.selectedPlayer); this.SetBagAmt(this.hitItem, this.hitItem.stackSize, this.selectedPlayer); this.hitItem.CheckStackSize(); this.dragItem.CheckStackSize(); flag23 = true; } } string[] array6 = new string[5]; array6[0] = flag23.ToString(); array6[1] = " "; array6[2] = this.dragItem.onGround.ToString(); array6[3] = " "; int num40 = 4; global::Item worldItem = this.dragItem.worldItem; array6[num40] = ((worldItem != null) ? worldItem.ToString() : null); Debug.Log(string.Concat(array6)); if (!flag23) { flag4 = true; flag3 = false; } else { flag4 = false; flag3 = false; if (flag24) { if (this.dragItem.worldItem) { this.dragItem.worldItem.DestroyItem(false, false); } this.dragItem.DestroyItem(true, false); this.dragItem = null; this.HoverOverGround(); this.EndDragging(true); } else { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); } } } else { flag4 = true; flag3 = false; } IL_4EAA: if (!flag3 && !flag4 && !flag5) { Links.x.characterSheet.PlayRandomClick(); if (this.dragItem) { this.dragItem.SetSprite(false); } this.ToggleCharacterSheetButtonStateForDrag(false); this.dragging = false; this.draggingSocket = false; if (this.dragFromGround && this.groundDragItem != null) { this.groundDragItem.DestroyGroundItem(); } if (this.dropScript && flag) { this.SnapToGrid(this.dragItem, ""); } this.dragFromGround = false; } if (this.addMoney > 0) { this.emeralds += this.addMoney; } } } } else { flag3 = true; flag4 = false; for (int num41 = 0; num41 < this.dragHoverImg.Count; num41++) { Debug.Log(this.gridState[this.dragHoverImg[num41]].ToString() + " " + this.dragHoverImg[num41].ToString()); if (this.gridState[this.dragHoverImg[num41]]) { Debug.Log("has item in slot " + num41.ToString()); for (int num42 = 0; num42 < this.bagItems.Count; num42++) { if (this.bagItems[num42] && this.bagItems[num42].HasGridSlot(this.dragHoverImg[num41])) { flag3 = false; flag4 = true; } } } } } IL_505A: if (this.startDragObjectScript && !this.dropScript && !this.startDragObjectScript.merchantTake) { flag3 = true; } if (flag3 && !flag4) { if (this.swapping) { this.HoverOverGround(); this.EndDragging(true); this.FailedDrag(); this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.dragItem = null; this.ToggleCharacterSheetButtonStateForDrag(false); return; } this.HoverOverGround(); this.EndDragging(true); Links.x.characterSheet.PlayRandomClick(); if (this.startDragObjectScript && this.startDragObjectScript.equip) { int equipIndex2 = this.dragItem.equipIndex; this.bagItems[equipIndex2] = null; this.bagID[equipIndex2] = this.dragItem.ID; this.bagAmount[equipIndex2] = this.dragItem.stackSize; this.socketA[equipIndex2] = this.dragItem.socketA; this.socketB[equipIndex2] = this.dragItem.socketB; this.bagPos[equipIndex2] = -1; this.durabilities[equipIndex2] = this.dragItem.durability; this.dragItem.DestroyItem(false, false); this.dragItem = null; this.HoverOverGround(); this.EndDragging(true); this.prevHitItem = null; this.prevItem = null; this.dragging = false; this.draggingSocket = false; this.dragGo = null; this.selectedPlayer.UpdateListsFromInv(true); this.selectedPlayer.CreateEquippedItems(this.bagID[equipIndex2], this.bagAmount[equipIndex2], this.socketA[equipIndex2], this.socketB[equipIndex2], equipIndex2 * 2, true); this.SetupEquippedItems(Links.x.characterSheet.body, false, equipIndex2, false); return; } if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragGo = null; this.draggingSocket = false; this.dragging = false; this.FailedDrag(); } else if (flag2) { this.AddCombatTime(this.selectedPlayer, "Medium"); } this.UpdateMisc(); this.UpdateSlotStates(this.openBag); } this.UpdateSlotStates(this.openBag); } // Token: 0x060010C2 RID: 4290 RVA: 0x0014719C File Offset: 0x0014539C public void UpdateSlotStates(InventoryContainer listBag) { if (!listBag) { return; } this.updateBagItems = listBag.bagItems; if (this.gridTrs != null) { for (int i = 0; i < this.gridTrs.Count; i++) { this.gridState[i] = false; } } for (int j = 0; j < this.updateBagItems.Count; j++) { if (this.updateBagItems[j] && this.updateBagItems[j] != this.dragItem) { this.localImg = this.updateBagItems[j].gridImg; for (int k = 0; k < this.localImg.Count; k++) { this.gridImg[this.localImg[k]].sprite = this.filledSprite; this.gridState[this.localImg[k]] = true; } } } if (this.gridTrs != null) { for (int l = 0; l < this.gridTrs.Count; l++) { if (this.gridState[l]) { this.gridImg[l].sprite = this.filledSprite; } else if (this.dragging) { bool flag = false; bool flag2 = true; if (Links.x.characterSheet.merchant && this.dropScript && this.dropScript.merchantTake) { flag2 = false; } if (flag2) { for (int m = 0; m < this.dragHoverImg.Count; m++) { if (this.dragHoverImg[m] == l) { flag = true; } } } if (flag) { this.gridImg[l].sprite = this.hoverSprite; } else { this.gridImg[l].sprite = this.emptySprite; } } else { this.gridImg[l].sprite = this.emptySprite; } } } } // Token: 0x060010C3 RID: 4291 RVA: 0x001473AC File Offset: 0x001455AC public void UpdateSlotStatesMerchantBag() { this.updateBagItems = Links.x.merchant.items; this.gridTrsMisc = this.secondaryBag.gridTrs; this.gridStateMisc = this.secondaryBag.gridState; this.gridImgMisc = this.secondaryBag.gridImg; this.currGridImg = this.gridImgMisc; this.currGridTrs = this.gridTrsMisc; this.currGridState = this.gridStateMisc; for (int i = 0; i < this.gridTrsMisc.Count; i++) { bool flag = false; for (int j = 0; j < this.updateBagItems.Count; j++) { if (this.updateBagItems[j] && !flag) { this.localImg = this.updateBagItems[j].gridImg; for (int k = 0; k < this.localImg.Count; k++) { if (this.localImg[k] == i) { flag = true; } } } } this.currGridState[i] = flag; if (flag) { this.currGridImg[i].sprite = this.filledSprite; } else { this.currGridImg[i].sprite = this.emptySprite; } } this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; } // Token: 0x060010C4 RID: 4292 RVA: 0x00147514 File Offset: 0x00145714 public void RemoveEquippedItem(ItemEquipped currentEquipped, int newIndex, int oldIndex) { if (newIndex == -1) { newIndex = this.FindFreeSpace(); } Debug.Log(string.Concat(new string[] { "Removing item: ", currentEquipped.invRow._Name, " from ", oldIndex.ToString(), " to ", newIndex.ToString() })); global::Item item = this.SpawnItem(null, true, currentEquipped.ID, currentEquipped.stackSize, currentEquipped.socketA, currentEquipped.socketB, currentEquipped.durability, Vector3.zero, this.openBag.transform); item.img.enabled = true; Debug.Log(item.invRow._Name); item.durability = currentEquipped.durability; item.bagGridID = -1; if (newIndex == -1) { Links.x.characterSheet.StartQuip("I'll throw this item on the ground", FaceAnimations.AnimationNames.LookRight); this.ToGround(item, false); } else { bool flag = this.FindOpenSpace(item.transform.position, item, this.mainBagX, this.mainBagY, "Hidden", this.openBag); Debug.Log(flag.ToString() + " " + item.bagGridID.ToString()); if (!flag) { Links.x.characterSheet.StartQuip("I'll throw this item on the ground", FaceAnimations.AnimationNames.LookRight); this.ToGround(item, false); } else { this.ListsAddBagItem(item); this.bagPos[newIndex] = item.bagGridID; this.selectedPlayer.SetBagPosition(newIndex, item.bagGridID); } } int num = oldIndex; this.bagItems[num] = null; this.bagID[num] = 0; this.bagAmount[num] = 0; this.socketA[num] = Vector3.zero; this.socketB[num] = Vector3.zero; this.bagPos[num] = -1; this.durabilities[num] = Vector4.zero; if (this.open) { this.SetupEquippedItems(Links.x.characterSheet.body, false, num, false); } this.selectedPlayer.CreateEquippedItems(this.bagID[num], this.bagAmount[num], this.socketA[num], this.socketB[num], num * 2, true); } // Token: 0x060010C5 RID: 4293 RVA: 0x00147764 File Offset: 0x00145964 public Button EquipSelected() { GameObject currentEventObject = Links.x.gameplay.currentEventObject; if (currentEventObject && this.equippedItems != null) { int num = this.equippedItems.Length; for (int i = 0; i < num; i++) { if (this.equippedButtons[i].gameObject == currentEventObject) { this.selectedEquipButton = i; return this.equippedButtons[i]; } } } return null; } // Token: 0x060010C6 RID: 4294 RVA: 0x001477CC File Offset: 0x001459CC public void AddCombatTime(Character character, string amt) { if (character.actions) { if (amt == "Short") { character.UpdateAtkTime(1f); } else if (amt == "Medium") { character.UpdateAtkTime(2f); } else if (amt == "Long") { character.UpdateAtkTime(3f); } else if (amt == "ExtraLong") { character.UpdateAtkTime(5f); } this.selectedPlayer.characterSheetPortrait.time.SetActive(true); this.selectedPlayer.characterSheetPortrait.timeText.text = character.inventoryTime.ToString() + " sec."; Links.x.itemPickupFX.gameObject.SetActive(true); Links.x.itemPickupFX.gameObject.GetComponent().Play("Idle"); Links.x.itemPickupFX.position = this.selectedPlayer.characterSheetPortrait.time.transform.position; } } // Token: 0x060010C7 RID: 4295 RVA: 0x001478EB File Offset: 0x00145AEB public void SetColorsForEquipButtons(bool visible) { } // Token: 0x060010C8 RID: 4296 RVA: 0x001478F0 File Offset: 0x00145AF0 public void UpdateEquipmentButtons() { if (this.open) { if (!Links.x.characterSheet.merchant) { this.equippedItems = Links.x.characterSheet.body.equippedItems; if (this.equippedItems != null) { int num = this.equippedItems.Length; for (int i = 0; i < num; i++) { bool flag = false; if (this.dragging) { int equipSlot = this.dragItem.equipSlot; if (equipSlot >= 8 && equipSlot <= 12) { if (equipSlot == i) { flag = true; } } else if (equipSlot == 0) { if (i == 0 || i == 1 || i == 2 || i == 3) { flag = true; } if (i == 15 || i == 16 || i == 17 || i == 18) { flag = true; } } else if (equipSlot == 1) { if (i == 1 || i == 3) { flag = true; } } else if (equipSlot == 13) { if (i == 13 || i == 14 || i == 7) { flag = true; } } else if (equipSlot == 4 && (i == 4 || i == 5 || i == 6)) { flag = true; } } if (i == 9) { if ((Links.x.characterSheet.character.GetInvNum(18) > 1 && !this.dragging) || (this.dragging && flag)) { this.equippedButtons[i].interactable = true; } else { this.equippedButtons[i].interactable = false; } } else if (i == 0 || i == 1 || i == 7 || i == 8 || i == 9 || i == 10 || i == 11 || i == 12 || i == 13 || i == 14) { Transform slot = Links.x.characterSheet.body.GetSlot(i * 2); if (slot) { this.equippedButtons[i].transform.position = slot.position + new Vector3(0f, 0.6f, 0f); Vector3 position = this.equippedButtons[i].transform.position; position.z = this.equipPosition.position.z; this.equippedButtons[i].transform.position = position; if ((this.equippedItems[i] && !this.dragging) || (this.dragging && flag)) { this.equippedButtons[i].interactable = true; } else { this.equippedButtons[i].interactable = false; } } else { this.equippedButtons[i].interactable = false; } } else { Transform transform = null; if (i == 4) { transform = this.slotAmmo1; } if (i == 5) { transform = this.slotAmmo2; } if (i == 6) { transform = this.slotAmmo3; } if (i == 16) { transform = this.slotAlt1; } if (i == 17) { transform = this.slotAlt2; } if (transform) { this.equippedButtons[i].transform.position = transform.position + new Vector3(0f, 0.6f, 0f); Vector3 position2 = this.equippedButtons[i].transform.position; position2.z = this.equipPosition.position.z; this.equippedButtons[i].transform.position = position2; if ((this.equippedItems[i] && !this.dragging) || (this.dragging && flag)) { this.equippedButtons[i].interactable = true; } else { this.equippedButtons[i].interactable = false; } } else { this.equippedButtons[i].interactable = false; } } } return; } } else { int num2 = this.equippedButtons.Length; for (int j = 0; j < num2; j++) { this.equippedButtons[j].interactable = false; } } } } // Token: 0x060010C9 RID: 4297 RVA: 0x00147C9C File Offset: 0x00145E9C public int GetEquipSlot(int slot, global::Item inItem) { Body body = Links.x.characterSheet.body; if (slot == 13 && body.GetItemEquipped(13)) { slot = 14; if (body.GetItemEquipped(14)) { slot = 7; } } if (slot == 10 && body.GetItemEquipped(10)) { slot = 11; } if (slot == 0 || slot == 1) { if (body.GetItemEquipped(0)) { Library.Inventory invRow = body.GetItemEquipped(0).invRow; if (invRow._TwoHanded || invRow._MainSkill == "Whip") { slot = 0; } else if (!inItem.invRow._TwoHanded && (inItem.invRow._MainSkill != "Whip" || (inItem.invRow._MainSkill == "Whip" && invRow._EquipSlotID == 1))) { slot = 1; } else { slot = 0; } } if (inItem.equipSlot == 1) { slot = 1; } } if (slot == 4 && body.GetItemEquipped(4)) { slot = 5; if (body.GetItemEquipped(5)) { slot = 6; if (body.GetItemEquipped(6)) { slot = 4; } } } return slot; } // Token: 0x060010CA RID: 4298 RVA: 0x00147DD0 File Offset: 0x00145FD0 public void CheckSlotImages() { if (this.currGridImg != this.secondaryBag.gridImg && this.currGridImg != null) { for (int i = 0; i < this.gridTrs.Count; i++) { bool flag = false; for (int j = 0; j < this.bagItems.Count; j++) { if (!flag && this.bagItems[j] && this.bagItems[j].HasGridSlot(i)) { flag = true; } } if (this.currGridImg[i]) { if (!flag) { this.currGridImg[i].sprite = this.emptySprite; this.currGridState[i] = false; } else { this.currGridImg[i].sprite = this.filledSprite; this.currGridState[i] = true; } } } } if (Links.x.characterSheet.merchant) { this.gridTrsMisc = this.secondaryBag.gridTrs; this.gridStateMisc = this.secondaryBag.gridState; this.gridImgMisc = this.secondaryBag.gridImg; this.currGridImg = this.gridImgMisc; this.currGridTrs = this.gridTrsMisc; this.currGridState = this.gridStateMisc; for (int k = 0; k < this.gridTrsMisc.Count; k++) { if (!this.currGridState[k]) { this.currGridImg[k].sprite = this.emptySprite; } else { this.currGridImg[k].sprite = this.filledSprite; } } this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; } for (int l = 0; l < this.groundSlotsList.Count; l++) { if (this.groundSlotsList[l]) { this.groundSlotsList[l].ToggleBackImage(true); } } } // Token: 0x060010CB RID: 4299 RVA: 0x00147FE4 File Offset: 0x001461E4 public void FailedDrag() { if (Records.x.editor || Records.x.secrets) { string[] array = new string[5]; int num = 0; global::Item item = this.dragItem; array[num] = ((item != null) ? item.ToString() : null); array[1] = " failed drag "; int num2 = 2; Transform transform = this.dragParent; array[num2] = ((transform != null) ? transform.ToString() : null); array[3] = " "; int num3 = 4; Vector3 vector = this.savedPosition; array[num3] = vector.ToString(); Debug.Log(string.Concat(array)); } if (this.dragItem && (this.dragParent == this.openBag.transform || this.dragParent == null)) { this.UpdateSlotStates(this.openBag); bool flag = this.FindOpenSpace(this.dragItem.transform.position, this.dragItem, this.mainBagX, this.mainBagY, "Hidden", this.openBag); if (Records.x.editor || Records.x.secrets) { string text = "looking for space item "; global::Item item2 = this.dragItem; Debug.Log(text + ((item2 != null) ? item2.ToString() : null) + " found is " + flag.ToString()); } if (!flag) { int num4 = -1; if (this.selectedPlayer.node != null) { num4 = (int)this.selectedPlayer.node.Area; } this.groundBag.DropLoot(this.dragItem.ID, this.dragItem.stackSize, this.dragItem.socketA, this.dragItem.socketB, this.dragItem.durability, this.selectedPlayer, this.selectedPlayer.tr.position + new Vector3(Random.Range(-2f, 2f), 0f, Random.Range(-2f, 2f)), true, this.dragItem.forSale, num4); this.dragItem.DestroyItem(false, false); this.UpdateSlotStates(this.openBag); this.CheckSlotImages(); if (this.dragSaveImg.Count > 0 && this.dragItem) { this.dragItem.bagGridID = this.dragSaveImg[0]; } if (this.open) { this.UpdateGroundSlots(); } } else { this.inSecondaryBag = false; if (this.dragParent != this.openBag.transform) { this.ListsAddBagItem(this.dragItem); } if (this.dragItem.enabled) { int num5 = this.bagItems.IndexOf(this.dragItem); if (num5 > -1) { this.bagPos[num5] = this.dragItem.bagGridID; } this.dragItem.AddSocketImgs(); this.dragItem.CheckStackSize(); } this.dragItem.gameObject.transform.SetParent(this.openBag.transform); this.dragItem.SetSprite(false); this.dragItem.ToggleBackImage(false); this.SetBackImageSize(this.dragItem.backImage, this.dragItem); this.UpdateSlotStates(this.openBag); this.CheckSlotImages(); if (this.dragSaveImg.Count > 0 && this.dragItem) { this.dragItem.bagGridID = this.dragSaveImg[0]; } this.selectedPlayer.UpdateListsFromInv(true); } } else if (this.dragItem && this.dragParent == this.merchantBag.transform) { this.UpdateSlotStates(this.openBag); this.startDragObjectScript = null; this.dropScript = null; if (this.dragItem) { this.dragItem.gameObject.transform.SetParent(this.dragParent, false); } Links.x.merchant.ReturnFromDrag(this.dragItem); Debug.Log("From merchant bag"); this.UpdateSlotStatesMerchantBag(); } else { string text2 = "Drag parent "; Transform transform2 = this.dragParent; Debug.Log(text2 + ((transform2 != null) ? transform2.ToString() : null)); this.dragItem.gameObject.transform.SetParent(this.dragParent, false); this.dragItem.transform.localPosition = this.savedPosition; } if (Links.x.characterSheet.merchant) { this.CheckSlotImages(); this.UpdateSlotStatesMerchantBag(); } this.UpdateSlots(false, this.openBag); this.startDragObjectScript; if (Links.x.joy && this.dragItem && this.dragItem.bag && !this.dragItem.inGroundMenu && this.dragItem.bagGridID > -1) { if (this.dragItem.forSale) { GameObject gameObject = this.gridTrsMisc[this.dragItem.bagGridID].gameObject; EventSystem.current.SetSelectedGameObject(gameObject); } else { GameObject gameObject2 = this.gridTrs[this.dragItem.bagGridID].gameObject; EventSystem.current.SetSelectedGameObject(gameObject2); } } this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; this.inSecondaryBag = false; this.dragGo = null; if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragging = false; this.draggingSocket = false; this.dragItem = null; } // Token: 0x060010CC RID: 4300 RVA: 0x00148590 File Offset: 0x00146790 public global::Item AddedToStack(global::Item item, Character addToCharacter, out bool added, out ItemEquipped stackEquipped) { global::Item item2 = null; added = false; stackEquipped = null; if (item) { int maxStackSize = item.invRow._MaxStackSize; if (item.socketA.x == -1f) { item.socketA = Vector3.zero; item.socketB = Vector3.zero; } for (int i = 0; i < this.bagID.Count; i++) { if (this.bagID[i] > 0 && this.bagID[i] == item.ID) { if (this.socketA[i].x == -1f) { this.socketA[i] = Vector3.zero; this.socketB[i] = Vector3.zero; } if (item.socketA.x == -1f) { item.socketB = Vector3.zero; item.socketB = Vector3.zero; } if (!added && item.socketA == this.socketA[i] && item.socketB == this.socketB[i] && item.durability.w == this.durabilities[i].w) { if (this.bagItems[i]) { if (this.bagItems[i] != item && this.bagAmount[i] < maxStackSize) { int num = this.bagAmount[i] + item.stackSize; if (num <= maxStackSize) { this.bagItems[i].stackSize = num; this.bagAmount[i] = num; this.bagItems[i].CheckStackSize(); item2 = this.bagItems[i]; added = true; } } } else if (this.bagAmount[i] < maxStackSize) { int num2 = this.bagAmount[i] + item.stackSize; if (num2 <= maxStackSize) { this.bagAmount[i] = num2; added = true; if (!this.open) { SkillBag skillBag = addToCharacter.portrait.skillBag; GameObject gameObject = null; if (i == 7) { gameObject = skillBag.beltItem1text.gameObject; } if (i == 13) { gameObject = skillBag.beltItem2text.gameObject; } if (i == 14) { gameObject = skillBag.beltItem3text.gameObject; } if (i == 4) { gameObject = skillBag.ammo1Txt.gameObject; } if (i == 5) { gameObject = skillBag.ammo2Txt.gameObject; } if (i == 6) { gameObject = skillBag.ammo3Txt.gameObject; } if (gameObject) { Links.x.itemPickupFX2.gameObject.SetActive(true); Links.x.itemPickupFX2.gameObject.GetComponent().Play("Idle"); Links.x.itemPickupFX2.position = gameObject.gameObject.transform.position; } } else { ItemEquipped itemEquippedFromIndex = this.GetItemEquippedFromIndex(i); stackEquipped = itemEquippedFromIndex; if (itemEquippedFromIndex && Links.x.characterSheet.character == addToCharacter) { itemEquippedFromIndex.stackSize = num2; itemEquippedFromIndex.UpdateStackSize(); } } } } } } } if (added) { addToCharacter.UpdateListsFromInv(true); addToCharacter.portrait.skillBag.SetTrinketGrid(false); } } return item2; } // Token: 0x060010CD RID: 4301 RVA: 0x00148910 File Offset: 0x00146B10 public void RemoveStack(Character c, global::Item item, int amt) { if (c.inventoryBag) { c.inventoryBag.RemoveStack(item, amt); } } // Token: 0x060010CE RID: 4302 RVA: 0x0014892C File Offset: 0x00146B2C public void UpdateSocketLists(global::Item item) { int num = this.bagItems.IndexOf(item); this.socketA[num] = item.socketA; this.socketB[num] = item.socketB; this.selectedPlayer.UpdateListsFromInv(true); } // Token: 0x060010CF RID: 4303 RVA: 0x00148978 File Offset: 0x00146B78 public void UpdateContainer(global::Item item, Vector3 position, InventoryContainer container, InventoryContainer prevContainer, bool add, bool canStack) { Character character = this.selectedPlayer; bool flag = false; bool flag2 = false; if (container && container.bag) { flag = true; } if (flag) { if (add) { if (item.stackable) { flag2 = false; int maxStackSize = item.invRow._MaxStackSize; canStack = false; for (int i = 0; i < this.bagID.Count; i++) { if (this.bagID[i] > 0 && this.bagID[i] == item.ID && this.bagItems[i] != this.dragItem && this.bagItems[i] && (!flag2 && canStack) && this.bagItems[i] != item && this.bagAmount[i] + item.stackSize < maxStackSize && item.socketA == this.bagItems[i].socketA && item.socketB == this.bagItems[i].socketB && item.durability.w == this.bagItems[i].durability.w) { this.bagAmount[i] = this.bagAmount[i] + item.stackSize; flag2 = true; this.bagItems[i].stackSize += item.stackSize; this.bagItems[i].CheckStackSize(); this.RemoveItemSlots(item, true); if (item.forSale) { Debug.Log("for sale"); } item.DestroyItem(false, false); if (this.dragging) { this.EndDragging(true); } } } } if (!flag2) { this.ListsAddBagItem(item); } } else { int num = this.bagItems.IndexOf(item); this.UpdateWeight(this.openBag, this.selectedPlayer); if (num > -1) { this.bagItems[num] = null; this.bagID[num] = 0; this.bagAmount[num] = 0; this.bagPos[num] = -1; this.durabilities[num] = Vector4.zero; this.socketA[num] = Vector3.zero; this.socketB[num] = Vector3.zero; } } character.UpdateListsFromInv(true); } } // Token: 0x060010D0 RID: 4304 RVA: 0x00148C24 File Offset: 0x00146E24 public void RemoveBagItem(int index, Character party) { InventoryContainer inventoryContainer = null; if (party == this.bag1.character) { inventoryContainer = this.bag1; } if (party == this.bag2.character) { inventoryContainer = this.bag2; } if (party == this.bag3.character) { inventoryContainer = this.bag3; } if (party == this.bag4.character) { inventoryContainer = this.bag4; } if (inventoryContainer) { inventoryContainer.RemoveBagItem(index); } } // Token: 0x060010D1 RID: 4305 RVA: 0x00148CAC File Offset: 0x00146EAC public void AddSlotItem(int slot, int id, int amt, int socketA, int socketB, global::Item linkedItem, bool fromDrag, Character party) { Transform transform = this.bag1.transform; transform = party.inventoryBag.transform; if (linkedItem != null) { linkedItem.gameObject.transform.SetParent(transform, true); if (!fromDrag) { linkedItem.gameObject.transform.localPosition = new Vector3(50f, 0f, 0f); } linkedItem.gameObject.transform.localRotation = Quaternion.Euler(Vector3.zero); } } // Token: 0x060010D2 RID: 4306 RVA: 0x00148D34 File Offset: 0x00146F34 public void ReleaseGroundList() { for (int i = 0; i < this.groundSlotsList.Count; i++) { this.groundSlotsList[i].DestroyItem(false, false); } this.groundSlotsList.Clear(); } // Token: 0x060010D3 RID: 4307 RVA: 0x00148D78 File Offset: 0x00146F78 public void OpenGroundList() { if (this.groundSlotsList.Count > 0) { return; } this.inRangeGroundItems = Links.x.diorama.groundItems; for (int i = 0; i < this.inRangeGroundItems.Count; i++) { global::Item item = this.inRangeGroundItems[i]; if (item) { item.GetLinkedCharacter(); if (!item.forSale && !item.linkedCharacter && item.ID > 2 && item.gameObject.activeInHierarchy && item.active && (item.transform.position - this.selectedPlayer.tr.position).sqrMagnitude < 36f) { global::Item item2 = this.SpawnItem(null, false, item.ID, item.stackSize, item.socketA, item.socketB, item.durability, Vector3.zero, this.groundBag.groundItemsParent.transform); item.slotItem = item2; item2.gameObject.transform.SetParent(this.groundBag.groundItemsParent.transform, false); item2.worldItem = item; item2.InGroundMenuList(); item2.SetSprite(false); item2.AddSocketImgs(); item2.img.enabled = true; item2.backImage.transform.SetParent(this.groundContent); item2.GetBackImage(); if (item2.bag) { item2.bag.RemoveImage(item2.backImage); } this.groundContainer.AddImage(item2.backImage, item2); item2.backImage.transform.SetParent(item2.gameObject.transform); this.SetBackImageSize(item2.backImage, item2); Color color = new Color(0.5f, 0.5f, 0.5f, 1f); item2.backImage.color = color; item2.ToggleBackImage(true); } } } for (int j = 0; j < this.groundSlotsList.Count; j++) { this.groundSlotsList[j].img.raycastTarget = true; } this.dragItem = null; this.groundContainer.UpdateItemInteractableState(true); } // Token: 0x060010D4 RID: 4308 RVA: 0x00148FCA File Offset: 0x001471CA public void UpdateGroundSlots() { this.ReleaseGroundList(); this.OpenGroundList(); } // Token: 0x060010D5 RID: 4309 RVA: 0x00148FD8 File Offset: 0x001471D8 public void AddToGroundList(global::Item item) { if (!this.groundSlotsList.Contains(item)) { this.groundSlotsList.Add(item); } } // Token: 0x060010D6 RID: 4310 RVA: 0x00148FF4 File Offset: 0x001471F4 public void RemoveFromGroundList(global::Item item) { int num = this.groundSlotsList.IndexOf(item); this.groundSlotsList.RemoveAt(num); } // Token: 0x060010D7 RID: 4311 RVA: 0x0014901C File Offset: 0x0014721C public void ToGround(global::Item item, bool fromDragging) { Links.x.characterSheet.PlayRandomClick(); bool flag = false; Character main = Links.x.main; if (this.open) { main = this.selectedPlayer; } if (!item.worldItem) { int num = -1; if (this.selectedPlayer && this.selectedPlayer.node != null) { num = (int)this.selectedPlayer.node.Area; } global::Item item2 = this.groundBag.DropLoot(item.ID, item.stackSize, item.socketA, item.socketB, item.durability, main, main.tr.position + new Vector3(Random.Range(-2f, 2f), 0f, Random.Range(-2f, 2f)), true, item.forSale, num); if (!item2) { flag = true; } item.worldItem = item2; item2.slotItem = item; } this.ClearDrag(); if (flag) { item.DestroyItem(true, false); if (fromDragging) { this.dragItem = null; this.HoverOverGround(); this.EndDragging(true); } } else { item.InGroundMenuList(); if (this.selectedPlayer && this.open) { this.selectedPlayer.UpdateListsFromInv(true); } if (item.isEquipped && item.invRow._EquipSlotID == 0) { this.CreateFist(0, false, this.selectedPlayer, this.openBag.transform, true); } this.RemoveItemSlots(item, false); if (fromDragging) { this.UpdateContainer(item, this.dropPosition, this.startDragObjectScript, null, false, true); this.EndDragging(true); } this.GroundInstructions(item, main); item.transform.SetParent(this.groundBag.groundItemsParent.transform, true); if (item.bag) { item.bag.RemoveImage(item.backImage); } this.groundContainer.AddImage(item.backImage, item); } if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragItem = null; this.draggingSocket = false; this.dragGo = null; this.dragging = false; } // Token: 0x060010D8 RID: 4312 RVA: 0x0014924C File Offset: 0x0014744C private void GroundInstructions(global::Item item, Character addToCharacter) { item.backImage.transform.SetParent(this.groundContent); item.GetBackImage(); Debug.Log("setting parent to ground"); this.groundContainer.AddImage(item.backImage, this.dragItem); item.backImage.transform.SetParent(item.gameObject.transform); this.SetBackImageSize(item.backImage, item); } // Token: 0x060010D9 RID: 4313 RVA: 0x001492C0 File Offset: 0x001474C0 public void DestroyedItem(global::Item item, Character character) { InventoryContainer inventoryBag = character.inventoryBag; this.UpdateContainer(item, Vector3.zero, inventoryBag, null, false, true); item.DestroyItem(false, false); this.RemoveItemSlots(item, false); if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragItem = null; this.dragGo = null; this.draggingSocket = false; this.dragging = false; this.ToggleCharacterSheetButtonStateForDrag(false); this.UpdateWeight(this.openBag, character); this.UpdateSlotStates(this.openBag); this.CheckSlotImages(); } // Token: 0x060010DA RID: 4314 RVA: 0x0014934F File Offset: 0x0014754F public Transform GetGridTransform(int index) { return this.gridTrs[index]; } // Token: 0x060010DB RID: 4315 RVA: 0x00149360 File Offset: 0x00147560 public global::Item CheckGridHover() { float num = float.PositiveInfinity; int num2 = -1; Vector3 vector = Links.x.menuCamera.ScreenToWorldPoint(Input.mousePosition); float num3 = 0.16000001f; global::Item item = this.currHoverItem; bool flag = this.fromSecondaryBag; for (int i = 0; i < this.bagItems.Count; i++) { global::Item item2 = this.bagItems[i]; if (item2) { this.localImg = item2.gridImg; foreach (int num4 in this.localImg) { vector.z = this.gridTrs[num4].position.z; float sqrMagnitude = (this.gridTrs[num4].position - vector).sqrMagnitude; if (sqrMagnitude < num && sqrMagnitude < num3) { num = sqrMagnitude; num2 = i; this.fromSecondaryBag = false; } } } } bool flag2 = false; if (Links.x.characterSheet.merchant) { flag2 = true; } if (flag2) { this.gridTrsMisc = this.secondaryBag.gridTrs; this.gridStateMisc = this.secondaryBag.gridState; this.gridImgMisc = this.secondaryBag.gridImg; } if (num2 == -1 && this.open && flag2) { this.merchantItems = Links.x.merchant.items; for (int j = 0; j < this.merchantItems.Count; j++) { global::Item item3 = this.merchantItems[j]; if (item3) { this.localImg = item3.gridImg; foreach (int num5 in this.localImg) { if (num5 < this.gridTrsMisc.Count) { vector.z = this.gridTrsMisc[num5].position.z; float sqrMagnitude2 = (this.gridTrsMisc[num5].position - vector).sqrMagnitude; if (sqrMagnitude2 < num && sqrMagnitude2 < num3) { num = sqrMagnitude2; num2 = j; this.fromSecondaryBag = true; } } } } } } if (num2 <= -1) { this.currHoverItem = null; if (item) { item.InventoryHoverOut(flag); this.SetBackSprite("Normal", item.backImage, item); } return null; } if (this.fromSecondaryBag) { this.currHoverItem = this.merchantItems[num2]; } else { this.currHoverItem = this.bagItems[num2]; } if (item && this.currHoverItem != item) { item.InventoryHoverOut(flag); this.SetBackSprite("Normal", item.backImage, item); } bool flag3 = true; if (this.dragging && this.dragItem) { flag3 = false; if (this.currHoverItem.isEquipped) { flag3 = true; } if (this.draggingSocket && !this.fromSecondaryBag && this.CheckSocket(this.dragItem, this.currHoverItem)) { flag3 = true; } if (this.dragItem.invRow._Stackable && this.currHoverItem.invRow._Stackable && !this.dragItem.forSale && !this.currHoverItem.forSale && this.currHoverItem.ID == this.dragItem.ID && this.currHoverItem.stackSize + this.dragItem.stackSize <= this.currHoverItem.invRow._MaxStackSize && !this.currHoverItem.inGroundMenu && !this.currHoverItem.forSale) { flag3 = true; } } if (!flag3) { this.currHoverItem = null; num2 = -1; return null; } if (item != this.currHoverItem) { this.currHoverItem.InventoryHoverIn(this.fromSecondaryBag); this.SetBackSprite("Hover", this.currHoverItem.backImage, this.currHoverItem); } if (this.fromSecondaryBag) { return this.merchantItems[num2]; } return this.bagItems[num2]; } // Token: 0x060010DC RID: 4316 RVA: 0x001497E4 File Offset: 0x001479E4 public void ChangeImage(bool inSlot, Image img, int itemID) { Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(itemID); img.sprite = Links.x.archives.GetItem(invRowByIndex._UIModel); img.preserveAspect = true; } // Token: 0x060010DD RID: 4317 RVA: 0x00149824 File Offset: 0x00147A24 public void UpdateMisc() { this.emeraldText.text = this.emeralds.ToString(); this.gemText.text = this.gems.ToString(); if (Links.x.characterSheet.merchant) { Links.x.merchant.CheckSlotCosts(); Links.x.merchant.UpdateMerchant(); } if (Links.x.characterSheet.open) { Links.x.characterSheet.GetStats(); this.selectedPlayer.stats.UpdateAbilityTriggers(); if (this.selectedPlayer.portrait && this.selectedPlayer.portrait.skillBag) { if ((this.selectedPlayer.portrait.skillBag.GetSpellCount() > 0 && !this.selectedPlayer.stats.HasSpellbook()) || (this.selectedPlayer.portrait.skillBag.GetSpellCount() == 0 && this.selectedPlayer.stats.HasSpellbook())) { this.selectedPlayer.portrait.skillBag.SetSpellbookGrid(); } int songCount = this.selectedPlayer.portrait.skillBag.GetSongCount(); if ((songCount > 0 && !this.selectedPlayer.stats.HasSongbook()) || (songCount == 0 && this.selectedPlayer.stats.HasSongbook()) || (songCount == 0 && this.selectedPlayer.HasInstrument()) || (songCount > 0 && !this.selectedPlayer.HasInstrument())) { this.selectedPlayer.portrait.skillBag.SetSongGrid(); } } Links.x.characterSheet.booksMenu.UpdateAbilityTriggers(); Links.x.characterSheet.character.portrait.SetMagicColor(); } if (this.selectedPlayer && this.selectedPlayer.portrait && Links.x.gaia.sceneLoaded) { this.selectedPlayer.portrait.skillBag.UpdateWindowStates(); } this.UpdateWeight(this.openBag, this.selectedPlayer); if (Links.x.characterSheet.enchanting) { this.enchantMenu.OpenMenu(this.selectedPlayer); } } // Token: 0x060010DE RID: 4318 RVA: 0x00149A74 File Offset: 0x00147C74 public global::Item SpawnItem(global::Item item, bool isDragging, int id, int amt, Vector3 socketA, Vector3 socketB, Vector4 durability, Vector3 position, Transform par) { bool flag = false; if (item == null) { flag = true; } Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(id); if (id <= 0) { return null; } if (invRowByIndex == null) { return null; } if (invRowByIndex._ArmorID == -1) { return null; } item = Links.x.cellar.GetItem(); if (item) { item.Reset(); item.GetBackImage(); item.ToggleBackImage(false); if (this.openBag) { item.backImage.gameObject.transform.SetParent(this.openBag.transform); } if (Records.x.editor) { item.name = invRowByIndex._DisplayName + "_" + Random.Range(1, 100).ToString(); } Image component = item.GetComponent(); if (component) { component.enabled = true; component.sprite = Links.x.archives.GetItem(invRowByIndex._UIModel); component.preserveAspect = true; if (id == 1) { component.raycastTarget = false; } if (par == null) { par = base.gameObject.transform; } Transform component2 = item.GetComponent(); item.transform.SetParent(par, true); component2.localScale = new Vector3(1f, 1f, 1f); } } if (item) { item.gameObject.SetActive(true); item.ToggleBackImage(false); if (item.bag) { item.bag.RemoveImage(item.backImage); } item.bag = this.openBag; if (item.bag) { item.bag.AddImage(item.backImage, item); } item.maskedSprite = Links.x.archives.GetItem(invRowByIndex._UIModel); item.fullSprite = Links.x.archives.GetItemFull(invRowByIndex._UIModelFull); GameObject gameObject = item.gameObject; gameObject.transform.localPosition = Vector3.zero; global::Item item2 = item; if (item2) { item2.onGround = false; if (flag) { item2.stackSize = amt; if (amt > invRowByIndex._MaxStackSize) { item2.stackSize = invRowByIndex._MaxStackSize; } item2.ID = id; } else { item2.stackSize = item.stackSize; if (item.stackSize > invRowByIndex._MaxStackSize) { item2.stackSize = invRowByIndex._MaxStackSize; } item2.forSale = item.forSale; item2.ID = item.ID; } item2.equipSlot = invRowByIndex._EquipSlotID; item2.socketA = socketA; item2.socketB = socketB; item2.stackable = invRowByIndex._Stackable; item2.itemTag = invRowByIndex._Tag; item2.durability = durability; if (invRowByIndex._Life > 0) { if (durability.x > 0f) { item2.durability = durability; } else if (!invRowByIndex._Effect.Contains("Cure")) { item2.durability.x = Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours()) + (float)invRowByIndex._Life; durability.x = item2.durability.x; } } else { if (durability.x == -1f) { item2.durability = new Vector4((float)invRowByIndex._DurabilityMax, durability.y, durability.z, durability.w); } else { item2.durability = durability; } if (item2.durability.x > (float)invRowByIndex._DurabilityMax && (item2.invRow._Tag == "Weapon" || item2.invRow._Tag == "Shield" || item2.invRow._Tag == "Armor")) { item2.durability.x = (float)invRowByIndex._DurabilityMax; } if (id == Links.x.library.bombID && item2.durability.x <= 0f) { item2.durability.x = Links.x.gameplay.seconds; } } if (invRowByIndex._Contraband > 0) { item2.durability.w = 1f; } int num = invRowByIndex._SocketMax; if (invRowByIndex._Tag == "Weapon" || invRowByIndex._Tag == "Jewelry") { num = 0; } item2.socketMax = num; item2.invRow = invRowByIndex; item2.active = true; if (item2.stackSize == 0) { item2.stackSize = 1; } gameObject.transform.localRotation = Quaternion.Euler(Vector3.zero); this.t = gameObject.GetComponentsInChildren(); for (int i = 0; i < this.t.Length; i++) { this.t[i].gameObject.layer = 5; } if (isDragging && item != null) { this.groundDragItem = item; this.dragItem = item2; this.sizeX = this.dragItem.invRow._SizeX; this.sizeY = this.dragItem.invRow._SizeY; this.dragGo = gameObject; item.PickUp(); } item2.CheckStackSize(); item2.SetSprite(false); this.SetBackImageSize(item2.backImage, item2); if (invRowByIndex._SetVariable != "" && invRowByIndex._Tag != "Note" && DialogueLua.GetVariable(invRowByIndex._SetVariable).asInt == 0) { DialogueLua.SetVariable(invRowByIndex._SetVariable, 1); } if (invRowByIndex._SetQuest != "" && invRowByIndex._Tag != "Note") { bool flag2 = true; if (flag2) { if (invRowByIndex._SetQuestState == "Conversation") { if (invRowByIndex._SetQuest == "C6_Dan") { if (QuestLog.GetQuestState(invRowByIndex._SetQuest) == QuestState.PerpIsDead) { flag2 = false; } if (QuestLog.GetQuestState(invRowByIndex._SetQuest) == QuestState.Complete) { flag2 = false; } if (QuestLog.GetQuestState(invRowByIndex._SetQuest) == QuestState.WaitingForExileIsland) { flag2 = false; } if (QuestLog.GetQuestState(invRowByIndex._SetQuest) == QuestState.ExileIsland) { flag2 = false; } if (QuestLog.GetQuestState(invRowByIndex._SetQuest) == QuestState.Success) { flag2 = false; } if (flag2) { if (Records.x.editor) { QuestLog.GetQuestState(invRowByIndex._SetQuest); } if (Links.x.gaia.sceneLoaded) { Character secondAvailableParty = Links.x.GetSecondAvailableParty(Links.x.main.currentPosition, Links.x.main); Links.x.gameplay.StartDialogue(Links.x.main, secondAvailableParty, null, null, "LazureCaves/MissingDryad"); } } } } else if (invRowByIndex._SetQuest == "D6_Licech") { flag2 = false; if (QuestLog.GetQuestState(invRowByIndex._SetQuest) == QuestState.Unassigned) { flag2 = true; } if (QuestLog.GetQuestState(invRowByIndex._SetQuest) == QuestState.Active) { flag2 = true; } if (QuestLog.GetQuestState(invRowByIndex._SetQuest) == QuestState.Discussed) { flag2 = true; } if (flag2) { QuestLog.SetQuestState(invRowByIndex._SetQuest, Records.x.StringToQuestState(invRowByIndex._SetQuestState)); } Links.x.dialogue.SetVariableInt("TalkToD6LicechFound", 1); } else { QuestLog.SetQuestState(invRowByIndex._SetQuest, Records.x.StringToQuestState(invRowByIndex._SetQuestState)); } } } } return item2; } return null; } // Token: 0x060010DF RID: 4319 RVA: 0x0014A218 File Offset: 0x00148418 public void HandItems() { this.SwapHandItems(this.selectedPlayer); } // Token: 0x060010E0 RID: 4320 RVA: 0x0014A228 File Offset: 0x00148428 public void SwapHandItems(Character c) { if (this.enchantMenu.open) { return; } if (!c.inventoryBag) { return; } c.inventoryBag.SwapBagItem(0, 16, this.selectedPlayer, true); c.inventoryBag.SwapBagItem(2, 18, this.selectedPlayer, true); c.inventoryBag.SwapBagItem(1, 17, this.selectedPlayer, true); c.inventoryBag.SwapBagItem(3, 15, this.selectedPlayer, true); this.SetupEquippedItems(Links.x.characterSheet.body, true, 0, true); this.SetupEquippedItems(Links.x.characterSheet.body, true, 16, true); } // Token: 0x060010E1 RID: 4321 RVA: 0x0014A2D8 File Offset: 0x001484D8 public void ClearAllBags() { if (this.bag1) { this.bag1.EmptyItems(); } if (this.bag2) { this.bag2.EmptyItems(); } if (this.bag3) { this.bag3.EmptyItems(); } if (this.bag4) { this.bag4.EmptyItems(); } } // Token: 0x060010E2 RID: 4322 RVA: 0x0014A348 File Offset: 0x00148548 public void ClearBag(Character bagToClear) { InventoryContainer partyBag = this.GetPartyBag(bagToClear); if (partyBag) { partyBag.EmptyItems(); if (!this.openBags.Contains(partyBag)) { this.openBags.Add(partyBag); bagToClear.inventoryBag = null; } } this.openBags.RemoveAll((InventoryContainer item) => item == null); } // Token: 0x060010E3 RID: 4323 RVA: 0x0014A3B8 File Offset: 0x001485B8 public void ListsAddBagItem(global::Item item) { int num = -1; for (int i = 0; i < this.bagItems.Count; i++) { if (i >= 19 && (this.bagItems[i] == null || this.bagItems[i] == item)) { num = i; break; } } if (num == -1) { Debug.Log(((item != null) ? item.ToString() : null) + " ITEM DROPPED TO GROUND"); this.ToGround(item, true); return; } this.bagItems[num] = item; this.bagID[num] = item.ID; this.bagAmount[num] = item.stackSize; this.bagPos[num] = item.bagGridID; this.socketA[num] = item.socketA; this.socketB[num] = item.socketB; this.durabilities[num] = item.durability; if (item.bag) { item.bag.RemoveImage(item.backImage); } item.bag = this.openBag; item.bag.AddImage(item.backImage, item); } // Token: 0x060010E4 RID: 4324 RVA: 0x0014A4EC File Offset: 0x001486EC public int FindFreeSpace() { int num = -1; for (int i = 0; i < this.bagItems.Count; i++) { if (i >= 19 && this.bagItems[i] == null) { num = i; break; } } return num; } // Token: 0x060010E5 RID: 4325 RVA: 0x0014A530 File Offset: 0x00148730 public bool AddFromGround(GroundItemText textItem, global::Item item, int stackSizeOverride, bool stolen, float cost, int itemID, int stack, Vector3 socketA, Vector3 socketB, Vector4 dur, Character addToCharacter, bool canStack, bool overrideDurability, out global::Item addedItem, out ItemEquipped addedItemEquipped) { addedItem = null; addedItemEquipped = null; if (!addToCharacter.party) { addToCharacter = Links.x.GetNearestPortraitParty(addToCharacter.tr.position); } Character character = null; if (this.open) { character = this.selectedPlayer; } this.lookingForSpot = true; this.inSecondaryBag = false; cost = 0f; this.GetBagLists(addToCharacter); Transform transform = this.GetPartyBag(addToCharacter).transform; if (item) { if (item.ID == 2) { if (textItem) { this.groundBag.RemoveItemLabel(textItem); } this.emeralds += item.stackSize; this.lookingForSpot = false; if (this.open) { this.GetBagLists(this.selectedPlayer); } return true; } } else if (itemID == 2) { this.emeralds += stack; this.lookingForSpot = false; if (this.open) { this.GetBagLists(this.selectedPlayer); } return false; } if (item) { if (cost > 0f) { if (item.invRow._NeverSell) { cost = 0f; } if (item.invRow._Stackable) { cost = 0f; } } if (stolen) { item.durability = new Vector4(item.durability.x, item.durability.y, item.durability.z, 1f); } } global::Item item2; if (item) { item2 = this.SpawnItem(null, true, item.ID, item.stackSize, item.socketA, item.socketB, item.durability, Vector3.zero, transform); } else { item2 = this.SpawnItem(null, true, itemID, stack, socketA, socketB, dur, Vector3.zero, transform); } this.dragFromGround = true; this.groundDragItem = item; if (textItem) { this.groundBag.RemoveItemLabel(textItem); } if (overrideDurability) { item2.durability = dur; } if (stolen) { item2.durability = new Vector4(item2.durability.x, item2.durability.y, item2.durability.z, 1f); } else if (cost > 0f) { item2.durability = new Vector4(item2.durability.x, item2.durability.y, item2.durability.z, cost * -1f); } addedItem = item2; bool flag = false; this.UpdateSlots(false, addToCharacter.inventoryBag); if (item2.gameObject.activeSelf) { if (stackSizeOverride > 0) { item2.stackSize = stackSizeOverride; } bool flag2 = false; if (item2.stackable && canStack) { bool flag3 = false; ItemEquipped itemEquipped; global::Item item3 = this.AddedToStack(item2, addToCharacter, out flag3, out itemEquipped); if (item3 || itemEquipped) { flag = true; flag2 = true; item2.DestroyItem(false, false); addedItem = item3; addedItemEquipped = itemEquipped; item2 = null; } else if (flag3) { flag = true; flag2 = true; item2.DestroyItem(false, false); item2 = null; addedItem = null; } } if (!flag2) { flag = this.FindOpenSpace(item2.transform.position, item2, this.mainBagX, this.mainBagY, "Hidden", addToCharacter.inventoryBag); if (!flag) { int num = -1; if (this.selectedPlayer && this.selectedPlayer.node != null) { num = (int)this.selectedPlayer.node.Area; } this.groundBag.DropLoot(item2.ID, item2.stackSize, item2.socketA, item2.socketB, item2.durability, addToCharacter, addToCharacter.tr.position + new Vector3(Random.Range(-2f, 2f), 0f, Random.Range(-2f, 2f)), true, item2.forSale, num); item2.DestroyItem(false, false); if (this.open) { this.UpdateGroundSlots(); } addedItem = null; } else { this.ListsAddBagItem(item2); if (item2.bag) { item2.bag.RemoveImage(item2.backImage); } item2.bag = this.openBag; item2.bag.AddImage(item2.backImage, item2); item2.gameObject.transform.SetParent(addToCharacter.inventoryBag.gameObject.transform, true); if (item2.enabled) { int num2 = this.bagItems.IndexOf(item2); if (num2 > -1) { this.bagPos[num2] = item2.bagGridID; } item2.AddSocketImgs(); item2.CheckStackSize(); } if (item2 && !this.open && item2.invRow._RightClickAction == "Consume") { int num3 = this.bagItems.IndexOf(item2); int num4 = -1; if (addToCharacter.GetInvNum(14) <= 1) { num4 = 7; } if (addToCharacter.GetInvNum(26) <= 1) { num4 = 13; } if (addToCharacter.GetInvNum(28) <= 1) { num4 = 14; } if (num4 > -1) { addToCharacter.inventoryBag.SwapBagItem(num3, num4, addToCharacter, true); if (this.open) { this.UpdateGroundSlots(); } } } addToCharacter.UpdateListsFromInv(true); addToCharacter.portrait.skillBag.SetTrinketGrid(false); } } } this.currGridImg = this.gridImg; this.currGridTrs = this.gridTrs; this.currGridState = this.gridState; this.CheckSlotImages(); this.UpdateWeight(this.openBag, addToCharacter); this.lookingForSpot = false; if (this.open) { if (item2 && addToCharacter == this.selectedPlayer) { item2.ToggleBackImage(true); item2.CheckStackSize(); if (Links.x.arrowKit.open) { this.fx.gameObject.SetActive(true); this.fx.gameObject.GetComponent().Play("Idle"); this.fx.gameObject.transform.position = item2.gameObject.transform.position; } } this.GetBagLists(character); } return flag; } // Token: 0x060010E6 RID: 4326 RVA: 0x0014AB3C File Offset: 0x00148D3C public void DropInBag(global::Item item, int num, int id, int amt, Vector3 socketA, Vector3 socketB, Vector4 dur, InventoryContainer prevContainer, bool canStack) { InventoryContainer inventoryContainer = null; if (num == 0) { inventoryContainer = this.bag1; } if (item == null) { item = this.SpawnItem(null, false, id, amt, socketA, socketB, dur, Vector3.zero, inventoryContainer.gameObject.transform); } else if (!this.dragFromGround && prevContainer != null) { this.UpdateContainer(item, item.gameObject.transform.position, prevContainer, prevContainer, false, canStack); } else { if (this.dragFromGround) { this.groundDragItem.DestroyGroundItem(); } this.dragFromGround = false; } if (item != null) { inventoryContainer.transform.position + new Vector3(0f, 0f, 0f); if (!item.inGroundMenu) { item.gameObject.transform.SetParent(inventoryContainer.gameObject.transform, true); item.gameObject.transform.localRotation = Quaternion.Euler(Vector3.zero); item.SetSprite(false); this.UpdateContainer(item, item.gameObject.transform.position, inventoryContainer, prevContainer, true, canStack); this.SnapToGrid(item, "Hidden"); } item.AddSocketImgs(); } if (this.openBag) { this.openBag.UpdateItemInteractableState(this.openBag.lastInteractableState); } this.UpdateWeight(this.openBag, this.openBag.character); } // Token: 0x060010E7 RID: 4327 RVA: 0x0014ACAE File Offset: 0x00148EAE public void AddGoodItem(global::Item item) { if (this.goodItems.IndexOf(item) == -1) { this.goodItems.Add(item); } } // Token: 0x060010E8 RID: 4328 RVA: 0x0014ACCC File Offset: 0x00148ECC public void RemoveGoodItem(global::Item item) { int num = this.goodItems.IndexOf(item); if (num > -1) { this.goodItems.RemoveAt(num); } } // Token: 0x060010E9 RID: 4329 RVA: 0x0014ACF8 File Offset: 0x00148EF8 public global::Item FindNearItem(Character nearCharacter, int checkForItemID) { global::Item item = null; float num = 400f; if (!nearCharacter.actions) { return null; } for (int i = 0; i < this.goodItems.Count; i++) { global::Item item2 = this.goodItems[i]; float sqrMagnitude = (item2.gameObject.transform.position - nearCharacter.tr.position).sqrMagnitude; if (sqrMagnitude < num) { if (checkForItemID == -1) { if (this.goodItems[i].itemTag == "Consumable" || this.goodItems[i].itemTag == "Ammunition" || this.goodItems[i].itemTag == "Buff") { item = item2; num = sqrMagnitude; } } else if (this.goodItems[i].ID == checkForItemID) { item = item2; num = sqrMagnitude; } } } return item; } // Token: 0x060010EA RID: 4330 RVA: 0x0014AE00 File Offset: 0x00149000 public void SetListItems(int invIndex, global::Item i, int newID, int amt, Vector3 sockA, Vector3 sockB, int pos, Vector4 time, Character c) { if (c.inventoryBag) { c.inventoryBag.SetListItems(invIndex, i, newID, amt, sockA, sockB, pos, time); } } // Token: 0x060010EB RID: 4331 RVA: 0x0014AE34 File Offset: 0x00149034 public void SpawnSavedItems(Character party) { InventoryContainer partyBag = this.GetPartyBag(party); if (this.gridTrs.Count == 0) { this.GetGrid(); } List list = partyBag.bagID; List list2 = partyBag.bagAmount; List list3 = partyBag.socketA; List list4 = partyBag.socketB; List list5 = partyBag.bagPos; List durability = partyBag.durability; List list6 = partyBag.bagItems; for (int i = 0; i < 19; i++) { if (list[i] > 0) { list6[i] = null; } } this.UpdateSlots(false, party.inventoryBag); for (int j = 19; j < list6.Count; j++) { if (list[j] > 0 && list6[j] == null) { global::Item item = this.SpawnItem(null, false, list[j], list2[j], list3[j], list4[j], durability[j], Vector3.zero, partyBag.transform); if (item != null) { int num = this.mainBagX; int num2 = this.mainBagY; durability[j] = item.durability; if (list5[j] == -1) { if (this.FindOpenSpace(Vector3.zero, item, num, num2, "Hidden", partyBag)) { if (item.bag) { item.bag.RemoveImage(item.backImage); } item.bag = partyBag; item.bag.AddImage(item.backImage, item); int num3 = list6.IndexOf(item); if (num3 > -1) { list5[num3] = item.bagGridID; party.SetBagPosition(num3, item.bagGridID); } } else { int num4 = -1; if (this.selectedPlayer && this.selectedPlayer.node != null) { num4 = (int)this.selectedPlayer.node.Area; } this.groundBag.DropLoot(item.ID, item.stackSize, item.socketA, item.socketB, item.durability, party, party.tr.position + new Vector3(Random.Range(-2f, 2f), 0f, Random.Range(-2f, 2f)), true, item.forSale, num4); item.DestroyItem(false, false); } } else { item.bagGridID = list5[j]; this.SetupGridFromSave(item, item.bagGridID, -1, num, num2); } item.AddSocketImgs(); list6[j] = item; } } } this.UpdateWeight(partyBag, party); party.UpdateListsFromInv(true); party.SetupPartyAfterLoadedVariables2(); } // Token: 0x060010EC RID: 4332 RVA: 0x0014B104 File Offset: 0x00149304 public void UpdateWeight(InventoryContainer listBag, Character c) { if (!listBag) { return; } listBag.UpdateWeight(); } // Token: 0x060010ED RID: 4333 RVA: 0x0014B118 File Offset: 0x00149318 public void TooMuchWeight(Character c) { this.str.Clear(); this.str.Append(Links.x.gameFeed.GetPartyColorText(c)); this.str.Append(c.stats.GetName()); this.str.Append(""); this.str.Append(" is carrying too much weight."); Links.x.gameFeed.AddFeed(this.str.ToString()); } // Token: 0x060010EE RID: 4334 RVA: 0x0014B1A0 File Offset: 0x001493A0 public InventoryContainer GetPartyBag(Character character) { return character.inventoryBag; } // Token: 0x060010EF RID: 4335 RVA: 0x0014B1A8 File Offset: 0x001493A8 public void GetBagLists(Character character) { if (character.party && this.openBag != character.inventoryBag) { if (this.openBag) { this.openBag.Close(); } this.selectedPlayer = character; this.openBag = character.inventoryBag; if (this.openBag) { this.openBag.Open(); this.openBag.UpdateItemInteractableState(true); this.bagItems = this.openBag.bagItems; this.bagID = this.openBag.bagID; this.bagAmount = this.openBag.bagAmount; this.socketA = this.openBag.socketA; this.socketB = this.openBag.socketB; this.bagPos = this.openBag.bagPos; this.durabilities = this.openBag.durability; if (this.open && Links.x.characterSheet.body) { this.equippedItems = Links.x.characterSheet.body.equippedItems; } this.UpdateSlots(false, character.inventoryBag); this.UpdateEquipmentSlots(); this.CheckSlotImages(); } } } // Token: 0x060010F0 RID: 4336 RVA: 0x0014B2F0 File Offset: 0x001494F0 public void GetBag(Character party) { if (party && this.openBags.Count > 0) { party.inventoryBag = this.openBags[0]; this.openBags.RemoveAt(0); party.inventoryBag.character = party; } } // Token: 0x060010F1 RID: 4337 RVA: 0x0014B340 File Offset: 0x00149540 public bool SkillCheck(Library.Inventory invRow) { int combatSkillID = Links.x.characterSheet.character.stats.GetCombatSkillID(invRow._MainSkill); return Links.x.characterSheet.character.stats.GetSkill(combatSkillID) >= 50f; } // Token: 0x060010F2 RID: 4338 RVA: 0x0014B394 File Offset: 0x00149594 public void SetupEquippedItems(Body body, bool all, int single, bool skipArmor) { if (!Links.x.characterSheet.open) { return; } body = Links.x.characterSheet.body; if (all) { body.CreateMenuItems(this.bagID[0], this.bagAmount[0], this.socketA[0], this.socketB[0], this.durabilities[0], 0, null); body.CreateMenuItems(this.bagID[1], this.bagAmount[1], this.socketA[1], this.socketB[1], this.durabilities[1], 1, null); body.CreateMenuItems(this.bagID[2], this.bagAmount[2], this.socketA[2], this.socketB[2], this.durabilities[2], 2, null); body.CreateMenuItems(this.bagID[3], this.bagAmount[3], this.socketA[3], this.socketB[3], this.durabilities[3], 3, null); body.CreateMenuItems(this.bagID[8], this.bagAmount[8], this.socketA[8], this.socketB[8], this.durabilities[8], 8, null); body.CreateMenuItems(this.bagID[10], this.bagAmount[10], this.socketA[10], this.socketB[10], this.durabilities[10], 10, null); body.CreateMenuItems(this.bagID[11], this.bagAmount[11], this.socketA[11], this.socketB[11], this.durabilities[11], 11, null); body.CreateMenuItems(this.bagID[12], this.bagAmount[12], this.socketA[12], this.socketB[12], this.durabilities[12], 12, null); body.CreateMenuItems(this.bagID[7], this.bagAmount[7], this.socketA[7], this.socketB[7], this.durabilities[7], 7, null); body.CreateMenuItems(this.bagID[13], this.bagAmount[13], this.socketA[13], this.socketB[13], this.durabilities[13], 13, null); body.CreateMenuItems(this.bagID[14], this.bagAmount[14], this.socketA[14], this.socketB[14], this.durabilities[14], 14, null); if (this.bagAmount[4] > 0) { single = 4; body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, this.slotAmmo1); } if (this.bagAmount[5] > 0) { single = 5; body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, this.slotAmmo2); } if (this.bagAmount[6] > 0) { single = 6; body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, this.slotAmmo3); } single = 16; body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, this.slotAlt1); single = 17; body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, this.slotAlt2); single = 18; body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, this.slotAlt3); single = 15; body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, this.slotAlt4); } else { if (single <= 3 || (single >= 7 && single <= 14)) { body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, null); } else { if (single == 4) { body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, this.slotAmmo1); } if (single == 5) { body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, this.slotAmmo2); } if (single == 6) { body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, this.slotAmmo3); } if (single == 16) { body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, this.slotAlt1); } if (single == 17) { body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, this.slotAlt2); } if (single == 18) { body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, this.slotAlt3); } if (single == 15) { body.CreateMenuItems(this.bagID[single], this.bagAmount[single], this.socketA[single], this.socketB[single], this.durabilities[single], single, this.slotAlt4); } } if (Links.x.characterSheet.body) { this.equippedItems = Links.x.characterSheet.body.equippedItems; } } if (!skipArmor && (all || single == 9)) { Library.Inventory invRowByIndex = Links.x.library.GetInvRowByIndex(this.bagID[9]); if (invRowByIndex._ArmorID != -1) { string text = invRowByIndex._CharacterModel; if (this.bagID[9] <= 1) { text = "Tunic"; } string armorModel = Links.x.archives.GetArmorModel(text, this.selectedPlayer.stats.race, this.selectedPlayer.stats.sex, this.selectedPlayer); if (armorModel != body.model) { body = Links.x.characterSheet.UpdateBody(armorModel); } body.SetupArmorForInventory(this.bagID[9], this.bagAmount[9], this.socketA[9], this.socketB[9], this.durabilities[9], 9); } else { string armorModel2 = Links.x.archives.GetArmorModel("Tunic", this.selectedPlayer.stats.race, this.selectedPlayer.stats.sex, this.selectedPlayer); if (armorModel2 != body.model) { body = Links.x.characterSheet.UpdateBody(armorModel2); } body.SetupArmorForInventory(this.bagID[9], this.bagAmount[9], this.socketA[9], this.socketB[9], this.durabilities[9], 9); } } else if (skipArmor && all) { body.SetupArmorForInventory(this.bagID[9], this.bagAmount[9], this.socketA[9], this.socketB[9], this.durabilities[9], 9); } if (!all) { bool mainSelected = this.selectedPlayer.mainSelected; } this.selectedPlayer.portrait.skillBag.UpdateWindowStates(); Links.x.characterSheet.GetStats(); Links.x.characterSheet.GetProficiency(); } // Token: 0x060010F3 RID: 4339 RVA: 0x0014BDFB File Offset: 0x00149FFB public void GetEquipSlotInfo(int index, out Button b, out Image i) { b = this.equipButtons[index]; i = this.equipImages[index]; } // Token: 0x060010F4 RID: 4340 RVA: 0x0014BE14 File Offset: 0x0014A014 public void SetUpBag(Character party) { if (!party.inventoryBag) { this.GetBag(party); } int num = 0; this.bag = party.bag; this.sockets = party.sockets; this.bagPositions = party.bagPositions; this.durabilitiesParty = party.durability; List list = party.inventoryBag.bagID; List list2 = party.inventoryBag.bagAmount; List list3 = party.inventoryBag.socketA; List list4 = party.inventoryBag.socketB; List list5 = party.inventoryBag.bagPos; List durability = party.inventoryBag.durability; List list6 = party.inventoryBag.bagItems; int num2 = this.bagPositions.Count * 2; for (int i = 0; i < this.bag.Count; i++) { if (i < num2) { int num3 = this.bag[i]; if (i % 2 == 0) { list6.Add(null); list.Add(num3); list5.Add(this.bagPositions[num]); list3.Add(this.sockets[i]); list4.Add(this.sockets[i + 1]); durability.Add(this.durabilitiesParty[num]); } else if (i % 2 == 1) { list2.Add(num3); num++; } } } } // Token: 0x060010F5 RID: 4341 RVA: 0x0014BF80 File Offset: 0x0014A180 public void LookForTorch() { if (this.open) { return; } for (int i = 0; i < 4; i++) { InventoryContainer inventoryContainer = null; if (i == 0) { inventoryContainer = this.bag1; } if (i == 1) { inventoryContainer = this.bag2; } if (i == 2) { inventoryContainer = this.bag3; } if (i == 3) { inventoryContainer = this.bag4; } if (inventoryContainer.character) { inventoryContainer.LookForTorch(); } } } // Token: 0x060010F6 RID: 4342 RVA: 0x0014BFE4 File Offset: 0x0014A1E4 public void NewHour() { for (int i = 0; i < 4; i++) { InventoryContainer inventoryContainer = null; if (i == 0) { inventoryContainer = this.bag1; } if (i == 1) { inventoryContainer = this.bag2; } if (i == 2) { inventoryContainer = this.bag3; } if (i == 3) { inventoryContainer = this.bag4; } if (inventoryContainer.character) { inventoryContainer.NewHour(); } } } // Token: 0x060010F7 RID: 4343 RVA: 0x0014C040 File Offset: 0x0014A240 public void UseItemFromPause(global::Item item, int equippedItemIndex, int equippedItemID, Character character) { Debug.Log(string.Concat(new string[] { "Using item from pause ", (character != null) ? character.ToString() : null, " ", (item != null) ? item.ToString() : null, " ", equippedItemIndex.ToString(), " ", equippedItemID.ToString() })); if (item == null && equippedItemIndex <= 0) { return; } if (item) { Debug.Log(string.Concat(new string[] { item.active.ToString(), " ", item.ID.ToString(), " ", equippedItemID.ToString() })); if (!item.active || item.ID != equippedItemID) { return; } this.UseItem(item, null, character); } if (equippedItemIndex > 0 && character.GetInvNum(equippedItemIndex * 2) == equippedItemID) { this.UseBeltItem(equippedItemIndex, character); } character.waitingToUseBeltItemIndex = 0; character.waitingToUseBeltItemID = 0; character.waitingToUseBagItem = null; character.waitingToUseItem = false; } // Token: 0x060010F8 RID: 4344 RVA: 0x0014C164 File Offset: 0x0014A364 public ItemEquipped GetItemEquippedFromIndex(int index) { if (this.equipButtons[index]) { return this.equipButtons[index].gameObject.GetComponent(); } return null; } // Token: 0x060010F9 RID: 4345 RVA: 0x0014C189 File Offset: 0x0014A389 public void UseItem(global::Item item, ItemEquipped equippedItem, Character character) { if (character.inventoryBag) { character.inventoryBag.UseItem(item, equippedItem, this.hitEquippedIndex); } } // Token: 0x060010FA RID: 4346 RVA: 0x0014C1AB File Offset: 0x0014A3AB public void UseBeltItem(int beltIndex, Character character) { if (character.inventoryBag) { character.inventoryBag.UseBeltItem(beltIndex); } } // Token: 0x060010FB RID: 4347 RVA: 0x0014C1C6 File Offset: 0x0014A3C6 public void RemoveBeltItem(int beltIndex, Character character) { if (character.inventoryBag) { character.inventoryBag.RemoveBeltItem(beltIndex); } } // Token: 0x060010FC RID: 4348 RVA: 0x0014C1E1 File Offset: 0x0014A3E1 public void AddEffect(global::Item item, Library.Inventory equippedItemRow, int equipIndex, Character character) { if (character.inventoryBag) { character.inventoryBag.AddEffect(item, equippedItemRow, equipIndex); } } // Token: 0x060010FD RID: 4349 RVA: 0x0014C200 File Offset: 0x0014A400 public void SetRepairMessage() { string text = Links.x.characterSheet.repairInstructions.text; if (this.mineralizing) { bool flag = false; if (this.hitItem && this.IsGemMatch(this.hitItem.invRow._Name)) { flag = true; } string text2 = "Select gems to grind into mineral powder\n\n"; if (flag) { text2 = "Grind " + this.hitItem.invRow._DisplayName + " into mineral powder"; text2 += "\n\nCost: "; int stackSize = this.hitItem.stackSize; text2 += stackSize.ToString(); if (stackSize == 1) { text2 += " emerald"; } else { text2 += " emeralds"; } } Links.x.characterSheet.repairInstructions.text = text2; } else { bool flag2 = false; if (this.repairType == "Armor") { if (this.hitItem && (this.hitItem.invRow._Tag == "Armor" || this.hitItem.invRow._Tag == "Shield")) { flag2 = true; } if (this.hitEquipped && (this.hitEquipped.invRow._Tag == "Armor" || this.hitEquipped.invRow._Tag == "Shield")) { flag2 = true; } } else if (this.repairType == "Weapon") { if (this.hitItem && this.hitItem.invRow._EquipSlotID == 0) { flag2 = true; } if (this.hitEquipped && this.hitEquipped.invRow._EquipSlotID == 0) { flag2 = true; } } else if (this.repairType == "Robe") { if (this.hitItem && this.hitItem.invRow._Tag == "MagicArmor") { flag2 = true; } if (this.hitEquipped && this.hitEquipped.invRow._Tag == "MagicArmor") { flag2 = true; } } else { Links.x.characterSheet.repairInstructions.text = "What would you like to repair?"; } if (this.hitEquipped && !this.hitEquipped.buddyItemEquipped3D) { flag2 = false; } if (this.repairType.Contains("Armor")) { string text3 = "Select damaged armor or shield sets to repair to full durability\n\n"; if (flag2 && (this.hitItem || this.hitEquipped)) { text3 += "Cost: "; int repairCost = this.GetRepairCost(this.hitItem, this.hitEquipped); text3 += repairCost.ToString(); if (repairCost == 1) { text3 += " emerald"; } else { text3 += " emeralds"; } } Links.x.characterSheet.repairInstructions.text = text3; } if (this.repairType == "Weapon") { string text4 = "Select damaged weapons to restore them to full durability\n\n"; if (flag2 && (this.hitItem || this.hitEquipped)) { text4 += "Cost: "; int repairCost2 = this.GetRepairCost(this.hitItem, this.hitEquipped); text4 += repairCost2.ToString(); if (repairCost2 == 1) { text4 += " emerald"; } else { text4 += " emeralds"; } } Links.x.characterSheet.repairInstructions.text = text4; } } if (text != Links.x.characterSheet.repairInstructions.text) { Links.x.characterSheet.repairInstructions.gameObject.GetComponent().Play("Repair Message", -1, 0f); } } // Token: 0x060010FE RID: 4350 RVA: 0x0014C61C File Offset: 0x0014A81C public int GetRepairCost(global::Item item, ItemEquipped itemEquipped) { int num = 0; float num2 = 1f; if (item) { num2 = 1f - item.durability.x / (float)item.invRow._DurabilityMax; } else if (itemEquipped) { num2 = 1f - itemEquipped.durability.x / (float)itemEquipped.invRow._DurabilityMax; } if (this.repairType == "Armor") { num = Mathf.RoundToInt(30f * num2); } else if (this.repairType == "Weapon") { num = Mathf.RoundToInt(20f * num2); } return Mathf.RoundToInt((float)num * this.selectedPlayer.stats.DispositionCost(Links.x.diorama.sceneName, Links.x.merchant.merchantCharacter)); } // Token: 0x060010FF RID: 4351 RVA: 0x0014C6FC File Offset: 0x0014A8FC private bool IsGemMatch(string n) { return n.Contains("Ameythyst") || n.Contains("Citrine") || n.Contains("Emerald") || n.Contains("Garnet") || n.Contains("GemNugget") || n.Contains("GemPoor"); } // Token: 0x06001100 RID: 4352 RVA: 0x0014C75C File Offset: 0x0014A95C public void StartGemMineral() { this.mineralizing = true; Links.x.characterSheet.repairInstructions.enabled = true; this.SetRepairMessage(); if (Links.x.mk) { EventSystem.current.SetSelectedGameObject(null); } Links.x.hudControl.MenuText(); } // Token: 0x06001101 RID: 4353 RVA: 0x0014C7B4 File Offset: 0x0014A9B4 private void GrindGem(global::Item gem) { bool flag = false; if (this.repairItem && this.repairItem.onGround) { flag = true; } if (gem && gem.onGround) { flag = true; } if (!flag) { int num = (int)gem.invRow._Level * gem.stackSize; if (gem.stackSize <= this.emeralds || this.repairItem) { this.gems += num; MasterAudio.PlaySoundAndForget("Mineralize", 1f, new float?(1f), 0f, "", null); this.fx.gameObject.transform.position = gem.gameObject.transform.position; this.fx.Play("Idle"); if (!this.repairItem) { this.emeralds -= gem.stackSize; } this.RemoveStack(this.selectedPlayer, gem, gem.stackSize); this.UpdateMisc(); Links.x.itemPickupFX.gameObject.SetActive(true); Links.x.itemPickupFX.gameObject.GetComponent().Play("Idle"); Links.x.itemPickupFX.position = this.gemText.gameObject.transform.position; return; } Links.x.characterSheet.StartQuip("Not enough emeralds", FaceAnimations.AnimationNames.Frown); } } // Token: 0x06001102 RID: 4354 RVA: 0x0014C940 File Offset: 0x0014AB40 public void StartRepair(string type) { this.repairing = true; this.repairType = type; this.repairItem = null; Links.x.characterSheet.repairInstructions.enabled = true; this.SetRepairMessage(); if (Links.x.mk) { EventSystem.current.SetSelectedGameObject(null); } MasterAudio.PlaySoundAndForget("Skill Ready", 0.6f, new float?(1f), 0f, "", null); Links.x.hudControl.MenuText(); } // Token: 0x06001103 RID: 4355 RVA: 0x0014C9D0 File Offset: 0x0014ABD0 public void RepairFromMerchant(global::Item item, ItemEquipped itemEquipped) { bool flag = false; bool flag2 = false; bool flag3 = false; int repairCost = this.GetRepairCost(item, itemEquipped); if (this.emeralds >= repairCost) { flag = true; } if (this.repairType == "Armor") { if (item && (item.invRow._Tag == "Armor" || item.invRow._Tag == "Shield")) { flag2 = true; } if (itemEquipped && (itemEquipped.invRow._Tag == "Armor" || itemEquipped.invRow._Tag == "Shield")) { flag2 = true; } } else if (this.repairType == "Weapon") { if (item && item.invRow._EquipSlotID == 0) { flag2 = true; } if (itemEquipped && itemEquipped.invRow._EquipSlotID == 0) { flag2 = true; } } if (item && item.durability.x < (float)item.invRow._DurabilityMax) { flag3 = true; } if (itemEquipped && itemEquipped.durability.x < (float)itemEquipped.invRow._DurabilityMax) { flag3 = true; } if (flag && flag2 && flag3) { if (this.repairType == "Staff") { if (item) { item.durability = new Vector4(item.durability.x, 0f, item.durability.z, item.durability.w); } if (itemEquipped) { itemEquipped.durability = new Vector4(itemEquipped.durability.x, 0f, itemEquipped.durability.z, itemEquipped.durability.w); } } else { if (item) { item.durability = new Vector4((float)item.invRow._DurabilityMax, item.durability.y, item.durability.z, item.durability.w); } if (itemEquipped) { itemEquipped.durability = new Vector4((float)itemEquipped.invRow._DurabilityMax, itemEquipped.durability.y, itemEquipped.durability.z, itemEquipped.durability.w); } } this.emeralds -= repairCost; MasterAudio.PlaySoundAndForget("Repair", 1f, new float?(1f), 0f, "", null); int num = -1; if (item) { this.fx.gameObject.transform.position = item.gameObject.transform.position; this.fx.Play("Idle"); if (item.durability.x > (float)item.invRow._DurabilityMax) { item.durability = new Vector4((float)item.invRow._DurabilityMax, item.durability.y, item.durability.z, item.durability.w); } num = this.bagItems.IndexOf(item); this.durabilities[num] = item.durability; item.SetDurabilityVisual(); if (this.repairType == "Armor") { item.socketA = new Vector3(0f, 0f, 0f); item.socketB = new Vector3(0f, 0f, 0f); this.socketA[num] = Vector3.zero; this.socketB[num] = Vector3.zero; item.RemoveSockets(); } } if (itemEquipped) { this.fx.gameObject.transform.position = itemEquipped.gameObject.transform.position; this.fx.Play("Idle"); if (itemEquipped.durability.x > (float)itemEquipped.invRow._DurabilityMax) { itemEquipped.durability = new Vector4((float)itemEquipped.invRow._DurabilityMax, itemEquipped.durability.y, itemEquipped.durability.z, itemEquipped.durability.w); } num = itemEquipped.equipIndex; this.durabilities[num] = itemEquipped.durability; this.selectedPlayer.ChangeDurabilityVisual(num); itemEquipped.SetDurabilityVisual(); if (this.repairType == "Armor") { itemEquipped.socketA = new Vector3(0f, 0f, 0f); itemEquipped.socketB = new Vector3(0f, 0f, 0f); this.socketA[num] = Vector3.zero; this.socketB[num] = Vector3.zero; } } if (num == 8 || num == 10 || num == 11 || num == 12) { this.selectedPlayer.stats.EnchantJewelryEffects(num * 2, false); } this.selectedPlayer.UpdateListsFromInv(true); if (itemEquipped) { itemEquipped.SetDurabilityVisual(); } if (this.itemInfo.open) { this.itemInfo.SetNumbers(true); } this.UpdateMisc(); Links.x.characterSheet.GetStats(); return; } if (!flag) { Links.x.characterSheet.StartQuip("Not enough emeralds", FaceAnimations.AnimationNames.Frown); return; } if (!flag2) { if (this.repairType == "Armor") { Links.x.characterSheet.StartQuip("This isn't armor", FaceAnimations.AnimationNames.LookRight); return; } if (this.repairType == "Weapon") { Links.x.characterSheet.StartQuip("This isn't a weapon", FaceAnimations.AnimationNames.LookRight); return; } } else if (!flag3) { Links.x.characterSheet.StartQuip("This doesn't need to be repaired", FaceAnimations.AnimationNames.LookRight); } } // Token: 0x06001104 RID: 4356 RVA: 0x0014CFA4 File Offset: 0x0014B1A4 public void RepairItem(global::Item item, ItemEquipped itemEquipped) { bool flag = true; if (item) { if (item.durability.x >= (float)item.invRow._DurabilityMax || item.invRow._DurabilityMax == 0) { flag = false; } } else if (itemEquipped.durability.x >= (float)itemEquipped.invRow._DurabilityMax || itemEquipped.invRow._DurabilityMax == 0) { flag = false; } if (!flag) { Links.x.characterSheet.StartQuip("This doesn't need to be repaired", FaceAnimations.AnimationNames.LookLeft); return; } this.AddCombatTime(this.selectedPlayer, "ExtraLong"); MasterAudio.PlaySoundAndForget("Repair", 1f, new float?(1f), 0f, "", null); int num = -1; if (item) { this.fx.gameObject.transform.position = item.gameObject.transform.position; this.fx.Play("Idle"); int num2 = (int)Mathf.Ceil(this.selectedPlayer.stats.Repair(item.invRow._MainSkill, false)); item.durability.x = item.durability.x + (float)num2; if (item.durability.x > (float)item.invRow._DurabilityMax) { item.durability.x = (float)item.invRow._DurabilityMax; } num = this.bagItems.IndexOf(item); this.durabilities[num] = item.durability; item.SetDurabilityVisual(); } if (itemEquipped) { this.fx.gameObject.transform.position = itemEquipped.gameObject.transform.position; this.fx.Play("Idle"); int num3 = (int)Mathf.Ceil(this.selectedPlayer.stats.Repair(itemEquipped.invRow._MainSkill, false)); itemEquipped.durability.x = itemEquipped.durability.x + (float)num3; if (itemEquipped.durability.x > (float)itemEquipped.invRow._DurabilityMax) { itemEquipped.durability.x = (float)itemEquipped.invRow._DurabilityMax; } num = itemEquipped.equipIndex; this.durabilities[num] = itemEquipped.durability; this.selectedPlayer.ChangeDurabilityVisual(num); } Links.x.characterSheet.PlayFaceAnimation(FaceAnimations.AnimationNames.Smile); this.selectedPlayer.UpdateListsFromInv(true); if (itemEquipped) { itemEquipped.SetDurabilityVisual(); } if (this.itemInfo.open) { this.itemInfo.SetNumbers(true); } if (num == 8 || num == 10 || num == 11 || num == 12) { this.selectedPlayer.stats.EnchantJewelryEffects(num * 2, false); } Links.x.characterSheet.GetStats(); this.RemoveStack(this.selectedPlayer, this.repairItem, 1); if (!this.repairItem) { this.repairing = false; return; } if (!this.repairItem.gameObject.activeSelf) { this.repairing = false; return; } } // Token: 0x06001105 RID: 4357 RVA: 0x0014D2B5 File Offset: 0x0014B4B5 public Library.Sockets GetSocket(int socketID) { if (socketID > 0 && socketID < this.allSockets.Count) { return this.allSockets[socketID]; } return null; } // Token: 0x06001106 RID: 4358 RVA: 0x0014D2D7 File Offset: 0x0014B4D7 public void Submit(InputAction.CallbackContext ctx) { Debug.Log("sumbitting"); if (this.dragging) { this.releaseItem = true; } } // Token: 0x06001107 RID: 4359 RVA: 0x0014D2F2 File Offset: 0x0014B4F2 public void Cancel(InputAction.CallbackContext ctx) { Debug.Log("cancel"); if (this.dragging) { this.releaseItem = true; } } // Token: 0x06001108 RID: 4360 RVA: 0x0014D310 File Offset: 0x0014B510 public void Open() { if (Records.x.banquetIsle) { this.emeraldImage.sprite = this.pasaarenEmerald; this.gemText.gameObject.transform.parent.gameObject.SetActive(false); } else { this.emeraldImage.sprite = this.minerovEmerald; this.gemText.gameObject.transform.parent.gameObject.SetActive(true); } for (int i = 0; i < this.equipImages.Length; i++) { if (this.equipImages[i]) { this.equipImages[i].enabled = false; } } this.bag1.Close(); this.bag2.Close(); this.bag3.Close(); this.bag4.Close(); Character character = Links.x.characterSheet.character; this.GetBagLists(character); this.groundContainer.btn.interactable = false; this.groundContainer.img.enabled = true; this.groundContainer.img.raycastTarget = false; this.hitGroundItem = null; this.CheckForExtras(); this.openBag.Open(); this.UpdateMisc(); this.open = true; this.UpdateSlots(false, this.openBag); this.CloseTooltip(); this.openBag.UpdateItemInteractableState(false); if (Links.x.mk) { int num = this.equippedButtons.Length; for (int j = 0; j < num; j++) { this.equippedButtons[j].interactable = false; } } else { this.SetColorsForEquipButtons(false); } for (int k = 0; k < this.gridTrs.Count; k++) { if (k >= this.gridAmt - this.equippedGridAmt) { if (Links.x.characterSheet.merchant) { this.gridImg[k].enabled = false; } else { this.gridImg[k].enabled = true; } } else { this.gridImg[k].enabled = true; } } this.DeleteRacks(); this.dragMessageText.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset); this.dragMessageText.enabled = false; this.dragMessageImg.enabled = false; if (Records.x.partySailing) { this.groundContainer.gameObject.SetActive(false); } else { this.groundContainer.gameObject.SetActive(true); } this.OpenGroundList(); this.ToggleCharacterSheetButtonStateForDrag(false); if (Links.x.characterSheet.blacksmith) { EventSystem.current.SetSelectedGameObject(Links.x.characterSheet.blacksmithButton); } this.CheckSlotImages(); this.UpdateSlotStates(this.openBag); } // Token: 0x06001109 RID: 4361 RVA: 0x0014D5E4 File Offset: 0x0014B7E4 public void ToggleEquipmentHover(bool state) { for (int i = 0; i < this.equippedHoverImages.Length; i++) { this.equippedHoverImages[i].enabled = state; } } // Token: 0x0600110A RID: 4362 RVA: 0x0014D614 File Offset: 0x0014B814 public void CheckForExtras() { foreach (global::Item item in this.bagItems) { if (item) { item.CheckStackSize(); this.SetBackSprite("Normal", item.backImage, item); item.SetDurabilityVisual(); } } } // Token: 0x0600110B RID: 4363 RVA: 0x0014D688 File Offset: 0x0014B888 public void UpdateSlots(bool updatePositions, InventoryContainer invBag) { this.currSlotsUsed.Clear(); this.addToGround.Clear(); bool flag = false; for (int i = 0; i < this.gridTrs.Count; i++) { this.gridState[i] = false; this.gridImg[i].sprite = this.emptySprite; } this.slotBagItems = this.bagItems; this.slotBagPos = this.bagPos; if (!this.open) { this.slotBagItems = invBag.bagItems; } for (int j = 0; j < this.slotBagItems.Count; j++) { global::Item item = this.slotBagItems[j]; if (item) { flag = false; if (item.stackable && item.stackSize == 0) { item.DestroyItem(true, false); } else { if (item.img) { item.img.enabled = true; } item.gameObject.SetActive(true); this.gridSlots = item.gridImg; for (int k = 0; k < this.gridSlots.Count; k++) { if (k > -1) { int num = this.gridSlots[k]; this.gridState[num] = true; this.gridImg[num].sprite = this.filledSprite; if (!this.currSlotsUsed.Contains(num)) { this.currSlotsUsed.Add(num); } else { if (!flag) { this.addToGround.Add(item); } flag = true; } } } } if (this.gridSlots.Count == 0) { this.addToGround.Add(item); } if (!flag && updatePositions) { Vector3 vector = Vector3.zero; int num2 = 0; for (int l = 0; l < this.gridSlots.Count; l++) { vector += this.gridTrs[this.gridSlots[l]].position; num2++; } if (vector != Vector3.zero) { vector /= (float)num2; } if (item.gameObject) { item.gameObject.transform.position = vector; } } } } int count = this.addToGround.Count; int num3 = this.mainBagX; int num4 = this.mainBagY; for (int m = 0; m < count; m++) { bool flag2 = this.FindOpenSpace(Vector3.zero, this.addToGround[m], num3, num4, "Hidden", invBag); if (flag2 && this.addToGround[m]) { if (this.addToGround[m].bag) { this.addToGround[m].bag.RemoveImage(this.addToGround[m].backImage); } this.addToGround[m].bag = this.openBag; this.addToGround[m].bag.AddImage(this.addToGround[m].backImage, this.addToGround[m]); int num5 = this.slotBagItems.IndexOf(this.addToGround[m]); if (Records.x.editor || Records.x.secrets) { string[] array = new string[5]; int num6 = 0; global::Item item2 = this.addToGround[m]; array[num6] = ((item2 != null) ? item2.ToString() : null); array[1] = " "; array[2] = this.addToGround[m].stackSize.ToString(); array[3] = " no spot "; array[4] = num5.ToString(); Debug.Log(string.Concat(array)); } if (num5 > -1) { this.slotBagPos[num5] = this.addToGround[m].bagGridID; this.selectedPlayer.SetBagPosition(num5, this.addToGround[m].bagGridID); } } if (!flag2) { string text = ""; if ((Records.x.editor || Records.x.secrets) && m < this.addToGround.Count) { text = this.addToGround[m].name; } this.ToGround(this.addToGround[m], true); if (Records.x.editor || Records.x.secrets) { Debug.Log(text + " overlapping item, going to ground"); } } } if (this.addToGround.Count > 0) { for (int n = 0; n < this.gridTrs.Count; n++) { this.gridState[n] = false; this.gridImg[n].sprite = this.emptySprite; } foreach (global::Item item3 in this.slotBagItems) { if (item3) { if (item3.img) { item3.img.enabled = true; } this.gridSlots = item3.gridImg; for (int num7 = 0; num7 < this.gridSlots.Count; num7++) { if (num7 > -1) { int num = this.gridSlots[num7]; this.gridState[num] = true; this.gridImg[num].sprite = this.filledSprite; } } if (!flag && updatePositions) { Vector3 vector2 = Vector3.zero; int num8 = 0; for (int num9 = 0; num9 < this.gridSlots.Count; num9++) { vector2 += this.gridTrs[this.gridSlots[num9]].position; num8++; } if (vector2 != Vector3.zero) { vector2 /= (float)num8; } if (item3.gameObject) { item3.gameObject.transform.position = vector2; } } } } } this.UpdateWeight(this.openBag, this.selectedPlayer); } // Token: 0x0600110C RID: 4364 RVA: 0x0014DD08 File Offset: 0x0014BF08 public void Close() { this.repairing = false; this.repairItem = null; this.repairType = ""; if (Links.x.characterSheet.repairInstructions) { Links.x.characterSheet.repairInstructions.enabled = false; } this.mineralizing = false; this.repairing = false; this.startDragObjectScript = null; this.dropScript = null; this.UpdateMisc(); if (this.openBag) { this.openBag.Close(); } if (this.dragging) { this.RemovePrevEquipped(); this.pickingEquipItem = false; this.closing = true; bool flag = false; if (this.dropScript && this.dropScript.equip) { flag = true; } if (flag || !this.dragParent) { this.ToGround(this.dragItem, false); } else { this.DragListen(); } this.closing = false; } this.dragGo = null; if (this.dragItem) { this.dragItem.SetSprite(false); } this.dragItem = null; this.prevHitItem = null; this.hitItem = null; this.hitGroundItem = null; this.groundDragItem = null; this.prevDragItem = null; this.prevItem = null; this.repairItem = null; this.open = false; this.ReleaseGroundList(); this.dragging = false; this.draggingSocket = false; this.ToggleCharacterSheetButtonStateForDrag(false); this.openBag = null; } // Token: 0x0600110D RID: 4365 RVA: 0x0014DE7C File Offset: 0x0014C07C public void CloseTooltip() { this.itemTooltipOpen = false; this.itemInfo.EndMenu(); this.tooltipitem = null; this.itemInfoCompare.gameObject.SetActive(false); if (Links.x.mk) { this.SetDragMessageText("", null); } Links.x.characterSheet.targetAlpha = -2f; } // Token: 0x0600110E RID: 4366 RVA: 0x0014DEE0 File Offset: 0x0014C0E0 public void CloseTooltipController() { this.itemTooltipOpen = false; this.itemInfo.EndMenu(); this.tooltipitem = null; this.itemInfoCompare.gameObject.SetActive(false); if (Links.x.mk) { this.SetDragMessageText("", null); } } // Token: 0x0600110F RID: 4367 RVA: 0x0014DF30 File Offset: 0x0014C130 public void OpenTooltip(ItemEquipped tooltip) { this.itemTooltipOpen = true; Links.x.characterSheet.levelProgress.SetActive(false); Links.x.characterSheet.targetAlpha = 1f; this.itemInfo.comboCompare = false; this.itemInfo.StartMenu(null, tooltip); } // Token: 0x06001110 RID: 4368 RVA: 0x0014DF88 File Offset: 0x0014C188 public void OpenTooltip(global::Item tooltip) { if (this.spinning || this.dragging) { return; } this.itemTooltipOpen = true; this.tooltipitem = tooltip; Links.x.characterSheet.levelProgress.SetActive(false); Links.x.characterSheet.targetAlpha = 1f; bool flag = false; if (tooltip && (tooltip.invRow._EquipSlotID == 0 || tooltip.invRow._EquipSlotID == 1 || tooltip.invRow._EquipSlotID == 9 || tooltip.invRow._EquipSlotID == 8 || tooltip.invRow._EquipSlotID == 11 || tooltip.invRow._EquipSlotID == 12 || tooltip.invRow._EquipSlotID == 10) && !tooltip.isEquipped && Links.x.characterSheet.body && this.bagID[tooltip.invRow._EquipSlotID] > 1) { this.itemInfoCompare.gameObject.SetActive(true); ItemEquipped itemEquipped = Links.x.characterSheet.body.GetItemEquipped(tooltip.invRow._EquipSlotID); if (itemEquipped) { this.itemInfo.compareItem = itemEquipped; this.itemInfoCompare.StartMenu(null, itemEquipped); flag = true; } } this.itemInfo.StartMenu(tooltip, null); if (!flag) { this.itemInfoCompare.gameObject.SetActive(false); } } // Token: 0x06001111 RID: 4369 RVA: 0x0014E104 File Offset: 0x0014C304 public void SetDragMessageText(string text, global::Item item) { if (Links.x.joy) { if (!(text != "")) { this.dragMessageText.enabled = false; this.dragMessageImg.enabled = false; return; } this.dragMessageText.enabled = true; this.dragMessageImg.enabled = true; if (text == "Hover") { if (!item) { if (this.hitEquipped) { if (this.hitEquipped.invRow._RightClickAction == "Consume" && !Records.x.InCombat(false)) { this.dragMessageText.text = Links.x.gameplay.itemHoverUseText; } else { this.dragMessageText.text = Links.x.gameplay.itemHoverText; } } else { this.dragMessageText.text = Links.x.gameplay.itemHoverText; } } else if (item.invRow._Stackable) { if (item.invRow._RightClickAction == "Consume") { this.dragMessageText.text = Links.x.gameplay.itemHoverSplitUseText; } else { this.dragMessageText.text = Links.x.gameplay.itemHoverSplitText; } } else if (item.invRow._RightClickAction == "Consume" && !Records.x.InCombat(false)) { this.dragMessageText.text = Links.x.gameplay.itemHoverUseText; } else { this.dragMessageText.text = Links.x.gameplay.itemHoverText; } } if (text == "Dragging") { this.dragMessageText.text = Links.x.gameplay.dragJoystickText; } if (text == "EquipBag") { if (this.dragging) { this.dragMessageText.text = Links.x.gameplay.equipBagDragText; } else { this.dragMessageText.text = Links.x.gameplay.equipBagText; } } if (text == "Equip") { this.dragMessageText.text = Links.x.gameplay.equipText; } if (text == "EquipDragging") { this.dragMessageText.text = "Equip item\n" + Links.x.gameplay.dragJoystickText; } if (text == "GroundDragging") { this.dragMessageText.text = "Drop on ground\n" + Links.x.gameplay.dragJoystickText; } if (text == "Spinning") { this.dragMessageText.text = Links.x.gameplay.equipSpinningText; return; } } else { this.dragMessageText.enabled = false; this.dragMessageImg.enabled = false; } } // Token: 0x06001112 RID: 4370 RVA: 0x0014E400 File Offset: 0x0014C600 public int PartyMineralCount() { return this.gems; } // Token: 0x06001113 RID: 4371 RVA: 0x0014E408 File Offset: 0x0014C608 public int MineralValue(Library.Inventory row) { return (int)row._Level; } // Token: 0x06001114 RID: 4372 RVA: 0x0014E411 File Offset: 0x0014C611 public void RemoveMinerals(int amount) { this.gems -= amount; } // Token: 0x06001115 RID: 4373 RVA: 0x0014E424 File Offset: 0x0014C624 public Vector3 SubtractVectors(Vector3 a, Vector3 b) { Vector3 vector; vector.x = a.x - b.x; vector.y = a.y - b.y; vector.z = a.z - b.z; return vector; } // Token: 0x06001116 RID: 4374 RVA: 0x0014E470 File Offset: 0x0014C670 public global::Item GetMoney() { for (int i = 0; i < this.bagItems.Count; i++) { if (this.bagItems[i] && this.bagItems[i].ID == 2) { return this.bagItems[i]; } } return null; } // Token: 0x06001117 RID: 4375 RVA: 0x0014E4C8 File Offset: 0x0014C6C8 public global::Item CheckListForItem(int num, Character party) { InventoryContainer inventoryContainer = null; if (party == this.bag1.character) { inventoryContainer = this.bag1; } if (party == this.bag2.character) { inventoryContainer = this.bag2; } if (party == this.bag3.character) { inventoryContainer = this.bag3; } if (party == this.bag4.character) { inventoryContainer = this.bag4; } if (inventoryContainer) { global::Item item = inventoryContainer.CheckListForItem(num); if (item) { return item; } } return null; } // Token: 0x06001118 RID: 4376 RVA: 0x0014E55C File Offset: 0x0014C75C public int GetRealAmmo(string id, Vector3 sockA) { bool flag = false; bool flag2 = false; bool flag3 = false; string text = ""; if (id == "Arrow") { flag = true; } if (id == "Dart") { flag2 = true; } if (id == "Elixir") { flag3 = true; } if (flag) { if (sockA.y == 0f || sockA.y == 9f) { text = "Arrow"; } if (sockA.y == 21f) { text = "ArrowFang"; } if (sockA.y == 20f) { text = "ArrowNail"; } if (sockA.y == 22f) { text = "ArrowScales"; } } else if (flag2) { if (sockA.y == 0f || sockA.y == 9f) { text = "Dart"; } if (sockA.y == 4f) { text = "DartFrog"; } if (sockA.y == 5f) { text = "DartMushroom"; } if (sockA.y == 6f) { text = "DartAcorn"; } if (sockA.y == 7f) { text = "DartShinyRock"; } if (sockA.y == 8f) { text = "DartShell"; } } else if (flag3) { text = "Vial"; if (sockA.y == 10f) { text = "VialRed1"; } if (sockA.y == 11f) { text = "VialRed2"; } if (sockA.y == 12f) { text = "VialBlue1"; } if (sockA.y == 13f) { text = "VialBlue2"; } if (sockA.y == 14f) { text = "VialGreen1"; } if (sockA.y == 15f) { text = "VialGreen2"; } if (sockA.y == 16f) { text = "VialWhite1"; } if (sockA.y == 17f) { text = "VialWhite2"; } if (sockA.y == 18f) { text = "VialBlack1"; } if (sockA.y == 19f) { text = "VialBlack2"; } } return Links.x.library.GetInvRowID(text); } // Token: 0x04001B7B RID: 7035 [Header("Lists")] private List bagItems; // Token: 0x04001B7C RID: 7036 private List tempBagItems; // Token: 0x04001B7D RID: 7037 private List listUpdateBagItems; // Token: 0x04001B7E RID: 7038 private List slotBagItems; // Token: 0x04001B7F RID: 7039 private List updateBagItems; // Token: 0x04001B80 RID: 7040 private List tempBagStack; // Token: 0x04001B81 RID: 7041 private List listUpdateBagID; // Token: 0x04001B82 RID: 7042 private List listUpdateBagAmount; // Token: 0x04001B83 RID: 7043 private List listUpdateSocketA; // Token: 0x04001B84 RID: 7044 private List listUpdateSocketB; // Token: 0x04001B85 RID: 7045 private List listUpdateBagPositions; // Token: 0x04001B86 RID: 7046 private List slotBagPos; // Token: 0x04001B87 RID: 7047 private List listUpdateDurabilities; // Token: 0x04001B88 RID: 7048 private List torchDurabilities; // Token: 0x04001B89 RID: 7049 private List torchBagID; // Token: 0x04001B8A RID: 7050 private List bagID; // Token: 0x04001B8B RID: 7051 private List bagAmount; // Token: 0x04001B8C RID: 7052 private List socketA; // Token: 0x04001B8D RID: 7053 private List socketB; // Token: 0x04001B8E RID: 7054 private List bagPos; // Token: 0x04001B8F RID: 7055 private List bag; // Token: 0x04001B90 RID: 7056 private List bagPositions; // Token: 0x04001B91 RID: 7057 private List durabilitiesParty; // Token: 0x04001B92 RID: 7058 private List durabilities; // Token: 0x04001B93 RID: 7059 private List sockets; // Token: 0x04001B94 RID: 7060 private List inRangeGroundItems; // Token: 0x04001B95 RID: 7061 private List merchantItems; // Token: 0x04001B96 RID: 7062 public List openBags = new List(); // Token: 0x04001B97 RID: 7063 private ItemEquipped[] equippedItems; // Token: 0x04001B98 RID: 7064 [Header("Objects")] public GroundBag groundBag; // Token: 0x04001B99 RID: 7065 public InventoryContainer bag1; // Token: 0x04001B9A RID: 7066 public InventoryContainer bag2; // Token: 0x04001B9B RID: 7067 public InventoryContainer bag3; // Token: 0x04001B9C RID: 7068 public InventoryContainer bag4; // Token: 0x04001B9D RID: 7069 public ItemBook itemInfo; // Token: 0x04001B9E RID: 7070 public ItemBook itemInfoCompare; // Token: 0x04001B9F RID: 7071 public GameObject itemTooltip; // Token: 0x04001BA0 RID: 7072 public GameObject itemTooltipCompare; // Token: 0x04001BA1 RID: 7073 public TextMeshProUGUI emeraldText; // Token: 0x04001BA2 RID: 7074 public TextMeshProUGUI gemText; // Token: 0x04001BA3 RID: 7075 public TextMeshProUGUI dragMessageText; // Token: 0x04001BA4 RID: 7076 public Image emeraldImage; // Token: 0x04001BA5 RID: 7077 public RectTransform dragMessageImgRT; // Token: 0x04001BA6 RID: 7078 public Image dragMessageImg; // Token: 0x04001BA7 RID: 7079 public Image[] equippedHoverImages = new Image[0]; // Token: 0x04001BA8 RID: 7080 public RectTransform bottomLeft; // Token: 0x04001BA9 RID: 7081 public RectTransform topRight; // Token: 0x04001BAA RID: 7082 public HannahAnimator fx; // Token: 0x04001BAB RID: 7083 public Animator peddlerFX; // Token: 0x04001BAC RID: 7084 public Image peddlerFabric; // Token: 0x04001BAD RID: 7085 public Image peddlerEmeraldBackground; // Token: 0x04001BAE RID: 7086 public TextMeshProUGUI peddlerHeader; // Token: 0x04001BAF RID: 7087 public TextMeshProUGUI peddlerSellAmount; // Token: 0x04001BB0 RID: 7088 public TextMeshProTypewriterEffect typewriter; // Token: 0x04001BB1 RID: 7089 public EnchantItem enchantMenu; // Token: 0x04001BB2 RID: 7090 public Image bagWeightFill; // Token: 0x04001BB3 RID: 7091 [Header("Dragging")] public global::Item dragItem; // Token: 0x04001BB4 RID: 7092 public GameObject dropObject; // Token: 0x04001BB5 RID: 7093 public GameObject startDragObject; // Token: 0x04001BB6 RID: 7094 public GameObject dragGo; // Token: 0x04001BB7 RID: 7095 public InventoryContainer dropScript; // Token: 0x04001BB8 RID: 7096 public InventoryContainer startDragObjectScript; // Token: 0x04001BB9 RID: 7097 public InventoryContainer openBag; // Token: 0x04001BBA RID: 7098 public InventoryContainer groundContainer; // Token: 0x04001BBB RID: 7099 public InventoryContainer merchantBag; // Token: 0x04001BBC RID: 7100 public InventoryContainer equipBag; // Token: 0x04001BBD RID: 7101 public Transform groundContent; // Token: 0x04001BBE RID: 7102 public Vector3 dropPosition; // Token: 0x04001BBF RID: 7103 public Vector3 prevPosition; // Token: 0x04001BC0 RID: 7104 public bool dragging; // Token: 0x04001BC1 RID: 7105 public bool doSplit; // Token: 0x04001BC2 RID: 7106 public bool draggingSocket; // Token: 0x04001BC3 RID: 7107 public bool canEndDrag; // Token: 0x04001BC4 RID: 7108 public bool secondaryDragSave; // Token: 0x04001BC5 RID: 7109 private Vector3 itemCenterOffset; // Token: 0x04001BC6 RID: 7110 private Vector3 savedPosition; // Token: 0x04001BC7 RID: 7111 private float prevDist; // Token: 0x04001BC8 RID: 7112 private global::Item swapDragItem; // Token: 0x04001BC9 RID: 7113 public Vector3 startPos; // Token: 0x04001BCA RID: 7114 public Transform dragParent; // Token: 0x04001BCB RID: 7115 public Transform itemDrag; // Token: 0x04001BCC RID: 7116 private int dragX; // Token: 0x04001BCD RID: 7117 private int dragY; // Token: 0x04001BCE RID: 7118 public Vector2 pickUpTiles; // Token: 0x04001BCF RID: 7119 public bool dragFromGround; // Token: 0x04001BD0 RID: 7120 public bool swapping; // Token: 0x04001BD1 RID: 7121 public Bag secondaryBag; // Token: 0x04001BD2 RID: 7122 public RectTransform itemDragRT; // Token: 0x04001BD3 RID: 7123 private float dragTime; // Token: 0x04001BD4 RID: 7124 public bool pickingEquipItem; // Token: 0x04001BD5 RID: 7125 public bool releaseItem; // Token: 0x04001BD6 RID: 7126 public Button groundContainerBtn; // Token: 0x04001BD7 RID: 7127 public Image groundContainerBtnImg; // Token: 0x04001BD8 RID: 7128 private Vector3 controllerOffset; // Token: 0x04001BD9 RID: 7129 private global::Item itemToDrag; // Token: 0x04001BDA RID: 7130 private ItemEquipped itemEquippedToDrag; // Token: 0x04001BDB RID: 7131 public List