Initial commit
This commit is contained in:
30
CFisher/src/io/reisub/dreambot/cfisher/CFisher.java
Normal file
30
CFisher/src/io/reisub/dreambot/cfisher/CFisher.java
Normal file
@ -0,0 +1,30 @@
|
||||
package io.reisub.dreambot.cfisher;
|
||||
|
||||
import io.reisub.dreambot.cfisher.tasks.Drop;
|
||||
import io.reisub.dreambot.cfisher.tasks.Fish;
|
||||
import io.reisub.dreambot.util.Constants;
|
||||
import io.reisub.dreambot.util.randomevents.GenieSolver;
|
||||
import io.reisub.dreambot.util.tasks.kitten.KittenTask;
|
||||
import org.dreambot.api.script.Category;
|
||||
import org.dreambot.api.script.ScriptManifest;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
import org.dreambot.api.script.impl.TaskScript;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@ScriptManifest(name = "CFisher", description = "Fisher", author = Constants.AUTHOR,
|
||||
version = 1.0, category = Category.FISHING, image = "")
|
||||
public class CFisher extends TaskScript {
|
||||
@Override
|
||||
public void onStart() {
|
||||
getRandomManager().registerSolver(new GenieSolver(GenieSolver.Skill.HERBLORE));
|
||||
|
||||
TaskNode kittenTask = KittenTask.createKittenTask();
|
||||
if (kittenTask != null) {
|
||||
addNodes(kittenTask);
|
||||
}
|
||||
|
||||
String[] fishNames = Constants.BARBARIAN_FISH_NAMES;
|
||||
|
||||
addNodes(new Drop(fishNames), new Fish(fishNames));
|
||||
}
|
||||
}
|
45
CFisher/src/io/reisub/dreambot/cfisher/tasks/Drop.java
Normal file
45
CFisher/src/io/reisub/dreambot/cfisher/tasks/Drop.java
Normal file
@ -0,0 +1,45 @@
|
||||
package io.reisub.dreambot.cfisher.tasks;
|
||||
|
||||
import io.reisub.dreambot.util.CInventory;
|
||||
import org.dreambot.api.methods.Calculations;
|
||||
import org.dreambot.api.methods.MethodContext;
|
||||
import org.dreambot.api.methods.container.impl.Inventory;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
|
||||
public class Drop extends TaskNode {
|
||||
private final String[] fishNames;
|
||||
|
||||
public Drop(String[] fishNames) {
|
||||
this.fishNames = fishNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept() {
|
||||
int r = Calculations.random(100);
|
||||
|
||||
if (r < 6) {
|
||||
return Inventory.fullSlotCount() >= 27;
|
||||
} else if (r < 9) {
|
||||
return Inventory.fullSlotCount() >= 26;
|
||||
} else if (r < 10) {
|
||||
return Inventory.fullSlotCount() >= 25;
|
||||
}
|
||||
|
||||
return Inventory.isFull();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute() {
|
||||
if (Inventory.isFull()) {
|
||||
MethodContext.sleep(0, 1200);
|
||||
}
|
||||
|
||||
Inventory.setDropPattern(CInventory.verticalSnakeDropPattern);
|
||||
|
||||
Inventory.dropAll(fishNames);
|
||||
|
||||
MethodContext.sleepUntil(() -> !Inventory.contains(fishNames), 1300);
|
||||
|
||||
return Calculations.random(250, 400);
|
||||
}
|
||||
}
|
40
CFisher/src/io/reisub/dreambot/cfisher/tasks/Fish.java
Normal file
40
CFisher/src/io/reisub/dreambot/cfisher/tasks/Fish.java
Normal file
@ -0,0 +1,40 @@
|
||||
package io.reisub.dreambot.cfisher.tasks;
|
||||
|
||||
import io.reisub.dreambot.util.Constants;
|
||||
import io.reisub.dreambot.util.Util;
|
||||
import org.dreambot.api.methods.Calculations;
|
||||
import org.dreambot.api.methods.MethodContext;
|
||||
import org.dreambot.api.methods.container.impl.Inventory;
|
||||
import org.dreambot.api.methods.interactive.NPCs;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
import org.dreambot.api.wrappers.interactive.NPC;
|
||||
|
||||
public class Fish extends TaskNode {
|
||||
private final String[] fishNames;
|
||||
|
||||
public Fish(String[] fishNames) {
|
||||
this.fishNames = fishNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept() {
|
||||
return Util.playerIsIdle() && !Inventory.isFull();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute() {
|
||||
if (Inventory.contains(fishNames)) {
|
||||
MethodContext.sleep(0, 2400);
|
||||
}
|
||||
|
||||
NPC npc = NPCs.closest(Constants.FISHING_SPOT);
|
||||
|
||||
if (npc == null) return 0;
|
||||
|
||||
npc.interactForceLeft(Constants.USE_ROD);
|
||||
|
||||
Util.sleepUntilMovingAndAnimating();
|
||||
|
||||
return Calculations.random(80, 200);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user