Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package thieverWhipz;
- import java.awt.BasicStroke;
- import java.awt.Color;
- import java.awt.EventQueue;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Polygon;
- import java.awt.Toolkit;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.util.ArrayList;
- import javax.swing.DefaultComboBoxModel;
- import javax.swing.GroupLayout;
- import javax.swing.JButton;
- import javax.swing.JComboBox;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- import javax.swing.GroupLayout.Alignment;
- import javax.swing.LayoutStyle.ComponentPlacement;
- import javax.swing.border.EmptyBorder;
- import org.parabot.environment.api.interfaces.Paintable;
- import org.parabot.environment.api.utils.Time;
- import org.parabot.environment.scripts.Category;
- import org.parabot.environment.scripts.Script;
- import org.parabot.environment.scripts.ScriptManifest;
- import org.parabot.environment.scripts.framework.SleepCondition;
- import org.parabot.environment.scripts.framework.Strategy;
- import org.rev317.min.api.events.MessageEvent;
- import org.rev317.min.api.events.listeners.MessageListener;
- import org.rev317.min.api.methods.Inventory;
- import org.rev317.min.api.methods.Npcs;
- import org.rev317.min.api.methods.Players;
- import org.rev317.min.api.methods.SceneObjects;
- import org.rev317.min.api.methods.Skill;
- import org.rev317.min.api.wrappers.Npc;
- import org.rev317.min.api.wrappers.SceneObject;
- import org.rev317.min.api.wrappers.Tile;
- @ScriptManifest(author = "Whipz", category = Category.THIEVING, description = "Theives at skilling area", name = "Whipz Theiver", servers = { "PkHonor" }, version = 1.02)
- public class whipzThiever extends Script implements Paintable, MessageListener {
- public int animation = 832;
- //stalls
- public int bakerStall = 2561;
- public int furStall = 2563;
- public int silkStall = 2560;
- public int silverStall = 2565;
- public int spiceStall = 2564;
- public int gemStall = 2562;
- public int stealFrom;
- //coins
- public int coins;
- public SceneObject stallToInteract;
- //gui stuff
- thieverGUI gui;
- public String chosenStall;
- //Paint
- public int startXP, startLvl, currentLvl, startCoins, currentCoins, coinsMade;
- public long time;
- private final ArrayList<Strategy> strategies = new ArrayList<Strategy>();
- public boolean onExecute() {
- gui = new thieverGUI();
- gui.setVisible(true);
- strategies.add(new Steal());
- strategies.add(new AntiRandoms());
- provide(strategies);
- time = System.currentTimeMillis();
- startXP = Skill.THIEVING.getExperience();
- startLvl = Skill.THIEVING.getLevel();
- startCoins = Inventory.getCount(true, coins);
- return true;
- }
- public class Steal implements Strategy {
- public boolean activate() {
- for (SceneObject so : SceneObjects.getNearest(stealFrom)) {
- if (Players.getMyPlayer().getAnimation() == -1) {
- stallToInteract = so;
- return true;
- }
- }
- return false;
- }
- @Override
- public void execute() {
- if (stallToInteract != null) {
- if (Players.getMyPlayer().getAnimation() == -1) {
- stallToInteract.interact(1);
- Time.sleep(new SleepCondition() {
- @Override
- public boolean isValid() {
- return Players.getMyPlayer().getAnimation() != -1;
- }
- } ,3000);
- Time.sleep(500);
- }
- }
- Time.sleep(100,200);
- }
- }
- public void messageReceived(MessageEvent arg0) {
- }
- private final Color color1 = new Color(204, 0, 0);
- private final Color color2 = new Color(255, 0, 0);
- private final BasicStroke stroke1 = new BasicStroke(5);
- private final Font font1 = new Font("Tahoma", 1, 15);
- private final Font font2 = new Font("Tahoma", 1, 10);
- public void paint(Graphics arg0) {
- coinsMade = Inventory.getCount(true, coins) - startCoins;
- currentLvl = Skill.THIEVING.getLevel();
- long millis = System.currentTimeMillis() - time;
- final long hours = millis / (1000 * 60 * 60);
- millis -= hours * 1000 * 60 * 60;
- final long minutes = millis / (1000 * 60);
- millis -= minutes * 1000 * 60;
- final long seconds = millis / 1000;
- Graphics2D g = (Graphics2D) arg0;
- g.setColor(color1);
- g.setStroke(stroke1);
- g.drawRoundRect(547, 207, 186, 259, 16, 16);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Whipz AIO Thiever", 569, 231);
- g.setFont(font2);
- g.drawString("RunTime: " +hours+":"+minutes+":"+seconds, 556, 251);
- g.drawString("Current Lvl: " +currentLvl , 556, 271);
- g.drawString("Money Gained: "+coinsMade, 556, 291);
- }
- public class thieverGUI extends JFrame {
- private JPanel contentPane;
- /**
- * Launch the application.
- */
- public void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- thieverGUI frame = new thieverGUI();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the frame.
- */
- public thieverGUI() {
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(100, 100, 340, 152);
- contentPane = new JPanel();
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- setContentPane(contentPane);
- JLabel lblWhipzAioThiever = new JLabel("Whipz AIO Thiever");
- lblWhipzAioThiever.setForeground(Color.RED);
- lblWhipzAioThiever.setFont(new Font("Tahoma", Font.BOLD, 15));
- JLabel lblWhatWouldYou = new JLabel("What would you like to steal from?");
- lblWhatWouldYou.setForeground(Color.RED);
- lblWhatWouldYou.setFont(new Font("Tahoma", Font.BOLD, 11));
- JComboBox chosen = new JComboBox();
- chosen.setModel(new DefaultComboBoxModel(new String[] {"Bakery Stall", "Fur Stall", "Silk Stall", "Silver Stall", "Gem Stall"}));
- chosen.setForeground(Color.RED);
- chosen.setFont(new Font("Tahoma", Font.BOLD, 11));
- JButton startButton = new JButton("Start");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- chosenStall = chosen.getSelectedItem().toString();;
- if(chosenStall.equals("Bakery Stall")) {
- stealFrom = bakerStall;
- }
- if(chosenStall.equals("Fur Stall")) {
- stealFrom = furStall;
- }
- if(chosenStall.equals("Silk Stall")) {
- stealFrom = silkStall;
- }
- if(chosenStall.equals("Silver Stall")) {
- stealFrom = silverStall;
- }
- if(chosenStall.equals("Gem Stall")) {
- stealFrom = gemStall;
- }
- if(chosenStall.equals("Spice Stall")) {
- stealFrom = spiceStall;
- }
- dispose();
- }
- });
- GroupLayout gl_contentPane = new GroupLayout(contentPane);
- gl_contentPane.setHorizontalGroup(
- gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addContainerGap()
- .addComponent(lblWhatWouldYou)
- .addGap(18)
- .addComponent(chosen, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGap(88)
- .addComponent(lblWhipzAioThiever))
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGap(131)
- .addComponent(startButton)))
- .addContainerGap(7, Short.MAX_VALUE))
- );
- gl_contentPane.setVerticalGroup(
- gl_contentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(gl_contentPane.createSequentialGroup()
- .addGap(6)
- .addComponent(lblWhipzAioThiever)
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
- .addComponent(lblWhatWouldYou)
- .addComponent(chosen, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(ComponentPlacement.UNRELATED)
- .addComponent(startButton)
- .addContainerGap(42, Short.MAX_VALUE))
- );
- contentPane.setLayout(gl_contentPane);
- }
- }
- //Credits to Minimal
- public class AntiRandoms implements Strategy
- {
- private Npc antiRandom;
- private Area bobsIsland = new Area(new Tile(2511, 4765),
- new Tile(2511, 4790),
- new Tile(2542, 4790),
- new Tile(2542, 4765));
- private final int[] RANDOMS = { 410, 1091, 3117, 3022, 3351, 409 };
- private final int BOB = 1091;
- private final int SANDWICH_LADY = 3117;
- private final int OLD_MAN = 410;
- private final int PORTAL = 8987;
- public int randomCount;
- public final Runnable RUNNABLE = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.exclamation");
- public boolean activate()
- {
- for (Npc n : Npcs.getNearest(RANDOMS))
- {
- if (n.getInteractingCharacter().equals(Players.getMyPlayer()) && n.distanceTo() < 3)
- {
- antiRandom = n;
- return true;
- }
- }
- return false;
- }
- public void execute()
- {
- Time.sleep(1000);
- if (RUNNABLE != null)
- RUNNABLE.run();
- System.out.println("There is a random nearby!");
- if (antiRandom != null)
- {
- if (antiRandom.getDef().getId() == BOB && bobsIsland.contains(Players.getMyPlayer().getLocation()))
- {
- for (SceneObject portal : SceneObjects.getNearest(PORTAL))
- {
- if (portal != null && bobsIsland.contains(Players.getMyPlayer().getLocation()))
- {
- final SceneObject portalToInteract = portal;
- portal.interact(0);
- Time.sleep(new SleepCondition()
- {
- @Override
- public boolean isValid()
- {
- return portalToInteract.getLocation().distanceTo() == 1;
- }
- }, 7500);
- Time.sleep(1000);
- }
- else
- {
- break;
- }
- }
- if (!bobsIsland.contains(Players.getMyPlayer().getLocation()))
- {
- System.out.println("The Bob random has been completed");
- }
- }
- else if (antiRandom.getDef().getId() == SANDWICH_LADY || antiRandom.getDef().getId() == OLD_MAN)
- {
- String str;
- if (antiRandom.getDef().getId() == SANDWICH_LADY)
- str = "Sandwich Lady";
- else
- str = "Old man";
- antiRandom.interact(0);
- Time.sleep(1500);
- System.out.println("The " + str + " random has been completed.");
- }
- else
- {
- System.out.println("A suspicious genie random has been called on us.");
- System.out.println("The client was closed to protect your account.");
- System.exit(0);
- }
- }
- randomCount++;
- }
- public class Area {
- private Polygon p;
- /**
- * Initializes a PolygonArea with the tiles given
- *
- * @param tiles
- * tiles to use in the area
- */
- public Area(Tile... tiles) {
- this.p = new Polygon();
- for (int i = 0; i < tiles.length; i++) {
- p.addPoint(tiles[i].getX(), tiles[i].getY());
- }
- }
- /**
- * Checks if a tile is in the area
- *
- * @param tile
- * The tile to check
- * @return <b>true</b> if area does contain the tile, otherwise <b>false</b>
- */
- public boolean contains(Tile tile) {
- return this.contains(tile.getX(), tile.getY());
- }
- public boolean contains(int x, int y) {
- int i;
- int j;
- boolean result = false;
- for (i = 0, j = p.npoints - 1; i < p.npoints; j = i++) {
- if ((p.ypoints[i] > y - 1) != (p.ypoints[j] > y - 1)
- && (x <= (p.xpoints[j] - p.xpoints[i]) * (y - p.ypoints[i])
- / (p.ypoints[j] - p.ypoints[i]) + p.xpoints[i])) {
- result = !result;
- }
- }
- return result;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement