|
@@ -51,6 +51,7 @@ public class FishingManager extends SkillManager {
|
|
private long lastWarnedExhaust = 0L;
|
|
private long lastWarnedExhaust = 0L;
|
|
private FishHook fishHookReference;
|
|
private FishHook fishHookReference;
|
|
private BoundingBox lastFishingBoundingBox;
|
|
private BoundingBox lastFishingBoundingBox;
|
|
|
|
+ private boolean sameTarget;
|
|
private Item fishingCatch;
|
|
private Item fishingCatch;
|
|
private Location hookLocation;
|
|
private Location hookLocation;
|
|
private int fishCaughtCounter = 1;
|
|
private int fishCaughtCounter = 1;
|
|
@@ -125,33 +126,34 @@ public class FishingManager extends SkillManager {
|
|
return hasFished;
|
|
return hasFished;
|
|
}
|
|
}
|
|
|
|
|
|
- public boolean isExploitingFishing(Vector centerOfCastVector) {
|
|
|
|
-
|
|
|
|
- /*Block targetBlock = getPlayer().getTargetBlock(BlockUtils.getTransparentBlocks(), 100);
|
|
|
|
-
|
|
|
|
- if (!targetBlock.isLiquid()) {
|
|
|
|
- return false;
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
|
|
+ public void processExploiting(Vector centerOfCastVector) {
|
|
BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector);
|
|
BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector);
|
|
|
|
+ this.sameTarget = lastFishingBoundingBox != null && lastFishingBoundingBox.overlaps(newCastBoundingBox);
|
|
|
|
|
|
- boolean sameTarget = lastFishingBoundingBox != null && lastFishingBoundingBox.overlaps(newCastBoundingBox);
|
|
|
|
-
|
|
|
|
- if(sameTarget)
|
|
|
|
|
|
+ if (this.sameTarget) {
|
|
fishCaughtCounter++;
|
|
fishCaughtCounter++;
|
|
- else
|
|
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
fishCaughtCounter = 1;
|
|
fishCaughtCounter = 1;
|
|
|
|
+ }
|
|
|
|
|
|
- if(fishCaughtCounter + 1 == ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit())
|
|
|
|
- {
|
|
|
|
|
|
+ //If the new bounding box does not intersect with the old one, then update our bounding box reference
|
|
|
|
+ if (!this.sameTarget) lastFishingBoundingBox = newCastBoundingBox;
|
|
|
|
+
|
|
|
|
+ if (fishCaughtCounter + 1 == ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit()) {
|
|
getPlayer().sendMessage(LocaleLoader.getString("Fishing.LowResourcesTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange()));
|
|
getPlayer().sendMessage(LocaleLoader.getString("Fishing.LowResourcesTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange()));
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
- //If the new bounding box does not intersect with the old one, then update our bounding box reference
|
|
|
|
- if(!sameTarget)
|
|
|
|
- lastFishingBoundingBox = newCastBoundingBox;
|
|
|
|
|
|
+ public boolean isExploitingFishing(Vector centerOfCastVector) {
|
|
|
|
+
|
|
|
|
+ /*Block targetBlock = getPlayer().getTargetBlock(BlockUtils.getTransparentBlocks(), 100);
|
|
|
|
+
|
|
|
|
+ if (!targetBlock.isLiquid()) {
|
|
|
|
+ return false;
|
|
|
|
+ }*/
|
|
|
|
|
|
- return sameTarget && fishCaughtCounter >= ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit();
|
|
|
|
|
|
+ return this.sameTarget && fishCaughtCounter >= ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit();
|
|
}
|
|
}
|
|
|
|
|
|
public static BoundingBox makeBoundingBox(Vector centerOfCastVector) {
|
|
public static BoundingBox makeBoundingBox(Vector centerOfCastVector) {
|