Advertisement
Guest User

FishableSpot.java

a guest
May 30th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.05 KB | None | 0 0
  1. package server.game.content.skills.fishing;
  2.  
  3. import java.util.EnumSet;
  4. import java.util.HashMap;
  5. import java.util.Map;
  6. import java.util.Set;
  7.  
  8. import server.game.player.Player;
  9.  
  10. /**
  11. * The data for fishing.
  12. *
  13. * @author Tim
  14. */
  15. public enum FishableSpot {
  16.    
  17.     SHRIMPS_ANCHOVIES(1521, 1, 317, 321, 1, 15, 303, 621, -1, false, false, 10, 40, 4),
  18.     SARDINE_HERRING(1521, 2, 327, 345, 5, 10, 307, 623, 313, true, true, 20, 30, 5),
  19.     LOBSTER(1519, 1, 377, -1, 40, -1, 301, 619, -1, false, false, 90, -1, 8),
  20.     TUNA_SWORDFISH(1519, 2, 359, 371, 35, 50, 311, 618, -1, false, false, 80, 100, 7),
  21.     MACKEREL_COD(1520, 1, 353, 341, 16, 23, 305, 620, -1, true, false, 20, 45, 6),
  22.     SHARK(1520, 2, 383, -1, 76, -1, 311, 618, -1, false, false, 110, 0, 10),
  23.     TROUT_SALMON(1526, 1, 335, 331, 20, 30, 309, 622, 314, true, true, 50, 70, 6),
  24.     MANTA(1526, 2, 389, -1, 81, -1, 303, 620, -1, false, false, 46, -1, 9),
  25.     KARAMBWAN(635, 1, 3142, -1, 65, -1, 303, 620, -1, false, false, 105, -1, 7);
  26.    
  27.     private int spotId; //The fishing spot at which you fish at.
  28.     private int spotOption; //The option selected.
  29.     private int fishId; //The first fish ID (the main fish).
  30.     private int secondFishId; //If a second fish is available at a spot, what is the ID of that fish.
  31.     private int levelRequired; //The level required to catch the first fish.
  32.     private int secondLevelRequired; //The level required to catch the second fish.
  33.     private int tool; //The equipment that needs to be used to fish.
  34.     private int animation; //The animation performed when fishing at the spot.
  35.     private int baitUsed; //The bait which will be used if required.
  36.     private boolean secondFish; //Is a second fish available?
  37.     private boolean baitRequired; //Is bait required?
  38.     private double firstFishExperience; //The experience gained from the first fish.
  39.     private double secondFishExperience; //The experience gained from the second fish.
  40.     private int timer; //The timer in which the fish is collected within.
  41.    
  42.     FishingData(int spotId, int spotOption, int fishId, int secondFishId, int levelRequired, int secondLevelRequired, int tool, int animation, int baitUsed, boolean secondFish, boolean baitRequired, double firstFishExperience, double secondFishExperience, int timer)
  43.     {
  44.         this.spotId = spotId;
  45.         this.spotOption = spotOption;
  46.         this.fishId = fishId;
  47.         this.secondFishId = secondFishId;
  48.         this.levelRequired = levelRequired;
  49.         this.secondLevelRequired = secondLevelRequired;
  50.         this.tool = tool;
  51.         this.animation = animation;
  52.         this.baitUsed = baitUsed;
  53.         this.secondFish = secondFish;
  54.         this.baitRequired = baitRequired;
  55.         this.firstFishExperience = firstFishExperience;
  56.         this.secondFishExperience = secondFishExperience;
  57.         this.timer = timer;
  58.     }
  59.    
  60.     private static final Set<FishableSpot> FISH = Collections.unmodifiableSet(EnumSet.allOf(FishableSpot.class));
  61.  
  62.     public int getSpotId() {
  63.         return spotId;
  64.     }
  65.    
  66.     public int getFishId() {
  67.         return fishId;
  68.     }
  69.    
  70.     public int getSecondFishId() {
  71.         return secondFishId;
  72.     }
  73.    
  74.     public int getLevelRequired() {
  75.         return levelRequired;
  76.     }
  77.    
  78.     public int getSecondLevelRequired() {
  79.         return secondLevelRequired;
  80.     }
  81.    
  82.     public int getToolId() {
  83.         return tool;
  84.     }
  85.    
  86.     public int getAnimation() {
  87.         return animation;
  88.     }
  89.    
  90.     public int getBaitUsed() {
  91.         return baitUsed;
  92.     }
  93.    
  94.     public boolean isSecondFishAvailable() {
  95.         return secondFish;
  96.     }
  97.    
  98.     public boolean isBaitRequired() {
  99.         return baitRequired;
  100.     }
  101.    
  102.     public double getFirstExperience() {
  103.         return firstFishExperience;
  104.     }
  105.    
  106.     public double getSecondExperience() {
  107.         return secondFishExperience;
  108.     }
  109.    
  110.     public int getTimer() {
  111.         return timer;
  112.     }
  113.    
  114.     /**
  115.      *
  116.      * @param id
  117.      * @param option
  118.      * @return the id and option
  119.      */
  120.     public static FishableSpot forId(int id, int option) {
  121.         return FISH.stream().filter(fish -> fish.spot == id && fish.option == option).findFirst().orElse(null);
  122.     }
  123.     /**
  124.      *
  125.      * @param spot
  126.      * @return true if the spot matches a defined spot id
  127.      */
  128.     public static boolean fishingNPC(int spot) {
  129.         return FISH.stream().anyMatch(fish -> fish.spot == spot);
  130.     }
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement