Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.scripts;
- import java.awt.*;
- import java.awt.event.KeyListener;
- import java.awt.event.KeyEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
- import com.kbot2.handlers.eventSystem.eventListeners.ServerMessageListener;
- import com.kbot2.scriptable.Script;
- import com.kbot2.scriptable.methods.wrappers.NPC;
- import com.kbot2.scriptable.methods.wrappers.Player;
- import javax.swing.*;
- public class CapeXTaker extends Script implements PaintListener, ServerMessageListener {
- int status = 0;
- int CASHCHK = 0;
- int CASHCHK2 = 0;
- int CAPE = 0;
- int SEND = 0;
- int cape1 = 4379;
- int cape2 = 4359;
- int cape3 = 4399;
- int cape4 = 4319;
- int cape5 = 4339;
- private String charName;
- private boolean _active;
- public boolean active() {
- return true;
- }
- public void onServerMessage(String trade) {
- if (trade.contains("You cannot buy that item right now")) {
- CAPE++; } }
- @Override
- public boolean onStart() {
- charName = null;
- JFrame frame = new JFrame("iEssWalker");
- frame.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
- c.gridx = 0;
- c.gridy = 0;
- c.gridheight = 1;
- c.gridwidth = 1;
- JTextField textField = new JTextField();
- textField.setText("Character's name here");
- textField.addKeyListener(new KeyListener() {
- public void keyTyped(KeyEvent e){
- }
- public void keyPressed(KeyEvent e){
- }
- public void keyReleased(KeyEvent e){
- charName = ((JTextField) e.getSource()).getText();
- }
- });
- frame.add(textField, c);
- c.gridheight = 2;
- c.gridy = 0;
- c.gridx = 1;
- JButton button = new JButton("Start\nScript");
- button.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(charName == null) {
- JOptionPane.showMessageDialog(null, "You have to enter a Characters name");
- return;
- }
- Container c = ((JButton) e.getSource()).getParent();
- while(c.getParent() != null)
- c = c.getParent();
- c.setVisible(false);
- _active = true;
- }
- });
- frame.add(button, c);
- frame.pack();
- frame.setVisible(true);
- return true;
- }
- public int loop() {
- switch (status) {
- case 0://checks if we can start
- if(_active) {
- status = 1; }
- return random(300, 500);
- case 1:
- if (inventory.contains(cape1, cape2, cape3, cape4, cape5)) {
- status = 2; }
- if (!inventory.contains(cape1, cape2, cape3, cape4, cape5)) {
- status = 4; }
- return random(200, 300);
- case 2:
- CASHCHK = inventory.getCount(true, 995);
- if (!inventory.contains(cape1, cape2, cape3, cape4, cape5)) {
- status = 3; }
- if (interfaces.interfaceExists(335, 18)) {
- if (interfaces.getInterface(335, 18).getAbsoluteX() > 2.0) {
- inventory.atItem("Offer-All", cape1, cape2, cape3, cape4, cape5); } }
- if (inventory.contains(cape1, cape2, cape3, cape4, cape5)) {
- Player noob = null;
- for (Player player : players.getPlayers()) {
- if(player.getName().toLowerCase().contains(charName)){
- noob = player;
- break; } }
- if (noob != null) {
- if (walking.atTile(noob.getLocation(), "Trade with "+ noob.getName())) {
- sleep(2000, 3000);} } }
- return random(200, 300);
- case 3:
- CASHCHK2 = inventory.getCount(true, 995);
- if (CASHCHK < CASHCHK2) {
- CASHCHK = 0;
- CASHCHK2 = 0;
- status = 1; }
- if (interfaces.interfaceExists(335, 16)) {
- if (interfaces.getInterface(335, 18).getAbsoluteX() > 2.0) {
- interfaces.getInterface(335, 16).doAction("Accept");
- sleep(1400, 2000); } }
- if (interfaces.interfaceExists(334, 20)) {
- if (interfaces.getInterface(334, 20).getAbsoluteX() > 2.0) {
- interfaces.getInterface(334, 20).doAction("Accept");
- sleep(500, 800); } }
- if (!interfaces.interfaceExists(335, 16)) {
- status = 1; }
- return random(200, 300);
- case 4:
- NPC Larry = npcs.getClosest(10, 1780);
- if (!inventory.contains(cape1, cape2, cape3, cape4, cape5)) {
- Larry.doAction("Trade");
- sleep(800, 1200); }
- if (interfaces.interfaceExists(620, 7)) {
- status = 5; }
- return random(200, 300);
- case 5:
- int RAND = random(27, 99);
- if (SEND > 0) {
- sleep(800, 1200);
- sendText("" +RAND, true);
- SEND = 0; }
- if (CAPE > 4) {
- CAPE = 0; }
- if (inventory.contains(cape1, cape2, cape3, cape4, cape5)) {
- interfaces.getInterface(620, 7).doAction("Close");
- status = 1; }
- else if (interfaces.interfaceExists(620, 24)) {
- sleep(600, 800);
- if (SEND == 0) {
- interfaces.getInterface(620, 24).getChild(0).doAction("Buy X");
- SEND++; }
- if (SEND == 1) {
- interfaces.getInterface(620, 24).getChild(1).doAction("Buy X");
- SEND++; }
- if (SEND == 2) {
- interfaces.getInterface(620, 24).getChild(2).doAction("Buy X");
- SEND++; }
- if (SEND == 3) {
- interfaces.getInterface(620, 24).getChild(3).doAction("Buy X");
- SEND++;}
- if (SEND == 4) {
- interfaces.getInterface(620, 24).getChild(4).doAction("Buy X");
- SEND++;} }
- return random(200, 300);
- }
- return random(200, 300);
- }
- void clickMouse(int x, int y, int randx, int randy, boolean button) {
- mouse.moveMouse(x, y, randx, randy);
- sleep(100);
- mouse.clickMouse(button);
- }
- public String getName() {
- return "CapeXTaker";
- }
- public String getAuthor() {
- return "Ryan";
- }
- public String getDescription() {
- return "xfers through capes";
- }
- public void onRepaint(Graphics w) {
- }
- }
Add Comment
Please, Sign In to add comment