private static void startFishing(Player p, int i, Npc npc, bool newFish, bool secondOption)
        {
            if (!newFish && p.getTemporaryAttribute("fishingSpot") == null)
            {
                return;
            }
            if (newFish)
            {
                int      j     = secondOption ? 1 : 0;
                int[]    fish  = secondOption ? SECOND_SPOT_FISH[i] : FIRST_SPOT_FISH[i];
                int[]    level = secondOption ? SECOND_SPOT_LEVEL[i] : FIRST_SPOT_LEVEL[i];
                double[] xp    = secondOption ? SECOND_SPOT_XP[i] : FIRST_SPOT_XP[i];
                p.setTemporaryAttribute("fishingSpot", new Spot(fish, level, i, SPOT_IDS[i], xp, npc.getLocation(), PRIMARY_ITEM[i][j], SECONDARY_ITEM[i][j], PRIMARY_NAME[i][j], SECONDARY_NAME[i][j], secondOption));
            }
            Spot fishingSpot = (Spot)p.getTemporaryAttribute("fishingSpot");
            int  k           = fishingSpot.isSecondOption() ? 1 : 0;
            int  index       = getFishToAdd(p, fishingSpot);

            if (!canFish(p, fishingSpot, null, index))
            {
                resetFishing(p);
                p.setLastAnimation(new Animation(65535));
                return;
            }
            if (newFish)
            {
                p.getPackets().sendMessage("You attempt to catch a fish...");
                p.setLastAnimation(new Animation(FISHING_ANIMATION[i][k]));
            }
            string name           = fishingSpot.isSecondOption() ? SECOND_CATCH_NAME[fishingSpot.getSpotindex()][index] : FIRST_CATCH_NAME[fishingSpot.getSpotindex()][index];
            string s              = fishingSpot.getSpotindex() == 1 && !fishingSpot.isSecondOption() ? "some" : "a";
            Event  doFishingEvent = new Event(getFishingDelay(p, fishingSpot));

            doFishingEvent.setAction(() => {
                doFishingEvent.stop();
                if (p.getTemporaryAttribute("fishingSpot") == null)
                {
                    resetFishing(p);
                    p.setLastAnimation(new Animation(65535));
                    return;
                }
                Spot fishingSpot2 = (Spot)p.getTemporaryAttribute("fishingSpot");
                if (!canFish(p, fishingSpot, fishingSpot2, index))
                {
                    resetFishing(p);
                    p.setLastAnimation(new Animation(65535));
                    return;
                }
                p.getPackets().closeInterfaces();
                p.getInventory().deleteItem(fishingSpot2.getSecondaryItem());
                p.setLastAnimation(new Animation(FISHING_ANIMATION2[fishingSpot2.getSpotindex()][k]));
                p.getPackets().sendMessage("You catch " + s + " " + name + ".");
                if (p.getInventory().addItem(fishingSpot2.getFish()[index]))
                {
                    p.getSkills().addXp(Skills.SKILL.FISHING, fishingSpot2.getFishingXp()[index]);
                }
                startFishing(p, i, null, false, secondOption);
            });
            Server.registerEvent(doFishingEvent);
        }
 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);
 }
 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;
 }