Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.tasks;
- import org.tribot.api.General;
- import org.tribot.api.Timing;
- import org.tribot.api.input.Mouse;
- import org.tribot.api2007.GrandExchange;
- import org.tribot.api2007.Inventory;
- import scripts.data.Conditions;
- import scripts.data.Vars;
- import scripts.tools.Bank;
- import scripts.tools.Interaction;
- import scripts.tools.Prices;
- import scripts.tools.Walk;
- public class Buying {
- public static boolean NeedToReplacePick() {
- if (Mining.CurrentPickaxe() == null || Vars.currentPickaxe == 0) {
- return true;
- }
- if ((Mining.CurrentPickaxe().getID() == Vars.TOOLS[0] || Mining.CurrentPickaxe().getID() == Vars.TOOLS[1])
- && Vars.MiningLevel >= Vars.REQ_STEEL_PICK) {
- return true;
- }
- if (Mining.CurrentPickaxe().getID() == Vars.TOOLS[2] && Vars.MiningLevel >= Vars.REQ_MITHRIL_PICK) {
- return true;
- }
- if (Mining.CurrentPickaxe().getID() == Vars.TOOLS[3] && Vars.MiningLevel >= Vars.REQ_ADDY_PICK) {
- return true;
- }
- if (Mining.CurrentPickaxe().getID() == Vars.TOOLS[4] && Vars.MiningLevel >= Vars.REQ_RUNE_PICK) {
- return true;
- }
- else {
- Vars.currentPickaxe = Mining.CurrentPickaxe().getID();
- return false;
- }
- }
- public static void UpgradeTools() {
- // if (Mining.CurrentPickaxe())
- if (NeedToReplacePick()) {
- System.out.println(Vars.accountName + " needs a new pick. Going to GE now...");
- int pickID = 10;
- String pickString = "undefined";
- if (Vars.MiningLevel < 6) {
- pickID = Vars.TOOLS[1];
- pickString = "Iron pickaxe";
- }
- if (Vars.MiningLevel > 6 && Vars.MiningLevel < 21) {
- pickID = Vars.TOOLS[2];
- pickString = "Steel pickaxe";
- }
- if (Vars.MiningLevel > 21 && Vars.MiningLevel < 31) {
- pickID = Vars.TOOLS[3];
- pickString = "Mithril pickaxe";
- }
- if (Vars.MiningLevel > 31 && Vars.MiningLevel < 41) {
- pickID = Vars.TOOLS[4];
- pickString = "Adamant pickaxe";
- }
- if (Vars.MiningLevel > 41) {
- pickID = Vars.TOOLS[5];
- pickString = "Rune pickaxe";
- }
- Walk.GrandExchange(120000);
- General.sleep(4000);
- int price = (int) (Prices.getGEPrice(pickID) * 1.25);
- if (Inventory.find(995).length < 1) {
- Bank.Withdraw(price, 2000, "Coins");
- }
- // This opens ge interface and sleeps just in case.
- Interaction.WithNPC(2148, 20, "Exchange Grand Exchange Clerk", 10000);
- Timing.waitCondition(Conditions.isGEInterfaceOpen, 20000);
- General.sleep(2000, 3000);
- // Buys a pickaxe
- GrandExchange.offer(pickString, price, 1, false);
- Timing.waitCondition(Conditions.GETransaction0, 120000);
- General.sleep(2000, 2500);
- // Equips pickaxe
- Mouse.click(General.random(450, 456), General.random(68, 73), 1);
- Timing.waitCondition(Conditions.gotPickAxe, 3000);
- GrandExchange.close(true);
- General.sleep(2000, 2500);
- Inventory.find(pickID)[0].click("Wield");
- General.sleep(400, 700);
- Bank.DepositExcept(2000, Vars.TOOLS);
- Vars.currentPickaxe = Mining.CurrentPickaxe().getID();
- System.out.println(Vars.accountName + " just bought a new pick");
- }
- }
- }
Add Comment
Please, Sign In to add comment