45public class Fishing
extends Skill {
47 public Fishing(
int level,
double experience) {
48 super(
Skill.FISHING, level, experience);
50 public static double getBonus(
Player player) {
52 if(player.equipment.
getId(0) == 13258)
54 if(player.equipment.
getId(4) == 13259)
56 if(player.equipment.
getId(7) == 13260)
58 if(player.equipment.
getId(10) == 13261)
61 if(player.equipment.
containsAll(13258, 13259, 13260, 13261))
69 static boolean canFish(
Player player,
Fishable fish,
boolean message) {
71 if (message) player.message(
"You need a fishing level of " + fish.getRequiredLevel() +
" to fish here.");
74 return hasFishingItems(player, fish, message);
77 private static boolean hasFishingItems(
Player player,
Fishable fish,
boolean message) {
78 int tool = fish.getToolId();
79 int bait = fish.getBaitRequired();
80 boolean hasDragonHarpoon;
82 hasDragonHarpoon = player.inventory.
contains(
new Item(21028, 1));
83 if (!player.inventory.
contains(
new Item(tool, 1)) && !hasDragonHarpoon) {
85 player.message(
"You need " +
Utility.
getAOrAn(name) +
" " + name +
" to fish here.");
89 if (!player.inventory.
contains(
new Item(tool, 1)) && message) {
91 player.message(
"You need " +
Utility.
getAOrAn(name) +
" " + name +
" to fish here.");
95 if (bait > -1 && !player.inventory.
contains(
new Item(bait, 1))) {
98 player.message(
"You need " +
Utility.
getAOrAn(name) +
" " + name +
" to fish here.");
106 var usingDragonHarpoon = (player.inventory.
contains(
new Item(21028, 1))
107 || player.equipment.contains(
new Item(21028, 1))) && player.skills.
get(
Skill.FISHING).
getLevel() > 60;
108 if (usingDragonHarpoon && (fish.getToolId() == 311 || fish.getToolId() == 21028)) {
116 Npc npc =
event.getNpc();
117 int opcode =
event.getOpcode();
123 if (player.skills.
get(
Skill.FISHING).isDoingSkill()) {
133 fish = spot.getFirstOption();
134 for (
int i = 0; i < fish.length; i++) {
135 if (canFish(player, fish[i], i == 0)) {
136 fishable[i] = fish[i];
142 fish = spot.getSecondOption();
143 for (
int i = 0; i < fish.length; i++) {
144 if (canFish(player, fish[i], i == 0)) {
145 fishable[i] = fish[i];
155 System.arraycopy(fishable, 0, fishing, 0, amount);
156 start(player, fishing, 0);
160 public void start(
Player player,
Fishable[] fishing,
int option) {
161 if (fishing ==
null || fishing[option] ==
null || fishing[option].getToolId() == -1) {
167 if (!hasFishingItems(player, fishing[option],
true)) {
171 player.action.execute(
new FishingAction(player, tool, fishing));
172 player.skills.
get(
Skill.FISHING).setDoingSkill(
true);