private void inventoryWindow(int windowid) { bool controlIsDown = false; bool shiftIsDown = false; int cnt = 0; for (int y = 0; y < _inventoryRows; y++) { if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) { controlIsDown = true; } if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { shiftIsDown = true; } for (int x = 0; x < _inventoryCols; x++) { if (cnt < _pc.Inventory.Count) { buttonRects[cnt] = new Rect(5 + (itemWidth * x), 20 + y * itemHeight, itemWidth, itemHeight); //Item Button if (GUI.Button(buttonRects[cnt], new GUIContent(_pc.Inventory[cnt].Icon, string.Format("Inventory{0}", cnt)), _pc.Inventory[cnt].Rarity.ToString())) { //Left Click To Pick Up Item/Split Stack if (!showSplit) { if (Event.current.button == 0) { if (shiftIsDown && _pc.Inventory[cnt].CurStacks > 1) { showSplit = true; MyGUI.inventoryArrayToSplit = cnt; } else if (!MyGUI.itemIsPickedUp) { MyGUI.itemIsPickedUp = true; MyGUI.SetPickedUpItem(_pc.Inventory[cnt].Icon, string.Format("Inventory{0}", cnt)); } else { if (!MyGUI.itemIsForUse) { GUIHandler.SwapItems(string.Format("Inventory{0}", cnt)); } else { GUIHandler.UseSocket(cnt); } } } //Right Click To Use Item if (Event.current.button == 1 && !MyGUI.itemIsPickedUp) { if (_pc.playerState == PlayerState.Stash) { _pc.AddToBank(cnt); } else if (_pc.playerState != PlayerState.NPCDialog) { InventoryDo("UseItem", cnt); } else if (controlIsDown && NPCDialogGUI.openedNPCDialog.OptionNumber == 100) //if in vendor and holding control { NPCDialogGUI.openedNPCDialog.vendor.PlayerSellItem(cnt); } MyGUI._toolTip = ""; return; } } } string stackInfo = _pc.Inventory[cnt].MaxStacks > 1 ? _pc.Inventory[cnt].CurStacks.ToString() : string.Empty; GUI.Box(buttonRects[cnt], stackInfo, "StackOverlay"); string moreInfo = _pc.Inventory[cnt].ItemType == ItemEquipType.Weapon ? "+" + (_pc.Inventory[cnt] as Weapon).Enchants : string.Empty; if (_pc.Inventory[cnt].ItemType == ItemEquipType.QuestItem) { moreInfo = "Q"; } GUI.Box(buttonRects[cnt], moreInfo, "ItemInfoOverlay"); } else { GUI.Box(new Rect(5 + (itemWidth * x), 20 + y * itemHeight, itemWidth, itemHeight), "", "inventorySlot"); } cnt++; } } if (GUI.Button(new Rect(5, _inventoryWindowRect.height - 25, 20, 20), new GUIContent("", "Deletes items from your inventory."), "Invisible")) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.TrashIconDropItem(); } } } GUI.Label(new Rect(27, _inventoryWindowRect.height - 27, _inventoryWindowRect.width - 54, 20), _pc.Gold.ToString("N0").Replace(".", ","), "Gold"); GUI.DragWindow(new Rect(0, 0, 10000, 20)); GUIHandler.SetToolTip(); }