Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Insets;
- import java.awt.Rectangle;
- import org.powerbot.concurrent.Task;
- import org.powerbot.concurrent.strategy.Strategy;
- import org.powerbot.game.api.ActiveScript;
- import org.powerbot.game.api.Manifest;
- import org.powerbot.game.api.methods.Tabs;
- import org.powerbot.game.api.methods.Widgets;
- import org.powerbot.game.api.methods.input.Mouse;
- import org.powerbot.game.api.methods.interactive.Players;
- import org.powerbot.game.api.methods.tab.Inventory;
- import org.powerbot.game.api.methods.tab.Skills;
- import org.powerbot.game.api.util.Time;
- import org.powerbot.game.api.util.Timer;
- import org.powerbot.game.api.wrappers.widget.WidgetChild;
- import org.powerbot.game.bot.event.listener.PaintListener;
- import java.awt.*;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.DefaultComboBoxModel;
- import javax.swing.JButton;
- import javax.swing.JComboBox;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- @Manifest(authors = { "Syndicate" }, name = "SAlcher", description = "Alch Those Items", version = 1.0)
- public class SAlcher extends ActiveScript implements PaintListener{
- public long startTime = 0;
- public long millis = 0;
- public long hours= 0;
- public long minutes = 0;
- public long seconds = 0;
- private static int startXP;
- public String Status;
- protected void setup1() {
- Status = "Starting Up";
- startTime = System.currentTimeMillis();
- startXP = Skills.getExperience(Skills.MAGIC);
- }
- public class Alcher extends Strategy implements Task {
- @Override
- public boolean validate() {
- return Players.getLocal().getAnimation() == -1;
- }
- @Override
- public void run() {
- if(Tabs.getCurrent() != Tabs.MAGIC) {
- Tabs.MAGIC.open();
- Timer t = new Timer(2000);
- while(t.isRunning() && Tabs.getCurrent() !=Tabs.MAGIC){
- Time.sleep(50);
- }
- }else{
- WidgetChild Alch = Widgets.get(192,27);
- if(Alch !=null){
- Alch.click(true);
- Inventory.getItem(1733 , 1135 , 1123 , 230 , 1333 , 2358 , 1464 , 63 , 11070 , 892).getWidgetChild().interact("cast");
- Time.sleep(1500,2000);
- }
- }
- }
- }
- private int getPerHour (final long value) {
- return (int) (value * 3600000D / (System.currentTimeMillis() - startTime ));
- }
- private final Color color1 = new Color(0, 232, 255, 130);
- private final Color color2 = new Color(0, 0, 0);
- private final Color color3 = new Color(1, 1, 1);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Bitstream Charter", 1, 15);
- private final Font font2 = new Font("Bitstream Charter", 1, 13);
- private final Font font3 = new Font("Bitstream Charter", 1, 17);
- private final Font font4 = new Font("Bitstream Charter", 1, 12);
- private int xpGained;
- private String xpPH;
- public void onRepaint(Graphics g1) {
- setXpGained(Skills.getExperience(Skills.MAGIC - startXP));
- long millis = System.currentTimeMillis() - startTime;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRoundRect(3, 61, 185, 242, 16, 16);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRoundRect(3, 61, 185, 242, 16, 16);
- g.setFont(font1);
- g.setColor(color3);
- g.drawString("SAlcher", 54, 74);
- g.setFont(font2);
- g.drawString("RunTime:" + hours + ":" + minutes + ":" + seconds, 6, 99);
- g.drawString("Xp P/h:" + xpPH, 6, 147);
- g.drawString("Xp Gained:" + xpGained, 7, 197);
- g.setFont(font3);
- g.drawString("Made By Syndicate", 16, 301);
- g.setFont(font4);
- g.drawLine(Mouse.getLocation().x - 6, Mouse.getLocation().y,
- Mouse.getLocation().x + 6, Mouse.getLocation().y);
- g.drawLine(Mouse.getLocation
- ().x, Mouse.getLocation().y - 6,
- Mouse.getLocation().x, Mouse.getLocation().y + 6);
- class SAlcherGUI extends JFrame {
- public SAlcherGUI() {
- initComponents();
- }
- private void comboBox1ActionPerformed(ActionEvent e) {
- // TODO add your code here
- }
- private void button1ActionPerformed(ActionEvent e) {
- // TODO add your code here
- }
- private void initComponents() {
- //GEN-BEGIN:initComponents
- label1 = new JLabel();
- label2 = new JLabel();
- comboBox1 = new JComboBox<>();
- button1 = new JButton();
- //======== this ========
- Container contentPane = getContentPane();
- contentPane.setLayout(null);
- //---- label1 ----
- label1.setText("SAlcher GUI v1");
- label1.setFont(new Font("Bitstream Charter", Font.BOLD | Font.ITALIC, 26));
- contentPane.add(label1);
- label1.setBounds(85, 0, 180, 30);
- //---- label2 ----
- label2.setText("Select An Item To Alch");
- label2.setFont(new Font("Bitstream Charter", Font.BOLD | Font.ITALIC, 18));
- contentPane.add(label2);
- label2.setBounds(85, 60, 195, 30);
- //---- comboBox1 ----
- comboBox1.setModel(new DefaultComboBoxModel<>(new String[] {
- "Select an item ",
- "needles ",
- "rune scim ",
- "Greendhidebody ",
- "goldbars ",
- "vials",
- "Archery tickets ",
- "Maple longs u ",
- "gold braclets ",
- "rune arrows "
- }));
- comboBox1.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- comboBox1ActionPerformed(e);
- }
- });
- contentPane.add(comboBox1);
- comboBox1.setBounds(85, 135, 185, 30);
- //---- button1 ----
- button1.setText("Start");
- button1.setFont(new Font("Bitstream Charter", Font.BOLD | Font.ITALIC, 22));
- button1.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- button1ActionPerformed(e);
- }
- });
- contentPane.add(button1);
- button1.setBounds(120, 200, 100, 45);
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for(int i = 0; i < contentPane.getComponentCount(); i++) {
- Rectangle bounds = contentPane.getComponent(i).getBounds();
- preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
- preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
- }
- Insets insets = contentPane.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- contentPane.setMinimumSize(preferredSize);
- contentPane.setPreferredSize(preferredSize);
- }
- pack();
- setLocationRelativeTo(getOwner());
- //GEN-END:initComponents
- }
- //GEN-BEGIN:variables
- private JLabel label1;
- private JLabel label2;
- private JComboBox<String> comboBox1;
- private JButton button1;
- //GEN-END:variables
- }
- }
- @Override
- protected void setup() {
- provide(new Alcher());
- }
- public int getXpGained() {
- return xpGained;
- }
- public void setXpGained(int xpGained) {
- this.xpGained = xpGained;
- }
- }
Add Comment
Please, Sign In to add comment