Created
February 19, 2016 03:24
-
-
Save KarimiM/a3e1fd7040d481990a91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.runique.misc; | |
import java.awt.Color; | |
import java.awt.Font; | |
import java.awt.Graphics; | |
import java.awt.Graphics2D; | |
import org.parabot.environment.api.interfaces.Paintable; | |
import org.parabot.environment.api.utils.Time; | |
import org.parabot.environment.api.utils.Timer; | |
import org.parabot.environment.scripts.Category; | |
import org.parabot.environment.scripts.Script; | |
import org.parabot.environment.scripts.ScriptManifest; | |
import org.parabot.environment.scripts.framework.LoopTask; | |
import org.rev317.min.api.methods.Bank; | |
import org.rev317.min.api.methods.Game; | |
import org.rev317.min.api.methods.Inventory; | |
import org.rev317.min.api.methods.Menu; | |
import org.rev317.min.api.methods.Npcs; | |
import org.rev317.min.api.wrappers.Npc; | |
import com.runique.framework.Location; | |
import com.runique.framework.RuniqueObject; | |
@ScriptManifest(author = "Empathy", category = Category.UTILITY, description = "Buys steel bars.", name = "EBarBuyer", servers = { "Runique" }, version = 1.0) | |
public class SteelBarBuyer extends Script implements LoopTask, Paintable { | |
int runes; | |
Timer time = new Timer(); | |
final Location chest = new Location(3211, 3437); | |
@SuppressWarnings("deprecation") | |
@Override | |
public int loop() { | |
Npc n = Npcs.getClosest(6970); | |
if (!Inventory.isEmpty()) { | |
RuniqueObject.interact(0, 4483, RuniqueObject.getObject(chest)); | |
Time.sleep(() -> Bank.isOpen(), 7000); | |
if (Bank.isOpen()) { | |
Menu.sendAction(315, 253575168, 62, 5386); | |
Time.sleep(() -> Inventory.isEmpty(), 5000); | |
Menu.sendAction(200, 0, 0, 5384); | |
} | |
} | |
if (n != null & Inventory.isEmpty() && Game.getOpenBackDialogId() == -1 && Game.getOpenInterfaceId() == -1) { | |
System.out.println("Running to Pikkupstix"); | |
n.interact(2); | |
Time.sleep(() -> Game.getOpenBackDialogId() != -1, 6000); | |
} | |
if (Game.getOpenBackDialogId() != -1) { | |
System.out.println("Opening shop."); | |
Menu.sendAction(315, 253575168, 360, 2462); | |
Time.sleep(() -> Game.getOpenInterfaceId() != -1, 3000); | |
} | |
if (Game.getOpenInterfaceId() != -1) { | |
Menu.sendAction(53, 2353, 11, 20703); | |
Time.sleep(() -> !Inventory.isEmpty(), 3000); | |
runes += 28; | |
} | |
return 250; | |
} | |
@Override | |
public void paint(Graphics g1) { | |
Graphics2D gr = (Graphics2D) g1; | |
gr.setColor(Color.WHITE); | |
gr.setFont(new Font("Verdana", 0, 12)); | |
gr.drawString("By: Empathy", 333, 120); | |
gr.drawString("Runtime: " + time.toString(), 333, 100); | |
gr.drawString("Runes: " + runes + " (" + time.getPerHour(runes) + "/hr)", 333, 80); | |
gr.drawRect(330, 6, 183, 130); | |
Graphics2D rect = (Graphics2D) g1; | |
rect.setColor(new Color(0, 0, 0, 120)); | |
rect.fillRect(330, 6, 183, 130); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment