Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Insets;
- import java.awt.LayoutManager;
- import java.awt.Point;
- import java.awt.event.ActionEvent;
- import javax.swing.JButton;
- import javax.swing.JComboBox;
- import javax.swing.JLabel;
- import javax.swing.JTextField;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.Game;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.wrappers.RSGroundItem;
- import org.rsbot.script.wrappers.RSTile;
- @ScriptManifest(authors = {"alluk"}, name = "aKilla", version = 0.26, description = "Kills Al-Kharid Warriors")
- public class aKilla extends Script implements PaintListener {
- RSTile[] bankToWarrior = {new RSTile(3276, 3172), new RSTile(3280, 3180), new RSTile(3286, 3181), new RSTile(3292, 3181), new RSTile(3292, 3170)};
- RSTile[] warriorToBank = {new RSTile(3292, 3181), new RSTile(3286, 3181), new RSTile(3280, 3180), new RSTile(3276, 3175), new RSTile(3271, 3166)};
- RSTile warriorTile = new RSTile(3292, 3170);
- RSTile bankTile = new RSTile(3269, 3168);
- RSGroundItem itegr;
- volatile RSGroundItem ite;
- int foodb = 0;
- int warrior = 18;
- int food;
- int[] items = { 1440, 199, 201, 203, 205, 207, 3049, 12174, 209, 14836,
- 211, 213, 3051, 215, 2485, 217, 219 };
- boolean inFight = false;
- boolean walkToBank = false;
- boolean walkToWarrior = false;
- public String status;
- int trainStatran;
- int startStatLvlran;
- int startXpran;
- int trainStatdef;
- int startStatLvldef;
- int startXpdef;
- int trainStatatt;
- int startStatLvlatt;
- int startXpatt;
- int trainStatstr;
- int startStatLvlstr;
- int startXpstr;
- int htrainStat;
- int hstartStatLvl;
- int hstartXp;
- long startTime = System.currentTimeMillis();
- boolean pickup = true;
- boolean eat = true;
- private gui gui;
- JLabel label_1;
- JLabel label_2;
- JComboBox combobox_1;
- JTextField textfield_1;
- JLabel label_3;
- JLabel label_4;
- JComboBox combobox_2;
- JLabel label_5;
- JComboBox combobox_3;
- JLabel label_6;
- JComboBox combobox_4;
- JButton button_1;
- public boolean start = false;
- public boolean paint = true;
- public String Style;
- public int loop() {
- try {
- if (start == true) {
- gui.setVisible(false);
- }
- if (gui.isVisible() == false) {
- if (textfield_1.getText().length() == 0) {
- if (eat == true) {
- log("You need to enter Food ID, if eating is true!");
- stopScript();
- }
- }
- if (textfield_1.getText().length() != 0) {
- try {
- food = Integer.parseInt(textfield_1.getText());
- }
- catch (NumberFormatException e) {
- log("Food ID = number!");
- stopScript();
- }
- }
- if (walkToWarrior == true) {
- if (!getMyPlayer().isMoving()) {
- status = "Walking to Warriors";
- walking.walkPathMM(bankToWarrior, 1, 1);
- walkToWarrior = false;
- }
- }
- if (walkToBank == true) {
- if (!getMyPlayer().isMoving()) {
- status = "Walking to bank";
- walking.walkPathMM(warriorToBank, 1, 1);
- walkToBank = false;
- }
- }
- if (getMyPlayer().isMoving()) {
- antiban();
- sleep(180, 220);
- }
- if (inFight == true){
- antiban();
- sleep(180, 220);
- }
- if (!walking.isRunEnabled() && (walking.getEnergy() > random(55, 95))) {
- walking.setRun(true);
- status = "Setting run";
- sleep(800, 1000);
- }
- else if (calc.distanceTo(warriorTile) < 15 ) {
- if (eat == true) {
- if (!inventory.contains(food)) {
- walkToBank = true;
- }
- if (combat.getLifePoints() < (skills.getRealLevel(3) * 10) / 2) {
- if (inventory.getItem(food).doAction("Eat")) {
- status = "Eating...";
- sleep(300, 600);
- }
- }
- }
- if (inventory.isFull() && eat == false) {
- walkToBank = true;
- }
- if (pickup == true) {
- itegr = groundItems.getNearest(items);
- if (itegr != null) {
- if (itegr != ite) {
- if (itegr.isOnScreen()) {
- ite = itegr;
- if (!inventory.isFull() && (ite != null) && getMyPlayer().getInteracting() == null) {
- if(ite.doAction("Take")){
- status = "Picking up item..";
- sleep(1800,2300);
- }
- }
- if (inventory.isFull() && (ite != null) && getMyPlayer().getInteracting() == null) {
- inventory.getItem(food).doAction("Eat");
- status = "Eating for space";
- sleep(1300, 1600);
- if (!inventory.isFull() && (ite != null)) {
- if(ite.doAction("Take")){
- status = "Picking up item..";
- sleep(1800,2300);
- }
- }
- }
- }
- else {
- ite = null;
- }
- }
- }
- else if (ite != null) {
- ite = null;
- }
- }
- if (getMyPlayer().getAnimation() != -1 && getMyPlayer().getInteracting() != null) {
- status = "Fighting...";
- inFight = true;
- }
- if (getMyPlayer().getAnimation() == -1 && getMyPlayer().getInteracting() == null) {
- inFight = false;
- }
- if (inFight == false) {
- attack();
- }
- }
- else if (calc.distanceTo(bankTile) < 5 ) {
- if (eat == true) {
- if (!inventory.contains(food)) {
- status = "No food, taking some...";
- useBank();
- }
- if (inventory.contains(food)) {
- walkToWarrior = true;
- }
- }
- if (eat == false) {
- if (inventory.getCount() != 0) {
- useBank();
- }
- if (inventory.getCount() == 0) {
- walkToWarrior = true;
- }
- }
- }
- }
- }
- catch (Exception e) {
- }
- return 0;
- }
- public int useBank() {
- try {
- if (!bank.isOpen()) {
- bank.open();
- sleep(700, 1400);
- }
- if (bank.isOpen()) {
- status = "Banking";
- sleep(500, 1200);
- if (inventory.getCount() != 0) {
- bank.depositAll();
- sleep(500, 700);
- }
- if (eat == false && inventory.getCount() == 0) {
- bank.close();
- }
- if (eat == true) {
- if (bank.getCount(food) == 0) {
- sleep(3000, 4000);
- bank.close();
- sleep(2000, 3000);
- foodb++;
- log("Out of food +1 time(s)");
- if (foodb > 5) {
- log("Out of food, more than 5 times. stopScript();");
- stopScript();
- }
- else {
- useBank();
- }
- }
- else {
- bank.withdraw(food, 0);
- sleep(1500, 2300);
- foodb = 0;
- }
- }
- }
- }
- catch (Exception e) {
- }
- return 1200;
- }
- public boolean onStart() {
- if(!game.isLoggedIn()) {
- log("Please log in before starting the script!");
- return false;
- }
- gui = new gui();
- gui.setVisible(true);
- mouse.setSpeed(random(4, 5));
- log("Starting aKilla");
- trainStatran = Skills.RANGE;
- startStatLvlran = skills.getCurrentLevel(trainStatran);
- startXpran = skills.getCurrentExp(trainStatran);
- trainStatatt = Skills.ATTACK;
- startStatLvlatt = skills.getCurrentLevel(trainStatatt);
- startXpatt = skills.getCurrentExp(trainStatatt);
- trainStatdef = Skills.DEFENSE;
- startStatLvldef = skills.getCurrentLevel(trainStatdef);
- startXpdef = skills.getCurrentExp(trainStatdef);
- trainStatstr = Skills.STRENGTH;
- startStatLvlstr = skills.getCurrentLevel(trainStatstr);
- startXpstr = skills.getCurrentExp(trainStatstr);
- htrainStat = Skills.CONSTITUTION;
- hstartStatLvl = skills.getCurrentLevel(Skills.CONSTITUTION);
- hstartXp = skills.getCurrentExp(Skills.CONSTITUTION);
- return true;
- }
- public void onRepaint(Graphics g) {
- if (game.isLoggedIn()) {
- if (start == true && paint == true) {
- Point m = mouse.getLocation();
- g.setColor(Color.green);
- g.drawRoundRect(m.x - 6, m.y, 14, 2, 5, 5);
- g.drawRoundRect(m.x, m.y - 6, 2, 14, 5, 5);
- g.setColor(Color.green);
- g.fillRoundRect(m.x - 6, m.y, 14, 2, 5, 5);
- g.fillRoundRect(m.x, m.y - 6, 2, 14, 5, 5);
- double millis = System.currentTimeMillis() - startTime;
- int hlevelChange = skills.getCurrentLevel(htrainStat) - hstartStatLvl;
- int hxpChange = skills.getCurrentExp(htrainStat) - hstartXp;
- int hclvl = skills.getCurrentLevel(htrainStat);
- int hxpPerHour = (int)((hxpChange / millis) * (1000 * 3600));
- int alevelChange = skills.getCurrentLevel(trainStatatt) - startStatLvlatt;
- int axpChange = skills.getCurrentExp(trainStatatt) - startXpatt;
- int aclvl = skills.getCurrentLevel(trainStatatt);
- int axpPerHour = (int)((axpChange / millis) * (1000 * 3600));
- int slevelChange = skills.getCurrentLevel(trainStatstr) - startStatLvlstr;
- int sxpChange = skills.getCurrentExp(trainStatstr) - startXpstr;
- int sclvl = skills.getCurrentLevel(trainStatstr);
- int sxpPerHour = (int)((sxpChange / millis) * (1000 * 3600));
- int dlevelChange = skills.getCurrentLevel(trainStatdef) - startStatLvldef;
- int dxpChange = skills.getCurrentExp(trainStatdef) - startXpdef;
- int dclvl = skills.getCurrentLevel(trainStatdef);
- int dxpPerHour = (int)((dxpChange / millis) * (1000 * 3600));
- int rlevelChange = skills.getCurrentLevel(trainStatran) - startStatLvlran;
- int rxpChange = skills.getCurrentExp(trainStatran) - startXpran;
- int rclvl = skills.getCurrentLevel(trainStatran);
- int rxpPerHour = (int)((rxpChange / millis) * (1000 * 3600));
- String time = formatTime((int)(millis/1000));
- g.setColor(new Color(0, 0, 0, 100));
- g.draw3DRect(5, 15, 210, 130, true);
- g.fill3DRect(5, 15, 210, 130, true);
- g.setColor(Color.red);
- g.setFont(new Font("zurich ex bt", Font.BOLD, 11));
- g.drawString("aKilla, by alluk", 8, 30);
- g.setFont(new Font("zurich ex bt", Font.PLAIN, 11));
- g.setColor(Color.LIGHT_GRAY);
- g.drawString("Version 0.26", 8, 40);
- g.setColor(Color.white);
- g.setFont(new Font("zurich ex bt", Font.BOLD, 11));
- g.drawString("Status: " + status, 8, 55);
- g.setColor(Color.orange);
- if(combobox_4.getSelectedItem().toString().contains("Attack")) {
- g.drawString("Attack lvl: " + aclvl + " (" + alevelChange + ")", 8, 70);
- g.drawString("Attack XP Gained: " + axpChange, 8, 80);
- g.drawString("Attack XP/H: " + axpPerHour, 8, 90);
- }
- if(combobox_4.getSelectedItem().toString().contains("Strength")) {
- g.drawString("Strength lvl: " + sclvl + " (" + slevelChange + ")", 8, 70);
- g.drawString("Strength XP Gained: " + sxpChange, 8, 80);
- g.drawString("Strength XP/H: " + sxpPerHour, 8, 90);
- }
- if(combobox_4.getSelectedItem().toString().contains("Defense")) {
- g.drawString("Defense lvl: " + dclvl + " (" + dlevelChange + ")", 8, 70);
- g.drawString("Defense XP Gained: " + dxpChange, 8, 80);
- g.drawString("Defense XP/H: " + dxpPerHour, 8, 90);
- }
- if(combobox_4.getSelectedItem().toString().contains("Ranged")) {
- g.drawString("Ranged lvl: " + rclvl + " (" + rlevelChange + ")", 8, 70);
- g.drawString("Ranged XP Gained: " + rxpChange, 8, 80);
- g.drawString("Ranged XP/H: " + rxpPerHour, 8, 90);
- }
- g.setColor(Color.pink);
- g.drawString("Hitpoints lvl: " + hclvl + " (" + hlevelChange + ")", 8, 105);
- g.drawString("Hitpoints XP Gained: " + hxpChange, 8, 115);
- g.drawString("Hitpoints XP/H: " + hxpPerHour, 8, 125);
- g.setColor(Color.white);
- g.drawString("Runtime: " + time, 8, 140);
- }
- }
- }
- String formatTime (int seconds) {
- return (((int)seconds / 3600 < 10 ? "0" : "") + (int)seconds / 3600 + ":" + ((int)seconds / 60 % 60 < 10 ? "0" : "") + (int)seconds / 60 % 60 + ":" + ((int)seconds % 60 < 10 ? "0" : "") + (int)seconds % 60);
- }
- public void antiban() {
- try {
- if (getMyPlayer().getInteracting() != null) {
- int rndm;
- rndm = random(1, 10000);
- if (rndm <= 10) {
- if (!(game.getCurrentTab() == Game.TAB_STATS)) {
- game.openTab(Game.TAB_STATS);
- sleep(300, 500);
- }
- mouse.move(642, 222, 28, 9);
- sleep(500, 700);
- }
- else if (rndm <= 40) {
- if (!(game.getCurrentTab() == Game.TAB_STATS)) {
- sleep(200, 300);
- game.openTab(Game.TAB_STATS);
- sleep(200, 300);
- }
- if (Style == "Attack") {
- mouse.move(580, 222, 28, 9);
- sleep(500, 700);
- }
- else if (Style == "Strength") {
- mouse.move(580, 248, 28, 9);
- sleep(500, 700);
- }
- else if (Style == "Defence") {
- mouse.move(580, 280, 28, 9);
- sleep(500, 700);
- }
- else if (Style == "Range") {
- mouse.move(580, 306, 28, 9);
- sleep(500, 700);
- }
- }
- else if (rndm <= 425) {
- mouse.moveRandomly(500);
- }
- else if (rndm <= 650) {
- camera.setAngle(random(1, 360));
- }
- else if (rndm <= 850) {
- mouse.setSpeed(random(4, 5));
- }
- else if (rndm <= 860) {
- if (!(game.getCurrentTab() == Game.TAB_STATS)) {
- sleep(200, 300);
- game.openTab(Game.TAB_STATS);
- sleep(200, 300);
- }
- mouse.move(580, 336, 27, 9);
- sleep(500, 700);
- }
- else if (rndm <= 880){
- mouse.moveOffScreen();
- }
- sleep(100, 200);
- }
- else {
- int rndm;
- rndm = random(1, 10000);
- if (rndm == 10) {
- if (!(game.getCurrentTab() == Game.TAB_STATS)) {
- game.openTab(Game.TAB_STATS);
- sleep(300, 500);
- }
- mouse.move(642, 222, 28, 9);
- sleep(500, 700);
- }
- else if (rndm <= 40) {
- if (!(game.getCurrentTab() == Game.TAB_STATS)) {
- sleep(200, 300);
- game.openTab(Game.TAB_STATS);
- sleep(200, 300);
- }
- if (Style == "Attack") {
- mouse.move(580, 222, 28, 9);
- sleep(500, 700);
- }
- else if (Style == "Strength") {
- mouse.move(580, 248, 28, 9);
- sleep(500, 700);
- }
- else if (Style == "Defence") {
- mouse.move(580, 280, 28, 9);
- sleep(500, 700);
- }
- else if (Style == "Range") {
- mouse.move(580, 306, 28, 9);
- sleep(500, 700);
- }
- }
- else if (rndm <= 425) {
- mouse.moveRandomly(500);
- }
- else if (rndm <= 650) {
- camera.setAngle(random(1, 360));
- }
- else if (rndm <= 850) {
- mouse.setSpeed(random(4, 5));
- }
- else if (rndm <= 950) {
- if (!(game.getCurrentTab() == Game.TAB_STATS)) {
- sleep(200, 300);
- game.openTab(Game.TAB_STATS);
- sleep(200, 300);
- }
- mouse.move(580, 336, 27, 9);
- sleep(500, 700);
- }
- else if (rndm <= 980){
- mouse.moveOffScreen();
- }
- sleep(100, 200);
- }
- }
- catch(Exception e) {
- }
- }
- public int attack() {
- try {
- if (!npcs.getNearest(warrior).isOnScreen()) {
- if(npcs.getNearest(warrior).getHPPercent() != 0) {
- if (!getMyPlayer().isMoving()) {
- if (walkToBank == false) {
- if (walkToWarrior == false){
- if(walking.walkTileMM(npcs.getNearest(warrior, 1, 1).getLocation())){
- status = ("Walking to nearest warrior");
- attack();
- }
- }
- }
- }
- }
- }
- else {
- if (npcs.getNearest(warrior).isOnScreen()) {
- if (npcs.getNearest(warrior).getHPPercent() != 0) {
- if (getMyPlayer().getInteracting() == null) {
- if (walkToBank == false) {
- if (walkToWarrior == false) {
- if (npcs.getNearest(warrior).doAction("Attack")) {
- status = "Attacking Warriors";
- sleep(1500, 2000);
- }
- }
- }
- }
- }
- }
- }
- }
- catch (Exception e) {
- }
- return 0;
- }
- public class gui extends javax.swing.JFrame {
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void initComponents() {
- aLayout customLayout = new aLayout();
- getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
- getContentPane().setLayout(customLayout);
- label_1 = new JLabel("aKilla - alluk");
- getContentPane().add(label_1);
- label_2 = new JLabel("Food ID:");
- getContentPane().add(label_2);
- textfield_1 = new JTextField("");
- getContentPane().add(textfield_1);
- label_3 = new JLabel("Pickup:");
- getContentPane().add(label_3);
- combobox_1 = new JComboBox();
- combobox_1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Yes", "No" }));
- getContentPane().add(combobox_1);
- label_4 = new JLabel("Eat food:");
- getContentPane().add(label_4);
- combobox_2 = new JComboBox();
- combobox_2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Yes", "No" }));
- getContentPane().add(combobox_2);
- label_5 = new JLabel("Paint:");
- getContentPane().add(label_5);
- combobox_3 = new JComboBox();
- combobox_3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Yes", "No" }));
- getContentPane().add(combobox_3);
- label_6 = new JLabel("Paint skill:");
- getContentPane().add(label_6);
- combobox_4 = new JComboBox();
- combobox_4.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Attack", "Strength", "Defense", "Ranged" }));
- getContentPane().add(combobox_4);
- button_1 = new JButton("Start!");
- getContentPane().add(button_1);
- button_1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- button_1actionPerformed(evt);
- }
- });
- setSize(getPreferredSize());
- }
- public void button_1actionPerformed(ActionEvent evt) {
- if(combobox_1.getSelectedItem().toString().contains("Yes")) {
- pickup = true;
- }
- if(combobox_1.getSelectedItem().toString().contains("No")) {
- pickup = false;
- }
- if(combobox_2.getSelectedItem().toString().contains("Yes")) {
- eat = true;
- }
- if(combobox_2.getSelectedItem().toString().contains("No")) {
- eat = false;
- }
- if(combobox_3.getSelectedItem().toString().contains("No")) {
- paint = false;
- }
- if(combobox_3.getSelectedItem().toString().contains("Yes")) {
- paint = true;
- }
- if(combobox_4.getSelectedItem().toString().contains("Attack")) {
- Style = "Attack";
- }
- if(combobox_4.getSelectedItem().toString().contains("Strength")) {
- Style = "Strength";
- }
- if(combobox_4.getSelectedItem().toString().contains("Defense")) {
- Style = "Defense";
- }
- if(combobox_4.getSelectedItem().toString().contains("Ranged")) {
- Style = "Range";
- }
- start = true;
- }
- @SuppressWarnings("deprecation")
- public void main(String args[]) {
- gui window = new gui();
- window.setTitle("aKilla");
- window.pack();
- window.show();
- }
- class aLayout implements LayoutManager {
- public aLayout() {
- }
- public void addLayoutComponent(String name, Component comp) {
- }
- public void removeLayoutComponent(Component comp) {
- }
- public Dimension preferredLayoutSize(Container parent) {
- Dimension dim = new Dimension(0, 0);
- Insets insets = parent.getInsets();
- dim.width = 110 + insets.left + insets.right;
- dim.height = 365 + insets.top + insets.bottom;
- return dim;
- }
- public Dimension minimumLayoutSize(Container parent) {
- Dimension dim = new Dimension(0, 0);
- return dim;
- }
- public void layoutContainer(Container parent) {
- Insets insets = parent.getInsets();
- Component c;
- c = parent.getComponent(0);
- if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+8,88,24);}
- c = parent.getComponent(1);
- if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+40,88,24);}
- c = parent.getComponent(2);
- if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+64,88,24);}
- c = parent.getComponent(3);
- if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+88,88,24);}
- c = parent.getComponent(4);
- if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+112,88,24);}
- c = parent.getComponent(5);
- if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+136,88,24);}
- c = parent.getComponent(6);
- if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+160,88,24);}
- c = parent.getComponent(7);
- if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+184,88,24);}
- c = parent.getComponent(8);
- if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+208,88,24);}
- c = parent.getComponent(9);
- if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+232,88,24);}
- c = parent.getComponent(10);
- if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+256,88,24);}
- c = parent.getComponent(11);
- if (c.isVisible()) {c.setBounds(insets.left+16,insets.top+288,72,24);}
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement