Advertisement
Guest User

fishes

a guest
Jul 31st, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. package server.model.players.skills;
  2.  
  3. import server.Config;
  4. import server.event.CycleEvent;
  5. import server.event.CycleEventContainer;
  6. import server.event.CycleEventHandler;
  7. import server.model.players.Player;
  8. import server.model.players.Client;
  9. import server.util.Misc;
  10.  
  11.  
  12. public class Fishin2 {
  13. /**
  14. *
  15. * Fishing enum
  16. * @author Emre
  17. *
  18. */
  19. public enum Fishes {
  20. SHRIMP(317,10,1,303, 618),
  21. TROUT(335,50,10,303, 618);
  22.  
  23. private int fishType;
  24. private int exp;
  25. private int req;
  26. private int fishEquipment;
  27. private int animation;
  28. Fishes(int fishType, int exp, int req, int fishEquipment, int animation) {
  29. this.fishType = fishType;
  30. this.exp = exp;
  31. this.req = req;
  32. this.fishEquipment = fishEquipment;
  33. this.animation = animation;
  34. }
  35. public int getFishType() {
  36. return fishType;
  37. }
  38. public int getExp() {
  39. return exp;
  40. }
  41. public int getReq() {
  42. return req;
  43. }
  44. public int getFishEquipment() {
  45. return fishEquipment;
  46. }
  47. public int getAnimation() {
  48. return animation;
  49. }
  50. }
  51.  
  52. /**
  53. *
  54. * Start fishing here
  55. * @param f
  56. * @param c
  57. */
  58. public static void refreshAnimation(Fishes f, Client c) {
  59. if (c.fishTimes == 0 && c.fishTimes <= 103 );
  60. c.startAnimation(f.getAnimation());
  61. }
  62. public static void resetFishing(Fishes f, Client c) {
  63. c.fishTimes = -1;
  64. c.fishing2 = false;
  65. c.startAnimation(-1);
  66. }
  67. public static void startFishing(Fishes f, Client c) {
  68. if(checkFishing(c, f)) {
  69. c.getItems().addItem(f.getFishType(), 1);
  70. c.getPA().addSkillXP(f.getExp() * Config.FISHING_EXPERIENCE,
  71. c.playerFishing);
  72. c.fishTimes = 3 + Misc.random(100);
  73. c.startAnimation(f.getAnimation());
  74. refreshAnimation(f, c);
  75. c.sendMessage("You catch a fish");
  76. c.fishing2 = true;
  77.  
  78. }
  79. }
  80. /**
  81. * checks requirements
  82. * @param c
  83. * @param f
  84. * @return
  85. */
  86. public static boolean checkFishing(Client c, Fishes f) {
  87. if (!c.getItems().playerHasItem(f.getFishEquipment())) {
  88. c.sendMessage("You dont have the right equipment");
  89. c.fishing2 = false;
  90. resetFishing(f,c);
  91. return false;
  92. }
  93. if (c.getItems().freeSlots() <= 1) {
  94. c.sendMessage("You don't have enough free slots");
  95. c.fishing2 = false;
  96. resetFishing(f,c);
  97. return false;
  98. }
  99. if (c.playerFishing < f.getReq()) {
  100. c.sendMessage("You need a fishing level of " + f.getReq() + " To fish here");
  101. c.fishing2 = false;
  102. resetFishing(f,c);
  103. return false;
  104. }
  105. return true;
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement