Compare commits
6 Commits
84da7e108a
...
ab50d739c1
Author | SHA1 | Date | |
---|---|---|---|
ab50d739c1
|
|||
1aa793b4bf
|
|||
7f44187e6b
|
|||
4f764a4eb9
|
|||
75ab1e7fe8
|
|||
b26c38cbcc
|
9
.idea/artifacts/CSmelter_jar.xml
generated
Normal file
9
.idea/artifacts/CSmelter_jar.xml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="CSmelter:jar">
|
||||
<output-path>$USER_HOME$/DreamBot/Scripts</output-path>
|
||||
<root id="archive" name="CSmelter.jar">
|
||||
<element id="module-output" name="CSmelter" />
|
||||
<element id="module-output" name="Util" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
1
.idea/modules.xml
generated
1
.idea/modules.xml
generated
@ -10,6 +10,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/CMiner/CMiner.iml" filepath="$PROJECT_DIR$/CMiner/CMiner.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/CPlanker/CPlanker.iml" filepath="$PROJECT_DIR$/CPlanker/CPlanker.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/CShopper/CShopper.iml" filepath="$PROJECT_DIR$/CShopper/CShopper.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/CSmelter/CSmelter.iml" filepath="$PROJECT_DIR$/CSmelter/CSmelter.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/CThiever/CThiever.iml" filepath="$PROJECT_DIR$/CThiever/CThiever.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/CWintertodt/CWintertodt.iml" filepath="$PROJECT_DIR$/CWintertodt/CWintertodt.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/DreambotScripts.iml" filepath="$PROJECT_DIR$/DreambotScripts.iml" />
|
||||
|
@ -44,5 +44,9 @@ public class CAgility extends CTaskScript {
|
||||
|
||||
int marks = PickupMark.marksPickedUp;
|
||||
getUI().drawString("Marks picked up: " + marks + " (" + getUI().getHourlyRate(marks) + " per hour)");
|
||||
|
||||
if (HandleObstacle.current != null && HandleObstacle.current.getGameObject() != null && HandleObstacle.current.getGameObject().getModel() != null) {
|
||||
HandleObstacle.current.getGameObject().getModel().drawWireFrame(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,9 @@ import io.reisub.dreambot.cagility.Obstacle;
|
||||
import io.reisub.dreambot.util.Constants;
|
||||
import io.reisub.dreambot.util.Util;
|
||||
import org.dreambot.api.input.Mouse;
|
||||
import org.dreambot.api.input.event.impl.InteractionEvent;
|
||||
import org.dreambot.api.input.event.impl.InteractionSetting;
|
||||
import org.dreambot.api.input.mouse.destination.impl.EntityDestination;
|
||||
import org.dreambot.api.input.mouse.destination.impl.MiniMapTileDestination;
|
||||
import org.dreambot.api.methods.Calculations;
|
||||
import org.dreambot.api.methods.MethodContext;
|
||||
@ -84,7 +87,8 @@ public class HandleObstacle extends TaskNode {
|
||||
new Tile(2721, 3489, 3),
|
||||
new Tile(2730, 3489, 3),
|
||||
new Tile(2730, 3497, 3),
|
||||
new Tile(2721, 3497, 3))),
|
||||
new Tile(2721, 3497, 3)),
|
||||
() -> Players.localPlayer().getTile().equals(new Tile(2729, 3491, 3))),
|
||||
new Obstacle(14932, new Area(
|
||||
new Tile(2715, 3487, 2),
|
||||
new Tile(2715, 3498, 2),
|
||||
@ -145,7 +149,7 @@ public class HandleObstacle extends TaskNode {
|
||||
private final Course course;
|
||||
private final Map<Integer, Rectangle> hoverMap;
|
||||
|
||||
private Obstacle current;
|
||||
public static Obstacle current;
|
||||
private int retries = 0;
|
||||
|
||||
public HandleObstacle(Course course) {
|
||||
@ -196,6 +200,7 @@ public class HandleObstacle extends TaskNode {
|
||||
}
|
||||
|
||||
Tile finalTarget = target;
|
||||
if (!MethodProvider.sleepUntil(() -> Players.localPlayer().isMoving(), Calculations.random(1200, 1500))) continue;
|
||||
MethodContext.sleepUntil(() -> finalTarget.distance(Players.localPlayer()) < Calculations.random(4, 7), Calculations.random(14000, 15000));
|
||||
}
|
||||
}
|
||||
@ -221,6 +226,10 @@ public class HandleObstacle extends TaskNode {
|
||||
Mouse.move(hoverRect);
|
||||
}
|
||||
|
||||
if (!Util.sleepUntilMoving(Calculations.random(1200, 1500))) {
|
||||
return Calculations.random(180, 350);
|
||||
}
|
||||
|
||||
if (isWalking) {
|
||||
Util.sleepUntilMovingAndAnimating(Calculations.random(12000, 13000));
|
||||
} else {
|
||||
@ -232,7 +241,10 @@ public class HandleObstacle extends TaskNode {
|
||||
|
||||
public void interact(GameObject currentObject, boolean shouldHop) {
|
||||
Mouse.setAlwaysHop(shouldHop);
|
||||
currentObject.interactForceLeft(currentObject.getActions()[0]);
|
||||
EntityDestination ed = new EntityDestination(currentObject);
|
||||
InteractionEvent ie = new InteractionEvent(ed);
|
||||
ie.interact(currentObject.getActions()[0], InteractionSetting.EMPTY_SETTING, InteractionSetting.FORCE_LEFT_CLICK);
|
||||
//currentObject.interactForceLeft(currentObject.getActions()[0]);
|
||||
Mouse.setAlwaysHop(false);
|
||||
|
||||
Tile dest = null;
|
||||
@ -244,6 +256,8 @@ public class HandleObstacle extends TaskNode {
|
||||
dest = Walking.getDestination();
|
||||
}
|
||||
|
||||
if (dest == null) return;
|
||||
|
||||
if (!currentObject.getObjectTiles().contains(dest) && !currentObject.getInteractableFrom().contains(dest)) {
|
||||
MethodProvider.log("Misclick, trying again ");
|
||||
interact(currentObject, true);
|
||||
|
@ -4,7 +4,6 @@ import io.reisub.dreambot.util.Constants;
|
||||
import io.reisub.dreambot.util.Util;
|
||||
import org.dreambot.api.methods.Calculations;
|
||||
import org.dreambot.api.methods.container.impl.Inventory;
|
||||
import org.dreambot.api.methods.filter.Filter;
|
||||
import org.dreambot.api.methods.interactive.GameObjects;
|
||||
import org.dreambot.api.methods.map.Area;
|
||||
import org.dreambot.api.methods.map.Tile;
|
||||
|
@ -1,11 +1,8 @@
|
||||
package io.reisub.dreambot.cplanker.tasks;
|
||||
|
||||
import io.reisub.dreambot.util.Constants;
|
||||
import io.reisub.dreambot.util.Util;
|
||||
import org.dreambot.api.methods.Calculations;
|
||||
import org.dreambot.api.methods.MethodProvider;
|
||||
import org.dreambot.api.methods.container.impl.Inventory;
|
||||
import org.dreambot.api.methods.filter.Filter;
|
||||
import org.dreambot.api.methods.interactive.GameObjects;
|
||||
import org.dreambot.api.methods.map.Area;
|
||||
import org.dreambot.api.methods.map.Tile;
|
||||
|
@ -8,7 +8,6 @@ import org.dreambot.api.methods.container.impl.Inventory;
|
||||
import org.dreambot.api.methods.container.impl.bank.Bank;
|
||||
import org.dreambot.api.methods.filter.Filter;
|
||||
import org.dreambot.api.methods.interactive.GameObjects;
|
||||
import org.dreambot.api.methods.interactive.NPCs;
|
||||
import org.dreambot.api.methods.interactive.Players;
|
||||
import org.dreambot.api.methods.map.Tile;
|
||||
import org.dreambot.api.methods.walking.impl.Walking;
|
||||
|
@ -3,7 +3,6 @@ package io.reisub.dreambot.cplanker.tasks;
|
||||
import org.dreambot.api.methods.Calculations;
|
||||
import org.dreambot.api.methods.MethodProvider;
|
||||
import org.dreambot.api.methods.container.impl.Inventory;
|
||||
import org.dreambot.api.methods.filter.Filter;
|
||||
import org.dreambot.api.methods.item.GroundItems;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
import org.dreambot.api.wrappers.items.GroundItem;
|
||||
|
@ -1,9 +1,6 @@
|
||||
package io.reisub.dreambot.cshopper;
|
||||
|
||||
import io.reisub.dreambot.cshopper.tasks.Buy;
|
||||
import io.reisub.dreambot.cshopper.tasks.Hop;
|
||||
import io.reisub.dreambot.cshopper.tasks.Open;
|
||||
import io.reisub.dreambot.cshopper.tasks.Stop;
|
||||
import io.reisub.dreambot.cshopper.tasks.*;
|
||||
import io.reisub.dreambot.util.CTaskScript;
|
||||
import io.reisub.dreambot.util.Constants;
|
||||
import io.reisub.dreambot.util.tasks.Run;
|
||||
@ -18,9 +15,14 @@ import java.awt.*;
|
||||
@ScriptManifest(category = Category.MISC, name = "CShopper", description = "Shops like a woman with an unlimited Visa card", author = Constants.AUTHOR, version = 1.0)
|
||||
public class CShopper extends CTaskScript {
|
||||
private static final Configuration configuration = new Configuration(
|
||||
Constants.LUNDAIL,
|
||||
new ItemWrapper(Constants.COSMIC_RUNE, -1),
|
||||
new ItemWrapper(Constants.NATURE_RUNE, 6000)
|
||||
"Ordan",
|
||||
new ItemWrapper("Gold ore", 2600, 73, false)
|
||||
//new ItemWrapper("Hammerstone seed", -1),
|
||||
//new ItemWrapper("Asgarnian seed", -1),
|
||||
//new ItemWrapper("Jute seed", -1),
|
||||
//new ItemWrapper("Yanillian seed", -1),
|
||||
//new ItemWrapper("Krandorian seed", -1),
|
||||
//new ItemWrapper("Barley seed", 2000)
|
||||
);
|
||||
|
||||
private Buy buyTask;
|
||||
@ -36,6 +38,7 @@ public class CShopper extends CTaskScript {
|
||||
buyTask = new Buy();
|
||||
|
||||
addNodes(
|
||||
new Deposit(),
|
||||
new Stop(),
|
||||
new Run(),
|
||||
new Open(),
|
||||
|
@ -3,15 +3,25 @@ package io.reisub.dreambot.cshopper;
|
||||
public class ItemWrapper {
|
||||
private final String name;
|
||||
private final int buyTotal, minimumInShop;
|
||||
private final boolean stackable;
|
||||
|
||||
public ItemWrapper(String name, int buyTotal, int minimumInShop) {
|
||||
public ItemWrapper(String name, int buyTotal, int minimumInShop, boolean stackable) {
|
||||
this.name = name;
|
||||
this.buyTotal = buyTotal;
|
||||
this.minimumInShop = minimumInShop;
|
||||
this.stackable = stackable;
|
||||
}
|
||||
|
||||
public ItemWrapper(String name, int buyTotal, boolean stackable) {
|
||||
this(name, buyTotal, 0, stackable);
|
||||
}
|
||||
|
||||
public ItemWrapper(String name, int buyTotal, int minimumInShop) {
|
||||
this(name, buyTotal, minimumInShop, false);
|
||||
}
|
||||
|
||||
public ItemWrapper(String name, int buyTotal) {
|
||||
this(name, buyTotal, 0);
|
||||
this(name, buyTotal, 0, false);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@ -25,4 +35,8 @@ public class ItemWrapper {
|
||||
public int getMinimumInShop() {
|
||||
return minimumInShop;
|
||||
}
|
||||
|
||||
public boolean isStackable() {
|
||||
return stackable;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class Buy extends TaskNode {
|
||||
|
||||
@Override
|
||||
public boolean accept() {
|
||||
if (!Shop.isOpen()) return false;
|
||||
if (!Shop.isOpen() || Inventory.isFull() || Hop.shouldHop) return false;
|
||||
|
||||
for (ItemWrapper iw : CShopper.getConfiguration().getItems()) {
|
||||
int shopCount = Shop.get(iw.getName()).getAmount();
|
||||
@ -54,7 +54,7 @@ public class Buy extends TaskNode {
|
||||
int toBuy = buyTotal - inventoryCount;
|
||||
int canBuy = iw.getMinimumInShop() == 0 ? 50 : shopCount - iw.getMinimumInShop();
|
||||
|
||||
if (toBuy >= 50 && canBuy >= 50) {
|
||||
if ((toBuy >= 50 && canBuy >= 50) || (toBuy >= 27 && canBuy >= 27 && !iw.isStackable())) {
|
||||
shopItem.interact("Buy 50");
|
||||
} else if (toBuy >= 10 && canBuy >= 10) {
|
||||
shopItem.interact("Buy 10");
|
||||
|
45
CShopper/src/io/reisub/dreambot/cshopper/tasks/Deposit.java
Normal file
45
CShopper/src/io/reisub/dreambot/cshopper/tasks/Deposit.java
Normal file
@ -0,0 +1,45 @@
|
||||
package io.reisub.dreambot.cshopper.tasks;
|
||||
|
||||
import io.reisub.dreambot.util.Util;
|
||||
import org.dreambot.api.methods.Calculations;
|
||||
import org.dreambot.api.methods.MethodProvider;
|
||||
import org.dreambot.api.methods.container.impl.Inventory;
|
||||
import org.dreambot.api.methods.container.impl.Shop;
|
||||
import org.dreambot.api.methods.container.impl.bank.Bank;
|
||||
import org.dreambot.api.methods.interactive.GameObjects;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
import org.dreambot.api.wrappers.interactive.GameObject;
|
||||
|
||||
public class Deposit extends TaskNode {
|
||||
@Override
|
||||
public boolean accept() {
|
||||
return Inventory.isFull();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute() {
|
||||
GameObject bank = GameObjects.closest("Bank chest");
|
||||
if (bank == null) return Calculations.random(250, 400);
|
||||
|
||||
if (Shop.isOpen()) {
|
||||
Shop.close();
|
||||
MethodProvider.sleepUntil(() -> !Shop.isOpen(), Calculations.random(2000, 2500));
|
||||
}
|
||||
|
||||
bank.interact();
|
||||
if (!Util.sleepUntilMoving()) return Calculations.random(250, 400);
|
||||
|
||||
if (!MethodProvider.sleepUntil(Bank::isOpen, Calculations.random(5000, 5500))) return Calculations.random(250, 400);
|
||||
|
||||
MethodProvider.sleep(300, 500);
|
||||
|
||||
Bank.depositAllExcept("Coins");
|
||||
MethodProvider.sleepUntil(() -> Inventory.onlyContains("Coins"), Calculations.random(5000, 5500));
|
||||
|
||||
Bank.close();
|
||||
MethodProvider.sleepUntil(() -> !Bank.isOpen(), Calculations.random(2000, 2500));
|
||||
Hop.shouldHop = true;
|
||||
|
||||
return Calculations.random(250, 400);
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
public class Hop extends TaskNode {
|
||||
public static boolean shouldHop;
|
||||
private final Queue<World> worlds;
|
||||
|
||||
public Hop(boolean members) {
|
||||
@ -42,6 +43,8 @@ public class Hop extends TaskNode {
|
||||
|
||||
@Override
|
||||
public boolean accept() {
|
||||
if (Hop.shouldHop) return true;
|
||||
|
||||
if (!Shop.isOpen()) return false;
|
||||
|
||||
for (ItemWrapper iw : CShopper.getConfiguration().getItems()) {
|
||||
@ -60,6 +63,7 @@ public class Hop extends TaskNode {
|
||||
|
||||
@Override
|
||||
public int execute() {
|
||||
shouldHop = false;
|
||||
Shop.close();
|
||||
MethodProvider.sleepUntil(() -> !Shop.isOpen(), Calculations.random(2000, 2500));
|
||||
|
||||
|
@ -4,6 +4,7 @@ import io.reisub.dreambot.cshopper.CShopper;
|
||||
import io.reisub.dreambot.util.Constants;
|
||||
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.container.impl.Shop;
|
||||
import org.dreambot.api.methods.interactive.NPCs;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
@ -12,7 +13,9 @@ import org.dreambot.api.wrappers.interactive.NPC;
|
||||
public class Open extends TaskNode {
|
||||
@Override
|
||||
public boolean accept() {
|
||||
return !Shop.isOpen();
|
||||
return !Shop.isOpen()
|
||||
&& !Inventory.isFull()
|
||||
&& !Hop.shouldHop;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
13
CSmelter/CSmelter.iml
Normal file
13
CSmelter/CSmelter.iml
Normal 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>
|
45
CSmelter/src/io/reisub/dreambot/csmelter/CSmelter.java
Normal file
45
CSmelter/src/io/reisub/dreambot/csmelter/CSmelter.java
Normal file
@ -0,0 +1,45 @@
|
||||
package io.reisub.dreambot.csmelter;
|
||||
|
||||
import io.reisub.dreambot.csmelter.tasks.DoBank;
|
||||
import io.reisub.dreambot.csmelter.tasks.OpenBank;
|
||||
import io.reisub.dreambot.csmelter.tasks.SetCamera;
|
||||
import io.reisub.dreambot.csmelter.tasks.Smelt;
|
||||
import io.reisub.dreambot.util.CTaskScript;
|
||||
import io.reisub.dreambot.util.Constants;
|
||||
import io.reisub.dreambot.util.randomevents.GenieSolver;
|
||||
import io.reisub.dreambot.util.tasks.Run;
|
||||
import io.reisub.dreambot.util.tasks.kitten.KittenTask;
|
||||
import org.dreambot.api.methods.skills.Skill;
|
||||
import org.dreambot.api.script.Category;
|
||||
import org.dreambot.api.script.ScriptManifest;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
|
||||
@ScriptManifest(category = Category.SMITHING, name = "CSmelter", author = Constants.AUTHOR, version = 1.0)
|
||||
public class CSmelter extends CTaskScript {
|
||||
public static SmeltingOption smeltingOption = SmeltingOption.GOLD_BRACELET;
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
getRandomManager().registerSolver(new GenieSolver(GenieSolver.Skill.HERBLORE));
|
||||
|
||||
if (smeltingOption.getMould().equals("")) {
|
||||
getUI().addSkills(Skill.SMITHING);
|
||||
} else {
|
||||
getUI().addSkills(Skill.CRAFTING);
|
||||
}
|
||||
|
||||
TaskNode kittenTask = KittenTask.getInstance();
|
||||
if (kittenTask != null) {
|
||||
addNodes(kittenTask);
|
||||
}
|
||||
|
||||
addNodes(
|
||||
new SetCamera(),
|
||||
new Run(),
|
||||
new Smelt(),
|
||||
new OpenBank(),
|
||||
new DoBank()
|
||||
);
|
||||
}
|
||||
}
|
23
CSmelter/src/io/reisub/dreambot/csmelter/Ingredient.java
Normal file
23
CSmelter/src/io/reisub/dreambot/csmelter/Ingredient.java
Normal file
@ -0,0 +1,23 @@
|
||||
package io.reisub.dreambot.csmelter;
|
||||
|
||||
public class Ingredient {
|
||||
private final String name;
|
||||
private final int amount;
|
||||
|
||||
public Ingredient(String name, int amount) {
|
||||
this.name = name;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public Ingredient(String name) {
|
||||
this(name, 1);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
}
|
71
CSmelter/src/io/reisub/dreambot/csmelter/SmeltingOption.java
Normal file
71
CSmelter/src/io/reisub/dreambot/csmelter/SmeltingOption.java
Normal file
@ -0,0 +1,71 @@
|
||||
package io.reisub.dreambot.csmelter;
|
||||
|
||||
public enum SmeltingOption {
|
||||
GOLD_BAR(new Ingredient("Gold ore"), "Gold bar", 6),
|
||||
GOLD_BRACELET(new Ingredient("Gold bar"), "Gold bracelet", 46, "Bracelet mould");
|
||||
|
||||
private final Ingredient[] ingredients;
|
||||
private final String endProduct, mould;
|
||||
private final int hotkey, maxCraftsPerInventory;
|
||||
|
||||
SmeltingOption(Ingredient[] ingredients, String endProduct, int hotkey, String mould) {
|
||||
this.ingredients = ingredients;
|
||||
this.endProduct = endProduct;
|
||||
this.hotkey = hotkey;
|
||||
this.mould = mould;
|
||||
|
||||
int totalIngredientsRequired = 0;
|
||||
|
||||
for (Ingredient i : ingredients) {
|
||||
totalIngredientsRequired += i.getAmount();
|
||||
}
|
||||
|
||||
if (mould.equals("")) {
|
||||
maxCraftsPerInventory = Math.floorDiv(28, totalIngredientsRequired);
|
||||
} else {
|
||||
maxCraftsPerInventory = Math.floorDiv(27, totalIngredientsRequired);
|
||||
}
|
||||
}
|
||||
|
||||
SmeltingOption(Ingredient[] ingredients, String endProduct, int hotkey) {
|
||||
this(ingredients, endProduct, hotkey, "");
|
||||
}
|
||||
|
||||
SmeltingOption(Ingredient ingredient, String endProduct, int hotkey, String mould) {
|
||||
this(new Ingredient[]{ingredient}, endProduct, hotkey, mould);
|
||||
}
|
||||
|
||||
SmeltingOption(Ingredient ingredient, String endProduct, int hotkey) {
|
||||
this(new Ingredient[]{ingredient}, endProduct, hotkey, "");
|
||||
}
|
||||
|
||||
public Ingredient[] getIngredients() {
|
||||
return ingredients;
|
||||
}
|
||||
|
||||
public String[] getIngredientsNames() {
|
||||
String[] ingredientNames = new String[ingredients.length];
|
||||
|
||||
for (int i = 0; i < ingredients.length; i++) {
|
||||
ingredientNames[i] = ingredients[i].getName();
|
||||
}
|
||||
|
||||
return ingredientNames;
|
||||
}
|
||||
|
||||
public int getMaxCraftsPerInventory() {
|
||||
return maxCraftsPerInventory;
|
||||
}
|
||||
|
||||
public String getEndProduct() {
|
||||
return endProduct;
|
||||
}
|
||||
|
||||
public int getHotkey() {
|
||||
return hotkey;
|
||||
}
|
||||
|
||||
public String getMould() {
|
||||
return mould;
|
||||
}
|
||||
}
|
53
CSmelter/src/io/reisub/dreambot/csmelter/tasks/DoBank.java
Normal file
53
CSmelter/src/io/reisub/dreambot/csmelter/tasks/DoBank.java
Normal file
@ -0,0 +1,53 @@
|
||||
package io.reisub.dreambot.csmelter.tasks;
|
||||
|
||||
import io.reisub.dreambot.csmelter.CSmelter;
|
||||
import io.reisub.dreambot.csmelter.Ingredient;
|
||||
import org.dreambot.api.methods.Calculations;
|
||||
import org.dreambot.api.methods.MethodProvider;
|
||||
import org.dreambot.api.methods.container.impl.Inventory;
|
||||
import org.dreambot.api.methods.container.impl.bank.Bank;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
|
||||
public class DoBank extends TaskNode {
|
||||
@Override
|
||||
public boolean accept() {
|
||||
return Bank.isOpen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute() {
|
||||
if (Inventory.contains(CSmelter.smeltingOption.getEndProduct())) {
|
||||
Bank.depositAllExcept(item -> item.getName().endsWith("mould"));
|
||||
if (!MethodProvider.sleepUntil(() -> Inventory.isEmpty() || Inventory.onlyContains(item -> item.getName().endsWith("mould")), Calculations.random(2000, 2500))) return Calculations.random(250, 400);
|
||||
}
|
||||
|
||||
String mould = CSmelter.smeltingOption.getMould();
|
||||
if (!mould.equals("")) {
|
||||
if (!Inventory.contains(mould)) {
|
||||
Bank.withdraw(mould, 1);
|
||||
if (!MethodProvider.sleepUntil(() -> Inventory.contains(mould), Calculations.random(2000, 2500))) {
|
||||
return Calculations.random(250, 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String[] names = CSmelter.smeltingOption.getIngredientsNames();
|
||||
|
||||
if (CSmelter.smeltingOption.getIngredients().length == 1) {
|
||||
Bank.withdrawAll(CSmelter.smeltingOption.getIngredients()[0].getName());
|
||||
} else {
|
||||
int craftsPerInventory = CSmelter.smeltingOption.getMaxCraftsPerInventory();
|
||||
|
||||
for (Ingredient i : CSmelter.smeltingOption.getIngredients()) {
|
||||
if (Inventory.count(i.getName()) < i.getAmount() * craftsPerInventory) {
|
||||
Bank.withdraw(i.getName(), i.getAmount() * craftsPerInventory);
|
||||
}
|
||||
MethodProvider.sleep(200, 400);
|
||||
}
|
||||
}
|
||||
|
||||
MethodProvider.sleepUntil(() -> Inventory.containsAll(names), Calculations.random(2000, 2500));
|
||||
|
||||
return Calculations.random(250, 400);
|
||||
}
|
||||
}
|
42
CSmelter/src/io/reisub/dreambot/csmelter/tasks/OpenBank.java
Normal file
42
CSmelter/src/io/reisub/dreambot/csmelter/tasks/OpenBank.java
Normal file
@ -0,0 +1,42 @@
|
||||
package io.reisub.dreambot.csmelter.tasks;
|
||||
|
||||
import io.reisub.dreambot.csmelter.CSmelter;
|
||||
import io.reisub.dreambot.util.Util;
|
||||
import org.dreambot.api.methods.Calculations;
|
||||
import org.dreambot.api.methods.MethodProvider;
|
||||
import org.dreambot.api.methods.container.impl.Inventory;
|
||||
import org.dreambot.api.methods.container.impl.bank.Bank;
|
||||
import org.dreambot.api.methods.interactive.GameObjects;
|
||||
import org.dreambot.api.methods.walking.impl.Walking;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
import org.dreambot.api.wrappers.interactive.GameObject;
|
||||
|
||||
public class OpenBank extends TaskNode {
|
||||
@Override
|
||||
public boolean accept() {
|
||||
return !Bank.isOpen()
|
||||
&& !Inventory.containsAll(CSmelter.smeltingOption.getIngredientsNames())
|
||||
&& Util.playerIsIdle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute() {
|
||||
GameObject bank = GameObjects.closest("Bank booth");
|
||||
if (bank == null) return Calculations.random(250, 400);
|
||||
|
||||
if (!bank.isOnScreen()) {
|
||||
while (bank.distance() > Calculations.random(6, 9)) {
|
||||
if (Walking.shouldWalk(Calculations.random(4, 6))) {
|
||||
Walking.walk(bank);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bank.interactForceLeft("Bank");
|
||||
if (!Util.sleepUntilMoving()) return Calculations.random(250, 400);
|
||||
|
||||
MethodProvider.sleepUntil(Bank::isOpen, Calculations.random(10000, 11000));
|
||||
|
||||
return Calculations.random(250, 400);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package io.reisub.dreambot.csmelter.tasks;
|
||||
|
||||
import org.dreambot.api.methods.Calculations;
|
||||
import org.dreambot.api.methods.input.Camera;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
|
||||
public class SetCamera extends TaskNode {
|
||||
@Override
|
||||
public boolean accept() {
|
||||
return Camera.getPitch() <= 380;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute() {
|
||||
Camera.mouseRotateTo(Calculations.random(60, 302), 383);
|
||||
|
||||
return Calculations.random(250, 400);
|
||||
}
|
||||
}
|
71
CSmelter/src/io/reisub/dreambot/csmelter/tasks/Smelt.java
Normal file
71
CSmelter/src/io/reisub/dreambot/csmelter/tasks/Smelt.java
Normal file
@ -0,0 +1,71 @@
|
||||
package io.reisub.dreambot.csmelter.tasks;
|
||||
|
||||
import io.reisub.dreambot.csmelter.CSmelter;
|
||||
import io.reisub.dreambot.util.Util;
|
||||
import org.dreambot.api.methods.Calculations;
|
||||
import org.dreambot.api.methods.MethodProvider;
|
||||
import org.dreambot.api.methods.container.impl.Inventory;
|
||||
import org.dreambot.api.methods.container.impl.bank.Bank;
|
||||
import org.dreambot.api.methods.input.Keyboard;
|
||||
import org.dreambot.api.methods.interactive.GameObjects;
|
||||
import org.dreambot.api.methods.interactive.Players;
|
||||
import org.dreambot.api.methods.walking.impl.Walking;
|
||||
import org.dreambot.api.methods.widget.Widgets;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
import org.dreambot.api.wrappers.interactive.GameObject;
|
||||
import org.dreambot.api.wrappers.widgets.WidgetChild;
|
||||
|
||||
public class Smelt extends TaskNode {
|
||||
private boolean firstTime = true;
|
||||
|
||||
@Override
|
||||
public boolean accept() {
|
||||
return Inventory.containsAll(CSmelter.smeltingOption.getIngredientsNames())
|
||||
&& Util.playerIsIdle(1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute() {
|
||||
GameObject furnace = GameObjects.closest("Furnace");
|
||||
if (furnace == null) return Calculations.random(250, 400);
|
||||
|
||||
if (Bank.isOpen()) {
|
||||
Walking.walk(furnace);
|
||||
MethodProvider.sleep(300, 600);
|
||||
}
|
||||
|
||||
furnace.interact();
|
||||
if (!furnace.getInteractableFrom().contains(Players.localPlayer().getTile())) {
|
||||
if (!Util.sleepUntilMoving()) return Calculations.random(250, 400);
|
||||
}
|
||||
|
||||
MethodProvider.sleepWhile(() -> furnace.distance() > Calculations.random(2, 4), Calculations.random(10000, 11000));
|
||||
|
||||
if (CSmelter.smeltingOption.getMould().equals("")) {
|
||||
if (!firstTime) Keyboard.holdSpace(() -> {
|
||||
WidgetChild w = Widgets.getChildWidget(270, 13);
|
||||
return (w != null && w.isVisible()) || Players.localPlayer().isAnimating();
|
||||
}, Calculations.random(4000, 4500));
|
||||
|
||||
if (!MethodProvider.sleepUntil(() -> {
|
||||
WidgetChild w = Widgets.getChildWidget(270, 13);
|
||||
return w != null && w.isVisible();
|
||||
}, Calculations.random(5000, 5500))) return Calculations.random(250, 400);
|
||||
|
||||
Keyboard.type(CSmelter.smeltingOption.getHotkey(), false, false);
|
||||
if (Util.sleepUntilAnimating()) firstTime = false;
|
||||
} else {
|
||||
if (!MethodProvider.sleepUntil(() -> {
|
||||
WidgetChild w = Widgets.getChildWidget(446, CSmelter.smeltingOption.getHotkey());
|
||||
return w != null && w.isVisible();
|
||||
}, Calculations.random(3000, 3500))) return Calculations.random(250, 400);
|
||||
|
||||
WidgetChild w = Widgets.getChildWidget(446, CSmelter.smeltingOption.getHotkey());
|
||||
w.interact();
|
||||
|
||||
Util.sleepUntilAnimating();
|
||||
}
|
||||
|
||||
return Calculations.random(250, 400);
|
||||
}
|
||||
}
|
@ -2,13 +2,11 @@ package io.reisub.dreambot.cthiever.tasks;
|
||||
|
||||
import io.reisub.dreambot.util.Util;
|
||||
import org.dreambot.api.methods.Calculations;
|
||||
import org.dreambot.api.methods.MethodProvider;
|
||||
import org.dreambot.api.methods.interactive.NPCs;
|
||||
import org.dreambot.api.methods.interactive.Players;
|
||||
import org.dreambot.api.script.ScriptManager;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
import org.dreambot.api.script.listener.ChatListener;
|
||||
import org.dreambot.api.wrappers.interactive.Character;
|
||||
import org.dreambot.api.wrappers.interactive.NPC;
|
||||
import org.dreambot.api.wrappers.widgets.message.Message;
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
package io.reisub.dreambot.util;
|
||||
|
||||
import io.reisub.dreambot.util.ui.UI;
|
||||
import org.dreambot.api.Client;
|
||||
import org.dreambot.api.methods.MethodContext;
|
||||
import org.dreambot.api.methods.MethodProvider;
|
||||
import org.dreambot.api.script.AbstractScript;
|
||||
|
||||
import java.awt.*;
|
||||
@ -25,6 +27,12 @@ public abstract class CAbstractScript extends AbstractScript implements MouseLis
|
||||
ui.draw(g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
MethodProvider.sleep(1000);
|
||||
Client.getInstance().setKeyboardInputEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
ui.pause();
|
||||
@ -32,6 +40,7 @@ public abstract class CAbstractScript extends AbstractScript implements MouseLis
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
Client.getInstance().setKeyboardInputEnabled(true);
|
||||
ui.resume();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
package io.reisub.dreambot.util;
|
||||
|
||||
import io.reisub.dreambot.util.ui.UI;
|
||||
import org.dreambot.api.Client;
|
||||
import org.dreambot.api.methods.MethodContext;
|
||||
import org.dreambot.api.methods.MethodProvider;
|
||||
import org.dreambot.api.script.impl.TaskScript;
|
||||
|
||||
import java.awt.*;
|
||||
@ -25,6 +27,12 @@ public abstract class CTaskScript extends TaskScript implements MouseListener {
|
||||
ui.draw(g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
MethodProvider.sleep(1000);
|
||||
Client.getInstance().setKeyboardInputEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
ui.pause();
|
||||
@ -32,6 +40,7 @@ public abstract class CTaskScript extends TaskScript implements MouseListener {
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
Client.getInstance().setKeyboardInputEnabled(true);
|
||||
ui.resume();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user