public Boolean sellItem(int index, int amount, Item tehItem = null) { updateInv(); int hash = seq[index]; if (hash == -1) { Console.WriteLine("Cannot sell item [item does not exist]"); return(false); } Item item = inv[hash]; if (item == null) { Console.WriteLine("Cannot sell item [item does not exist]"); return(false); } if (tehItem != null) { tehItem.setItemID(item.getItemID()); } removeItem(index, amount); saveInv(); return(true); }
public Boolean sellItem(int index, int amount, Item tehItem = null) { updateInv(); int hash = seq[index]; if(hash == -1) { Console.WriteLine("Cannot sell item [item does not exist]"); return false; } Item item = inv[hash]; if(item == null) { Console.WriteLine("Cannot sell item [item does not exist]"); return false; } if(tehItem != null) { tehItem.setItemID(item.getItemID()); } removeItem(index, amount); saveInv(); return true; }