Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Created by Mortenrb for KBot.info
- */
- package com.scripts;
- import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
- import com.kbot2.handlers.eventSystem.eventListeners.ServerMessageListener;
- import com.kbot2.scriptable.Script;
- import com.kbot2.scriptable.methods.data.Skills;
- import com.kbot2.scriptable.methods.input.Mouse;
- import com.kbot2.scriptable.methods.wrappers.GroundItem;
- import com.kbot2.scriptable.methods.wrappers.NPC;
- import com.kbot2.scriptable.methods.wrappers.Tile;
- import com.kbot2.scriptable.methods.data.Walking;
- import java.awt.*;
- public class ChickenKiller extends Script implements PaintListener, ServerMessageListener {
- private chickenframe FRAME;
- NPC C;
- GroundItem P;
- int[] chickens = new int[]{2313, 2314, 2315, 1017, 41};
- Tile[] RND = new Tile[] {new Tile(2673, 3420)};
- int PICKUP[];
- int DONE[];
- int SKILL = 2;
- private boolean _active = true;
- private boolean runnable = false;
- @Override
- public boolean active() {
- return _active;
- }
- @Override
- public boolean onStart() {
- log("Welcome to Mortenrb's Chicken Killer");
- FRAME = new chickenframe();
- FRAME.setVisible(true);
- return true;
- }
- public String getName() {
- return "Chicken Killer";
- }
- public String getVer() {
- return "v1,0";
- }
- public String getAuthor() {
- return "Mortenrb";
- }
- public String getDescription() {
- return "It kills chickens!\n\nYou have to start in a chicken farm or some\nplace close to chickens to make the script work.";
- }
- public void onServerMessage(String e) {
- if (e.contains("Someone else is")) {
- walking.randomizePath(RND, 3, 3);
- }
- if (e.contains("I'm already under")) {
- log("Fixing this soon, I think.");
- }
- }
- public int loop() {
- if(runnable) {
- if(skills.getLevel(SKILL) >= DONE[0]) {
- log("Level archeived.");
- _active = false;
- }
- if(!getMyPlayer().isInCombat() && !getMyPlayer().isMoving() && getMyPlayer().getAnimation() == -1) {
- P = groundItems.getClosestItem(10, PICKUP);
- if(P != null) {
- log("Picking up items.");
- P.doAction("Take");
- return random (300, 1200);
- }
- C = npcs.getClosest(10, chickens);
- if (C != null) {
- C.doAction("Attack");
- return random (300, 1200);
- }
- }
- return random (300, 1200);
- }
- return random (300, 1200);
- }
- public void onRepaint(Graphics g) {
- g.drawString("Script: " + getName() + " " + getVer(), 250, 370);
- g.drawString("Creator: " + getAuthor(), 250, 385);
- g.drawString("Current Level In Training Skill: " + skills.getLevel(SKILL), 250, 400);
- }
- public int[] extractIntegers(String text) { // Thanks to
- int[] ints = null;
- try {
- text = text.replaceAll(" ", "");
- String[] strInts = text.split(",");
- ints = new int[strInts.length];
- for (int a = 0; a < strInts.length; a++) {
- ints[a] = Integer.parseInt(strInts[a]);
- }
- } catch (Exception e) {
- System.out.print("extractIntegers(String) error: " + e);
- }
- return ints;
- }
- public class chickenframe extends javax.swing.JFrame {
- /** Creates new form chickenframe */
- public chickenframe() {
- initComponents();
- }
- /** This method is called from within the constructor to
- * initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is
- * always regenerated by the Form Editor.
- */
- @SuppressWarnings("unchecked")
- // <editor-fold defaultstate="collapsed" desc="Generated Code">
- private void initComponents() {
- buttonGroup1 = new javax.swing.ButtonGroup();
- jTextField1 = new javax.swing.JTextField();
- jLabel1 = new javax.swing.JLabel();
- jLabel2 = new javax.swing.JLabel();
- jLabel3 = new javax.swing.JLabel();
- jTextField2 = new javax.swing.JTextField();
- jLabel4 = new javax.swing.JLabel();
- jLabel5 = new javax.swing.JLabel();
- jRadioButton1 = new javax.swing.JRadioButton();
- jRadioButton2 = new javax.swing.JRadioButton();
- jRadioButton3 = new javax.swing.JRadioButton();
- jButton1 = new javax.swing.JButton();
- setTitle("Mortenrb's Chicken Killer");
- setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
- setMinimumSize(new java.awt.Dimension(295, 230));
- setResizable(false);
- jTextField1.setText("99");
- jLabel1.setText("Stop Training At Level:");
- jLabel2.setText("Train:");
- jLabel3.setText("Pick up item ids:");
- jTextField2.setText("0");
- jLabel4.setForeground(new java.awt.Color(204, 0, 0));
- jLabel4.setText("Made By Mortenrb");
- jLabel5.setForeground(new java.awt.Color(0, 0, 204));
- jLabel5.setText("Kosaki and KBot is hot");
- buttonGroup1.add(jRadioButton1);
- jRadioButton1.setSelected(true);
- jRadioButton1.setText("Strength");
- buttonGroup1.add(jRadioButton2);
- jRadioButton2.setText("Attack");
- buttonGroup1.add(jRadioButton3);
- jRadioButton3.setText("Defence");
- jButton1.setText("Start");
- jButton1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton1ActionPerformed(evt);
- }
- });
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel2)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jRadioButton1)
- .addComponent(jRadioButton2)
- .addComponent(jRadioButton3))
- .addContainerGap())
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(132, 132, 132))
- .addGroup(layout.createSequentialGroup()
- .addGap(10, 10, 10)
- .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap())
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel3)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE)
- .addGap(123, 123, 123))
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel4)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel5)
- .addContainerGap(11, Short.MAX_VALUE))))
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabel2)
- .addComponent(jRadioButton1))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jRadioButton2)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jRadioButton3)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel1)
- .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel3)
- .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel4)
- .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)))
- );
- java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
- setBounds((screenSize.width-236)/2, (screenSize.height-210)/2, 236, 210);
- }// </editor-fold>
- // Variables declaration - do not modify
- private javax.swing.ButtonGroup buttonGroup1;
- private javax.swing.JButton jButton1;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel2;
- private javax.swing.JLabel jLabel3;
- private javax.swing.JLabel jLabel4;
- private javax.swing.JLabel jLabel5;
- private javax.swing.JRadioButton jRadioButton1;
- private javax.swing.JRadioButton jRadioButton2;
- private javax.swing.JRadioButton jRadioButton3;
- private javax.swing.JTextField jTextField1;
- private javax.swing.JTextField jTextField2;
- // End of variables declaration
- }
- public void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
- runnable = true;
- DONE = extractIntegers(FRAME.jTextField1.getText());
- PICKUP = extractIntegers(FRAME.jTextField2.getText());
- if (FRAME.jRadioButton1.isSelected()) {
- SKILL = 2;
- mouse.moveMouse(542, 182, 10, 5);
- mouse.clickMouse(true);
- sleep(300, 600);
- mouse.moveMouse(678, 273, 10, 5);
- mouse.clickMouse(true);
- sleep(300, 600);
- mouse.moveMouse(640, 189, 10, 5);
- mouse.clickMouse(true);
- }
- if (FRAME.jRadioButton2.isSelected()) {
- SKILL = 0;
- mouse.moveMouse(542, 182, 10, 5);
- mouse.clickMouse(true);
- sleep(300, 600);
- mouse.moveMouse(611, 274, 10, 5);
- mouse.clickMouse(true);
- sleep(300, 600);
- mouse.moveMouse(640, 189, 10, 5);
- mouse.clickMouse(true);
- }
- if (FRAME.jRadioButton3.isSelected()) {
- SKILL = 1;
- mouse.moveMouse(542, 182, 10, 5);
- mouse.clickMouse(true);
- sleep(300, 600);
- mouse.moveMouse(686, 330, 10, 5);
- mouse.clickMouse(true);
- sleep(300, 600);
- mouse.moveMouse(640, 189, 10, 5);
- mouse.clickMouse(true);
- }
- }
- }
Add Comment
Please, Sign In to add comment