Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package server.model.players.skills;
- import server.Config;
- import server.event.CycleEvent;
- import server.event.CycleEventContainer;
- import server.event.CycleEventHandler;
- import server.model.players.Player;
- import server.model.players.Client;
- import server.util.Misc;
- public class Fishin2 {
- /**
- *
- * Fishing enum
- * @author Emre
- *
- */
- public enum Fishes {
- SHRIMP(317,10,1,303, 618),
- TROUT(335,50,10,303, 618);
- private int fishType;
- private int exp;
- private int req;
- private int fishEquipment;
- private int animation;
- Fishes(int fishType, int exp, int req, int fishEquipment, int animation) {
- this.fishType = fishType;
- this.exp = exp;
- this.req = req;
- this.fishEquipment = fishEquipment;
- this.animation = animation;
- }
- public int getFishType() {
- return fishType;
- }
- public int getExp() {
- return exp;
- }
- public int getReq() {
- return req;
- }
- public int getFishEquipment() {
- return fishEquipment;
- }
- public int getAnimation() {
- return animation;
- }
- }
- /**
- *
- * Start fishing here
- * @param f
- * @param c
- */
- public static void refreshAnimation(Fishes f, Client c) {
- if (c.fishTimes == 0 && c.fishTimes <= 103 );
- c.startAnimation(f.getAnimation());
- }
- public static void resetFishing(Fishes f, Client c) {
- c.fishTimes = -1;
- c.fishing2 = false;
- c.startAnimation(-1);
- }
- public static void startFishing(Fishes f, Client c) {
- if(checkFishing(c, f)) {
- c.getItems().addItem(f.getFishType(), 1);
- c.getPA().addSkillXP(f.getExp() * Config.FISHING_EXPERIENCE,
- c.playerFishing);
- c.fishTimes = 3 + Misc.random(100);
- c.startAnimation(f.getAnimation());
- refreshAnimation(f, c);
- c.sendMessage("You catch a fish");
- c.fishing2 = true;
- }
- }
- /**
- * checks requirements
- * @param c
- * @param f
- * @return
- */
- public static boolean checkFishing(Client c, Fishes f) {
- if (!c.getItems().playerHasItem(f.getFishEquipment())) {
- c.sendMessage("You dont have the right equipment");
- c.fishing2 = false;
- resetFishing(f,c);
- return false;
- }
- if (c.getItems().freeSlots() <= 1) {
- c.sendMessage("You don't have enough free slots");
- c.fishing2 = false;
- resetFishing(f,c);
- return false;
- }
- if (c.playerFishing < f.getReq()) {
- c.sendMessage("You need a fishing level of " + f.getReq() + " To fish here");
- c.fishing2 = false;
- resetFishing(f,c);
- return false;
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement