private static bool canMine(Player p, Rock rock, Rock rock2) { if (rock == null || p == null || !Server.getGlobalObjects().originalObjectExists(rock.getRockId(), rock.getRockLocation())) { return(false); } if (rock.getRockIndex() != 0) { if (!p.getLocation().withinDistance(rock.getRockLocation(), 2)) { return(false); } } else { // is rune ess rock if (!p.getLocation().inArea(rock.getRockLocation().getX() - 1, rock.getRockLocation().getY() - 1, rock.getRockLocation().getX() + 5, rock.getRockLocation().getY() + 5)) { return(false); } } if (rock2 != null) { if (!rock.Equals(rock2)) { return(false); } } if (p.getSkills().getGreaterLevel(Skills.SKILL.MINING) < rock.getLevel()) { p.getPackets().sendMessage("You need a Mining level of " + rock.getLevel() + " to mine that rock."); return(false); } if (!hasPickaxe(p)) { p.getPackets().sendMessage("You need a pickaxe to mine a rock!"); return(false); } if (p.getInventory().findFreeSlot() == -1) { p.getPackets().sendChatboxInterface(210); p.getPackets().modifyText("Your inventory is too full to carry any ore.", 210, 1); return(false); } return(true); }
private static bool canMine(Player p, Rock rock, Rock rock2) { if (rock == null || p == null || !Server.getGlobalObjects().originalObjectExists(rock.getRockId(), rock.getRockLocation())) { return false; } if (rock.getRockIndex() != 0) { if (!p.getLocation().withinDistance(rock.getRockLocation(), 2)) { return false; } } else { // is rune ess rock if (!p.getLocation().inArea(rock.getRockLocation().getX() - 1, rock.getRockLocation().getY() - 1, rock.getRockLocation().getX() + 5, rock.getRockLocation().getY() + 5)) { return false; } } if (rock2 != null) { if (!rock.Equals(rock2)) { return false; } } if (p.getSkills().getGreaterLevel(Skills.SKILL.MINING) < rock.getLevel()) { p.getPackets().sendMessage("You need a Mining level of " + rock.getLevel() + " to mine that rock."); return false; } if (!hasPickaxe(p)) { p.getPackets().sendMessage("You need a pickaxe to mine a rock!"); return false; } if (p.getInventory().findFreeSlot() == -1) { p.getPackets().sendChatboxInterface(210); p.getPackets().modifyText("Your inventory is too full to carry any ore.", 210, 1); return false; } return true; }