/* Attempts to interact with the specified GroundItem using the
  * specified String
  * If the item is not found under the cursor at ground height, the cursor
  * is moved to table height.
  * @param i GroundItem to interact with
  * @param s action to do
  * @return true if successfully clicked
  * @author Zippy
  */
 public static boolean itemInteract(GroundItem i, String s) {
   s = s.toLowerCase();
   Point p1 = Calculations.tileToScreen(i.getLocation(), .5, .5, 0),
       p2 = Calculations.tileToScreen(i.getLocation(), .5, .5, -400);
   if (p1.x != 0 || p1.y != 0) {
     Mouse.move(p1);
     if (Menu.contains(s + " " + i.getItem().getName()))
       return Menu.click(s + " " + i.getItem().getName());
   }
   if (p2.x != 0 || p2.y != 0) {
     Mouse.move(p2);
     if (Menu.contains(s + " " + i.getItem().getName())) {
       return Menu.click(s + " " + i.getItem().getName());
     }
   }
   return false;
 }
 /**
  * Uses an item on a game object.
  *
  * @param item the item to use
  * @param target the game object to be used on by the item
  * @return <tt>true</tt> if the "Use" action had been used on both the inventory item and the game
  *     object; otherwise <tt>false</tt>
  */
 public static boolean useItem(Item item, GameObject target) {
   if (item != null && target != null) {
     for (int i = 0, r = Random.nextInt(5, 8); i < r; i++) {
       if (!isItemSelected()) {
         if (item.interact("Use")) {
           for (int j = 0; j < 10 && !isItemSelected(); j++) {
             Task.sleep(100, 200);
           }
         } else {
           return false;
         }
       }
       // just make sure in case something bad happened
       if (isItemSelected()) {
         final String itemName = item.getName();
         final ObjectDefinition targetDef = target.getDef();
         final Model targetModel = target.getModel();
         if (targetDef != null && itemName != null && targetModel != null) {
           final String targetName = targetDef.getName();
           Mouse.move(targetModel.getNextPoint());
           final String action =
               "Use "
                   + itemName.replace("<col=ff9040>", "")
                   + " -> "
                   + targetName.replace("<col=ff9040>", "");
           for (int j = 0, s = Random.nextInt(5, 8); j < s; j++) {
             if (Menu.contains(action) && Menu.click(action)) {
               return true;
             } else {
               Mouse.move(targetModel.getNextPoint());
             }
           }
         }
         // kay, since that failed, let's try just use
         if (target.interact("Use")) {
           return true;
         }
       }
     }
   }
   return false;
 }
 /**
  * Drops the inventory item of the specified column and row.
  *
  * @param col the column the inventory item is in
  * @param row the row the inventory item is in
  */
 public static void dropItem(int col, int row) {
   if (col < 0 || col > 3 || row < 0 || row > 6) return;
   if (getAllItems()[col + row * 4].getId() == -1) return;
   Point p;
   p = Mouse.getLocation();
   if (p.x < 563 + col * 42
       || p.x >= 563 + col * 42 + 32
       || p.y < 213 + row * 36
       || p.y >= 213 + row * 36 + 32) {
     Mouse.move(getComponent().getComponents()[row * 4 + col].getCenter(), 10, 10);
   }
   Mouse.click(false);
   Task.sleep(Random.nextInt(10, 25));
   Menu.click("Drop");
   Task.sleep(Random.nextInt(25, 50));
 }