public void InventoryDo(string method, int cnt) { if (method == "DropItem") { if (_pc.Inventory[cnt].CanBeDropped) { _pc.Inventory.RemoveAt(cnt); } else { Debug.Log("Can't destroy this item!"); } } else if (method == "UseItem") { if (_pc.Inventory[cnt].ItemType == ItemEquipType.Clothing || _pc.Inventory[cnt].ItemType == ItemEquipType.Weapon) { if (_pc.playerState == PlayerState.Normal) { GUIHandler.EquipAnItem(cnt); } else { Debug.Log("Can't equip item right now."); } } else if (_pc.Inventory[cnt].ItemType == ItemEquipType.Consumable) { //IEnumerator for cooldown of using potions Consumable c = _pc.Inventory[cnt] as Consumable; bool usedPot = _pc.UseConsumable((int)c.VitalToRestore, c.AmountToHeal); if (usedPot) { if (c.CurStacks == 1) { _pc.Inventory.RemoveAt(cnt); } else { c.CurStacks -= 1; } } else { Debug.Log("Using pots on cooldown"); } } else if (_pc.Inventory[cnt].ItemType == ItemEquipType.Socket) { MyGUI.itemIsPickedUp = true; MyGUI.itemPickedUpIcon = _pc.Inventory[cnt].Icon; MyGUI.itemIsForUse = true; MyGUI.pickedUpItemIdentifier = string.Format("Inventory{0}", cnt); } else { Debug.Log("Unknown : This is a " + _pc.Inventory[cnt].Name); } } else { if (_pc.Inventory.Count < _maxInventorySpace) { switch (method) { //Returning Equipped Items case "ReturnEquippedWeapon": _pc.AddItem(_pc.EquipedWeapon); _pc.EquipedWeapon = null; break; case "ReturnEquippedArmorHead": _pc.AddItem(_pc.EquipedArmorHead); _pc.EquipedArmorHead = null; break; case "ReturnEquippedArmorChest": _pc.AddItem(_pc.EquipedArmorChest); _pc.EquipedArmorChest = null; break; case "ReturnEquippedArmorGloves": _pc.AddItem(_pc.EquipedArmorGloves); _pc.EquipedArmorGloves = null; break; case "ReturnEquippedArmorLegs": _pc.AddItem(_pc.EquipedArmorLegs); _pc.EquipedArmorLegs = null; break; case "ReturnEquippedArmorFeet": _pc.AddItem(_pc.EquipedArmorFeet); _pc.EquipedArmorFeet = null; break; case "ReturnEquippedArmorBack": _pc.AddItem(_pc.EquipedArmorBack); _pc.EquipedArmorBack = null; break; } } else { Debug.Log("Inventory is full"); Debug.Log("Your Inventory is full."); } } _pc.UpdateStats(); }