diff --git a/.idea/artifacts/CShopper_jar.xml b/.idea/artifacts/CShopper_jar.xml
new file mode 100644
index 0000000..df375f2
--- /dev/null
+++ b/.idea/artifacts/CShopper_jar.xml
@@ -0,0 +1,9 @@
+
+
+ $USER_HOME$/DreamBot/Scripts
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 262b23c..e2ff482 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -6,6 +6,7 @@
+
diff --git a/CShopper/CShopper.iml b/CShopper/CShopper.iml
new file mode 100644
index 0000000..ac9e1f0
--- /dev/null
+++ b/CShopper/CShopper.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CShopper/src/io/reisub/dreambot/cshopper/CShopper.java b/CShopper/src/io/reisub/dreambot/cshopper/CShopper.java
new file mode 100644
index 0000000..2d73bd4
--- /dev/null
+++ b/CShopper/src/io/reisub/dreambot/cshopper/CShopper.java
@@ -0,0 +1,24 @@
+package io.reisub.dreambot.cshopper;
+
+import io.reisub.dreambot.util.Constants;
+import org.dreambot.api.script.Category;
+import org.dreambot.api.script.ScriptManifest;
+import org.dreambot.api.script.impl.TaskScript;
+
+@SuppressWarnings("unused")
+@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 TaskScript {
+ private static final Configuration configuration = new Configuration(
+ Constants.LUNDAIL,
+ new ItemWrapper(Constants.NATURE_RUNE, 6000),
+ new ItemWrapper(Constants.COSMIC_RUNE, -1)
+ );
+
+ public static Configuration getConfiguration() {
+ return configuration;
+ }
+ @Override
+ public void onStart() {
+
+ }
+}
diff --git a/CShopper/src/io/reisub/dreambot/cshopper/Configuration.java b/CShopper/src/io/reisub/dreambot/cshopper/Configuration.java
new file mode 100644
index 0000000..faa58fb
--- /dev/null
+++ b/CShopper/src/io/reisub/dreambot/cshopper/Configuration.java
@@ -0,0 +1,19 @@
+package io.reisub.dreambot.cshopper;
+
+public class Configuration {
+ private final String traderName;
+ private final ItemWrapper[] items;
+
+ public Configuration(String traderName, ItemWrapper... items) {
+ this.traderName = traderName;
+ this.items = items;
+ }
+
+ public String getTraderName() {
+ return traderName;
+ }
+
+ public ItemWrapper[] getItems() {
+ return items;
+ }
+}
diff --git a/CShopper/src/io/reisub/dreambot/cshopper/ItemWrapper.java b/CShopper/src/io/reisub/dreambot/cshopper/ItemWrapper.java
new file mode 100644
index 0000000..09cefa7
--- /dev/null
+++ b/CShopper/src/io/reisub/dreambot/cshopper/ItemWrapper.java
@@ -0,0 +1,28 @@
+package io.reisub.dreambot.cshopper;
+
+public class ItemWrapper {
+ private final String name;
+ private final int buyTotal, minimumInShop;
+
+ public ItemWrapper(String name, int buyTotal, int minimumInShop) {
+ this.name = name;
+ this.buyTotal = buyTotal;
+ this.minimumInShop = minimumInShop;
+ }
+
+ public ItemWrapper(String name, int buyTotal) {
+ this(name, buyTotal, 0);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getBuyTotal() {
+ return buyTotal;
+ }
+
+ public int getMinimumInShop() {
+ return minimumInShop;
+ }
+}
diff --git a/CShopper/src/io/reisub/dreambot/cshopper/tasks/Buy.java b/CShopper/src/io/reisub/dreambot/cshopper/tasks/Buy.java
new file mode 100644
index 0000000..6015a7a
--- /dev/null
+++ b/CShopper/src/io/reisub/dreambot/cshopper/tasks/Buy.java
@@ -0,0 +1,46 @@
+package io.reisub.dreambot.cshopper.tasks;
+
+import io.reisub.dreambot.cshopper.CShopper;
+import io.reisub.dreambot.cshopper.ItemWrapper;
+import org.dreambot.api.methods.container.impl.Inventory;
+import org.dreambot.api.methods.container.impl.Shop;
+import org.dreambot.api.script.TaskNode;
+
+public class Buy extends TaskNode {
+ @Override
+ public boolean accept() {
+ if (!Shop.isOpen()) return false;
+
+ for (ItemWrapper iw : CShopper.getConfiguration().getItems()) {
+ int shopCount = Shop.get(iw.getName()).getAmount();
+
+ int inventoryCount = 0;
+ if (Inventory.get(iw.getName()) != null) {
+ inventoryCount = Inventory.get(iw.getName()).getAmount();
+ }
+
+ if (shopCount > iw.getMinimumInShop() && inventoryCount < iw.getBuyTotal()) return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public int execute() {
+ for (ItemWrapper iw : CShopper.getConfiguration().getItems()) {
+ int shopCount = Shop.get(iw.getName()).getAmount();
+
+ int inventoryCount = 0;
+ if (Inventory.get(iw.getName()) != null) {
+ inventoryCount = Inventory.get(iw.getName()).getAmount();
+ }
+
+ if (shopCount > iw.getMinimumInShop() && inventoryCount < iw.getBuyTotal()) {
+ int toBuy = shopCount - iw.getMinimumInShop();
+ // TODO finish while testing at shop
+ }
+ }
+
+ return 0;
+ }
+}
diff --git a/CShopper/src/io/reisub/dreambot/cshopper/tasks/Hop.java b/CShopper/src/io/reisub/dreambot/cshopper/tasks/Hop.java
new file mode 100644
index 0000000..5f006fe
--- /dev/null
+++ b/CShopper/src/io/reisub/dreambot/cshopper/tasks/Hop.java
@@ -0,0 +1,59 @@
+package io.reisub.dreambot.cshopper.tasks;
+
+import io.reisub.dreambot.cshopper.CShopper;
+import io.reisub.dreambot.cshopper.ItemWrapper;
+import org.dreambot.api.methods.Calculations;
+import org.dreambot.api.methods.container.impl.Inventory;
+import org.dreambot.api.methods.container.impl.Shop;
+import org.dreambot.api.methods.world.World;
+import org.dreambot.api.methods.world.Worlds;
+import org.dreambot.api.methods.worldhopper.WorldHopper;
+import org.dreambot.api.script.TaskNode;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
+
+public class Hop extends TaskNode {
+ private final Queue worlds;
+
+ public Hop(boolean members) {
+ List worldsList = Worlds.all(world -> world.isMembers() == members && world.isNormal() && !world.isHighRisk() && !world.isPVP());
+
+ worlds = new LinkedList<>(worldsList);
+ }
+
+ public Hop() {
+ this(true);
+ }
+
+ @Override
+ public boolean accept() {
+ if (!Shop.isOpen()) return false;
+
+ for (ItemWrapper iw : CShopper.getConfiguration().getItems()) {
+ int shopCount = Shop.get(iw.getName()).getAmount();
+
+ int inventoryCount = 0;
+ if (Inventory.get(iw.getName()) != null) {
+ inventoryCount = Inventory.get(iw.getName()).getAmount();
+ }
+
+ if (shopCount > iw.getMinimumInShop() && inventoryCount < iw.getBuyTotal()) return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int execute() {
+ World world = worlds.poll();
+ worlds.add(world);
+
+ if (world != null) {
+ WorldHopper.hopWorld(world);
+
+ }
+ return Calculations.random(200, 400);
+ }
+}
diff --git a/CShopper/src/io/reisub/dreambot/cshopper/tasks/Open.java b/CShopper/src/io/reisub/dreambot/cshopper/tasks/Open.java
new file mode 100644
index 0000000..e7f71b6
--- /dev/null
+++ b/CShopper/src/io/reisub/dreambot/cshopper/tasks/Open.java
@@ -0,0 +1,29 @@
+package io.reisub.dreambot.cshopper.tasks;
+
+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.Shop;
+import org.dreambot.api.methods.interactive.NPCs;
+import org.dreambot.api.script.TaskNode;
+import org.dreambot.api.wrappers.interactive.NPC;
+
+public class Open extends TaskNode {
+ @Override
+ public boolean accept() {
+ return !Shop.isOpen();
+ }
+
+ @Override
+ public int execute() {
+ NPC trader = NPCs.closest(CShopper.getConfiguration().getTraderName());
+
+ if (trader == null) return 0;
+
+ trader.interact(Constants.TRADE);
+ MethodContext.sleepUntil(Shop::isOpen, Calculations.random(6000, 7000));
+
+ return Calculations.random(200, 400);
+ }
+}
diff --git a/Util/src/io/reisub/dreambot/util/Constants.java b/Util/src/io/reisub/dreambot/util/Constants.java
index 15d5ee7..7f44dff 100644
--- a/Util/src/io/reisub/dreambot/util/Constants.java
+++ b/Util/src/io/reisub/dreambot/util/Constants.java
@@ -49,6 +49,9 @@ public class Constants {
public static final String BRAZIER = "Brazier";
public static final String BURNING_BRAZIER = "Burning brazier";
public static final String MARK_OF_GRACE = "Mark of grace";
+ public static final String LUNDAIL = "Lundail";
+ public static final String COSMIC_RUNE = "Cosmic rune";
+ public static final String NATURE_RUNE = "Nature rune";
// Actions
public static final String USE = "Use";
@@ -61,6 +64,7 @@ public class Constants {
public static final String DRINK = "Drink";
public static final String LIGHT = "Light";
public static final String FIX = "Fix";
+ public static final String TRADE = "Trade";
// Messages
public static final String KITTEN_WANTS_ATTENTION_MSG = "Your kitten wants attention.";