Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.event.*;
- import java.awt.*;
- import java.util.*;
- import java.io.*;
- import java.nio.channels.*;
- import java.net.*;
- import java.util.List;
- import java.util.logging.Level;
- import java.lang.reflect.Method;
- import javax.accessibility.*;
- import javax.swing.*;
- import org.rsbot.*;
- import org.rsbot.bot.Bot;
- import org.rsbot.script.*;
- import org.rsbot.script.wrappers.*;
- import org.rsbot.event.listeners.*;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.util.ScreenshotUtil;
- import javax.imageio.ImageIO;
- @ScriptManifest(authors = { "Conderoga" }, keywords = "Fishing", name = "C's Leaping Fisher", version = 1.00,description = "Fishes leaping fish and banks caviar.")
- /*UpdateLog:
- v1.00 - Initial Release
- */
- public class CLeap extends Script implements PaintListener, ServerMessageListener, MouseListener{
- //Paint stuff
- private int startLevelf;
- private int startLevela;
- private int startLevels;
- private int startExp;
- private int expGained;
- private int lvlsGainedf;
- private int lvlsGaineda;
- private int lvlsGaineds;
- private long startTime;
- private double startTimeDbl;
- private long ExpHr;
- private boolean showPaint = true;
- private boolean fancyPaint = true;
- private final Image img2 = getImage("http://i263.photobucket.com/albums/ii158/zpogo/Bar.png");
- private final Image img4 = getImage("http://i263.photobucket.com/albums/ii158/zpogo/EXPback-1copy.png");
- private Point p;
- //Script stuff
- private int [] equipAndCaviar = {11323,314,946,11326};
- private int [] equipAndSturg = {11323,314,946,11332};
- private int [] equipment = {11323,314,946};
- private int [] equipment2 = {11323,314};
- private RSTile [] toBank = {new RSTile(2503,3497),new RSTile(2499,3507),new RSTile(2501,3519),new RSTile(2506,3529),new RSTile(2506,3540),new RSTile(2508,3551),new RSTile(2516,3561),new RSTile(2520,3569),new RSTile(2531,3571),new RSTile(2536,3573)};
- private RSTile [] toFish;
- private int animId;
- private int spawnID;
- private String action;
- private String status;
- private int failSafe;
- private int amntLTrout;
- private int amntLSalmon;
- private int amntLSturgeon;
- private int amntCaviar;
- private int[] GEPRICES = new int [4];
- private int bankerID;
- private double [] columns= {563,605,647,689};
- private double [] rows = {213,249,285,321,357,393,429};
- private boolean caviarMade = false;
- //Other stuff
- private int safety = 0;
- private String version = "v1.00";
- CLeapGUI gui;
- private boolean guiWait = true;
- private boolean guiExit = true;
- public String type;
- private RSTile loc;
- public boolean onStart() {
- //Credits to Zombieknight for this:-----------------
- final int welcome = JOptionPane.showConfirmDialog(null,"Before using my script, would you like to thank me\nby clicking some adverts?","Welcome", JOptionPane.YES_NO_OPTION);
- if (welcome == 0) {
- final String message = "<html>Thank you for your support!<br /></html>";
- JOptionPane.showMessageDialog(null, message);
- openURL("http://adf.ly/AgSn");
- }
- //=------------------------------------------------------*/
- gui = new CLeapGUI();
- gui.setVisible(true);
- while(guiWait)
- {
- sleep(100);
- }
- startTime = System.currentTimeMillis();
- startTimeDbl = System.currentTimeMillis();
- return !guiExit;
- }
- public boolean checkAnim()
- {
- for(int i = 0; i<4;i++){
- if(getMyPlayer().getAnimation()==animId||getMyPlayer().getAnimation()==animId-1||getMyPlayer().getAnimation()==animId+1)
- { status = "Fishing.";
- failSafe=0;
- return true;
- }
- sleep(300);
- }
- failSafe++;
- status = "Not fishing.";
- return false;
- }
- public void fish()
- {
- RSNPC test = npcs.getNearest(spawnID);
- if(test!=null)
- {
- RSTile spawn = test.getLocation();
- if(calc.tileOnScreen(spawn))
- {
- status = "Clicking Spawn.";
- mouse.move(calc.tileToScreen(spawn),3,3);
- menu.doAction(action);
- }
- sleep(random(600,800));
- while(players.getMyPlayer().isMoving())
- {
- status = "Moving to Spawn.";
- sleep(random(100,200));
- }
- if(!checkAnim())
- {status = "Didn't click spawn.";
- failSafe++;
- }
- }
- else
- failSafe++;
- }
- public void setUp()
- {
- toFish = walking.reversePath(toBank);
- animId=623;
- spawnID = 2722;
- action = "Use-rod Fishing spot";
- amntLTrout = 0;
- amntLSalmon = 0;
- amntLSturgeon = 0;
- amntCaviar = 0;
- }
- public void serverMessageRecieved(final ServerMessageEvent a){
- final String serverString = a.getMessage();
- if(serverString.toLowerCase().contains("you catch a leaping trout"))
- amntLTrout++;
- else if(serverString.toLowerCase().contains("you catch a leaping salmon"))
- amntLSalmon++;
- else if(serverString.toLowerCase().contains("you catch a leaping sturgeon"))
- amntLSturgeon++;
- else if(serverString.toLowerCase().contains("caviar"))
- amntCaviar++;
- }
- public void bank(){
- mouse.setSpeed(random(7,8));
- boolean tryAgain = true;
- while(inventory.isFull()){
- tryAgain = true;
- while(tryAgain) {
- status = "Opening bank.";
- RSObject [] test = objects.getAllAt(new RSTile(2537,3573));
- RSObject bankBox = null;
- for(int i = 0; i<test.length;i++)
- if(test[i].getID()==20228)
- bankBox = test[i];
- RSModel m = bankBox.getModel();
- Point p = m.getPoint();
- mouse.move(p,1,1);
- if(menu.doAction("Deposit Bank deposit box"))
- tryAgain = false;
- }
- status = "Depositing.";
- sleep(random(3000,4000));
- if(type.equals("Bank Fish"))
- bank.depositAllExcept(equipment2);
- else
- bank.depositAllExcept(equipment);
- sleep(random(600,800));
- mouse.move(random(427,440),random(36,47),0,0);
- sleep(random(300,400));
- mouse.click(true);
- sleep(random(1000,2000));
- }
- }
- public void door()
- {
- if(calc.tileToScreen(new RSTile(2521,3571)).x!=-1)
- {
- RSObject door = getDoor();
- while(isDoorClosed()){
- status = "Opening door.";
- walking.walkTileMM(new RSTile(2521,3571),1,1);
- RSModel m = door.getModel();
- Point temp = m.getPoint();
- mouse.move(temp,1,1);
- if(menu.doAction("Open Barbarian Door"))
- status = "Door opened.";
- sleep(random(600,800));
- }
- }
- }
- public boolean isDoorClosed()
- {
- RSObject [] test = objects.getAllAt(new RSTile(2521,3571));
- for(int i = 0; i<test.length;i++)
- {
- if(test[i].getID()==20195){
- return true;
- }
- }
- return false;
- }
- public RSObject getDoor(){
- RSObject [] test = objects.getAllAt(new RSTile(2521,3571));
- RSObject door = null;
- for(int i = 0; i<test.length;i++)
- {
- if(test[i].getID()==20195){
- door = test[i];
- }
- }
- return door;
- }
- public void walkToBank()
- {
- status = "Walking to bank.";
- camera.setPitch(true);
- while(!atBank())
- {
- if(walking.getEnergy()> 40)
- walking.setRun(true);
- status = "Walking to bank..";
- door();
- walkPath(toBank);
- sleep(random(1500,2000));
- }
- }
- public void walkToFish()
- {
- status = "Walking to fish.";
- camera.setPitch(true);
- while(!atFish())
- {
- if(walking.getEnergy()> 40)
- walking.setRun(true);
- status = "Walking to fish..";
- door();
- walkPath(toFish);
- sleep(random(1500,2000));
- }
- }
- public boolean atBank(){
- return players.getMyPlayer().getLocation().getX()<2537&&players.getMyPlayer().getLocation().getX()>2533&&players.getMyPlayer().getLocation().getY()<3575&&players.getMyPlayer().getLocation().getY()>3571;
- }
- public boolean atFish(){
- return players.getMyPlayer().getLocation().getX()<2507&&players.getMyPlayer().getLocation().getY()<3519;
- }
- public int getGEValue(String name, int id){
- try{
- String [] temp = name.split(" ");
- String newName = "";
- for(int i = 0; i<temp.length; i++)
- if(i==temp.length-1)
- newName+=temp[i];
- else
- newName+="_"+temp[i];
- URL url = new URL("http://services.runescape.com/m=itemdb_rs/"+newName+"/viewitem.ws?obj="+id);
- InputStream is = url.openStream();
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- String line;
- String num = "";
- while((line=br.readLine())!=null){
- if(line.contains("Current guide price:"))
- num = line;
- }
- System.out.println(num);
- if(num.length()<29)
- return -1;
- else{
- num = num.substring(28);
- num = num.replaceAll(",", "");
- return Integer.parseInt(num);
- }
- }catch(Exception e){
- return -1;
- }
- }
- public void walkPath(RSTile [] path)
- {
- if(playerIsNear(path[path.length-2]))
- walking.walkTileMM(path[path.length-1],1,1);
- else{
- int temp = 0;
- boolean nearSomething = false;
- for(int i = 0; i<path.length;i++)
- {
- if(playerIsNear(path[i]))
- {
- nearSomething = true;
- temp = i+1;
- antiBan(random(1,200));
- for(int j = i; j<path.length; j++)
- {
- if(calc.tileToMinimap(path[j]).x==-1)
- {
- temp=j-1;
- break;
- }
- if(j==path.length-1&&calc.tileToMinimap(path[j]).x!=-1)
- {
- temp=j;
- break;
- }
- }
- door();
- walking.walkTileMM(path[temp],1,1);
- }
- }
- if(!nearSomething){
- door();
- walking.walkTileMM(walking.nextTile(path),1,1);
- }
- }
- }
- public boolean playerIsNear(RSTile tile)
- {
- return (Math.abs(getMyPlayer().getLocation().getX()-tile.getX())<6&&Math.abs(getMyPlayer().getLocation().getY()-tile.getY())<6);
- }
- public int loop() {
- try{
- if(safety<1)
- {
- setUp();
- GEPRICES[0]=getGEValue("Leaping trout",11328);
- GEPRICES[0]=getGEValue("Leaping salmon",11330);
- GEPRICES[0]=getGEValue("Leaping sturgeon",11332);
- GEPRICES[3]=getGEValue("Caviar",11326);
- camera.setPitch(true);
- safety=1;
- }
- if(atBank()&&inventory.isFull()){
- bank();
- sleep(random(600,800));
- walkToFish();
- }
- antiBan(random(1,50));
- boolean full = inventory.isFull();
- if(!full&&!checkAnim()&&!caviarMade&&atFish())
- fish();
- if(!inventory.contains(equipment[1]))
- {
- failSafe++;
- }
- if(failSafe>5)
- {
- camera.setPitch(false);
- int angle = camera.getAngle();
- if(angle<259)
- camera.setAngle(camera.getAngle()+random(80,100));
- else
- camera.setAngle(random(0,10));
- fish();
- if(!status.equals("Fishing."))
- {
- if(failSafe>15)
- walking.walkTo(new RSTile(2500,3515));
- while(players.getMyPlayer().isMoving())
- sleep(random(100,200));
- fish();
- if(failSafe>25)
- {
- if(!inventory.contains(equipment[1]))
- {
- log("Out of feathers, stopping script.");
- game.logout(true);
- stopScript();
- }
- }
- }
- else
- failSafe = 0;
- }
- if(caviarMade)
- {
- walkToBank();
- caviarMade=false;
- }
- if(atBank()&&full)
- {
- bank();
- sleep(random(600,800));
- walkToFish();
- }
- if(!atBank()&&!atFish()&&full&&!type.equals("PowerFish"))
- {
- walkToBank();
- }
- if(inventory.isFull()){
- if(caviarMade)
- walkToBank();
- else if(type.equals("PowerFish"))
- dropAll(equipment2);
- else if(type.equals("Bank Caviar")){
- if((!inventory.contains(11330)&&!inventory.contains(11328))||dropAll(equipAndSturg)){
- if((!inventory.contains(11330)&&!inventory.contains(11328))){
- mouse.move((int)columns[random(0,3)]+random(10,20),(int)rows[random(1,5)]+random(10,20),3,3);
- sleep(random(300,800));
- menu.doAction("Drop");
- sleep(random(300,800));
- }
- makeCaviar();
- }
- }
- else if(type.equals("Bank Fish"))
- {
- walkToBank();
- }
- }
- }
- catch (Exception e){}
- return random(300,500);
- }
- public void makeCaviar(){
- status = "Making caviar.";
- RSItem knife = null;
- RSItem sturgeon = null;
- RSItem [] inv = inventory.getItems();
- for(int i = 0; i < inv.length;i++){
- if(inv[i].getID()==946&&knife==null)
- knife = inv[i];
- if(inv[i].getID()==11332&&sturgeon==null)
- sturgeon = inv[i];
- if(knife!=null&&sturgeon!=null)
- break;
- }
- inventory.useItem(knife,sturgeon);
- sleep(random(1000,1500));
- mouse.move(random(208,308),random(393,455),0,0);
- mouse.click(true);
- sleep(random(600,800));
- animId = 6702;
- while(checkAnim()){
- sleep(random(100,200));
- antiBan(random(1,300));
- }
- caviarMade = inventory.contains(11326);
- animId= 623;
- }
- public boolean dropAll(int [] ids)
- {
- status = "Dropping.";
- mouse.setSpeed(random(6,8));
- if(ids.length==4){
- int count = 0;
- RSItem [] inv = inventory.getItems();
- for(int i =0; i<inv.length;i++)
- if(inv[i].getID()!=ids[0]&&inv[i].getID()!=ids[1]&&inv[i].getID()!=ids[2]&&inv[i].getID()!=ids[3])
- count++;
- RSItem [] toDrop = new RSItem [count-28];
- count = 0;
- for(int i =0; i<inv.length;i++){
- if(count==toDrop.length)
- break;
- if(inv[i].getID()!=ids[0]&&inv[i].getID()!=ids[1]&&inv[i].getID()!=ids[2]&&inv[i].getID()!=ids[3])
- {toDrop[count] = inv[i];
- count++;
- }
- }
- int [] dropOrder = new int[toDrop.length];
- int index = 0;
- for(int j = 0; j<columns.length;j++)
- for(int i =0; i<toDrop.length;i++)
- {
- if(toDrop[i].getComponent().getLocation().getX()==columns[j])
- {
- dropOrder[index]=i;
- index++;
- }
- }
- for(int i =0; i<toDrop.length;i++)
- {
- if(!toDrop[dropOrder[i]].doAction("Drop"))
- {status = "Attempting to Destroy";
- if(toDrop[dropOrder[i]].doAction("Destroy")){
- sleep(random(1000,1500));
- mouse.move(random(304,338),random(380,392),0,0);
- sleep(random(600,800));
- mouse.click(true);
- sleep(random(600,800));
- }
- }
- }
- if(toDrop.length==1)
- return true;
- if(toDrop.length>1)
- fish();
- }
- else if(ids.length==2){
- int count = 0;
- RSItem [] inv = inventory.getItems();
- for(int i =0; i<inv.length;i++)
- if(inv[i].getID()!=ids[0]&&inv[i].getID()!=ids[1])
- count++;
- RSItem [] toDrop = new RSItem [(count/2)-1];
- count = 0;
- for(int i =0; i<inv.length;i++){
- if(count==toDrop.length)
- break;
- if(inv[i].getID()!=ids[0]&&inv[i].getID()!=ids[1])
- {toDrop[count] = inv[i];
- count++;
- }
- }
- int [] dropOrder = new int[toDrop.length];
- int index = 0;
- for(int j = 0; j<columns.length;j++)
- for(int i =0; i<toDrop.length;i++)
- {
- if(toDrop[i].getComponent().getLocation().getX()==columns[j])
- {
- dropOrder[index]=i;
- index++;
- }
- }
- for(int i =0; i<toDrop.length;i++)
- {
- if(!toDrop[dropOrder[i]].doAction("Drop"))
- {status = "Attempting to Destroy";
- if(toDrop[dropOrder[i]].doAction("Destroy")){
- sleep(random(1000,1500));
- mouse.move(random(304,338),random(380,392),0,0);
- sleep(random(600,800));
- mouse.click(true);
- sleep(random(600,800));
- }}
- }
- if(toDrop.length>1)
- fish();
- }
- return false;
- }
- public void antiBan(int rand){
- status += "(AB)";
- mouse.setSpeed(random(7,8));
- if(rand==1)
- if(random(1, 4) == 2)
- mouse.moveRandomly(900,1200);
- if(rand==2)
- if(random(1, 4) == 2)
- mouse.moveRandomly(400,800);
- if(rand==3)
- if(random(1, 4) == 2)
- mouse.moveRandomly(200,700);
- if(rand==4) //THIS CHECKS THE FISHING STAT
- if(random(1, 12) == 2)
- {
- game.openTab(game.TAB_STATS);
- sleep(random(600,800));
- mouse.move(random(681, 690), random(269, 291),0,0);
- sleep(random(900,1000));
- game.openTab(game.TAB_INVENTORY);
- }
- if(rand==5) //THIS CLICKS THE XP BUTTON UNDER THE COMPASS
- if(random(1, 12) == 2)
- {
- mouse.move(random(527, 540), random(58, 65),0,0);
- sleep(random(800,1000));
- mouse.click(true);
- mouse.moveRandomly(20,50);
- sleep(random(3000,4000));
- }
- if(rand==6) //THIS CHECKS CURRENT GOAL
- if(random(1, 12) == 2)
- {
- game.openTab(8);
- sleep(random(300,1000));
- mouse.move(random(604, 630), random(394, 399),0,0);
- sleep(random(3000,4000));
- }
- if(rand==7) //RANDOM SPIN
- if(random(1, 3) == 2)
- {int r = random(1,2);
- camera.setAngle(random(1,359));
- if(r!=1)
- camera.setPitch(random(1,99));}
- if(rand==8) //THIS CHECKS A RANDOM TAB
- if(random(1, 4) == 2)
- {
- int[] tabs = {0,2,3,5,6,7,9,10,11,12,13,14,15};
- game.openTab(tabs[random(0,tabs.length-1)]);
- mouse.moveRandomly(150,200);
- sleep(random(1600,1800));
- sleep(random(900,1000));
- }
- if(rand==9)
- if(random(1,10)==2)
- mouse.moveOffScreen();
- status=status.substring(0,status.indexOf('('));
- }
- public void openURL(final String url) { // Credits ZombieKnight
- //who gave credits to Dave who gave credits
- // to
- // some guy who made this.
- final String osName = System.getProperty("os.name");
- try {
- if (osName.startsWith("Mac OS")) {
- final Class<?> fileMgr = Class
- .forName("com.apple.eio.FileManager");
- final Method openURL = fileMgr.getDeclaredMethod("openURL",new Class[]{String.class});
- openURL.invoke(null, new Object[]{url});
- } else if (osName.startsWith("Windows")) {
- Runtime.getRuntime().exec(
- "rundll32 url.dll,FileProtocolHandler " + url);
- } else { // assume Unix or Linux
- final String[] browsers = {"firefox", "opera", "konqueror",
- "epiphany", "mozilla", "netscape"};
- String browser = null;
- for (int count = 0; count < browsers.length && browser == null; count++) {
- if (Runtime.getRuntime().exec(
- new String[]{"which", browsers[count]})
- .waitFor() == 0) {
- browser = browsers[count];
- }
- }
- if (browser == null) {
- throw new Exception("Could not find web browser");
- } else {
- Runtime.getRuntime().exec(new String[]{browser, url});
- }
- }
- }catch(Exception e){};
- }
- public void mouseExited(MouseEvent e) {
- }
- public void mouseEntered(MouseEvent e) {
- }
- public void mouseReleased(MouseEvent e) {
- }
- public void mousePressed(MouseEvent e) {
- }
- public void mouseClicked(MouseEvent e) {
- p = e.getPoint();
- if(showPaint && p.getX()>447&&p.getX()<513&& p.getY()>458&&p.getY()<473)
- showPaint = false;
- else if(!showPaint && p.getX()>447&&p.getX()<513&& p.getY()>458&&p.getY()<473)
- showPaint = true;
- else if(showPaint && fancyPaint && p.getX()>397&&p.getX()<448&& p.getY()>458&&p.getY()<473)
- fancyPaint = false;
- else if(showPaint && !fancyPaint && p.getX()>397&&p.getX()<448&& p.getY()>458&&p.getY()<473)
- fancyPaint = true;
- }
- public void onRepaint(Graphics g)
- {
- if(game.isLoggedIn())
- {
- try{
- if(startExp==0)
- {
- startExp = skills.getCurrentExp(skills.getIndex("fishing"));
- startLevelf = skills.getCurrentLevel(skills.getIndex("fishing"));
- startLevela = skills.getCurrentLevel(skills.getIndex("agility"));
- startLevels = skills.getCurrentLevel(skills.getIndex("strength"));
- }
- lvlsGainedf = skills.getCurrentLevel(skills.getIndex("fishing")) - startLevelf;
- lvlsGaineda = skills.getCurrentLevel(skills.getIndex("agility")) - startLevela;
- lvlsGaineds = skills.getCurrentLevel(skills.getIndex("strength")) - startLevels;
- expGained = skills.getCurrentExp(skills.getIndex("fishing")) - startExp;
- long ms = System.currentTimeMillis() - startTime;
- double ms2 = System.currentTimeMillis() - startTimeDbl;
- long hours = ms/3600000;
- ms = ms-(hours*3600000);
- long minutes = ms/60000;
- ms = ms-(minutes*60000);
- long seconds = ms/1000;
- long expToLvl = skills.getExpToNextLevel(skills.getIndex("fishing"));
- long time2Lvl = 0;
- long time2LvlHrs = 0;
- long time2LvlMins = 0;
- long time2LvlSec = 0;
- if(ms2!=0&&expGained!=0){
- time2Lvl = (long)(expToLvl/(expGained/(ms2/3600000))*3600000);
- time2LvlHrs = time2Lvl/3600000;
- time2Lvl -= time2LvlHrs*3600000;
- time2LvlMins = time2Lvl/60000;
- time2Lvl -= time2LvlMins*60000;
- time2LvlSec = time2Lvl/1000;
- }
- if(fancyPaint)
- {
- if(showPaint){
- onRepaint2(g,true);
- //Text Color and Output
- g.setColor(new Color(0,0,0,255));
- g.setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
- g.drawString(" "+version,450,360);
- g.setFont(new Font("Comic Sans MS", Font.PLAIN, 11));
- if(lvlsGaineds==0&&lvlsGaineda==0)
- g.drawString("Fishing levels Gained: "+lvlsGainedf,16,40);
- else if(lvlsGaineds==0)
- g.drawString("Levels Gained: "+lvlsGainedf+"f "+lvlsGaineda+"a",16,40);
- else if(lvlsGaineda==0)
- g.drawString("Levels Gained: "+lvlsGainedf+"f "+lvlsGaineds+"s",16,40);
- else
- g.drawString("Levels Gained: "+lvlsGainedf+"f "+lvlsGaineda+"a "+lvlsGaineds+"s",16,40);
- g.drawString("Fish Caught: "+(amntLTrout+amntLSalmon+amntLSturgeon),415,22);
- g.drawString("Fish Exp Gained: "+expGained,16,55);
- g.drawString("Time Running: "+hours+":"+minutes+":"+seconds,16,97);
- //Determine Length:
- double difference = skills.XP_TABLE[skills.getCurrentLevel(skills.getIndex("fishing"))+1]-skills.XP_TABLE[skills.getCurrentLevel(skills.getIndex("fishing"))];
- double barLength = ((difference-expToLvl)/difference)*512;
- //Progress Bar
- g.setColor(new Color(255,0,0,255));
- g.fillRoundRect(4,320,512,18,8,8); //Bar background
- g.setColor(new Color(51,153,0,255)); //GREEN
- g.fillRoundRect(4,320,(int)barLength,18,4,4);
- g.setColor(new Color(0,0,0,255));
- int fishToLvl =0;
- if(amntLTrout+amntLSalmon+amntLSturgeon!=0)
- fishToLvl = (int)(expToLvl/(expGained/(amntLTrout+amntLSalmon+amntLSturgeon)));
- g.drawString(skills.getPercentToNextLevel(skills.getIndex("fishing"))+"% to: "+(skills.getCurrentLevel(skills.getIndex("fishing"))+1)+" ("+expToLvl+" exp / "+fishToLvl+" fish)",215,334);
- g.setColor(new Color(255,255,255,100));
- g.fillRoundRect(4,320,512,9,4,4);
- if(ms2!=0)
- g.setColor(new Color(0,0,0,255));
- g.drawString("Fish Exp/Hr: "+(int)(expGained/(ms2/3600000)),16,69);
- g.drawString("Status: "+status,11,22);
- if(type.equals("Bank Caviar"))
- {
- g.drawString("Profit: "+(amntCaviar*GEPRICES[3])+" ("+amntCaviar+" caviar)",149,22);
- if(ms2!=0)
- g.drawString("Profit/Hr: "+(int)((amntCaviar*GEPRICES[3])/(ms2/3600000)),293,22);
- }
- else if(type.equals("Bank Fish"))
- {
- g.drawString("Profit: "+(amntLTrout*GEPRICES[0]+amntLSalmon*GEPRICES[1]+amntLSturgeon*GEPRICES[2]),149,22);
- if(ms2!=0)
- g.drawString("Profit/Hr: "+(int)((amntLTrout*GEPRICES[0]+amntLSalmon*GEPRICES[1]+amntLSturgeon*GEPRICES[2])/(ms2/3600000)),293,22);
- }
- g.drawString("Est. Time to Lvl: "+time2LvlHrs+":"+time2LvlMins+":"+time2LvlSec,16,83);
- //Mouse Stuff
- Point tempPoint = mouse.getLocation();
- int tempXCoordinate = (int)tempPoint.getX();
- int tempYCoordinate = (int)tempPoint.getY();
- g.setColor(new Color(51,153,0,255));
- g.drawLine(tempXCoordinate,0,tempXCoordinate,501);
- g.drawLine(0,tempYCoordinate,764,tempYCoordinate);
- g.fillRect(tempXCoordinate-1,tempYCoordinate-1,3,3);
- }
- else
- {
- g.setColor(new Color(51,153,0,255));
- g.fillRect(448,459,(512-448),(472-459));
- g.setColor(new Color(0,0,0,255));
- g.drawRect(448,459,(512-448),(472-459));
- g.drawString("Hide/Show",450,470);
- }
- }
- else
- {
- if(showPaint){
- onRepaint2(g,false);
- //Background
- g.setColor(new Color(0, 0, 0, 205));
- g.fillRoundRect(333, 175, 181, 194, 6, 6); //Background
- //Text Color and Output
- g.setColor(new Color(255,0,0,255));
- g.setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
- g.drawString("C's Leaping Fisher "+version,338,192);
- g.setFont(new Font("Comic Sans MS", Font.PLAIN, 11));
- if(lvlsGaineds==0&&lvlsGaineda==0)
- g.drawString("Fishing levels Gained: "+lvlsGainedf,344,207);
- else if(lvlsGaineds==0)
- g.drawString("Levels Gained: "+lvlsGainedf+"f "+lvlsGaineda+"a",344,207);
- else if(lvlsGaineda==0)
- g.drawString("Levels Gained: "+lvlsGainedf+"f "+lvlsGaineds+"s",344,207);
- else
- g.drawString("Levels Gained: "+lvlsGainedf+"f "+lvlsGaineda+"a "+lvlsGaineds+"s",344,207);
- g.drawString("Fish Caught: "+(amntLTrout+amntLSalmon+amntLSturgeon),344,222);
- g.drawString("Fish Exp Gained: "+expGained,344,237);
- g.drawString("Time Running: "+hours+":"+minutes+":"+seconds,344, 252);
- //Progress Bar
- g.fillRoundRect(344,256,150,20,8,8); //Bar background
- g.setColor(new Color(0,255,0,255)); //GREEN
- g.fillRoundRect(344,256,(int)(skills.getPercentToNextLevel(skills.getIndex("fishing"))*1.5),20,8,8);
- g.setColor(new Color(0,0,0,255));
- g.setColor(new Color(255,255,255,100));
- g.drawString(skills.getPercentToNextLevel(skills.getIndex("fishing"))+"% to: "+(skills.getCurrentLevel(skills.getIndex("fishing"))+1)+" ("+expToLvl+" exp)",348,271);
- g.fillRoundRect(345,266,148,10,8,8);
- g.setColor(new Color(0,0,0,255));
- g.drawString(skills.getPercentToNextLevel(skills.getIndex("fishing"))+"% to: "+(skills.getCurrentLevel(skills.getIndex("fishing"))+1)+" ("+expToLvl+" exp)",347,270);
- g.setColor(new Color(255,0,0,255));
- if(ms2!=0)
- g.drawString("Fish Exp/Hr: "+(int)(expGained/(ms2/3600000)),344,289);
- g.drawString("Status: "+status,344,304);
- if(expGained!=0&&amntLTrout+amntLSalmon+amntLSturgeon!=0)
- g.drawString("Fish to Lvl: "+(int)(expToLvl/(expGained/(amntLTrout+amntLSalmon+amntLSturgeon))),344,319);
- g.drawString("Est. Time to Lvl: "+time2LvlHrs+":"+time2LvlMins+":"+time2LvlSec,344,334);
- g.drawString("Profit: "+(amntCaviar*GEPRICES[3])+" ("+amntCaviar+" caviar)",344,349);
- if(ms2!=0)
- g.drawString("Profit/Hr: "+(int)((amntCaviar*GEPRICES[3])/(ms2/3600000)),344,364);
- //Mouse Stuff
- Point tempPoint = mouse.getLocation();
- int tempXCoordinate = (int)tempPoint.getX();
- int tempYCoordinate = (int)tempPoint.getY();
- g.setColor(new Color(0,255,0,100));
- g.drawLine(tempXCoordinate,0,tempXCoordinate,501);
- g.drawLine(0,tempYCoordinate,764,tempYCoordinate);
- }
- else
- {
- g.setColor(new Color(51,153,0,255));
- g.fillRect(448,459,(512-448),(472-459));
- g.setColor(new Color(0,0,0,255));
- g.drawRect(448,459,(512-448),(472-459));
- g.drawString("Hide/Show",450,470);
- }
- }
- }catch (Exception e){};
- }
- }
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch(IOException e) {
- return null;
- }
- }
- private final Color color1 = new Color(1, 1, 1);
- private final Font font1 = new Font("Arial", 0, 12);
- public void onRepaint2(Graphics g1 , boolean fancy) {
- Graphics2D g = (Graphics2D)g1;
- if(fancy){
- g.drawImage(img2, 5, 6, null);
- g.drawImage(img4, 5, 29, null);
- }
- g.setColor(new Color(51,153,0,255));
- g.fillRect(448,459,(512-448),(472-459));
- g.fillRect(398,459,(448-398),(472-459));
- g.setColor(new Color(0,0,0,255));
- g.drawRect(448,459,(512-448),(472-459));
- g.drawRect(398,459,(448-398),(472-459));
- g.drawString("Hide/Show",450,470);
- if(fancy)
- g.drawString("Simple",405,470);
- else
- g.drawString("Adv.",415,470);
- }
- public void onFinish() {
- log("Exp gained: "+expGained);
- log("Fishing levels gained: "+lvlsGainedf);
- log("Agility levels gained: "+lvlsGaineda);
- log("Strength levels gained: "+lvlsGaineds);
- log("Thanks for using Conderoga's Leaping Fisher!");
- env.saveScreenshot(true);
- }
- public class CLeapGUI extends JFrame {
- private static final long serialVersionUID = 1L;
- public CLeapGUI()
- {
- initComponents();
- }
- private void button2ActionPerformed(ActionEvent e)
- {
- guiWait = false;
- guiExit = true;
- dispose();
- }
- private void button1ActionPerformed(ActionEvent e)
- {
- type = comboBox1.getSelectedItem().toString();
- guiExit = false;
- guiWait = false;
- dispose();
- }
- private void initComponents() {
- label1 = new JLabel();
- label2 = new JLabel();
- label3 = new JLabel();
- button1 = new JButton();
- button2 = new JButton();
- comboBox1 = new JComboBox();
- setTitle("Conderoga's Leaping Fisher");
- setResizable(false);
- setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
- Container contentPane = getContentPane();
- contentPane.setLayout(null);
- //---- label1 ----
- label1.setText("Conderoga's Leaping Fisher Settings");
- label1.setFont(new Font("Comic Sans MS", Font.PLAIN, 16));
- contentPane.add(label1);
- label1.setBounds(10, -10, 380, 70);
- //---- label2 ----
- label2.setText("Select the Action: ");
- contentPane.add(label2);
- label2.setBounds(new Rectangle(new Point(15, 50), label2.getPreferredSize()));
- //---- comboBox1 ----
- comboBox1.setMaximumRowCount(3);
- comboBox1.setModel(new DefaultComboBoxModel(new String[] {
- "Bank Caviar",
- "Bank Fish",
- "PowerFish"
- }));
- contentPane.add(comboBox1);
- comboBox1.setBounds(175, 45, 125, 25);
- //---- label3 ----
- label3.setText(version);
- contentPane.add(label3);
- label3.setBounds(15, 80, 124, label3.getPreferredSize().height);
- //---- button1 ----
- button1.setText("Start!");
- button1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- button1ActionPerformed(e);
- }
- });
- contentPane.add(button1);
- button1.setBounds(40, 115, 75, 30);
- //---- button2 ----
- button2.setText("Exit");
- button2.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- button2ActionPerformed(e);
- }
- });
- contentPane.add(button2);
- button2.setBounds(200, 115, 75, 30);
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for(int i = 0; i < contentPane.getComponentCount(); i++)
- {
- Rectangle bounds = contentPane.getComponent(i).getBounds();
- preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
- preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
- }
- Insets insets = contentPane.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- contentPane.setMinimumSize(preferredSize);
- contentPane.setPreferredSize(preferredSize);
- }
- setSize(325, 190);
- setLocationRelativeTo(getOwner());
- }
- private JLabel label1;
- private JLabel label2;
- private JComboBox comboBox1;
- private JLabel label3;
- private JButton button1;
- private JButton button2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement