Ejemplo n.º 1
0
 public static bool canFish(Player p, Spot fishingSpot, Spot fishingSpot2, int index)
 {
     if (p == null || fishingSpot == null)
     {
         return(false);
     }
     if (!p.getLocation().withinDistance(fishingSpot.getSpotLocation(), 2))
     {
         return(false);
     }
     if (fishingSpot2 != null)
     {
         if (!fishingSpot.Equals(fishingSpot2))
         {
             return(false);
         }
     }
     if (p.getSkills().getGreaterLevel(Skills.SKILL.FISHING) < fishingSpot.getLevel()[index])
     {
         p.getPackets().sendMessage("You need a fishing level of " + fishingSpot.getLevel()[index] + " to fish here.");
         return(false);
     }
     if (fishingSpot.getPrimaryItem() != -1)
     {
         if (!p.getInventory().hasItem(fishingSpot.getPrimaryItem()))
         {
             p.getPackets().sendMessage("You need " + fishingSpot.getPrimaryName() + " to fish here.");
             return(false);
         }
     }
     if (fishingSpot.getSecondaryItem() != -1)
     {
         if (!p.getInventory().hasItem(fishingSpot.getSecondaryItem()))
         {
             p.getPackets().sendMessage("You need " + fishingSpot.getSecondaryName() + " to fish here.");
             return(false);
         }
     }
     if (p.getInventory().findFreeSlot() == -1)
     {
         p.getPackets().sendChatboxInterface(210);
         p.getPackets().modifyText("Your inventory is too full to catch any more fish.", 210, 1);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 2
0
 public static bool canFish(Player p, Spot fishingSpot, Spot fishingSpot2, int index)
 {
     if (p == null || fishingSpot == null) {
         return false;
     }
     if (!p.getLocation().withinDistance(fishingSpot.getSpotLocation(), 2)) {
         return false;
     }
     if (fishingSpot2 != null) {
         if (!fishingSpot.Equals(fishingSpot2)) {
             return false;
         }
     }
     if (p.getSkills().getGreaterLevel(Skills.SKILL.FISHING)< fishingSpot.getLevel()[index]){
         p.getPackets ().sendMessage ("You need a fishing level of " +fishingSpot.getLevel()[index] + " to fish here.");
         return false;
     }
     if (fishingSpot.getPrimaryItem() != -1) {
         if (!p.getInventory().hasItem (fishingSpot.getPrimaryItem())){
             p.getPackets ().sendMessage ("You need " + fishingSpot.getPrimaryName() + " to fish here.");
             return false;
         }
     }
     if (fishingSpot.getSecondaryItem() != -1) {
         if (!p.getInventory().hasItem (fishingSpot.getSecondaryItem())){
             p.getPackets ().sendMessage ("You need " + fishingSpot.getSecondaryName() + " to fish here.");
             return false;
         }
     }
     if (p.getInventory().findFreeSlot() == -1) {
         p.getPackets().sendChatboxInterface(210);
         p.getPackets().modifyText("Your inventory is too full to catch any more fish.", 210, 1);
         return false;
     }
     return true;
 }