Initial commit

This commit is contained in:
2021-10-16 17:25:28 +02:00
commit 98dd5c66b6
41 changed files with 1484 additions and 0 deletions

13
CFisher/CFisher.iml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="client" level="project" />
<orderEntry type="module" module-name="Util" />
</component>
</module>

View 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));
}
}

View 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);
}
}

View 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);
}
}