Exemple #1
0
        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);
        }
Exemple #2
0
 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;
 }