Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //paint
- import java.util.ArrayList;
- import java.awt.*;
- //GUI
- import java.awt.event.ActionEvent;
- import javax.swing.*;
- import com.jgoodies.forms.factories.*;
- import com.jgoodies.forms.layout.*;
- //script
- import org.powerbot.concurrent.Task;
- import org.powerbot.concurrent.strategy.Condition;
- import org.powerbot.concurrent.strategy.Strategy;
- import org.powerbot.game.api.ActiveScript;
- import org.powerbot.game.api.Manifest;
- import org.powerbot.game.api.methods.Game;
- 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.NPCs;
- import org.powerbot.game.api.methods.interactive.Players;
- import org.powerbot.game.api.methods.node.GroundItems;
- import org.powerbot.game.api.methods.tab.Inventory;
- import org.powerbot.game.api.util.Filter;
- import org.powerbot.game.api.util.Random;
- import org.powerbot.game.api.util.Time;
- import org.powerbot.game.api.util.Timer;
- import org.powerbot.game.api.wrappers.Area;
- import org.powerbot.game.api.wrappers.Tile;
- import org.powerbot.game.api.wrappers.interactive.NPC;
- import org.powerbot.game.api.wrappers.map.TilePath;
- import org.powerbot.game.api.wrappers.node.Item;
- import org.powerbot.game.api.wrappers.widget.WidgetChild;
- import org.powerbot.game.bot.event.listener.PaintListener;
- @Manifest(name = "TEST FISHER", description = "TEST THIS ONE", version = 0.1, authors = {"brandon"})
- public class TEST extends ActiveScript implements PaintListener {
- //PAINT VARRIABLES
- String status;
- String Location;
- public Timer TIME;
- public Timer ERROR_TIMES;
- long runtime;
- int runningFishCount = -1;
- int startCount = -1;
- int bankedfishCount = 0;
- int animation;
- int client_state;
- int fish = 0;
- int before;
- int after;
- int GAINED;
- int FISH = -1;
- private final Color color1 = new Color(255, 255, 255);
- private final Color color2 = new Color(0, 0, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 20);
- private final Font font2 = new Font("Arial", 0, 10);
- //paint variables
- //GUI
- SuperSkillerGUI GUI;
- //GUI
- //script
- private boolean run;
- private boolean bank = true;
- private boolean drop = false;
- private boolean fishing;
- private boolean fly;
- private boolean pickup;
- private boolean GP_priority = true;
- private boolean XP_priotiy = false;
- private final int fishies[] = {335,331,349};
- private final int fishA1 = 335;// trout
- private final int fishA2 = 331;//salmon
- private final int fishA3 = 349;//pike
- private final int pools[] = {328};
- private final int items[] = {314,313};
- private final int banks = 553;
- //barbarian outpost
- private boolean barb;
- private final Area lebank = new Area(new Tile(3091, 3488, 0) , new Tile(3097, 3498, 0));
- private final Area lefish = new Area(new Tile(3099, 3423, 0) , new Tile(3112, 3440, 0));
- public final Tile[] Bankpath = {
- new Tile(3105, 3431, 0), new Tile(3100, 3440, 0),
- new Tile(3097, 3450, 0), new Tile(3096, 3460, 0),
- new Tile(3098, 3470, 0), new Tile(3101, 3481, 0),
- new Tile(3093, 3491, 0)
- };
- private final TilePath pathToBank = new TilePath(Bankpath);
- public final Tile[] Fishpath = {
- new Tile(3093, 3491, 0) , new Tile(3101, 3481, 0),
- new Tile(3098, 3470, 0), new Tile(3096, 3460, 0),
- new Tile(3097, 3450, 0), new Tile(3100, 3440, 0),
- new Tile(3105, 3431, 0)
- };
- public final TilePath pathToFish = new TilePath(Fishpath);
- //script
- public void setup(){
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- final SuperSkillerGUI GUI = new SuperSkillerGUI();
- GUI.setVisible(true);
- }
- });
- provide(new Strategy(new Fish_1(), new Fish_1()));
- provide(new Strategy(new Fish_2(), new Fish_2()));
- provide(new Strategy(new Pick_up_1(), new Pick_up_1()));
- provide(new Strategy(new Pick_up_2(), new Pick_up_2()));
- provide(new Strategy(new Drop(),new Drop()));
- provide(new Strategy(new Walk_to_bank(), new Walk_to_bank()));
- provide(new Strategy(new Bank(), new Bank()));
- provide(new Strategy(new Walk_to_fish(), new Walk_to_fish()));
- provide(new Strategy(new Record_error(), new Record_error()));
- provide(new Strategy(new Anti_Ban(), new Anti_Ban()));
- }
- public class Fish_1 implements Task, Condition{
- public void run(){
- status = "fishing";
- if(lefish.contains(Players.getLocal().getLocation()))
- InteractFlyFishing(pools);
- }
- public boolean validate() {
- return fishing
- && GP_priority
- && pickup
- && fly
- && Players.getLocal().getAnimation() == -1
- && !Inventory.isFull()
- && GroundItems.getLoaded(fishA1) == null
- && GroundItems.getLoaded(fishA2) == null
- && GroundItems.getLoaded(fishA3) == null;
- }
- }
- public class Fish_2 implements Task, Condition{
- public void run(){
- status = "fishing";
- if(lefish.contains(Players.getLocal().getLocation()))
- InteractFlyFishing(pools);
- }
- public boolean validate(){
- return fishing
- && fly
- && pickup
- && XP_priotiy
- && -1 == Players.getLocal().getAnimation()
- && !Inventory.isFull();
- }
- }
- public class Pick_up_1 implements Task, Condition{
- public void run(){
- status = "picking up fish";
- before = Inventory.getCount(fishies);
- if(lefish.contains(Players.getLocal().getLocation())){
- PickUp(fishies);
- after = Inventory.getCount(fishies);
- Time.sleep(Random.nextInt(300, 500));
- if(after - before == 1){
- ++fish;
- }
- }
- }
- public boolean validate(){
- return pickup == true
- && fly == true
- && Players.getLocal().getAnimation() == -1
- && !Inventory.isFull()
- && GP_priority == true;
- }
- }
- public class Pick_up_2 implements Task, Condition{
- public void run(){
- status = "picking up fish";
- before = Inventory.getCount(fishies);
- if(lefish.contains(Players.getLocal().getLocation())){
- PickUp(fishies);
- after = Inventory.getCount(fishies);
- if(after - before == 1){
- ++fish;
- }
- }
- }
- public boolean validate(){
- return XP_priotiy
- && NPCs.getLoaded(pools) == null;
- }
- }
- public class Drop implements Task, Condition{
- public void run(){
- status = "droping";
- dropAllExcept(items);
- Time.sleep(Random.nextInt(300, 500));
- }
- public boolean validate(){
- return !bank
- && drop
- && !pickup
- && Players.getLocal().getAnimation() == -1
- && Inventory.isFull();
- }
- }
- public class Walk_to_bank implements Task, Condition{
- public void run(){
- status = "walking to bank";
- traverse(pathToBank);
- Time.sleep(Random.nextInt(100, 300));
- }
- public boolean validate(){
- return fly
- && fishing
- && Players.getLocal().getAnimation() == -1
- && Inventory.isFull()
- && bank;
- }
- }
- public class Bank implements Task, Condition{
- public void run(){
- status = "banking";
- NPC bank = NPCs.getNearest(new Filter<NPC>(){
- public boolean accept(NPC npc){
- return npc.getId() == banks;
- }
- });
- if( lebank.contains(Players.getLocal().getLocation())){
- status = "selecting bank";
- if (bank != null){
- if (bank.isOnScreen()){
- bank.interact("bank");
- Time.sleep(Random.nextInt(300, 500));
- status = "interacting";
- }}
- status = "storing";
- Time.sleep(Random.nextInt(100,150 ));
- depositAllExcept(items);
- Time.sleep(Random.nextInt(250,300));
- Widgets.get(11, 15).interact("Close");
- }
- }
- public boolean validate(){
- return bank
- && Inventory.isFull()
- && Players.getLocal().getAnimation() == -1;
- }
- }
- public class Walk_to_fish implements Task, Condition{
- public void run(){
- status = "walking to fish";
- if(!lefish.contains(Players.getLocal().getLocation()))
- {traverse(pathToFish);
- Time.sleep(Random.nextInt(400, 600));
- }
- }
- public boolean validate(){
- return !Inventory.isFull()
- && Players.getLocal().getAnimation() == -1;
- }
- }
- public class Record_error implements Task, Condition{
- public void run(){
- if(Game.getClientState() == 3){
- runtime = TIME.getElapsed();
- log.info("what was it doing ?"+status);
- log.info("how long did it run?"+ runtime);
- log.info("Start again?");
- stop();
- }else if (run == false){
- runtime = TIME.getElapsed();
- log.info("what was it doing ?"+status);
- log.info("how long did it run?"+ runtime);
- log.info("Start again?");
- stop();
- }
- }
- public boolean validate(){
- return true;
- }
- }
- public class Get_paint_info implements Task, Condition{
- public void run(){
- animation = Players.getLocal().getAnimation();
- client_state = Game.getClientState();
- }
- public boolean validate(){
- return true;
- }
- }
- public class Anti_Ban implements Task, Condition{
- public void run(){
- }
- public boolean validate(){
- return true;
- }
- }
- public void traverse(TilePath path) {
- if (Tabs.INVENTORY.isOpen()) {
- if (Players.getLocal().getSpeed() == 0) {
- for (int i=0; i<10 && (Players.getLocal().getSpeed() == 0); i++) {
- path.getNext().clickOnMap();
- Time.sleep(500);
- }
- if (Players.getLocal().getSpeed() == 0) { //used as a failsafe when mouse keeps trying to traverse but just clicks edge of minimap
- Mouse.click(Random.nextInt(627-30, 627 + 30), Random.nextInt(85-30, 85+30), true); // x:627 & y:85 = exact center of minimap
- }
- } else {
- path.traverse();
- }
- } else {
- Tabs.INVENTORY.open();
- }
- }
- public void depositAllExcept(int... item) {
- ArrayList<Integer> ids = new ArrayList<Integer>();
- int ninvCount = -1;
- int invCount = Inventory.getCount();
- for (int id : item) {
- ids.add(id);
- }
- for (int i = 0; i < 28; i++) {
- WidgetChild slot = Widgets.get(679, 0).getChild(i);
- int slotId = slot.getChildId();
- if (slot.validate() && Inventory.getCount(slotId) > 0) {
- if (!ids.contains(slotId)) {
- for (int tries = 0; tries < 5; tries++) {
- if (Inventory.getCount(slotId) > 1) {
- if (slot.interact("Deposit-All"));
- else
- tries = 5;
- } else {
- if (slot.interact("Deposit"));
- else
- tries = 5;
- }
- Time.sleep(625, 902);
- ninvCount = Inventory.getCount();
- if (invCount > ninvCount) {
- invCount = ninvCount;
- tries = 5;
- }
- }
- }
- }
- }
- }
- public void dropAllExcept(final int... nodrop) {
- for(Item item : Inventory.getItems(new Filter<Item>() {
- @Override
- public boolean accept(Item arg0) {
- for(int i : nodrop) {
- if(arg0.getId() == i)
- return false;
- }
- return true;
- }
- })) {
- item.getWidgetChild().interact("Drop");
- Time.sleep(150, 300);
- }
- }
- public void InteractFlyFishing(int... Spot){
- NPC pool = NPCs.getNearest(Spot);
- pool.interact("lure");
- Time.sleep(Random.nextInt(6000, 12000));
- }
- public void PickUp(int... item){
- Mouse.click(GroundItems.getNearest(item).getLocation().getCentralPoint(), true);
- Time.sleep(Random.nextInt(100, 150));
- }
- public void InteractBank(int... teller){
- NPC bank = NPCs.getNearest(teller);
- bank.interact("bank");
- }
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(22, 357, 468, 87);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(22, 357, 468, 87);
- g.setFont(font1);
- g.drawString("FISHER", 223, 378);
- g.setFont(font2);
- g.drawString("status" + status, 26, 395);
- g.drawString("client state" + client_state, 27, 414);
- g.drawString("time:" + TIME, 29, 434);
- g.drawString("fish cought:" + fish, 295, 393);
- }
- //END: Code generated using Enfilade's Easel
- public class SuperSkillerGUI extends JFrame{
- public SuperSkillerGUI() {
- initComponents();
- }
- private void initComponents() {
- script_name = new JTextField();
- version = new JTextField();
- start_button = new JButton();
- set_skill = new JComboBox<>();
- set_location_to_fish = new JComboBox<>();
- set_fishing_type = new JComboBox<>();
- pick_up_button = new JRadioButton();
- Max_GP = new JRadioButton();
- radioButton2 = new JRadioButton();
- info = new JTextField();
- bank_button = new JRadioButton();
- scrollPane1 = new JScrollPane();
- info_1 = new JTextPane();
- drop_button = new JRadioButton();
- Info_2 = new JTextField();
- //======== this ========
- Container contentPane = getContentPane();
- contentPane.setLayout(new FormLayout(
- "5*(default, $lcgap), 74dlu",
- "10*(default, $lgap), default"));
- //---- script_name ----
- script_name.setText("Super Skiller");
- contentPane.add(script_name, CC.xy(1, 1));
- //---- version ----
- version.setText("version: BETA");
- contentPane.add(version, CC.xy(5, 1));
- //---- start_button ----
- start_button.setText("RUN SCRIPT");
- contentPane.add(start_button, CC.xywh(9, 1, 3, 1));
- start_button.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- start_buttonActionPerformed(evt);
- }
- private void start_buttonActionPerformed(ActionEvent evt) {
- if("Fishing" == set_skill.getSelectedItem()){
- fishing = true;
- if("barbarian outpost" == set_location_to_fish.getSelectedItem()){
- barb = true;
- if("fly fishing" == set_fishing_type.getSelectedItem()){
- fly = true;
- }else{
- run = false;
- }
- }else{
- run = false;
- }
- }else{
- run = false;
- }
- }
- });
- //---- set_skill ----
- set_skill.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] {
- "skill to train",
- "Fishing"
- }));
- contentPane.add(set_skill, CC.xy(1, 5));
- //---- set_location ----
- set_location_to_fish.setModel(new DefaultComboBoxModel<>(new String[] {
- "location",
- "barbarian outpost"
- }));
- contentPane.add(set_location_to_fish, CC.xy(5, 5));
- //---- set_fishing_type ----
- set_fishing_type.setModel(new DefaultComboBoxModel<>(new String[] {
- "fishing method",
- "fly fishing"
- }));
- contentPane.add(set_fishing_type, CC.xy(9, 5));
- //---- pick_up_button ----
- pick_up_button.setText("pick up");
- contentPane.add(pick_up_button, CC.xy(1, 11));
- if(pick_up_button.isSelected()){
- pickup = true;
- }else{
- pickup = false;
- }
- //---- Max_GP ----
- Max_GP.setText("Maximize Profit");
- contentPane.add(Max_GP, CC.xy(5, 11));
- if(Max_GP.isSelected()){
- GP_priority = true;
- }else{
- GP_priority = false;
- }
- //---- radioButton2 ----
- radioButton2.setText("Maximize exp");
- contentPane.add(radioButton2, CC.xy(5, 13));
- if(radioButton2.isSelected()){
- XP_priotiy = true;
- }else{
- XP_priotiy = false;
- }
- //---- info ----
- info.setText("go here to thank me, i get paid per click so click away :)");
- contentPane.add(info, CC.xywh(5, 17, 7, 1));
- //---- bank_button ----
- bank_button.setText("bank");
- contentPane.add(bank_button, CC.xy(1, 19));
- if(bank_button.isSelected()){
- bank = true;
- }else{
- bank = false;
- }
- //======== scrollPane1 ========
- {
- //---- info_1 ----
- info_1.setText("http://c8e3c151.linkbucks.com");
- scrollPane1.setViewportView(info_1);
- }
- contentPane.add(scrollPane1, CC.xywh(5, 19, 7, 1));
- //---- drop_button ----
- drop_button.setText("drop");
- contentPane.add(drop_button, CC.xy(1, 21));
- if(drop_button.isSelected()){
- drop = true;
- }else{
- drop = false;
- }
- //---- Info_2 ----
- Info_2.setText("redirects you to google (must click \"skip add\" for it to count) thankyou");
- contentPane.add(Info_2, CC.xywh(5, 21, 7, 1));
- pack();
- setLocationRelativeTo(getOwner());
- }
- private JTextField script_name;
- private JTextField version;
- private JButton start_button;
- private JComboBox<String> set_skill;
- private JComboBox<String> set_location_to_fish;
- private JComboBox<String> set_fishing_type;
- private JRadioButton pick_up_button;
- private JRadioButton Max_GP;
- private JRadioButton radioButton2;
- private JTextField info;
- private JRadioButton bank_button;
- private JScrollPane scrollPane1;
- private JTextPane info_1;
- private JRadioButton drop_button;
- private JTextField Info_2;
- }
- }
Add Comment
Please, Sign In to add comment