Compare commits
10 Commits
84da7e108a
...
master
Author | SHA1 | Date | |
---|---|---|---|
7536ae4db3
|
|||
03b882635e
|
|||
25844dad61
|
|||
aaee43be4c
|
|||
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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<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" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</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$/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$/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$/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$/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$/CWintertodt/CWintertodt.iml" filepath="$PROJECT_DIR$/CWintertodt/CWintertodt.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/DreambotScripts.iml" filepath="$PROJECT_DIR$/DreambotScripts.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;
|
int marks = PickupMark.marksPickedUp;
|
||||||
getUI().drawString("Marks picked up: " + marks + " (" + getUI().getHourlyRate(marks) + " per hour)");
|
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.Constants;
|
||||||
import io.reisub.dreambot.util.Util;
|
import io.reisub.dreambot.util.Util;
|
||||||
import org.dreambot.api.input.Mouse;
|
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.input.mouse.destination.impl.MiniMapTileDestination;
|
||||||
import org.dreambot.api.methods.Calculations;
|
import org.dreambot.api.methods.Calculations;
|
||||||
import org.dreambot.api.methods.MethodContext;
|
import org.dreambot.api.methods.MethodContext;
|
||||||
@ -84,7 +87,8 @@ public class HandleObstacle extends TaskNode {
|
|||||||
new Tile(2721, 3489, 3),
|
new Tile(2721, 3489, 3),
|
||||||
new Tile(2730, 3489, 3),
|
new Tile(2730, 3489, 3),
|
||||||
new Tile(2730, 3497, 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 Obstacle(14932, new Area(
|
||||||
new Tile(2715, 3487, 2),
|
new Tile(2715, 3487, 2),
|
||||||
new Tile(2715, 3498, 2),
|
new Tile(2715, 3498, 2),
|
||||||
@ -145,7 +149,7 @@ public class HandleObstacle extends TaskNode {
|
|||||||
private final Course course;
|
private final Course course;
|
||||||
private final Map<Integer, Rectangle> hoverMap;
|
private final Map<Integer, Rectangle> hoverMap;
|
||||||
|
|
||||||
private Obstacle current;
|
public static Obstacle current;
|
||||||
private int retries = 0;
|
private int retries = 0;
|
||||||
|
|
||||||
public HandleObstacle(Course course) {
|
public HandleObstacle(Course course) {
|
||||||
@ -196,6 +200,7 @@ public class HandleObstacle extends TaskNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Tile finalTarget = target;
|
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));
|
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);
|
Mouse.move(hoverRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Util.sleepUntilMoving(Calculations.random(1200, 1500))) {
|
||||||
|
return Calculations.random(180, 350);
|
||||||
|
}
|
||||||
|
|
||||||
if (isWalking) {
|
if (isWalking) {
|
||||||
Util.sleepUntilMovingAndAnimating(Calculations.random(12000, 13000));
|
Util.sleepUntilMovingAndAnimating(Calculations.random(12000, 13000));
|
||||||
} else {
|
} else {
|
||||||
@ -232,7 +241,10 @@ public class HandleObstacle extends TaskNode {
|
|||||||
|
|
||||||
public void interact(GameObject currentObject, boolean shouldHop) {
|
public void interact(GameObject currentObject, boolean shouldHop) {
|
||||||
Mouse.setAlwaysHop(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);
|
Mouse.setAlwaysHop(false);
|
||||||
|
|
||||||
Tile dest = null;
|
Tile dest = null;
|
||||||
@ -244,8 +256,10 @@ public class HandleObstacle extends TaskNode {
|
|||||||
dest = Walking.getDestination();
|
dest = Walking.getDestination();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dest == null) return;
|
||||||
|
|
||||||
if (!currentObject.getObjectTiles().contains(dest) && !currentObject.getInteractableFrom().contains(dest)) {
|
if (!currentObject.getObjectTiles().contains(dest) && !currentObject.getInteractableFrom().contains(dest)) {
|
||||||
MethodProvider.log("Misclick, trying again");
|
MethodProvider.log("Misclick, trying again ");
|
||||||
interact(currentObject, true);
|
interact(currentObject, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import io.reisub.dreambot.util.Constants;
|
|||||||
import io.reisub.dreambot.util.Util;
|
import io.reisub.dreambot.util.Util;
|
||||||
import org.dreambot.api.methods.Calculations;
|
import org.dreambot.api.methods.Calculations;
|
||||||
import org.dreambot.api.methods.container.impl.Inventory;
|
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.interactive.GameObjects;
|
||||||
import org.dreambot.api.methods.map.Area;
|
import org.dreambot.api.methods.map.Area;
|
||||||
import org.dreambot.api.methods.map.Tile;
|
import org.dreambot.api.methods.map.Tile;
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
package io.reisub.dreambot.cplanker.tasks;
|
package io.reisub.dreambot.cplanker.tasks;
|
||||||
|
|
||||||
import io.reisub.dreambot.util.Constants;
|
|
||||||
import io.reisub.dreambot.util.Util;
|
import io.reisub.dreambot.util.Util;
|
||||||
import org.dreambot.api.methods.Calculations;
|
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.Inventory;
|
||||||
import org.dreambot.api.methods.filter.Filter;
|
|
||||||
import org.dreambot.api.methods.interactive.GameObjects;
|
import org.dreambot.api.methods.interactive.GameObjects;
|
||||||
import org.dreambot.api.methods.map.Area;
|
import org.dreambot.api.methods.map.Area;
|
||||||
import org.dreambot.api.methods.map.Tile;
|
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.container.impl.bank.Bank;
|
||||||
import org.dreambot.api.methods.filter.Filter;
|
import org.dreambot.api.methods.filter.Filter;
|
||||||
import org.dreambot.api.methods.interactive.GameObjects;
|
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.interactive.Players;
|
||||||
import org.dreambot.api.methods.map.Tile;
|
import org.dreambot.api.methods.map.Tile;
|
||||||
import org.dreambot.api.methods.walking.impl.Walking;
|
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.Calculations;
|
||||||
import org.dreambot.api.methods.MethodProvider;
|
import org.dreambot.api.methods.MethodProvider;
|
||||||
import org.dreambot.api.methods.container.impl.Inventory;
|
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.methods.item.GroundItems;
|
||||||
import org.dreambot.api.script.TaskNode;
|
import org.dreambot.api.script.TaskNode;
|
||||||
import org.dreambot.api.wrappers.items.GroundItem;
|
import org.dreambot.api.wrappers.items.GroundItem;
|
||||||
|
@ -1,29 +1,39 @@
|
|||||||
package io.reisub.dreambot.cshopper;
|
package io.reisub.dreambot.cshopper;
|
||||||
|
|
||||||
import io.reisub.dreambot.cshopper.tasks.Buy;
|
import io.reisub.dreambot.cshopper.tasks.*;
|
||||||
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.util.CTaskScript;
|
import io.reisub.dreambot.util.CTaskScript;
|
||||||
import io.reisub.dreambot.util.Constants;
|
import io.reisub.dreambot.util.Constants;
|
||||||
import io.reisub.dreambot.util.tasks.Run;
|
import io.reisub.dreambot.util.tasks.Run;
|
||||||
|
import io.reisub.dreambot.util.ui.GUI;
|
||||||
|
import io.reisub.dreambot.util.ui.Parameter;
|
||||||
|
import org.dreambot.api.methods.MethodProvider;
|
||||||
import org.dreambot.api.methods.container.impl.Inventory;
|
import org.dreambot.api.methods.container.impl.Inventory;
|
||||||
|
import org.dreambot.api.randoms.RandomEvent;
|
||||||
import org.dreambot.api.script.Category;
|
import org.dreambot.api.script.Category;
|
||||||
import org.dreambot.api.script.ScriptManifest;
|
import org.dreambot.api.script.ScriptManifest;
|
||||||
import org.dreambot.api.wrappers.items.Item;
|
import org.dreambot.api.wrappers.items.Item;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@ScriptManifest(category = Category.MISC, name = "CShopper", description = "Shops like a woman with an unlimited Visa card", author = Constants.AUTHOR, version = 1.0)
|
@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 {
|
public class CShopper extends CTaskScript {
|
||||||
private static final Configuration configuration = new Configuration(
|
private static final Configuration configuration = new Configuration(
|
||||||
Constants.LUNDAIL,
|
Constants.LUNDAIL,
|
||||||
new ItemWrapper(Constants.COSMIC_RUNE, -1),
|
new ItemWrapper("Nature rune", 5000)
|
||||||
new ItemWrapper(Constants.NATURE_RUNE, 6000)
|
//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;
|
private Buy buyTask;
|
||||||
|
private GUI gui;
|
||||||
|
|
||||||
public static Configuration getConfiguration() {
|
public static Configuration getConfiguration() {
|
||||||
return configuration;
|
return configuration;
|
||||||
@ -32,9 +42,32 @@ public class CShopper extends CTaskScript {
|
|||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
getUI().setCustomLines(configuration.getItems().length);
|
getUI().setCustomLines(configuration.getItems().length);
|
||||||
|
getRandomManager().disableSolver(RandomEvent.BREAK);
|
||||||
|
getRandomManager().disableSolver(RandomEvent.LOGIN);
|
||||||
|
|
||||||
buyTask = new Buy();
|
buyTask = new Buy();
|
||||||
|
|
||||||
|
try {
|
||||||
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
|
gui = new GUI(getSDNName());
|
||||||
|
gui.addComboBox("Trader", CShopperOptions.traders, new Parameter("Custom"));
|
||||||
|
gui.addComboBox("Items",
|
||||||
|
CShopperOptions.items,
|
||||||
|
true,
|
||||||
|
new Parameter("Custom"),
|
||||||
|
new Parameter("Buy total"),
|
||||||
|
new Parameter("Minimum in shop"),
|
||||||
|
new Parameter("Stackable", new JCheckBox()));
|
||||||
|
gui.init();
|
||||||
|
});
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
|
||||||
|
while (gui == null || !gui.isReady()) {
|
||||||
|
MethodProvider.sleep(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
MethodProvider.log(gui.getOption("Trader").getName());
|
||||||
|
|
||||||
addNodes(
|
addNodes(
|
||||||
new Stop(),
|
new Stop(),
|
||||||
new Run(),
|
new Run(),
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package io.reisub.dreambot.cshopper;
|
||||||
|
|
||||||
|
import io.reisub.dreambot.util.Constants;
|
||||||
|
import io.reisub.dreambot.util.ui.Option;
|
||||||
|
|
||||||
|
public class CShopperOptions {
|
||||||
|
public final static Option[] traders = new Option[]{
|
||||||
|
new Option("custom"),
|
||||||
|
new Option("Lundail", "mage arena rune shop")
|
||||||
|
};
|
||||||
|
|
||||||
|
public final static Option[] items = new Option[]{
|
||||||
|
new Option("custom"),
|
||||||
|
new Option("Nature rune")
|
||||||
|
};
|
||||||
|
}
|
@ -3,15 +3,25 @@ package io.reisub.dreambot.cshopper;
|
|||||||
public class ItemWrapper {
|
public class ItemWrapper {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int buyTotal, minimumInShop;
|
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.name = name;
|
||||||
this.buyTotal = buyTotal;
|
this.buyTotal = buyTotal;
|
||||||
this.minimumInShop = minimumInShop;
|
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) {
|
public ItemWrapper(String name, int buyTotal) {
|
||||||
this(name, buyTotal, 0);
|
this(name, buyTotal, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -25,4 +35,8 @@ public class ItemWrapper {
|
|||||||
public int getMinimumInShop() {
|
public int getMinimumInShop() {
|
||||||
return minimumInShop;
|
return minimumInShop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isStackable() {
|
||||||
|
return stackable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
31
CShopper/src/io/reisub/dreambot/cshopper/ShopperItem.java
Normal file
31
CShopper/src/io/reisub/dreambot/cshopper/ShopperItem.java
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package io.reisub.dreambot.cshopper;
|
||||||
|
|
||||||
|
public enum ShopperItem {
|
||||||
|
CUSTOM("custom..."),
|
||||||
|
NATURE_RUNE("Nature rune");
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
private String customName;
|
||||||
|
|
||||||
|
ShopperItem(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomName(String customName) {
|
||||||
|
this.customName = customName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCustomName() {
|
||||||
|
return customName;
|
||||||
|
}
|
||||||
|
}
|
49
CShopper/src/io/reisub/dreambot/cshopper/Trader.java
Normal file
49
CShopper/src/io/reisub/dreambot/cshopper/Trader.java
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package io.reisub.dreambot.cshopper;
|
||||||
|
|
||||||
|
public enum Trader {
|
||||||
|
CUSTOM("custom..."),
|
||||||
|
LUNDAIL("Lundail", "mage arena rune shop");
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
private final String info;
|
||||||
|
|
||||||
|
private String customName;
|
||||||
|
|
||||||
|
Trader(String name) {
|
||||||
|
this(name, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
Trader(String name, String info) {
|
||||||
|
this.name = name;
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
if (customName == null || customName.equals("")) {
|
||||||
|
return name;
|
||||||
|
} else {
|
||||||
|
return customName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInfo() {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
if (info.equals("")) {
|
||||||
|
return name;
|
||||||
|
} else {
|
||||||
|
return name + " (" + info + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCustomName() {
|
||||||
|
return customName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomName(String customName) {
|
||||||
|
this.customName = customName;
|
||||||
|
}
|
||||||
|
}
|
@ -21,7 +21,7 @@ public class Buy extends TaskNode {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept() {
|
public boolean accept() {
|
||||||
if (!Shop.isOpen()) return false;
|
if (!Shop.isOpen() || Inventory.isFull() || Hop.shouldHop) return false;
|
||||||
|
|
||||||
for (ItemWrapper iw : CShopper.getConfiguration().getItems()) {
|
for (ItemWrapper iw : CShopper.getConfiguration().getItems()) {
|
||||||
int shopCount = Shop.get(iw.getName()).getAmount();
|
int shopCount = Shop.get(iw.getName()).getAmount();
|
||||||
@ -54,7 +54,7 @@ public class Buy extends TaskNode {
|
|||||||
int toBuy = buyTotal - inventoryCount;
|
int toBuy = buyTotal - inventoryCount;
|
||||||
int canBuy = iw.getMinimumInShop() == 0 ? 50 : shopCount - iw.getMinimumInShop();
|
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");
|
shopItem.interact("Buy 50");
|
||||||
} else if (toBuy >= 10 && canBuy >= 10) {
|
} else if (toBuy >= 10 && canBuy >= 10) {
|
||||||
shopItem.interact("Buy 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;
|
import java.util.Queue;
|
||||||
|
|
||||||
public class Hop extends TaskNode {
|
public class Hop extends TaskNode {
|
||||||
|
public static boolean shouldHop;
|
||||||
private final Queue<World> worlds;
|
private final Queue<World> worlds;
|
||||||
|
|
||||||
public Hop(boolean members) {
|
public Hop(boolean members) {
|
||||||
@ -42,6 +43,8 @@ public class Hop extends TaskNode {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept() {
|
public boolean accept() {
|
||||||
|
if (Hop.shouldHop) return true;
|
||||||
|
|
||||||
if (!Shop.isOpen()) return false;
|
if (!Shop.isOpen()) return false;
|
||||||
|
|
||||||
for (ItemWrapper iw : CShopper.getConfiguration().getItems()) {
|
for (ItemWrapper iw : CShopper.getConfiguration().getItems()) {
|
||||||
@ -60,6 +63,7 @@ public class Hop extends TaskNode {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int execute() {
|
public int execute() {
|
||||||
|
shouldHop = false;
|
||||||
Shop.close();
|
Shop.close();
|
||||||
MethodProvider.sleepUntil(() -> !Shop.isOpen(), Calculations.random(2000, 2500));
|
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 io.reisub.dreambot.util.Constants;
|
||||||
import org.dreambot.api.methods.Calculations;
|
import org.dreambot.api.methods.Calculations;
|
||||||
import org.dreambot.api.methods.MethodContext;
|
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.container.impl.Shop;
|
||||||
import org.dreambot.api.methods.interactive.NPCs;
|
import org.dreambot.api.methods.interactive.NPCs;
|
||||||
import org.dreambot.api.script.TaskNode;
|
import org.dreambot.api.script.TaskNode;
|
||||||
@ -12,7 +13,9 @@ import org.dreambot.api.wrappers.interactive.NPC;
|
|||||||
public class Open extends TaskNode {
|
public class Open extends TaskNode {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept() {
|
public boolean accept() {
|
||||||
return !Shop.isOpen();
|
return !Shop.isOpen()
|
||||||
|
&& !Inventory.isFull()
|
||||||
|
&& !Hop.shouldHop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
||||||
|
}
|
||||||
|
}
|
71
CSmelter/src/io/reisub/dreambot/csmelter/tasks/DoBank.java
Normal file
71
CSmelter/src/io/reisub/dreambot/csmelter/tasks/DoBank.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package io.reisub.dreambot.csmelter.tasks;
|
||||||
|
|
||||||
|
import io.reisub.dreambot.csmelter.CSmelter;
|
||||||
|
import io.reisub.dreambot.csmelter.Ingredient;
|
||||||
|
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.widget.Widgets;
|
||||||
|
import org.dreambot.api.script.TaskNode;
|
||||||
|
import org.dreambot.api.wrappers.items.Item;
|
||||||
|
import org.dreambot.api.wrappers.widgets.WidgetChild;
|
||||||
|
|
||||||
|
public class DoBank extends TaskNode {
|
||||||
|
@Override
|
||||||
|
public boolean accept() {
|
||||||
|
return Bank.isOpen();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int execute() {
|
||||||
|
if (Inventory.contains(CSmelter.smeltingOption.getEndProduct())) {
|
||||||
|
if (Util.getHoverEntry("deposit") == null) {
|
||||||
|
if (Inventory.contains(item -> item.getName().endsWith("mould"))) {
|
||||||
|
Item item = Inventory.get(CSmelter.smeltingOption.getEndProduct());
|
||||||
|
Util.addHoverEntry("deposit", item.getDestination().getBoundingBox());
|
||||||
|
} else {
|
||||||
|
WidgetChild depositAll = Widgets.getChildWidget(12, 42);
|
||||||
|
if (depositAll != null && depositAll.isVisible()) {
|
||||||
|
Util.addHoverEntry("deposit", depositAll.getRectangle());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Util.hover("minimapToFurnace");
|
||||||
|
|
||||||
|
MethodProvider.sleepUntil(() -> Inventory.containsAll(names), Calculations.random(2000, 2500));
|
||||||
|
|
||||||
|
return Calculations.random(250, 400);
|
||||||
|
}
|
||||||
|
}
|
45
CSmelter/src/io/reisub/dreambot/csmelter/tasks/OpenBank.java
Normal file
45
CSmelter/src/io/reisub/dreambot/csmelter/tasks/OpenBank.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Util.addHoverEntry("bank", bank);
|
||||||
|
|
||||||
|
bank.interactForceLeft("Bank");
|
||||||
|
if (!Util.sleepUntilMoving()) return Calculations.random(250, 400);
|
||||||
|
|
||||||
|
Util.hover("deposit");
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
76
CSmelter/src/io/reisub/dreambot/csmelter/tasks/Smelt.java
Normal file
76
CSmelter/src/io/reisub/dreambot/csmelter/tasks/Smelt.java
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
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())
|
||||||
|
&& (Bank.isOpen() || Util.playerIsIdle(1400));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int execute() {
|
||||||
|
GameObject furnace = GameObjects.closest("Furnace");
|
||||||
|
if (furnace == null) return Calculations.random(250, 400);
|
||||||
|
|
||||||
|
if (Bank.isOpen()) {
|
||||||
|
Util.addHoverEntry("minimapToFurnace", furnace.getTile(), true);
|
||||||
|
Walking.walk(furnace);
|
||||||
|
MethodProvider.sleep(300, 600);
|
||||||
|
}
|
||||||
|
|
||||||
|
furnace.interact();
|
||||||
|
if (!furnace.getInteractableFrom().contains(Players.localPlayer().getTile())) {
|
||||||
|
if (!Util.sleepUntilMoving()) return Calculations.random(250, 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
Util.hover("smeltWidget");
|
||||||
|
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());
|
||||||
|
Util.addHoverEntry("smeltWidget", w.getRectangle());
|
||||||
|
w.interact();
|
||||||
|
|
||||||
|
Util.sleepUntilAnimating();
|
||||||
|
}
|
||||||
|
|
||||||
|
Util.hover("bank");
|
||||||
|
|
||||||
|
return Calculations.random(250, 400);
|
||||||
|
}
|
||||||
|
}
|
@ -2,13 +2,11 @@ package io.reisub.dreambot.cthiever.tasks;
|
|||||||
|
|
||||||
import io.reisub.dreambot.util.Util;
|
import io.reisub.dreambot.util.Util;
|
||||||
import org.dreambot.api.methods.Calculations;
|
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.NPCs;
|
||||||
import org.dreambot.api.methods.interactive.Players;
|
import org.dreambot.api.methods.interactive.Players;
|
||||||
import org.dreambot.api.script.ScriptManager;
|
import org.dreambot.api.script.ScriptManager;
|
||||||
import org.dreambot.api.script.TaskNode;
|
import org.dreambot.api.script.TaskNode;
|
||||||
import org.dreambot.api.script.listener.ChatListener;
|
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.interactive.NPC;
|
||||||
import org.dreambot.api.wrappers.widgets.message.Message;
|
import org.dreambot.api.wrappers.widgets.message.Message;
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package io.reisub.dreambot.util;
|
package io.reisub.dreambot.util;
|
||||||
|
|
||||||
import io.reisub.dreambot.util.ui.UI;
|
import io.reisub.dreambot.util.ui.UI;
|
||||||
|
import org.dreambot.api.Client;
|
||||||
import org.dreambot.api.methods.MethodContext;
|
import org.dreambot.api.methods.MethodContext;
|
||||||
|
import org.dreambot.api.methods.MethodProvider;
|
||||||
import org.dreambot.api.script.AbstractScript;
|
import org.dreambot.api.script.AbstractScript;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@ -25,6 +27,12 @@ public abstract class CAbstractScript extends AbstractScript implements MouseLis
|
|||||||
ui.draw(g);
|
ui.draw(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
MethodProvider.sleep(1000);
|
||||||
|
Client.getInstance().setKeyboardInputEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
ui.pause();
|
ui.pause();
|
||||||
@ -32,6 +40,7 @@ public abstract class CAbstractScript extends AbstractScript implements MouseLis
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
Client.getInstance().setKeyboardInputEnabled(true);
|
||||||
ui.resume();
|
ui.resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package io.reisub.dreambot.util;
|
package io.reisub.dreambot.util;
|
||||||
|
|
||||||
import io.reisub.dreambot.util.ui.UI;
|
import io.reisub.dreambot.util.ui.UI;
|
||||||
|
import org.dreambot.api.Client;
|
||||||
import org.dreambot.api.methods.MethodContext;
|
import org.dreambot.api.methods.MethodContext;
|
||||||
|
import org.dreambot.api.methods.MethodProvider;
|
||||||
import org.dreambot.api.script.impl.TaskScript;
|
import org.dreambot.api.script.impl.TaskScript;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@ -25,6 +27,12 @@ public abstract class CTaskScript extends TaskScript implements MouseListener {
|
|||||||
ui.draw(g);
|
ui.draw(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
MethodProvider.sleep(1000);
|
||||||
|
Client.getInstance().setKeyboardInputEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
ui.pause();
|
ui.pause();
|
||||||
@ -32,6 +40,7 @@ public abstract class CTaskScript extends TaskScript implements MouseListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
Client.getInstance().setKeyboardInputEnabled(true);
|
||||||
ui.resume();
|
ui.resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,26 @@
|
|||||||
package io.reisub.dreambot.util;
|
package io.reisub.dreambot.util;
|
||||||
|
|
||||||
|
import org.dreambot.api.input.Mouse;
|
||||||
|
import org.dreambot.api.input.mouse.destination.impl.MiniMapTileDestination;
|
||||||
import org.dreambot.api.methods.Calculations;
|
import org.dreambot.api.methods.Calculations;
|
||||||
import org.dreambot.api.methods.MethodContext;
|
import org.dreambot.api.methods.MethodContext;
|
||||||
import org.dreambot.api.methods.interactive.Players;
|
import org.dreambot.api.methods.interactive.Players;
|
||||||
import org.dreambot.api.methods.map.Tile;
|
import org.dreambot.api.methods.map.Tile;
|
||||||
import org.dreambot.api.methods.skills.Skill;
|
import org.dreambot.api.methods.skills.Skill;
|
||||||
import org.dreambot.api.methods.skills.Skills;
|
import org.dreambot.api.methods.skills.Skills;
|
||||||
|
import org.dreambot.api.wrappers.interactive.Entity;
|
||||||
import org.dreambot.api.wrappers.interactive.GameObject;
|
import org.dreambot.api.wrappers.interactive.GameObject;
|
||||||
import org.dreambot.api.wrappers.interactive.Player;
|
import org.dreambot.api.wrappers.interactive.Player;
|
||||||
|
import org.w3c.dom.css.Rect;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class Util {
|
public class Util {
|
||||||
private static final String VERSION = "1.0.0";
|
private static final String VERSION = "1.0.0";
|
||||||
|
private static final Map<String, Rectangle> hoverMap = new HashMap<>();
|
||||||
|
|
||||||
public static String getVersion() {
|
public static String getVersion() {
|
||||||
return VERSION;
|
return VERSION;
|
||||||
@ -114,4 +123,40 @@ public class Util {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Rectangle getHoverEntry(String name) {
|
||||||
|
return hoverMap.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addHoverEntry(String name, Rectangle dest) {
|
||||||
|
hoverMap.putIfAbsent(name, dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addHoverEntry(String name, Tile dest, boolean minimap) {
|
||||||
|
Rectangle rect;
|
||||||
|
|
||||||
|
if (minimap) {
|
||||||
|
MiniMapTileDestination td = new MiniMapTileDestination(dest);
|
||||||
|
rect = td.getBoundingBox();
|
||||||
|
} else {
|
||||||
|
rect = dest.getTileReference().getBoundaryObject().getBoundingBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
addHoverEntry(name, rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addHoverEntry(String name, Tile dest) {
|
||||||
|
addHoverEntry(name, dest, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addHoverEntry(String name, Entity dest) {
|
||||||
|
addHoverEntry(name, dest.getBoundingBox());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void hover(String name) {
|
||||||
|
Rectangle dest = getHoverEntry(name);
|
||||||
|
if (dest != null) {
|
||||||
|
Mouse.move(dest);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
208
Util/src/io/reisub/dreambot/util/ui/GUI.java
Normal file
208
Util/src/io/reisub/dreambot/util/ui/GUI.java
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
package io.reisub.dreambot.util.ui;
|
||||||
|
|
||||||
|
import org.dreambot.api.methods.MethodProvider;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class GUI extends JFrame {
|
||||||
|
private final GridBagLayout layout;
|
||||||
|
private final GridBagConstraints constraints;
|
||||||
|
private final Map<String, Component> componentMap;
|
||||||
|
private final Map<String, java.util.List<Option>> optionMap;
|
||||||
|
|
||||||
|
private volatile boolean ready;
|
||||||
|
|
||||||
|
public GUI(String title) {
|
||||||
|
super(title);
|
||||||
|
layout = new GridBagLayout();
|
||||||
|
constraints = new GridBagConstraints();
|
||||||
|
constraints.insets = new Insets(6, 6, 6, 6);
|
||||||
|
|
||||||
|
componentMap = new HashMap<>();
|
||||||
|
optionMap = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
setUndecorated(true);
|
||||||
|
|
||||||
|
Container contentPane = getContentPane();
|
||||||
|
contentPane.setLayout(layout);
|
||||||
|
addStart();
|
||||||
|
|
||||||
|
pack();
|
||||||
|
setLocationRelativeTo(getOwner());
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addStart() {
|
||||||
|
JButton start = new JButton("Start");
|
||||||
|
start.setPreferredSize(new Dimension(100, 40));
|
||||||
|
|
||||||
|
constraints.fill = GridBagConstraints.VERTICAL;
|
||||||
|
constraints.weighty = 2.0;
|
||||||
|
layout.setConstraints(start, constraints);
|
||||||
|
getContentPane().add(start);
|
||||||
|
|
||||||
|
start.addActionListener((e) -> {
|
||||||
|
for (String key : componentMap.keySet()) {
|
||||||
|
Component component = componentMap.get(key);
|
||||||
|
java.util.List<Option> options = new ArrayList<>();
|
||||||
|
|
||||||
|
if (component instanceof JComboBox) {
|
||||||
|
Option option = (Option) ((JComboBox<?>) component).getSelectedItem();
|
||||||
|
options.add(option);
|
||||||
|
} else if (component instanceof JList) {
|
||||||
|
DefaultListModel<Option> listModel = (DefaultListModel<Option>) ((JList<?>) component).getModel();
|
||||||
|
for (int i = 0; i < listModel.size(); i++) {
|
||||||
|
options.add(listModel.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
optionMap.put(key, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
ready = true;
|
||||||
|
setVisible(false);
|
||||||
|
dispose();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addComboBox(String name, Option[] options, Parameter... parameters) {
|
||||||
|
addComboBox(name, options, false, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addComboBox(String name, Option[] options, boolean multiple, Parameter... parameters) {
|
||||||
|
JComboBox<Option> comboBox = new JComboBox<>();
|
||||||
|
|
||||||
|
for (Option option : options) {
|
||||||
|
comboBox.addItem(option);
|
||||||
|
}
|
||||||
|
|
||||||
|
JLabel label = new JLabel(name);
|
||||||
|
label.setLabelFor(comboBox);
|
||||||
|
|
||||||
|
JPanel parametersPanel = new JPanel();
|
||||||
|
GridBagLayout parametersPanelLayout = new GridBagLayout();
|
||||||
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
|
c.insets = new Insets(0, 6, 6, 6);
|
||||||
|
parametersPanel.setLayout(parametersPanelLayout);
|
||||||
|
|
||||||
|
DefaultListModel<Option> optionsList = new DefaultListModel<>();
|
||||||
|
JList<Option> optionsJList = new JList<>(optionsList);
|
||||||
|
|
||||||
|
for (Parameter parameter : parameters) {
|
||||||
|
JLabel pLabel = new JLabel(parameter.getName());
|
||||||
|
pLabel.setLabelFor(parameter.getComponent());
|
||||||
|
|
||||||
|
componentMap.put(name + "." + parameter.getName(), parameter.getComponent());
|
||||||
|
|
||||||
|
c.fill = GridBagConstraints.HORIZONTAL;
|
||||||
|
c.weightx = 1;
|
||||||
|
c.gridwidth = 1;
|
||||||
|
parametersPanelLayout.setConstraints(pLabel, c);
|
||||||
|
parametersPanel.add(pLabel);
|
||||||
|
|
||||||
|
c.gridwidth = GridBagConstraints.REMAINDER;
|
||||||
|
parametersPanelLayout.setConstraints(parameter.getComponent(), c);
|
||||||
|
parametersPanel.add(parameter.getComponent());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (multiple) {
|
||||||
|
c.gridwidth = 2;
|
||||||
|
JButton button = new JButton("Add");
|
||||||
|
|
||||||
|
button.addActionListener((e) -> {
|
||||||
|
Option option = (Option) comboBox.getSelectedItem();
|
||||||
|
assert option != null;
|
||||||
|
option = option.clone();
|
||||||
|
|
||||||
|
if (option.getName().equals("custom")) {
|
||||||
|
JTextField customField = (JTextField) componentMap.get(name + ".Custom");
|
||||||
|
MethodProvider.log(customField);
|
||||||
|
if (customField != null) {
|
||||||
|
option.setCustomName(customField.getText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Parameter parameter : parameters) {
|
||||||
|
Component component = parameter.getComponent();
|
||||||
|
String value = "";
|
||||||
|
if (component instanceof JTextField) {
|
||||||
|
value = ((JTextField) component).getText();
|
||||||
|
} else if (component instanceof JCheckBox) {
|
||||||
|
if (((JCheckBox) component).isSelected()) {
|
||||||
|
value = "true";
|
||||||
|
} else {
|
||||||
|
value = "false";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
option.setParameter(parameter.getName(), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
optionsList.addElement(option);
|
||||||
|
});
|
||||||
|
|
||||||
|
parametersPanelLayout.setConstraints(button, c);
|
||||||
|
parametersPanel.add(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||||
|
constraints.anchor = GridBagConstraints.NORTH;
|
||||||
|
constraints.gridwidth = 1;
|
||||||
|
|
||||||
|
layout.setConstraints(label, constraints);
|
||||||
|
getContentPane().add(label);
|
||||||
|
|
||||||
|
if (multiple) {
|
||||||
|
JPanel panel = new JPanel();
|
||||||
|
GridBagLayout panelLayout = new GridBagLayout();
|
||||||
|
GridBagConstraints panelConstraints = new GridBagConstraints();
|
||||||
|
panel.setLayout(panelLayout);
|
||||||
|
|
||||||
|
panelConstraints.weightx = 1;
|
||||||
|
panelConstraints.fill = GridBagConstraints.HORIZONTAL;
|
||||||
|
panelConstraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||||
|
|
||||||
|
panelLayout.setConstraints(comboBox, panelConstraints);
|
||||||
|
panel.add(comboBox);
|
||||||
|
|
||||||
|
panelConstraints.fill = GridBagConstraints.BOTH;
|
||||||
|
|
||||||
|
panelLayout.setConstraints(optionsJList, panelConstraints);
|
||||||
|
panel.add(optionsJList);
|
||||||
|
|
||||||
|
layout.setConstraints(panel, constraints);
|
||||||
|
getContentPane().add(panel);
|
||||||
|
} else {
|
||||||
|
layout.setConstraints(comboBox, constraints);
|
||||||
|
getContentPane().add(comboBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
constraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||||
|
layout.setConstraints(parametersPanel, constraints);
|
||||||
|
getContentPane().add(parametersPanel);
|
||||||
|
|
||||||
|
if (multiple) {
|
||||||
|
componentMap.put(name, optionsJList);
|
||||||
|
} else {
|
||||||
|
componentMap.put(name, comboBox);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isReady() {
|
||||||
|
return ready;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Option getOption(String name) {
|
||||||
|
return optionMap.get(name).get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.util.List<Option> getOptions(String name) {
|
||||||
|
return optionMap.get(name);
|
||||||
|
}
|
||||||
|
}
|
55
Util/src/io/reisub/dreambot/util/ui/Option.java
Normal file
55
Util/src/io/reisub/dreambot/util/ui/Option.java
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
package io.reisub.dreambot.util.ui;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class Option implements Cloneable {
|
||||||
|
private final String name, info;
|
||||||
|
private final Map<String, String> parameters;
|
||||||
|
|
||||||
|
private String customName = "";
|
||||||
|
|
||||||
|
public Option(String name) {
|
||||||
|
this(name, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Option(String name, String info) {
|
||||||
|
this.name = name;
|
||||||
|
this.info = info;
|
||||||
|
parameters = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
if (!customName.equals("")) {
|
||||||
|
return customName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.equals("")) {
|
||||||
|
return name;
|
||||||
|
} else {
|
||||||
|
return name + " (" + info + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomName(String customName) {
|
||||||
|
this.customName = customName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParameter(String key, String value) {
|
||||||
|
parameters.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Option clone() {
|
||||||
|
try {
|
||||||
|
return (Option) super.clone();
|
||||||
|
} catch (CloneNotSupportedException e) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
Util/src/io/reisub/dreambot/util/ui/Parameter.java
Normal file
29
Util/src/io/reisub/dreambot/util/ui/Parameter.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package io.reisub.dreambot.util.ui;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class Parameter {
|
||||||
|
private final String name;
|
||||||
|
private final Component component;
|
||||||
|
|
||||||
|
public Parameter(String name) {
|
||||||
|
JTextField textField = new JTextField(10);
|
||||||
|
|
||||||
|
this.name = name;
|
||||||
|
this.component = textField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Parameter(String name, Component component) {
|
||||||
|
this.name = name;
|
||||||
|
this.component = component;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Component getComponent() {
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user