Пример #1
0
 protected static int getFishToAdd(Player p, Spot fishingSpot)
 {
     int fishingLevel = p.getSkills().getGreaterLevel(Skills.SKILL.FISHING);
     int[] canCatch = new int[fishingSpot.getFish().Length];
     int j = 0;
     for (int i = 0; i < fishingSpot.getFish().Length; i++) {
         if (fishingLevel >= fishingSpot.getLevel()[i]) {
             canCatch[j] = fishingSpot.getFish()[i];
             j++;
         }
     }
     int[] canCatch2 = new int[j];
     for (int i = 0; i < canCatch.Length; i++) {
         if (canCatch[i] > 0) {
             canCatch2[i] = canCatch[i];
         }
     }
     int fish = misc.random(canCatch2.Length-1);
     for (int i = 0; i < fishingSpot.getFish().Length; i++) {
         if (fish == fishingSpot.getFish()[i]) {
             return i;
         }
     }
     return misc.random(canCatch2.Length-1);
 }
Пример #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);
 }
Пример #3
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;
 }
Пример #4
0
 private static long getFishingDelay(Player p, Spot fishingSpot)
 {
     int[] time = fishingSpot.isSecondOption() ? SECOND_SPOT_TIME : FIRST_SPOT_TIME;
     int[] minTime = fishingSpot.isSecondOption() ? SECOND_SPOT_MINTIME : FIRST_SPOT_MINTIME;
     int baseTime = time[fishingSpot.getSpotindex()];
     int min = minTime[fishingSpot.getSpotindex()];
     int finalDelay = baseTime -= misc.random(min);
     return finalDelay;
 }