Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.BasicStroke;
- import java.awt.Color;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Image;
- import java.awt.Insets;
- import java.awt.Point;
- import java.awt.Rectangle;
- import java.awt.RenderingHints;
- import java.awt.event.KeyEvent;
- import java.io.IOException;
- import java.lang.reflect.InvocationTargetException;
- import java.net.URL;
- import javax.imageio.ImageIO;
- import javax.swing.*;
- import com.rarebot.event.events.MessageEvent;
- import com.rarebot.event.listeners.MessageListener;
- import com.rarebot.event.listeners.PaintListener;
- import com.rarebot.script.Script;
- import com.rarebot.script.ScriptManifest;
- import com.rarebot.script.methods.Equipment;
- import com.rarebot.script.methods.Skills;
- import com.rarebot.script.util.Timer;
- import com.rarebot.script.util.WindowUtil;
- import com.rarebot.script.wrappers.RSArea;
- import com.rarebot.script.wrappers.RSComponent;
- import com.rarebot.script.wrappers.RSItem;
- import com.rarebot.script.wrappers.RSNPC;
- import com.rarebot.script.wrappers.RSObject;
- import com.rarebot.script.wrappers.RSPlayer;
- import com.rarebot.script.wrappers.RSTile;
- import java.text.NumberFormat;
- @SuppressWarnings("deprecation")
- @ScriptManifest(authors = "Patyfatycake", name = "patyFisherBeta",description ="Fixed GUI version + Urn release", version = 4.2, website = "http://www.powerbot.org/vb/showthread.php?t=656864")
- public class patyFisherBeta extends Script implements PaintListener,MessageListener {
- /*************************************************************************************
- * *
- * Fishing section *
- * *
- *************************************************************************************/
- final NumberFormat nf = NumberFormat.getInstance();
- long currentXP;
- long startingXP;
- int startingLevel;
- int currentLevel;
- int levelsgained;
- int currentStrLevel;
- int fishesCaught = 0;
- int runEnergy=100;
- String Status = "Waiting for GUI";
- String Bank = "";
- boolean doneGUI = false;
- Timer antiBanTimer = new Timer(random(60000,100000));
- private static int[] xpTable = { 0, 0, 83, 174, 276, 388, 512, 650, 801, 969, 1154, 1358, 1584,
- 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018, 5624, 6291, 7028, 7842, 8740, 9730,
- 10824, 12031, 13363, 14833, 16456, 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224,
- 41171, 45529, 50339, 55649, 61512, 67983, 75127, 83014, 91721, 101333, 111945, 123660,
- 136594, 150872, 166636, 184040, 203254, 224466, 247886, 273742, 302288, 333804, 368599,
- 407015, 449428, 496254, 547953, 605032, 668051, 737627, 814445, 899257, 992895, 1096278,
- 1210421, 1336443, 1475581, 1629200, 1798808, 1986068, 2192818, 2421087, 2673114, 2951373,
- 3258594, 3597792, 3972294, 4385776, 4842295, 5346332, 5902831, 6517253, 7195629, 7944614,
- 8771558, 9684577, 10692629, 11805606, 13034431 };
- private static int[] gamesNeck = {3867,3865,3863,3861,3859,3857,3855,3853};
- // Locations
- private static RSTile draynorFishingSpot = new RSTile(3086,3233);
- private static RSTile barbarianVillageFishingSpot = new RSTile(3098,3436);
- private static RSTile karamjaFishingSpot = new RSTile(2924,3180);
- private static RSTile shiloVillageFishingSpot = new RSTile(2857,2971);
- private static RSTile catherbyFishingSpot = new RSTile(2839,3433);
- private static RSTile livingRockFishingSpot = new RSTile(3612,5112);
- private static RSTile lumbridgeFishingSpot = new RSTile(3242,3241);
- private static RSTile livingRockCavernFishingSpot = new RSTile(3649,5086);
- private static RSTile crayfishFishingSpot = new RSTile(3258,3205);
- private static RSTile ottosFishingSpot = new RSTile(2499,3506);
- private static RSTile piscariousFishingSpot = new RSTile(2338,3700);
- private static RSTile stilesTile = new RSTile(2851, 3142);
- private static RSTile fishingGuildFishingSpot = new RSTile(2599,3421);
- private static RSTile rasoloFishingSpot = new RSTile(2533,3413);
- RSTile closestBank;
- private static RSTile[] toRasolo = new RSTile[]{new RSTile(2538,3408),new RSTile(2539,3417),new RSTile(2534,3421),
- new RSTile(2533,3428),new RSTile(2534,3433),new RSTile(2536,3440)};
- private static RSTile[] rasoloToFishingSpot = new RSTile[]{new RSTile(2535,3431),new RSTile(2535,3423),
- new RSTile(2535,3415)};
- private static RSTile[] lumbridgeBankGroundFloor = new RSTile[]{ new RSTile(3242,3241),
- new RSTile (3247,3233), new RSTile(3242,3226), new RSTile(3232,3220), new RSTile(3221,3219),
- new RSTile(3215,3216), new RSTile(3207,3210)
- };
- private static RSTile[] lumbridgeFishingSpotPath = new RSTile[]{new RSTile(3207,3210),
- new RSTile(3215,3216), new RSTile(3221,3219),new RSTile(3232,3220),
- new RSTile(3242,3226),new RSTile (3247,3233) ,new RSTile(3243,3240)
- };
- private static RSTile[] karamjaStiles = new RSTile[]{new RSTile(2921,3173),new RSTile(2912,3172), new RSTile(2901,3168),
- new RSTile(2899,3159), new RSTile(2893,3153), new RSTile(2886,3146), new RSTile(2876,3144),
- new RSTile(2868,3148), new RSTile(2858,3145), new RSTile(2851,3142)};
- private static RSTile[] karamjaStilesSafePath = new RSTile[]{
- new RSTile(2919, 3176), new RSTile(2911, 3172),
- new RSTile(2899, 3165), new RSTile(2894, 3154),
- new RSTile(2885, 3146), new RSTile(2873, 3147),
- new RSTile(2861, 3146), new RSTile(2851, 3142)};
- private static RSTile[] stilesKaramja = new RSTile[]{new RSTile(2851,3142),new RSTile(2858,3145),new RSTile(2868,3148),
- new RSTile(2876,3144),new RSTile(2886,3146),new RSTile(2893,3153),new RSTile(2899,3159),
- new RSTile(2901,3168),new RSTile(2912,3172),new RSTile(2921,3173)};
- private static RSTile[] draynorToShip = new RSTile[]{new RSTile(3086,3249),new RSTile(3077,3253), new RSTile(3073,3264),
- new RSTile(3072,3272), new RSTile(3062,3272), new RSTile(3058,3264), new RSTile(3054,3253),
- new RSTile(3045,3246), new RSTile(3042,3236), new RSTile(3032,3236),new RSTile(3028,3227),
- new RSTile(3028,3220)};
- private static RSTile[] shipToKaramjaFishingSpot = new RSTile[]{new RSTile(2946,3146),new RSTile(2936,3147),
- new RSTile(2923,3152), new RSTile(2917,3152), new RSTile(2920,3163), new RSTile(2924,3169),
- new RSTile(2925,3178)};
- private static RSTile[] shipToDraynorBank = new RSTile[]{new RSTile(3028,3220),new RSTile(3028,3227),new RSTile(3032,3236),
- new RSTile(3032,3236),new RSTile(3042,3236),new RSTile(3045,3246),new RSTile(3054,3253),new RSTile(3058,3264),
- new RSTile(3062,3272), new RSTile(3072,3272),new RSTile(3073,3264),new RSTile(3077,3253),new RSTile(3086,3249),
- new RSTile(3093,3243)};
- private static RSTile[] karamjaFishingSpotToShip = new RSTile[]{new RSTile(2925,3178),new RSTile(2924,3169),
- new RSTile(2920,3163),new RSTile(2917,3152),new RSTile(2923,3152),new RSTile(2936,3147),
- new RSTile(2946,3146),new RSTile(2952,3146)};
- private static RSTile[] exitCabbages = new RSTile[]{new RSTile(3053,3286), new RSTile(3058,3278)
- };
- private static RSTile[] catherbyToFishingSpot = new RSTile[]{new RSTile(2812,3435), new RSTile(2819,3437),
- new RSTile(2829,3438), new RSTile(2841,3435), new RSTile(2848,3431), new RSTile(2850,3430)};
- private static RSTile[] catherbyFishingSpotToBank = new RSTile[]{new RSTile(2854,3429), new RSTile(2845,3432),
- new RSTile(2835,3434), new RSTile(2825,3437), new RSTile(2815,3437), new RSTile(2809,3440)};
- private static RSTile[] draynorToFishingSpot = new RSTile[]{new RSTile(3086,3241), new RSTile(3085,3234)};
- private static RSTile[] fishingSpotToDraynorBank = new RSTile[]{new RSTile(3083,3236), new RSTile(3087,3244),
- new RSTile(3093,3243)};
- private static RSTile[] edgevilleToBarbarianVillage = new RSTile[]{new RSTile(3095,3485), new RSTile(3100,3478),
- new RSTile(3099,3471), new RSTile(3094,3465), new RSTile(3087,3465), new RSTile(3089,3457),
- new RSTile(3091,3448), new RSTile(3093,3440), new RSTile(3098,3436), new RSTile(3104,3433)};
- private static RSTile[] barbarianVillageToEdgeville = new RSTile[]{new RSTile(3101,3434), new RSTile(3093,3440),
- new RSTile(3091,3447), new RSTile(3090,3458), new RSTile(3091,3465), new RSTile(3099,3476),
- new RSTile(3094,3485), new RSTile(3094,3491)};
- private static RSTile[] piscariousToFishingSpot = new RSTile[]{new RSTile(2333,3698), new RSTile(2340,3697)};
- private static RSTile[] fishingSpotToPicarious = new RSTile[]{new RSTile(2340,3696), new RSTile(2331,3698)};
- private static RSTile[] fishingGuildToBank = new RSTile[]{new RSTile(2598,3412), new RSTile(2594,3421),
- new RSTile(2586,3422)};
- private static RSTile[] banktoFishingGuild = new RSTile[]{new RSTile(2594,3420), new RSTile(2602,3420)};
- private static RSTile[] shiloToBank = new RSTile[]{ new RSTile(2858,2980), new RSTile(2845,2978), new RSTile(2834,2977),
- new RSTile(2833,2968), new RSTile(2840,2966), new RSTile(2855,2970), new RSTile(2849,2961), new RSTile(2851,2955)};
- private static RSTile[] bankToShilo = new RSTile[]{new RSTile(2850,2961), new RSTile(2851,2970)};
- private static RSTile[] piscariousWest = new RSTile[]{new RSTile(2317,3698), new RSTile(2327,3697),
- new RSTile(2330,3689)
- };
- private static RSTile[] piscariousEast = new RSTile[]{new RSTile(2343,3696), new RSTile(2337,3691),
- new RSTile(2329,3690)
- };
- private static RSArea cabbageArea = new RSArea(new RSTile(3043, 3286), new RSTile(3056, 3279));
- private static RSArea draynorBankArea = new RSArea(new RSTile(3092,3240), new RSTile(3097,3246));
- private static RSArea lumbridgeBankArea = new RSArea(new RSTile(3207,3215), new RSTile(3210,3220));
- private static RSArea edgevilleBankArea = new RSArea(new RSTile(3091,3488), new RSTile(3098,3498));
- private static RSArea piscariousBankArea = new RSArea(new RSTile(2328,3686) , new RSTile(2332,23693));
- private static RSArea shiloBankArea = new RSArea(new RSTile(2849,2951), new RSTile(2854,2957));
- private static RSArea fishingGuildBankArea = new RSArea(new RSTile(2585,3420), new RSTile(2587,3424));
- private static RSArea fishingGuildFirstPlatform = new RSArea(new RSTile(2597,3419), new RSTile(2605,3426));
- private static RSArea fishingGuildSecondPlatform = new RSArea(new RSTile(2062,3407), new RSTile(2612,3416));
- private static RSArea catherbyBankArea = new RSArea(new RSTile(2806,3438), new RSTile(2812,3441));
- private static RSArea gameRoomBelow = new RSArea(new RSTile(2200,4936), new RSTile(2215,4943));
- private static RSArea gameRoom = new RSArea(new RSTile(2893,3559), new RSTile(2907,3575));
- private static RSArea roguePub = new RSArea(new RSTile(2905,3536), new RSTile(2915,3543));
- private static RSArea burthrope = new RSArea(new RSTile(2884,3528),new RSTile(2930,3578));
- public static RSArea inRogues = new RSArea(new RSTile(3039,4061), new RSTile(3064,4985));
- // Spot Ids
- private static int[] fishingSpotNet = {320,322,323,325,327,3848};
- private static int[] fishingSpotBait = {310,317,320,323,327,328,329,};
- private static int[] fishingSpotCage = {312,321,324};
- private static int[] fishingSpotCrayfish = {6267};
- private static int[] fishingSpotHarpoon = {312,321,324};
- private static int[] fishingSpotHarpoonShark = {313,322,3848};
- private static int[] fishingSpotRockShoal = {8841,8842};
- private static int[] fishingSpotBarbarian = {2722};
- private static int[] fishingSpotRockTail = {8842};
- private static int[] fishingSpotCaveShoal = {8841};
- private static int[] portSarimBoatPeople = {376,377,378};
- private static String fishingTypeNet = "Net";
- private static String fishingTypeBait = "Bait";
- private static String fishingTypeLure = "Lure";
- private static String fishingTypeCrayfish ="Cage";
- private static String fishingTypeCage = "Cage";
- private static String fishingTypeHarpoon = "Harpoon";
- private static String fishingTypeBarbarian = "Use-rod";
- int StripyFeathers = 10087;
- int RedFeathers = 10088;
- int BlueFeathers = 10089;
- int YellowFeathers =10090;
- int OrangeFeathers = 10091;
- private static RSTile karamjaOnBoat = new RSTile(2956,3143);
- private static RSTile portSarimOnBoat = new RSTile(3032,3217);
- private static RSTile fishingGuildFirstTile = new RSTile(2594,3420);
- private static RSTile fishingGuildSecondTile = new RSTile(2603,3406);
- int fragileUrnID = 20328;
- int fragileUrnStartedID = 20329;
- int fragileUrnDoneID = 20330;
- int crackedUrnID = 20322;
- int crackedUrnStartedID = 20323;
- int crackedUrnDoneID = 20324;
- int regularCookingUrnID = 20334;
- int regularCookingUrnStartedID = 20335;
- int regularUrnDoneID = 20336;
- int decoratedDoneID = 20346;
- int decoratedStartedID = 20347;
- int decoratedUrnID = 20348;
- int strongUrnDoneID = 20340;
- int strongUrnStartedID = 20341;
- int strongUrn = 20342;
- int urnID = 0;
- int urnStartedID = 0;
- int urnDoneID = 0;
- boolean urnDone = false;
- boolean useUrn = false;
- //Modes, Locations && Types
- String fishingType ;
- int fishingSecondary = 0;
- int fishingMain = 0;
- int[] fishingSpot;
- boolean powerFish = true;
- boolean stiles = false;
- boolean f1d1 = false;
- boolean dropTuna = false;
- RSArea bankArea;
- RSTile fishingSpotTile;
- RSTile[] bankPath;
- RSTile[] fishingPath;
- String location = "Not set";
- boolean handFishing = false;
- boolean useRing = false;
- long startTime = System.currentTimeMillis();
- long seconds = 0;
- long minutes = 0;
- long hours = 0;
- private static int lumbridgeFloorTwoLadderID = 36775;
- private static int lumbridgeFloorOneLadderID = 36774;
- private static int lumbridgeFloorZeroLadderID = 36773;
- private static RSTile floorTwoLadder = new RSTile(3205,3209);
- private static RSTile bankTile = new RSTile(3208,3219);
- //GUI
- private javax.swing.JButton BTN_Start;
- private javax.swing.JComboBox JCB_CookLocation;
- private javax.swing.JComboBox JCB_CookingType;
- private javax.swing.JComboBox JCB_FishingType;
- private javax.swing.JComboBox JCB_Location;
- private javax.swing.JComboBox JCB_Mode;
- private javax.swing.JCheckBox JCK_Cooking;
- private javax.swing.JCheckBox JCK_DropTuna;
- private javax.swing.JCheckBox JCK_UseFire;
- private javax.swing.JRadioButton JRB_Fish;
- private javax.swing.JRadioButton JRB_Time;
- private javax.swing.JTextField JTF_Higher;
- private javax.swing.JTextField JTF_Lower;
- private javax.swing.JLabel LBL_FishingType;
- private javax.swing.JLabel LBL_Location;
- private javax.swing.JLabel LBL_Mode;
- private javax.swing.JLabel LBL_Title;
- private javax.swing.JComboBox JCB_UrnType;
- private javax.swing.JLabel LBL_UrnType;
- @Override
- public int loop() {
- String returnText = interfaces.get(906)
- .getComponent(221)
- .getText().toLowerCase();
- if (!game.isLoggedIn() || game.isWelcomeScreen() || ( returnText != null && returnText.equals("Logging In - Please Wait")))
- {
- sleep(1000,1500);
- return random(6000,7000);
- }
- if (game.isLoggedIn()) {
- if(useUrn){
- RSItem item = inventory.getItem(urnDoneID);
- if(item != null){
- item.doClick(true);
- }
- }
- if (inventory.isFull() || (!inventory.contains(fishingMain) && !handFishing)
- || (fishingSecondary != 0 && !inventory.contains(fishingSecondary))){
- if(stiles){
- if(inventory.contains(359) && dropTuna){
- dropTuna();
- }else{
- exchangeStiles();
- }
- }else if(location.equals("Rasolo") && JCB_Mode.getSelectedItem().toString().equals("Sell"))
- {
- RSNPC rasolo = npcs.getNearest(1972);
- RSComponent tradeInterface = interfaces.getComponent(620,0);
- if(tradeInterface != null && tradeInterface.isValid())
- {
- for(int i=0; i < 28 ;i++)
- {
- RSItem item = inventory.getItemAt(i);
- if(item != null && item.getID() != -1 && item.getID() != fishingMain && item.getID() != fishingSecondary &&
- item.getID() != 314 && item.getID() != 313 && item.getID() != 995)
- {
- item.interact("Sell 50");
- sleep(1000,1200);
- }
- }
- }else{
- if(rasolo != null && rasolo.isOnScreen())
- {
- Status = "Exchanging fish";
- rasolo.interact("Trade");
- sleep(1000,1600);
- waitUntilNotMoving();
- }
- else
- {
- runEnergy();
- if(rasolo != null)
- {
- walking.walkTileMM(rasolo.getLocation());
- sleep(800,1000);
- waitUntilNotMoving();
- }
- else
- {
- runEnergy();
- walkPath(toRasolo);
- if(getMyPlayer().isMoving())
- sleep(random(600,800));
- }
- }
- }
- }else{
- if(inventory.contains(359) && dropTuna)
- {
- dropTuna();
- }
- else
- {
- Status = "Banking";
- bank();
- }
- }
- }else{
- fish();
- }
- }
- return 0;
- }
- public void exchangeStiles(){
- RSNPC Stiles = getClosestNPC(new int[]{11267});
- if(Stiles != null && Stiles.isOnScreen()){
- Status = "Exchanging fish";
- Stiles.doAction("Exchange");
- sleep(1000,1600);
- waitUntilNotMoving();
- }else{
- runEnergy();
- RSComponent hp = interfaces.getComponent(748,8);
- if(hp != null && hp.isValid() && 200 < Integer.parseInt(hp.getText())){
- walkPath(karamjaStilesSafePath );
- }else{
- walkPath(karamjaStiles);
- }
- if(getMyPlayer().isMoving())
- sleep(random(600,800));
- }
- }
- public void dropTuna(){
- RSItem[] tunas =inventory.getItems(359);
- if(tunas != null){
- for(RSItem tuna: tunas){
- tuna.doAction("Drop");
- sleep(200,300);
- Timer dropTimer = new Timer(random(1500,2000));
- while(dropTimer.isRunning() && tuna != null){
- sleep(100,150);
- }
- }
- }
- }
- public void fish(){
- openInventory();
- checkSecondaries();
- RSNPC fishingNPC = null;
- if(location.equals("Fishing Guild")){
- fishingNPC = getClosestNPCFishingGuild();
- }else{
- fishingNPC = getClosestNPC(fishingSpot);
- }
- if(fishingNPC == null){
- walkToFish();
- return;
- }
- if(!fishingNPC.isOnScreen()){
- walkTile(fishingNPC.getLocation());
- }
- if(fishingNPC.isOnScreen()){
- if(f1d1 == true && inventory.getItemAt(0) != null){
- dropFishF1D1();
- }else{
- if(getMyPlayer().getAnimation() == -1){
- if(fishingSpot == fishingSpotHarpoonShark){
- exactFishing("Harpoon","Net", fishingNPC);
- }else if(fishingNPC.getScreenLocation().x == -1 || fishingNPC.getScreenLocation() == null){
- mouse.move(calc.tileToScreen(fishingNPC.getLocation()));
- if(menu.getActions() != null && menu.getActions()[0].equals(fishingType)){
- mouse.click(calc.tileToScreen(fishingNPC.getLocation()),true);
- }else{
- if(!menu.isOpen()){
- mouse.click(calc.tileToScreen(fishingNPC.getLocation()),false);
- sleep(100,150);
- }
- if(menu.isOpen()){
- if(menu.contains(fishingType)){
- menu.doAction(fishingType);
- waitUntilMoving();
- waitUntilNotMoving();
- }else{
- double x = mouse.getLocation().getX();
- double y = mouse.getLocation().getY();
- mouse.move((int)random(x-60,x+60),(int)random(y-60,y+60));
- }
- sleep(300,450);
- }
- }
- }else{
- if(fishingNPC.interact(fishingType)){
- waitUntilMoving();
- waitUntilNotMoving();
- }
- }
- }else{
- doAntiBan();
- Status = "Fishing";
- sleep(random(2000,2500));
- }
- }
- }
- }
- public void doAntiBan(){
- if(getMyPlayer().getAnimation() != -1){
- if(!antiBanTimer.isRunning()){
- antiBan();
- antiBanTimer = new Timer(random(60000,100000));
- }
- }
- }
- public void openInventory(){
- if(game.getCurrentTab() != game.TAB_INVENTORY){
- log("Opening Inventory");
- keyboard.pressKey((char) KeyEvent.VK_F1);
- sleep(random(50,200));
- keyboard.releaseKey((char) KeyEvent.VK_F1);
- sleep(500,600);
- }
- }
- public void checkSecondaries(){
- if(fishingSecondary != 0 && !inventory.contains(fishingSecondary)){
- log("Starting failsafe check for secondarys");
- Timer failSafeTimer = new Timer(random(4000,6000));
- while(failSafeTimer.isRunning() && !inventory.contains(fishingSecondary)){
- if(game.getCurrentTab() != game.TAB_INVENTORY)
- {
- keyboard.pressKey((char) KeyEvent.VK_F1);
- sleep(random(50,200));
- keyboard.releaseKey((char) KeyEvent.VK_F1);
- sleep(200,400);
- }
- }
- if(!inventory.contains(fishingSecondary)){
- log("Detected no secondaries");
- game.logout(false);
- log("Out of supplies");
- stopScript();
- }
- }
- }
- public void exactFishing(String targetAction, String actionAbove, RSNPC fishingNPC){
- mouse.click(fishingNPC.getScreenLocation().getLocation(), false);
- sleep(500,600);
- if(menu.isOpen()){
- String[] menuItems = menu.getItems();
- for(int i = 0;i < menuItems.length ; i++){
- if(menuItems[i].contains(targetAction)){
- if(menuItems[i-1].contains(actionAbove)){
- menu.clickIndex(i);
- break;
- }
- }
- }
- }
- }
- public void walkToFish(){
- if(location.equals("Lumbridge")){
- lumbridgeWalkToFish();
- }
- else if(location.equals("Karamja")) {
- if(stiles){
- runEnergy();
- walkPath(stilesKaramja);
- if(getMyPlayer().isMoving())
- sleep(random(600,800));
- }
- else{
- walkToKaramja();
- }
- }
- else{
- runEnergy();
- walkPath(fishingPath);
- }
- }
- public void walkTile(RSTile tile){
- if (!getMyPlayer().isMoving() || calc.distanceTo(walking.getDestination()) < 4) {
- if(calc.tileOnMap(tile)){
- walking.walkTileMM(tile);
- }
- else{
- walking.walkTo(tile);
- }
- }
- }
- public void runEnergy(){
- if(walking.getEnergy() > runEnergy && walking.isRunEnabled() == false)
- {
- walking.setRun(true);
- sleep(1200,1500);
- runEnergy = random(30,60);
- }
- }
- public void lumbridgeBanking(){
- if(game.getPlane() == 0)
- {
- if(calc.distanceTo(walking.getDestination()) < 5)
- {
- RSObject ladder = objects.getNearest(lumbridgeFloorZeroLadderID);
- if(ladder != null)
- {
- log("I see the ladder");
- if(ladder.isOnScreen() && calc.distanceTo(ladder.getLocation()) < 4)
- {
- ladder.doClick(false);
- sleep(500,600);
- if(menu.doAction("Climb-up"))
- {
- Timer failSafe = new Timer(2000);
- while(failSafe.isRunning() && game.getPlane() != 2)
- {
- sleep(100,150);
- }
- }
- sleep(500,600);
- while(getMyPlayer().isMoving())
- {
- sleep(100,150);
- }
- }
- else
- {
- runEnergy();
- walkPath(lumbridgeBankGroundFloor);
- sleep(600,700);
- while(getMyPlayer().isMoving())
- {
- sleep(100,150);
- }
- }
- }
- else
- {
- runEnergy();
- walkPath(lumbridgeBankGroundFloor);
- sleep(600,700);
- while(getMyPlayer().isMoving())
- {
- sleep(100,150);
- }
- }
- }
- }
- else if(game.getPlane() == 1)
- {
- RSObject ladder = objects.getNearest(lumbridgeFloorOneLadderID);
- if(ladder != null)
- {
- if(ladder.isOnScreen() && calc.distanceTo(ladder.getLocation()) < 4)
- {
- ladder.doClick(false);
- sleep(500,600);
- if(menu.doAction("Climb-up"))
- {
- Timer failSafe = new Timer(2000);
- while(failSafe.isRunning() && game.getPlane() != 2)
- {
- sleep(100,150);
- }
- }
- sleep(500,600);
- while(getMyPlayer().isMoving())
- {
- sleep(100,150);
- }
- }
- else
- {
- log("Cant see ladder");
- walking.walkTo(floorTwoLadder);
- sleep(600,700);
- while(getMyPlayer().isMoving())
- {
- sleep(100,150);
- }
- }
- }
- }
- else if(game.getPlane() == 2)
- {
- if(lumbridgeBankArea.contains(getMyPlayer().getLocation()))
- {
- bank.open();
- }
- else
- {
- walking.walkTo(new RSTile(random(3207,3209),random(3218,3220)));
- sleep(random(600,700));
- while(getMyPlayer().isMoving())
- {
- sleep(random(100,150));
- }
- }
- }
- }
- public void lumbridgeWalkToFish()
- {
- if(game.getPlane() == 0)
- {
- if(calc.distanceTo(walking.getDestination()) < 5)
- {
- runEnergy();
- walkPath(lumbridgeFishingSpotPath);
- sleep(500,600);
- }
- }
- else if(game.getPlane() == 1)
- {
- RSObject ladder = objects.getNearest(lumbridgeFloorOneLadderID);
- if(ladder != null)
- {
- if(ladder.isOnScreen() && calc.distanceTo(ladder.getLocation()) < 4)
- {
- ladder.doClick(false);
- sleep(500,600);
- if(menu.doAction("Climb-down"))
- {
- Timer failSafe = new Timer(2000);
- while(failSafe.isRunning() && game.getPlane() != 2)
- {
- sleep(100,150);
- }
- }
- sleep(500,600);
- while(getMyPlayer().isMoving())
- {
- sleep(100,150);
- }
- }
- else
- {
- walking.walkTo(floorTwoLadder);
- sleep(600,700);
- while(getMyPlayer().isMoving())
- {
- sleep(100,150);
- }
- }
- }
- }
- else if(game.getPlane() == 2)
- {
- RSObject ladder = objects.getNearest(lumbridgeFloorTwoLadderID);
- if(ladder != null)
- {
- if(ladder.isOnScreen())
- {
- if(ladder.doClick(true))
- {
- Timer failSafe = new Timer(2000);
- while(failSafe.isRunning() && game.getPlane() != 1)
- {
- sleep(100,150);
- }
- }
- sleep(500,600);
- while(getMyPlayer().isMoving())
- {
- sleep(100,150);
- }
- }
- else
- {
- walking.walkTo(floorTwoLadder);
- sleep(500,600);
- while(getMyPlayer().isMoving())
- {
- sleep(100,150);
- }
- }
- }
- }
- }
- public void cabbageArea()
- {
- if(cabbageArea.contains(getMyPlayer().getLocation()))
- {
- RSObject gate = objects.getNearest(7049,7050);
- if(gate != null)
- {
- if(gate.isOnScreen())
- {
- gate.doAction("Open");
- sleep(1000,1500);
- waitUntilNotMoving();
- }
- else
- {
- walking.walkTo(gate.getLocation());
- sleep(500,700);
- waitUntilNotMoving();
- }
- }
- else
- {
- runEnergy();
- walkPath(exitCabbages);
- sleep(random(600,800));
- }
- }
- }
- public void walkToKaramja()
- {
- if(getMyPlayer().getLocation().getY() > 3200)
- {
- RSComponent yesPlease = interfaces.getComponent(228, 2);
- if(interfaces.canContinue() || yesPlease.isValid())
- {
- if(yesPlease.isValid())
- {
- yesPlease.doClick();
- sleep(600,800);
- }
- else if(interfaces.canContinue())
- {
- interfaces.clickContinue();
- sleep(600,900);
- }
- }
- else
- {
- RSNPC boatPerson = npcs.getNearest(portSarimBoatPeople);
- if(boatPerson != null && boatPerson.isOnScreen())
- {
- boatPerson.doAction("Pay-Fare");
- sleep(1000,1200);
- waitUntilNotMoving();
- sleep(600);
- }
- else
- {
- runEnergy();
- walkPath(draynorToShip);
- sleep(500,600);
- }
- }
- }
- else
- {
- RSObject karamjaPlank = objects.getNearest(2082);
- if(karamjaPlank != null)
- {
- if(karamjaPlank.isOnScreen())
- {
- karamjaPlank.doAction("Cross");
- sleep(1500,2000);
- }
- else
- {
- walking.walkTo(karamjaPlank.getLocation());
- waitUntilNotMoving();
- }
- }
- else
- {
- runEnergy();
- walkPath(shipToKaramjaFishingSpot);
- sleep(random(600,800));
- }
- }
- }
- @SuppressWarnings("static-access")
- public void walkToBankKaramja()
- {
- if(getMyPlayer().getLocation().getY() > 3200)
- {
- RSObject karamjaPlank = objects.getNearest(2084);
- if(karamjaPlank != null)
- {
- if(karamjaPlank.isOnScreen())
- {
- karamjaPlank.doAction("Cross");
- sleep(1500,2000);
- }
- else
- {
- walking.walkTo(karamjaPlank.getLocation());
- waitUntilNotMoving();
- }
- }
- else
- {
- if(cabbageArea.contains(getMyPlayer().getLocation()))
- {
- cabbageArea();
- }
- else
- {
- runEnergy();
- walkPath(shipToDraynorBank);
- sleep(random(600,800));
- bank.open();
- }
- }
- }
- else
- {
- if(useRing == true)
- {
- if(game.getCurrentTab() != game.TAB_EQUIPMENT)
- {
- game.openTab(game.TAB_EQUIPMENT);
- sleep(500,600);
- }
- interfaces.get(Equipment.INTERFACE_EQUIPMENT)
- .getComponent(Equipment.RING).doAction(
- "Cabbage-port");
- sleep(1000,1500);
- Timer failsafeTimer = new Timer(random(5000,6000));
- while(getMyPlayer().getAnimation() == 9984 && failsafeTimer.isRunning())
- {
- sleep(100,150);
- }
- sleep(1500,2000);
- Timer failsafeTimer2 = new Timer(random(4000,6000) );
- while(getMyPlayer().getAnimation() == 9986 && failsafeTimer2.isRunning())
- {
- sleep(100,150);
- }
- }
- else
- {
- RSComponent yesPlease = interfaces.getComponent(228, 2);
- RSComponent okClick = interfaces.getComponent(228, 3);
- RSComponent searchAway = interfaces.getComponent(230, 3);
- if(interfaces.canContinue() || yesPlease.isValid() || searchAway.isValid() || okClick.isValid())
- {
- if(yesPlease.isValid())
- {
- yesPlease.doClick();
- sleep(600,800);
- }
- else if(searchAway.isValid())
- {
- searchAway.doClick();
- sleep(600,800);
- }
- else if(okClick.isValid())
- {
- okClick.doClick();
- sleep(600,800);
- }
- else
- {
- interfaces.clickContinue();
- sleep(600,900);
- }
- }
- else
- {
- RSNPC customOfficer = npcs.getNearest(380);
- if(customOfficer != null)
- {
- if(customOfficer.isOnScreen())
- {
- customOfficer.doAction("Pay-Fare");
- sleep(500,600);
- waitUntilNotMoving();
- }
- else
- {
- if(getMyPlayer().getLocation().getX() > 2948 )
- {
- camera.turnTo(customOfficer.getLocation());
- }
- else
- {
- runEnergy();
- walkPath(karamjaFishingSpotToShip);
- sleep(random(600,800));
- }
- }
- }
- else
- {
- runEnergy();
- walkPath(karamjaFishingSpotToShip);
- sleep(random(600,800));
- }
- }
- }
- }
- }
- public boolean onFirstPlatform(RSTile tile)
- {
- if(fishingGuildFirstPlatform.contains(tile))
- {
- return true;
- }
- return false;
- }
- public boolean onSecondPlatform(RSTile tile)
- {
- return (fishingGuildSecondPlatform.contains(tile));
- }
- public RSNPC getClosestNPC()
- {
- double closestDistance=9999;
- RSNPC closestNPC = null;
- for(RSNPC npc : npcs.getAll())
- {
- for(int npcID : fishingSpot)
- {
- double npcDistance = 10000;
- if(npc.getID() == npcID)
- {
- npcDistance = calc.distanceTo(npc);
- }
- if(npcDistance < closestDistance)
- {
- closestNPC = npc;
- closestDistance = npcDistance;
- }
- }
- }
- return closestNPC;
- }
- public RSNPC getClosestNPCFishingGuild()
- {
- double closestDistance=9999;
- RSNPC closestNPC = null;
- for(RSNPC npc : npcs.getAll())
- {
- for(int npcID : fishingSpot)
- {
- if(npc.getID() == npcID)
- {
- double npcDistance = 10000;
- if((onFirstPlatform(getMyPlayer().getLocation()) && onFirstPlatform(npc.getLocation()))
- || onSecondPlatform(getMyPlayer().getLocation()) && onSecondPlatform(npc.getLocation()))
- {
- npcDistance = calc.distanceTo(npc.getLocation());
- }
- else if((onFirstPlatform(getMyPlayer().getLocation()) && !onFirstPlatform(npc.getLocation())))
- {
- npcDistance = calc.distanceTo(fishingGuildFirstTile)
- + calc.distanceBetween(fishingGuildFirstTile, fishingGuildSecondTile)
- + calc.distanceBetween(fishingGuildSecondTile, npc.getLocation());
- }
- else if(onSecondPlatform(getMyPlayer().getLocation()) && !onSecondPlatform(npc.getLocation()))
- {
- npcDistance = calc.distanceTo(fishingGuildSecondTile)
- + calc.distanceBetween(fishingGuildSecondTile, fishingGuildFirstTile)
- + calc.distanceBetween(fishingGuildFirstTile, npc.getLocation());
- }
- if(npcDistance < closestDistance)
- {
- closestNPC = npc;
- closestDistance = npcDistance;
- }
- }
- }
- }
- return closestNPC;
- }
- GUI gui;
- @SuppressWarnings("static-access")
- public boolean onStart()
- {
- Status = "Setting up script";
- try {
- try {
- SwingUtilities.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- gui = new GUI();
- WindowUtil.position(gui);
- gui.setVisible(true);
- }
- });
- } catch (InvocationTargetException ex) {
- }
- } catch (InterruptedException e) {
- }
- while (gui.isVisible()) {
- sleep(50);
- }
- gui.dispose();
- runEnergy = random(30,100);
- Status = "Starting up GUI";
- scriptSetup();
- setupUrns();
- usageThread.start();
- return true;
- }
- public void scriptSetup()
- {
- if(JCB_Location.getSelectedItem().toString().equals("Barbarian Village"))
- {
- fishingSpotTile = barbarianVillageFishingSpot;
- bankPath = barbarianVillageToEdgeville;
- bankArea = edgevilleBankArea;
- fishingPath = edgevilleToBarbarianVillage;
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Draynor Village"))
- {
- fishingSpotTile = draynorFishingSpot;
- bankArea = draynorBankArea;
- fishingPath = draynorToFishingSpot;
- bankPath = fishingSpotToDraynorBank;
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Catherby"))
- {
- bankArea = catherbyBankArea;
- fishingSpotTile = catherbyFishingSpot;
- bankPath = catherbyFishingSpotToBank;
- fishingPath = catherbyToFishingSpot;
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Fishing Guild"))
- {
- bankArea = fishingGuildBankArea;
- fishingSpotTile = fishingGuildFishingSpot;
- bankPath = fishingGuildToBank;
- fishingPath = banktoFishingGuild;
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Karamja"))
- {
- fishingSpotTile = karamjaFishingSpot;
- bankArea = draynorBankArea;
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Living Rock Cavern"))
- {
- fishingSpotTile=livingRockCavernFishingSpot;
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Lumbridge"))
- {
- fishingSpotTile = crayfishFishingSpot;
- bankArea = lumbridgeBankArea;
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Ottos"))
- {
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Shilo Village"))
- {
- fishingPath = bankToShilo;
- bankPath = shiloToBank;
- bankArea = shiloBankArea;
- }
- else if (JCB_Location.getSelectedItem().toString().equals("Piscarious"))
- {
- bankPath = fishingSpotToPicarious;
- fishingPath = rasoloToFishingSpot;
- }
- else if (JCB_Location.getSelectedItem().toString().equals("Rasolo"))
- {
- bankPath = toRasolo;
- fishingPath = rasoloToFishingSpot;
- bankArea = piscariousBankArea;
- }
- if(JCB_FishingType.getSelectedItem().toString().equals("Net"))
- {
- fishingType = fishingTypeNet;
- fishingMain = 303;
- fishingSpot = fishingSpotNet;
- }
- else if(JCB_FishingType.getSelectedItem().toString().equals("Barbarian fishing"))
- {
- fishingType = fishingTypeBarbarian;
- fishingMain = 11323;
- fishingSpot = fishingSpotBarbarian;
- if(inventory.getItem(313) != null && inventory.getItem(313).getStackSize() > 0)
- {
- fishingSecondary = 313;
- log("Using fishing bait");
- }
- else if(inventory.contains(StripyFeathers) && inventory.getItem(StripyFeathers).getStackSize() > 0)
- {
- fishingSecondary = StripyFeathers;
- log("Using stripy feathers");
- }
- else if(inventory.contains(RedFeathers) && inventory.getItem(RedFeathers).getStackSize() > 0)
- {
- fishingSecondary = RedFeathers;
- log("Using red feathers");
- }
- else if(inventory.contains(BlueFeathers) && inventory.getItem(BlueFeathers).getStackSize() > 0)
- {
- fishingSecondary = BlueFeathers;
- log("Using blue feathers");
- }
- else if(inventory.contains(YellowFeathers) && inventory.getItem(YellowFeathers).getStackSize() > 0)
- {
- fishingSecondary = YellowFeathers;
- log("Using yellow feathers");
- }
- else if(inventory.contains(OrangeFeathers) && inventory.getItem(OrangeFeathers).getStackSize() > 0)
- {
- fishingSecondary = OrangeFeathers;
- log("Using orange feathers");
- }
- else
- {
- fishingSecondary = 314;
- log("Using feathers");
- }
- }
- else if(JCB_FishingType.getSelectedItem().toString().equals("Big Net"))
- {
- fishingType = fishingTypeNet;
- fishingMain = 305;
- fishingSpot = fishingSpotHarpoonShark;
- }
- else if(JCB_FishingType.getSelectedItem().toString().equals("Crayfish cage"))
- {
- fishingType = fishingTypeCrayfish;
- fishingMain = 13431;
- fishingSpot = fishingSpotCrayfish;
- }
- else if(JCB_FishingType.getSelectedItem().toString().equals("Fishing Rod"))
- {
- fishingMain = 307;
- if(JCB_Location.getSelectedItem().toString().equals("Living Rock Cavern"))
- {
- if(inventory.getItem(313).getStackSize() > 0)
- {
- fishingSpot=fishingSpotCaveShoal;
- fishingSecondary = 313;
- fishingType = "Bait Cavefish";
- }
- else if(inventory.getItem(15263).getStackSize() > 0)
- {
- fishingSecondary = 15263;
- fishingSpot=fishingSpotRockTail;
- fishingType = "Bait Rocktail";
- }
- }
- else
- {
- fishingType = fishingTypeBait;
- fishingSecondary = 313;
- fishingSpot = fishingSpotBait;
- }
- }
- else if(JCB_FishingType.getSelectedItem().toString().equals("Fly Fishing Rod"))
- {
- fishingType = fishingTypeLure;
- fishingMain = 309;
- configureFeathers();
- fishingSpot = fishingSpotBait;
- if(JCB_Location.getSelectedItem().toString().equals("Lumbridge"))
- {
- fishingSpotTile = lumbridgeFishingSpot;
- }
- }
- else if(JCB_FishingType.getSelectedItem().toString().equals("Harpoon"))
- {
- fishingType = fishingTypeHarpoon;
- fishingMain = 311;
- fishingSpot = fishingSpotCage;
- configuringSettings();
- }
- else if(JCB_FishingType.getSelectedItem().toString().equals("Lobster Pot"))
- {
- fishingType = fishingTypeCage;
- fishingMain = 301;
- fishingSpot = fishingSpotCage;
- }
- else if(JCB_FishingType.getSelectedItem().toString().equals("Harpoon(Shark)"))
- {
- fishingType = fishingTypeHarpoon;
- fishingMain = 311;
- fishingSpot = fishingSpotHarpoonShark;
- configuringSettings();
- }
- if(JCB_Mode.getSelectedItem().toString().equals("Bank"))
- {
- powerFish = false;
- }
- else if(JCB_Mode.getSelectedItem().toString().equals("Powerfish"))
- {
- powerFish = true;
- }
- else if(JCB_Mode.getSelectedItem().toString().equals("Stiles"))
- {
- powerFish = false;
- stiles = true;
- }
- else if(JCB_Mode.getSelectedItem().toString().equals("F1D1"))
- {
- f1d1 = true;
- }
- if(JCK_DropTuna.isSelected())
- {
- dropTuna=true;
- }
- if(location.equals("Karamja"))
- {
- if(equipment.getItem(equipment.RING).getID() == 13562)
- {
- useRing = true;
- log("Using explorers ring.");
- }
- }
- location = JCB_Location.getSelectedItem().toString();
- log("Fishing at " + JCB_Location.getSelectedItem().toString());
- log(JCB_FishingType.getSelectedItem().toString());
- log("Method: " + JCB_Mode.getSelectedItem().toString());
- }
- private RSNPC getClosestNPC(int[] NPCID)
- {
- int closestDistance=9999;
- RSNPC closestNPC = null;
- for(RSNPC npc : npcs.getAll())
- {
- for(int i : NPCID)
- {
- if(npc.getID() == i)
- {
- double npcDistance = calc.distanceTo(npc.getLocation());
- if(location.equals("Shilo Village"))
- {
- if(onNorthSideShiloNPC(npc) && !onNorthSideShiloPlayer())
- {
- npcDistance = calc.distanceTo(new RSTile(2832,2969))
- +calc.distanceBetween(new RSTile(2832,2969),new RSTile(2832,2977))
- +calc.distanceBetween(new RSTile(2832,2977),npc.getLocation());
- }
- else if(!onNorthSideShiloNPC(npc) && onNorthSideShiloPlayer())
- {
- npcDistance = calc.distanceTo(new RSTile(2832,2977))
- +calc.distanceBetween(new RSTile(2832,2969),new RSTile(2832,2977))
- +calc.distanceBetween(new RSTile(2832,2969),npc.getLocation());
- }
- }
- if(npcDistance < closestDistance)
- {
- closestNPC = npc;
- closestDistance = (int) npcDistance;
- }
- else if(npcDistance == closestDistance)
- {
- if(npc.getLocation().getX() == getMyPlayer().getLocation().getX() &&
- (npc.getLocation().getY() == getMyPlayer().getLocation().getY()+1 ||
- npc.getLocation().getY() == getMyPlayer().getLocation().getY()-1)
- ||
- npc.getLocation().getY() == getMyPlayer().getLocation().getY() &&
- (npc.getLocation().getX() == getMyPlayer().getLocation().getX()+1 ||
- npc.getLocation().getX() == getMyPlayer().getLocation().getX()-1))
- {
- closestNPC = npc;
- closestDistance = (int)(npcDistance);
- }
- }
- }
- }
- }
- return closestNPC;
- }
- public boolean onNorthSideShiloPlayer()
- {
- if(getMyPlayer().getLocation().getY() > 2973)
- {
- return true;
- }
- return false;
- }
- public boolean onNorthSideShiloNPC(RSNPC npc)
- {
- if(npc.getLocation() != new RSTile(2855,29740) && npc.getLocation().getY() > 2973)
- {
- return true;
- }
- return false;
- }
- public void dropAllExcept(int[] notToDrop)
- {
- for (int c = 0; c < 4; c++)
- {
- for (int r = 0; r < 7; r++)
- {
- boolean match = false;
- RSItem item = inventory.getItemAt(c+r*4);
- for(int itemID : notToDrop)
- {
- if(item.getID() == itemID )
- {
- match = true;
- }
- }
- if(!match && item != null && item.getID() != -1)
- {
- item.doAction("Drop");
- sleep(125,175);
- }
- }
- }
- }
- public RSPlayer getClosestPlayer()
- {
- int closestDistance=9999;
- RSPlayer closestNPC = null;
- for (RSPlayer npc : players.getAll())
- {
- double npcDistance = calc.distanceTo(getMyPlayer().getLocation());
- if(npcDistance < closestDistance)
- {
- closestNPC = npc;
- closestDistance = (int) npcDistance;
- }
- }
- return closestNPC;
- }
- public void bank()
- {
- if(game.getCurrentTab() != game.TAB_INVENTORY)
- {
- log("Opening Inventory");
- keyboard.pressKey((char) KeyEvent.VK_F1);
- sleep(random(50,200));
- keyboard.releaseKey((char) KeyEvent.VK_F1);
- }
- if(powerFish)
- {
- int speed = mouse.getSpeed();
- mouse.setSpeed(random(4,6));
- if(useUrn){
- inventory.dropAllExcept(fishingMain,fishingSecondary,20340,urnDoneID,urnStartedID,urnID);
- }else{
- inventory.dropAllExcept(fishingMain,fishingSecondary,20340);
- }
- mouse.setSpeed(random(speed-1,speed+1));
- }
- else if(f1d1)
- {
- //dropFishF1D1();
- }
- else
- {
- Status = "Banking";
- if(bank.isOpen())
- {
- if(location.equals("Karamja"))
- {
- Status = "Withdrawing coins";
- while(inventory.getCount(true , 995) < 60)
- {
- bank.withdraw(995, (1000-(inventory.getCount(true, 617)+ (inventory.getCount(true, 995)+(inventory.getCount(true, 8890)) ))));
- }
- }
- Status = "Depositing fish";
- if(fishingMain == 0)
- {
- bank.depositAll();
- }
- else
- {
- if (!handFishing && !inventory.contains(fishingMain))
- {
- if(bank.getItem(fishingMain) != null && bank.getItem(fishingMain).getStackSize() > 0)
- bank.withdraw(fishingMain,1);
- else
- {
- log("No fishing mains?");
- game.logout(true);
- stopScript();
- }
- }
- if (fishingSecondary == 0)
- {
- if(location.equals("Karamja"))
- {
- if(useUrn){
- bank.depositAllExcept(new int[]{fishingMain,995,20340,urnID,urnStartedID});
- }else{
- bank.depositAllExcept(fishingMain,995,20340);
- }
- }
- else
- {
- if(useUrn){
- bank.depositAllExcept(fishingMain,20340,urnID,urnStartedID);
- }else{
- bank.depositAllExcept(fishingMain,20340);
- }
- }
- }
- else
- {
- if(!inventory.contains(fishingSecondary) && bank.getItem(fishingSecondary) != null && bank.getItem(fishingSecondary).getStackSize() > 0)
- bank.withdraw(fishingSecondary,0);
- if(location.equals("Karamja"))
- {
- if(useUrn){
- bank.depositAllExcept(new int[]{fishingSecondary,fishingMain,995,20340,urnID,urnStartedID});
- }else{
- bank.depositAllExcept(new int[]{fishingSecondary,fishingMain,995,20340});
- }
- }
- else
- {
- if(useUrn){
- bank.depositAllExcept(new int[]{fishingSecondary,fishingMain,20340,urnID,urnStartedID});
- }else{
- bank.depositAllExcept(new int[]{fishingSecondary,fishingMain,20340});
- }
- }
- }
- if(useUrn && !inventory.containsOneOf(urnID,urnStartedID)){
- if(bank.getItem(urnID) != null){
- if(bank.withdraw(urnID, 1)){
- sleep(500);
- }
- }else{
- log("Out of urns please restock");
- useUrn=false;
- }
- }
- bank.close();
- sleep(500,800);
- }
- }
- else if(!bank.isOpen())
- {
- Status = "Walking to bank area";
- runEnergy();
- if(location.equals("Lumbridge"))
- {
- lumbridgeBanking();
- }
- else if(location.equals("Karamja"))
- {
- walkToBankKaramja();
- }
- else
- {
- if(bankArea.contains(getMyPlayer().getLocation()) || (walking.getDestination() != null && bankArea.contains(walking.getDestination())))
- {
- Status = "Opening bank";
- bank.open();
- sleep(1000,1500);
- }
- else
- {
- Status = "Walking to bank";
- if(calc.distanceTo(walking.getDestination()) < 5)
- {
- runEnergy();
- if(location.equals("Piscarious"))
- {
- if(getMyPlayer().getLocation().getX() < 3234)
- {
- walkPath(piscariousWest);
- }
- else
- {
- walkPath(piscariousEast);
- }
- }
- else
- {
- walkPath(bankPath);
- }
- }
- }
- }
- }
- }
- }
- Thread usageThread = new Thread() {
- @Override
- public void run() {
- setPriority(9);
- while (isRunning()) {
- try {
- if (!isRunning()) {
- usageThread.interrupt();
- log("Shutting down AntiBan thread.");
- }
- long total = Runtime.getRuntime().totalMemory();
- long used = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
- log("Used: " + ((used/1024)/1024) + "/" + ((total/1024)/1024));
- System.gc();
- total = Runtime.getRuntime().totalMemory();
- used = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
- log("After GC: " + ((used/1024)/1024) + "/" + ((total/1024)/1024));
- sleep(3600000);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- if (!isRunning()) {
- log("Shutting down AntiBan thread.");
- usageThread.interrupt();
- }
- }
- };
- public void onFinish()
- {
- final int fishpExpHr = (int) ((currentXP-startingXP) * 3600000D / (System.currentTimeMillis() - startTime));
- log("Thanks for using patyFisher");
- log("Levels Gained: " + levelsgained);
- log("Fishies Caught: " + fishesCaught);
- log("Time running:" + hours + ":" + minutes + ":"+ seconds);
- log("Experience Gained: " + (currentXP-startingXP) +" (P/H " + fishpExpHr +" )");
- }
- public void configureFeathers()
- {
- if(inventory.contains(StripyFeathers))
- {
- log("Using stripy feathers");
- fishingSecondary = StripyFeathers;
- }
- else if(inventory.contains(RedFeathers))
- {
- log("Using red feathers");
- fishingSecondary = RedFeathers;
- }
- else if(inventory.contains(BlueFeathers))
- {
- log("Using blue feathers");
- fishingSecondary = BlueFeathers;
- }
- else if(inventory.contains(YellowFeathers))
- {
- log("Using yellow feathers");
- fishingSecondary = YellowFeathers;
- }
- else if(inventory.contains(OrangeFeathers))
- {
- log("Using oranage feathers");
- fishingSecondary = OrangeFeathers;
- }
- else
- {
- log("Using feathers");
- fishingSecondary = 314;
- }
- }
- public void configuringSettings()
- {
- if(inventory.getCount(10129) > 0)
- {
- fishingMain = 10129;
- log("Using " + fishingMain);
- }
- else if(equipment.containsOneOf(10129))
- {
- fishingMain = 0;
- handFishing = true;
- log("Using barb tailed harpoon equipped");
- }
- else if(inventory.getCount(14101) > 0|| equipment.containsOneOf(14101))
- {
- fishingMain = 14101;
- log("Using " + fishingMain);
- }
- else if(inventory.getCount(14109) > 0|| equipment.containsOneOf(14109))
- {
- fishingMain = 14109;
- log("Using " + fishingMain);
- }
- else if(inventory.getCount(311) > 0)
- {
- fishingMain = 311;
- log("Using " + fishingMain);
- }
- else
- {
- if(fishingSpot == fishingSpotCage && currentLevel >= 55 && skills.getCurrentLevel(skills.STRENGTH) >= 34)
- {
- fishingMain = 0;
- handFishing = true;
- log("Using Barbarian hand fishing");
- }
- else if(fishingSpot == fishingSpotHarpoonShark && currentLevel >= 96 && skills.getCurrentLevel(skills.STRENGTH) >= 76)
- {
- fishingMain = 0;
- handFishing = true;
- log("Using Barbarian hand fishing");
- }
- else
- {
- log("You don't have the requirements to barbarian hand fish");
- if(!inventory.contains(fishingSecondary))
- {
- Timer failSafeTimer = new Timer(random(4000,6000));
- while(failSafeTimer.isRunning() && !inventory.contains(fishingSecondary))
- {
- if(game.getCurrentTab() != game.TAB_INVENTORY)
- {
- keyboard.pressKey((char) KeyEvent.VK_F1);
- sleep(random(50,200));
- keyboard.releaseKey((char) KeyEvent.VK_F1);
- sleep(200,400);
- }
- }
- if(!inventory.contains(fishingSecondary))
- {
- game.logout(false);
- log("Out of supplies");
- stopScript();
- }
- }
- sleep(5000,6000);
- }
- }
- }
- public void setupUrns(){
- String text = JCB_UrnType.getSelectedItem().toString();
- if(text.equals("Cracked")){
- useUrn = true;
- urnID = crackedUrnID;
- urnStartedID = crackedUrnStartedID;
- urnDoneID = crackedUrnDoneID;
- }else if(text.equals("Fragile")){
- useUrn = true;
- urnID = fragileUrnID;
- urnStartedID = fragileUrnStartedID;
- urnDoneID = fragileUrnDoneID;
- }else if(text.equals("Regular")){
- useUrn = true;
- urnID = regularCookingUrnID;
- urnStartedID = regularCookingUrnStartedID;
- urnDoneID = regularUrnDoneID;
- }else if (text.equals("Strong")) {
- useUrn = true;
- urnID = strongUrn;
- urnStartedID = strongUrnStartedID;
- urnDoneID = strongUrnDoneID;
- }else if (text.equals("Decorated")) {
- useUrn = true;
- urnID = decoratedUrnID;
- urnStartedID = decoratedStartedID;
- urnDoneID = decoratedDoneID;
- }
- }
- public void antiBan()
- {
- if(getMyPlayer().getAnimation() != -1 && !getMyPlayer().isMoving())
- {
- try {
- switch (random(1,10))
- {
- case 1:
- log("[Antiban] Changing camera pitch");
- int startingPitch = camera.getPitch();
- camera.setPitch(random(20, 100));
- log("Changed pitch from " + startingPitch + " to " + camera.getPitch());
- break;
- case 2:
- log("[Antiban] Changing camera angle");
- int starting = camera.getAngle();
- camera.setAngle(random(camera.getAngle()-10,camera.getAngle()+10));
- log("Changed camera angle from " + starting + " to " + camera.getAngle());
- break;
- case 3:
- log("[Antiban] Changing camera pitch");
- int startingPitch2 = camera.getPitch();
- camera.setPitch(random(camera.getPitch()-15, camera.getPitch()+25));
- log("Changed pitch from " + startingPitch2 + " to " + camera.getPitch());
- break;
- case 4:
- log("[Antiban] Moving camera randomly");
- camera.moveRandomly(3000);
- break;
- case 5:
- log("[Antiban] Changing camera angle (Single direction)");
- sleep(200, 300);
- int startingAngle = camera.getAngle();
- int randomAntiban = random(1,4);
- if(randomAntiban == 1)
- {
- keyboard.pressKey((char) KeyEvent.VK_LEFT);
- sleep(random(400,1100));
- keyboard.releaseKey((char) KeyEvent.VK_LEFT);
- }
- else if(randomAntiban == 2)
- {
- keyboard.pressKey((char) KeyEvent.VK_RIGHT);
- sleep(random(400,1100));
- keyboard.releaseKey((char) KeyEvent.VK_RIGHT);
- }
- else if(randomAntiban == 3)
- {
- keyboard.pressKey((char) KeyEvent.VK_UP);
- sleep(random(400,1100));
- keyboard.releaseKey((char) KeyEvent.VK_UP);
- }
- else if(randomAntiban == 4)
- {
- keyboard.pressKey((char) KeyEvent.VK_DOWN);
- sleep(random(400,1100));
- keyboard.releaseKey((char) KeyEvent.VK_DOWN);
- }
- log("Changed camera angle from " + startingAngle + " to " + camera.getAngle());
- break;
- case 6:
- log("[Antiban] Moving mouse slightly");
- Point mouseLocation = mouse.getLocation();
- mouse.moveSlightly();
- log("Moved mouse from " + "(" + mouseLocation.x +"," + mouseLocation.y + ") to" +
- "(" + mouse.getLocation().x +"," + mouse.getLocation().y + ")");
- break;
- case 7:
- log("[Antiban] Moving mouse offscreen");
- mouse.moveOffScreen();
- break;
- case 8:
- log("[Antiban] Checking fishing experience");
- if(game.getCurrentTab() != game.TAB_STATS)
- {
- log("Opening Stats tab");
- game.openTab(game.TAB_STATS);
- }
- mouse.move(new Point(random(678,727),random(266,316)));
- sleep(800,4000);
- break;
- case 9:
- log("[Antiban] Opening friends list");
- game.openTab(game.TAB_FRIENDS);
- sleep(500,600);
- break;
- case 10:
- log("[Antiban] Changing camera angle (Multi direction)");
- sleep(200, 300);
- int startingAngle2 = camera.getAngle();
- int randomAntiban2 = random(1,4);
- int random2nd = random(1,2);
- if(randomAntiban2 == 1)
- {
- keyboard.pressKey((char) KeyEvent.VK_LEFT);
- if(random2nd==1)
- {
- keyboard.pressKey((char) KeyEvent.VK_DOWN);
- }
- else
- {
- keyboard.pressKey((char) KeyEvent.VK_UP);
- }
- sleep(random(400,1000));
- keyboard.releaseKey((char) KeyEvent.VK_LEFT);
- if(random2nd==1)
- {
- keyboard.releaseKey((char) KeyEvent.VK_DOWN);
- }
- else
- {
- keyboard.releaseKey((char) KeyEvent.VK_UP);
- }
- }
- else if(randomAntiban2 == 2)
- {
- keyboard.pressKey((char) KeyEvent.VK_RIGHT);
- if(random2nd==1)
- {
- keyboard.pressKey((char) KeyEvent.VK_DOWN);
- }
- else
- {
- keyboard.pressKey((char) KeyEvent.VK_UP);
- }
- sleep(random(500,1100));
- keyboard.releaseKey((char) KeyEvent.VK_RIGHT);
- if(random2nd==1)
- {
- keyboard.releaseKey((char) KeyEvent.VK_DOWN);
- }
- else
- {
- keyboard.releaseKey((char) KeyEvent.VK_UP);
- }
- }
- log("Changed camera angle from " + startingAngle2 + " to " + camera.getAngle());
- break;
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- public void dropFishF1D1()
- {
- RSNPC fishingNPC = npcs.getNearest(fishingSpot);
- if(location.equals("Fishing Guild"))
- {
- fishingNPC = getClosestNPCFishingGuild();
- }
- int[] items = (new int[]{fishingSecondary,fishingMain});
- int isID = inventory.getItemAt(0).getID();
- if(inventory.getItemAt(0).getID() != -1 && (isID == items[0] || isID == items[1] || isID == 314 || isID == 20340))
- {
- if(inventory.getItemAt(27).getID() != -1 && (isID != items[0]|| isID != items[1] || isID != 314 || isID != 20340))
- {
- mouse.click(random(570,580),random(216,240), true);
- mouse.drag(663, 443);
- }
- else
- {
- mouse.click(random(570,580),random(216,240), true);
- mouse.drag(703, 444);
- }
- }
- else
- {
- if(inventory.getItemAt(0) != null && inventory.getItemAt(0).getID() != -1 && (isID != items[0] && isID != items[1] && isID != 314 && isID != 20340))
- {
- inventory.getItemAt(0).interact("Drop");
- sleep(50,100);
- }
- if(fishingNPC != null)
- {
- if(fishingNPC.isOnScreen())
- {
- if(fishingNPC.getActions() == null)
- {
- mouse.move(fishingNPC.getLocation().getX(),fishingNPC.getLocation().getY());
- if(menu.getActions() != null && menu.getActions()[0].equals(fishingType))
- {
- mouse.click(fishingNPC.getLocation().getX(),fishingNPC.getLocation().getY(),true);
- sleep(600,800);
- }
- else
- {
- if(!menu.isOpen())
- {
- mouse.click(fishingNPC.getLocation().getX(),fishingNPC.getLocation().getY(),false);
- sleep(600,800);
- }
- if(menu.isOpen())
- {
- menu.doAction(fishingType);
- sleep(600,800);
- }
- }
- sleep(400,500);
- }
- else
- {
- fishingNPC.doAction(fishingType);
- }
- }
- else
- {
- if(calc.tileOnMap(fishingNPC.getLocation()))
- {
- walking.walkTileMM(fishingNPC.getLocation());
- }
- else
- {
- walking.walkTo(fishingNPC.getLocation());
- }
- sleep(500,600);
- waitUntilNotMoving();
- }
- }
- sleep(1000,1500);
- if(mouse.getLocation().getX() > 566 && mouse.getLocation().getX() < 590
- && mouse.getLocation().getY() > 217 && mouse.getLocation().getY()< 238)
- {
- }
- else
- {
- mouse.move(random(566,590),random(217,238));
- Timer t = new Timer(3000);
- while(getMyPlayer().getAnimation() == -1 && !t.isRunning())
- {
- sleep(300,400);
- }
- }
- while(getMyPlayer().getAnimation() != -1 && inventory.getItemAt(0) != null && inventory.getItemAt(0).getID() == -1)
- {
- if(!antiBanTimer.isRunning())
- {
- antiBan();
- antiBanTimer.setEndIn(random(60000,100000));
- }
- Status = "Fishing";
- sleep(100,200);
- }
- sleep(200,300);
- }
- }
- private final Color color1 = new Color(0, 0, 255, 122);
- private final Color color2 = new Color(0, 0, 0, 16);
- private final Color color3 = new Color(204, 0, 0);
- private final Color color4 = new Color(0, 153, 0);
- private final Color color5 = new Color(102, 102, 255);
- private final Color color6 = new Color(0, 0, 0);
- Color fishingSpotColor = new Color(50, 205, 50, 75);
- private final Font font1 = new Font("Palatino Linotype", 1, 13);
- private final Font font2 = new Font("Palatino Linotype", 1, 12);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Image img1 = getImage("http://img716.imageshack.us/img716/6219/9170e523.png");
- private final int getXPTL(int currentLevel, long currentXP2) {
- return (int) (xpTable[currentLevel + 1] - currentXP2);
- }
- private final int getXPTTL(int currentLevel) {
- return xpTable[currentLevel + 1] - xpTable[currentLevel];
- }
- private final RenderingHints antialiasing = new RenderingHints(
- RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch(IOException e) {
- return null;
- }
- }
- public RSTile nextTile(RSTile[] path)
- {
- RSTile returnTile = null;
- for(int i = 0; i < path.length; i++)
- {
- RSTile tile = path[i];
- if(calc.tileOnMap(tile))
- {
- returnTile = tile;
- }
- }
- return returnTile;
- }
- private void walkPath(RSTile[] path) {
- if (!getMyPlayer().isMoving() || calc.distanceTo(walking.getDestination()) < 4) {
- RSTile tile= nextTile(path);
- if(tile == null)
- return;
- tile = tile.randomize(2,2);
- if(walking.walkTileMM(tile)){
- sleep(500,600);
- }
- }else{
- if(!walking.isRunEnabled() && walking.getEnergy() > runEnergy){
- walking.setRun(true);
- sleep(600,800);
- runEnergy = random(40,64);
- }
- }
- }
- public void waitUntilNotMoving()
- {
- Timer sleepTimer = new Timer(random(1500,2000));
- while(getMyPlayer().isMoving() && sleepTimer.isRunning())
- {
- sleep(100,150);
- }
- }
- public void waitUntilMoving()
- {
- Timer sleepTimer = new Timer(random(1500,2000));
- while(!getMyPlayer().isMoving() && sleepTimer.isRunning())
- {
- sleep(100,150);
- }
- }
- @SuppressWarnings("serial")
- public class GUI extends javax.swing.JFrame {
- /** Creates new form GUIForFisher */
- public GUI() {
- 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.
- */
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- LBL_Location = new JLabel();
- LBL_FishingType = new JLabel();
- LBL_Mode = new JLabel();
- LBL_UrnType = new JLabel();
- JCB_Location = new JComboBox();
- JCB_FishingType = new JComboBox();
- JCB_Mode = new JComboBox();
- JCB_UrnType = new JComboBox();
- JCK_DropTuna = new JCheckBox();
- LBL_Title = new JLabel();
- BTN_Start = new JButton();
- //======== this ========
- setTitle("Paty Fisher");
- Container contentPane = getContentPane();
- contentPane.setLayout(null);
- //---- LBL_Location ----
- LBL_Location.setText("Location: ");
- contentPane.add(LBL_Location);
- LBL_Location.setBounds(new Rectangle(new Point(20, 50), LBL_Location.getPreferredSize()));
- //---- LBL_FishingType ----
- LBL_FishingType.setText("Type of fish: ");
- contentPane.add(LBL_FishingType);
- LBL_FishingType.setBounds(new Rectangle(new Point(5, 75), LBL_FishingType.getPreferredSize()));
- //---- LBL_Mode ----
- LBL_Mode.setText("Fishing type: ");
- contentPane.add(LBL_Mode);
- LBL_Mode.setBounds(new Rectangle(new Point(5, 100), LBL_Mode.getPreferredSize()));
- //---- LBL_UrnType ----
- LBL_UrnType.setText("Type of urn:");
- contentPane.add(LBL_UrnType);
- LBL_UrnType.setBounds(new Rectangle(new Point(10, 125), LBL_UrnType.getPreferredSize()));
- //---- JCB_Location ----
- JCB_Location.setModel(new DefaultComboBoxModel(new String[] {
- "Barbarian Village",
- "Catherby",
- "Draynor Village ",
- "Fishing Guild",
- "Karamja",
- "Lumbridge",
- "Ottos",
- "Piscarious",
- "Rasolo",
- "Shilo Village"
- }));
- contentPane.add(JCB_Location);
- JCB_Location.setBounds(new Rectangle(new Point(75, 45), JCB_Location.getPreferredSize()));
- //---- JCB_UrnType ----
- JCB_UrnType.setModel(new DefaultComboBoxModel(new String[] {
- "None",
- "Cracked",
- "Fragile",
- "Regular",
- "Decorated",
- "Strong"
- }));
- contentPane.add(JCB_UrnType);
- JCB_UrnType.setBounds(75, 120, JCB_UrnType.getPreferredSize().width, 20);
- //---- JCB_FishingType ----
- JCB_FishingType.setModel(new DefaultComboBoxModel(new String[] {
- "Fly Fishing Rod",
- "Fishing Rod"
- }));
- JCB_Location.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent evt) {
- JCB_LocationItemStateChanged(evt);
- }
- });
- contentPane.add(JCB_FishingType);
- JCB_FishingType.setBounds(new Rectangle(new Point(75, 70), JCB_FishingType.getPreferredSize()));
- //---- JCB_Mode ----
- JCB_Mode.setModel(new DefaultComboBoxModel(new String[] {
- "Bank",
- "F1D1",
- "Powerfish"
- }));
- contentPane.add(JCB_Mode);
- JCB_Mode.setBounds(new Rectangle(new Point(75, 95), JCB_Mode.getPreferredSize()));
- contentPane.add(JCB_UrnType);
- JCB_UrnType.setBounds(75, 120, JCB_UrnType.getPreferredSize().width, 20);
- //---- JCK_DropTuna ----
- JCK_DropTuna.setText("Drop Tuna: ");
- JCK_DropTuna.setHorizontalAlignment(SwingConstants.CENTER);
- contentPane.add(JCK_DropTuna);
- JCK_DropTuna.setBounds(0, 140, 185, 30);
- //---- LBL_Title ----
- LBL_Title.setText("Paty Fisher");
- LBL_Title.setFont(new Font("Calibri", Font.BOLD, 18));
- LBL_Title.setHorizontalAlignment(SwingConstants.CENTER);
- contentPane.add(LBL_Title);
- LBL_Title.setBounds(0, 0, 185, 35);
- //---- BTN_Start ----
- BTN_Start.setText("Start");
- contentPane.add(BTN_Start);
- BTN_Start.setBounds(45, 170, 85, BTN_Start.getPreferredSize().height);
- BTN_Start.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- BTN_StartActionPerformed(evt);
- }
- });
- { // 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);
- }
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- private void BTN_StartActionPerformed(java.awt.event.ActionEvent evt) {
- this.setVisible(false);
- }
- private void JCB_LocationItemStateChanged(java.awt.event.ItemEvent evt) {
- JCB_FishingType.removeAllItems();
- JCB_Mode.removeAllItems();
- JCB_Mode.addItem("Bank");
- JCB_Mode.addItem("Powerfish");
- JCB_Mode.addItem("F1D1");
- if(JCB_Location.getSelectedItem().toString().equals("Barbarian Village"))
- {
- JCB_FishingType.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"Fishing Rod","Fly Fishing Rod"}));
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Catherby"))
- {
- JCB_FishingType.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"Net","Big Net","Fishing Rod","Fly Fishing Rod","Harpoon","Lobster Pot","Harpoon(Shark)"}));
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Draynor Village"))
- {
- JCB_FishingType.addItem("Net");
- JCB_FishingType.addItem("Fishing Rod");
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Fishing Guild"))
- {
- JCB_FishingType.addItem("Net");
- JCB_FishingType.addItem("Fishing Rod");
- JCB_FishingType.addItem("Fly Fishing Rod");
- JCB_FishingType.addItem("Big Net");
- JCB_FishingType.addItem("Harpoon");
- JCB_FishingType.addItem("Lobster Pot");
- JCB_FishingType.addItem("Harpoon(Shark)");
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Karamja"))
- {
- JCB_FishingType.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"Net","Fishing Rod","Harpoon","Lobster Pot"}));
- JCB_Mode.addItem("Stiles");
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Lumbridge"))
- {
- JCB_FishingType.addItem("Fishing Rod");
- JCB_FishingType.addItem("Fly Fishing Rod");
- JCB_FishingType.addItem("Crayfish cage");
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Living Rock Cavern"))
- {
- JCB_FishingType.addItem("Fishing Rod");
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Piscarious"))
- {
- JCB_FishingType.addItem("Net");
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Shilo Village"))
- {
- JCB_FishingType.addItem("Fishing Rod");
- JCB_FishingType.addItem("Fly Fishing Rod");
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Ottos"))
- {
- JCB_FishingType.addItem("Barbarian fishing");
- }
- else if(JCB_Location.getSelectedItem().toString().equals("Rasolo"))
- {
- JCB_Mode.addItem("Sell");
- JCB_Mode.removeItem("Bank");
- JCB_FishingType.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"Fishing Rod","Fly Fishing Rod"}));
- }
- }
- private void JCK_CookingActionPerformed(java.awt.event.ActionEvent evt) {
- if(JCK_Cooking.isSelected())
- {
- JCB_CookLocation.setEnabled(true);
- JCB_CookingType.setEnabled(true);
- JCK_UseFire.setEnabled(true);
- JRB_Fish.setEnabled(true);
- JRB_Time.setEnabled(true);
- JTF_Lower.setEnabled(true);
- JTF_Higher.setEnabled(true);
- }
- else
- {
- JCB_CookLocation.setEnabled(false);
- JCB_CookingType.setEnabled(false);
- JCK_UseFire.setEnabled(false);
- JRB_Fish.setEnabled(false);
- JRB_Time.setEnabled(false);
- JTF_Lower.setEnabled(false);
- JTF_Higher.setEnabled(false);
- }
- }
- private void JRB_TimeActionPerformed(java.awt.event.ActionEvent evt) {
- if(JRB_Time.isSelected())
- {
- JRB_Fish.setSelected(false);
- }
- else
- {
- JRB_Fish.setSelected(true);
- }
- }
- private void JRB_FishActionPerformed(java.awt.event.ActionEvent evt) {
- if(JRB_Fish.isSelected())
- {
- JRB_Time.setSelected(false);
- }
- else
- {
- JRB_Time.setSelected(true);
- }
- }
- }
- public String TimeToLevel(int TTL)
- {
- final long t_seconds = TTL / 1000;
- final long t_minutes = t_seconds / 60;
- final long t_hours = t_minutes / 60;
- final long seconds1 = t_seconds % 60;
- final long minutes1 = t_minutes % 60;
- final long hours1 = t_hours;
- return (nf.format(hours1) + ":" + nf.format(minutes1) + ":" + nf.format(seconds1));
- }
- @Override
- public void onRepaint(Graphics g) {
- long millis = System.currentTimeMillis() - startTime;
- hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- seconds = millis / 1000;
- if(currentLevel == 0){
- startingLevel = skills.getCurrentLevel(Skills.FISHING);
- startingXP = skills.getCurrentExp(Skills.FISHING);
- }
- currentLevel = skills.getCurrentLevel(Skills.FISHING);
- currentXP = skills.getCurrentExp(Skills.FISHING);
- final int fishpExpHr = (int) ((currentXP-startingXP) * 3600000D / (System.currentTimeMillis() - startTime));
- ((Graphics2D) g).setRenderingHints(antialiasing);
- g.setColor(color1);
- g.fillRoundRect(224, 208, 292, 128, 16, 16);
- g.setColor(color2);
- ((Graphics2D) g).setStroke(stroke1);
- g.drawRoundRect(224, 208, 292, 128, 16, 16);
- g.setColor(color6);
- ((Graphics2D) g).setStroke(stroke1);
- g.drawImage(img1, 468, 285, null);
- g.setFont(font1);
- g.setColor(color3);
- g.drawString("Paty Fisher " + 4.2, 392, 221);
- g.setFont(font2);
- g.setColor(color4);
- g.drawString("Author: Patyfatycake ©", 239, 221);
- g.drawString("Status: " + Status, 239, 236);
- g.drawString("Location: " + location, 239, 251);
- g.drawString("Levels Gained: " + levelsgained, 359, 266 );
- g.drawString("Fishies Caught: " + fishesCaught, 239, 266);
- g.drawString("Time running:" + hours + ":" + minutes + ":"+ seconds, 239, 281);
- g.drawString("Experience Gained: " + (currentXP-startingXP) +" (P/H " + fishpExpHr +" )", 239, 296);
- g.setColor(color5);
- g.fillRoundRect(239, 311, 150, 16, 9, 9);
- g.setColor(Color.green.darker());
- g.fillRoundRect(239, 311, (int) ((1.00f - ((float) getXPTL(currentLevel,
- currentXP) / (float) getXPTTL(currentLevel))) * 150), 16,
- 9, 9);
- g.setColor(color1);
- g.drawString((int) ((1.00f - ((float) getXPTL(currentLevel,
- currentXP) / (float) getXPTTL(currentLevel))) * 100)
- + "% to "+(currentLevel+1), 280, 324);
- }
- @Override
- public void messageReceived(MessageEvent e) {
- String word = e.getMessage();
- if (word.contains("You catch"))
- {
- fishesCaught++;
- }
- else if (word.contains("catch two"))
- {
- fishesCaught++;
- fishesCaught++;
- }
- else if (word.contains("just advanced a Fishing"))
- {
- levelsgained++;
- }else if(useUrn && word.contains("urn is full")){
- urnDone = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement