Aleksander

Aeronix's Potato Picker

May 3rd, 2013
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 19.15 KB | None | 0 0
  1. package scripts;
  2.  
  3. import java.awt.*;
  4. import java.awt.event.ActionEvent;
  5. import java.awt.event.ActionListener;
  6. import java.awt.event.KeyEvent;
  7. import java.awt.event.WindowEvent;
  8. import java.awt.event.WindowListener;
  9. import java.util.ArrayList;
  10.  
  11. import org.tribot.api.Timing;
  12. import org.tribot.api.input.Keyboard;
  13. import org.tribot.api.input.Mouse;
  14. import org.tribot.api.types.colour.Tolerance;
  15. import org.tribot.api.types.generic.Condition;
  16. import org.tribot.api2007.Banking;
  17. import org.tribot.api2007.Camera;
  18. import org.tribot.api2007.GameTab;
  19. import org.tribot.api2007.GameTab.TABS;
  20. import org.tribot.api2007.Interfaces;
  21. import org.tribot.api2007.Inventory;
  22. import org.tribot.api2007.Objects;
  23. import org.tribot.api2007.PathFinding;
  24. import org.tribot.api2007.Player;
  25. import org.tribot.api2007.Walking;
  26. import org.tribot.api2007.types.RSInterfaceChild;
  27. import org.tribot.api2007.types.RSItem;
  28. import org.tribot.api2007.types.RSObject;
  29. import org.tribot.api2007.types.RSTile;
  30. import org.tribot.script.Script;
  31. import org.tribot.script.ScriptManifest;
  32. import org.tribot.script.interfaces.Painting;
  33.  
  34. @ScriptManifest(authors = { "Aeronix" }, category = "Money Making", name = "Aeronix's Potato Picker")
  35. public class AeroPotatoPicker extends Script implements Painting {
  36.  
  37.     public static SleepCondition Skip;
  38.     public static Integer ITEM_POTATO_ID = 1942;
  39.     public static Integer OBJECT_POTATO_ID = 312;
  40.  
  41.     public static int[] sack_Ids = { 5418, 5420, 5422, 5424, 5426, 5428, 5430, 5432, 5434, 5436 };
  42.    
  43.     private Integer Potatoes_Picked = 0;
  44.     private Double Version = 1.4;
  45.     private Activity currentActivity = Activity.Picking;
  46.     private Boolean Running = false;
  47.     private Boolean SackSupport = false;
  48.  
  49.     Rectangle bankArea = new Rectangle(3092, 3240, 6, 5);
  50.     RSArea PotatoField = null;
  51.    
  52.     RSTile[] potatoToBank = new RSTile[] { new RSTile(3146, 3286, 0),
  53.             new RSTile(3145, 3294, 0), new RSTile(3135, 3288, 0),
  54.             new RSTile(3135, 3275, 0), new RSTile(3135, 3263, 0),
  55.             new RSTile(3122, 3262, 0), new RSTile(3111, 3259, 0),
  56.             new RSTile(3105, 3251, 0), new RSTile(3094, 3244, 0), };
  57.     RSTile[] bankToPotato;
  58.  
  59.     public class SleepCondition {
  60.         Condition C;
  61.         Integer Timeout;
  62.  
  63.         SleepCondition(Condition c, Integer timeout) {
  64.             C = c;
  65.             Timeout = timeout;
  66.         }
  67.     }
  68.    
  69.     public enum Activity {
  70.         Picking,
  71.         Extract
  72.     }
  73.  
  74.     private final Color color1 = new Color(0, 0, 0);
  75.     private final Color color2 = new Color(0, 0, 0, 130);
  76.     private final Color color3 = new Color(255, 255, 255);
  77.  
  78.     private final BasicStroke stroke1 = new BasicStroke(1);
  79.  
  80.     private final Font font1 = new Font("Arial", 0, 12);
  81.     private final Font font2 = new Font("Arial", 0, 15);
  82.     private final Font font3 = new Font("Arial", 0, 11);
  83.  
  84.     @Override
  85.     public void onPaint(Graphics arg0) {
  86.         if (getRunningTime() == 0)
  87.             return;
  88.         Graphics2D g = (Graphics2D) arg0;
  89.         Integer hourRate = (int) (Potatoes_Picked * 3600000 / (getRunningTime()));
  90.         String potatoes = String.format("%d Potatoes (%d/HR)", Potatoes_Picked,
  91.                 hourRate);
  92.         String timeRan = Timing.msToString(getRunningTime());
  93.         g.setColor(color1);
  94.         g.setStroke(stroke1);
  95.         g.drawRect(556, 375, 173, 81);
  96.         g.setColor(color2);
  97.         g.fillRect(557, 376, 172, 80);
  98.         g.setColor(color3);
  99.         g.setFont(font1);
  100.         g.drawString("Picked:", 571, 420);
  101.         g.drawString("Time Ran:", 571, 398);
  102.         g.setFont(font2);
  103.         g.setColor(color1);
  104.         g.drawString("Aeronix's Potato Picker", 571, 449);
  105.         g.setColor(color3);
  106.         g.drawString("Aeronix's Potato Picker", 569, 447);
  107.         g.setFont(font3);
  108.         g.setColor(color1);
  109.         g.drawString(timeRan, 638, 401);
  110.         g.setColor(color3);
  111.         g.drawString(timeRan, 635, 398);
  112.         g.setColor(color1);
  113.         g.drawString(potatoes, 620, 422);
  114.         g.setColor(color3);
  115.         g.drawString(potatoes, 618, 420);
  116.     }
  117.  
  118.     @Override
  119.     public void run() {
  120.         Skip = new SleepCondition(new Condition() {
  121.             @Override
  122.             public boolean active() {
  123.                 return true;
  124.             }
  125.         }, 1);
  126.         println("Aeronix's Potato Picker BETA, running version " + Version + ".");
  127.         println("Please remember to reguarly check for updates on the thread.");
  128.         Mouse.setSpeed(170);
  129.         bankToPotato = reversePath(potatoToBank);
  130.         PotatoField = new RSArea(new RSTile[] { new RSTile(3153, 3291, 0), new RSTile(3142, 3291, 0), new RSTile(3142, 3290, 0),
  131.                 new RSTile(3138, 3290, 0), new RSTile(3138, 3286, 0), new RSTile(3137, 3285, 0),
  132.                 new RSTile(3137, 3280, 0), new RSTile(3138, 3279, 0), new RSTile(3138, 3275, 0),
  133.                 new RSTile(3137, 3274, 0), new RSTile(3137, 3269, 0), new RSTile(3138, 3268, 0),
  134.                 new RSTile(3141, 3268, 0), new RSTile(3141, 3267, 0), new RSTile(3150, 3267, 0),
  135.                 new RSTile(3150, 3268, 0), new RSTile(3153, 3268, 0), new RSTile(3155, 3270, 0),
  136.                 new RSTile(3155, 3273, 0), new RSTile(3156, 3273, 0), new RSTile(3156, 3282, 0),
  137.                 new RSTile(3157, 3282, 0), new RSTile(3157, 3288, 0), new RSTile(3154, 3291, 0) });
  138.         final AeroPotatoPicker instance = this;
  139.         java.awt.EventQueue.invokeLater(new Runnable() {
  140.             public void run() {
  141.                 new PotatoPicker(instance).setVisible(true);
  142.             }
  143.         });
  144.         while (true) {
  145.             if (!Running) {
  146.                 continue;
  147.             }
  148.             SleepCondition result = loop();
  149.             Timing.waitCondition(result.C, result.Timeout);
  150.         }
  151.     }
  152.  
  153.     public SleepCondition loop() {
  154.         SleepCondition resultCondition = Skip;
  155.         if (currentActivity == Activity.Picking)
  156.         {
  157.             if (haveAmountInterface()) {
  158.                 final int Count = Inventory.getCount(5418);
  159.                 Keyboard.typeSend("18");
  160.                 resultCondition = new SleepCondition(new Condition() {
  161.                     @Override
  162.                     public boolean active() {
  163.                         return Inventory.getCount(5418) != Count;
  164.                     }
  165.                 }, 1500);
  166.                 Banking.close();
  167.             } else if (Inventory.isFull()) {
  168.                 if (isInBank()) {
  169.                     RSObject[] booth = Objects.find(10, 2213);
  170.                     if (Banking.isBankScreenOpen()) {
  171.                         final int Count = Inventory.getCount(ITEM_POTATO_ID);
  172.                         Banking.depositAll();
  173.                         if (SackSupport) {
  174.                             if (Banking.find(5418).length == 0) {
  175.                                 SackSupport = false;
  176.                             } else {
  177.                                 Banking.find(5418)[0].click("Withdraw X");
  178.                                 resultCondition = new SleepCondition(new Condition() {
  179.                                     @Override
  180.                                     public boolean active() {
  181.                                         return haveAmountInterface();
  182.                                     }
  183.                                 }, 1500);
  184.                             }
  185.                         } else {
  186.                             resultCondition = new SleepCondition(new Condition() {
  187.                                 @Override
  188.                                 public boolean active() {
  189.                                     return Inventory.getCount(ITEM_POTATO_ID) != Count;
  190.                                 }
  191.                             }, 1500);
  192.                             Banking.close();
  193.                         }
  194.                     } else if (booth[0].click("Bank")) {
  195.                         if (GameTab.getOpen() != TABS.INVENTORY) {
  196.                             GameTab.open(TABS.INVENTORY);
  197.                         }
  198.                         resultCondition = new SleepCondition(new Condition() {
  199.                             @Override
  200.                             public boolean active() {
  201.                                 return Banking.isBankScreenOpen();
  202.                             }
  203.                         }, 3000);
  204.                     }
  205.                 } else if (isInPotatoField() && containsEmptySacks() && SackSupport) {
  206.                     RSItem[] Sacks = Inventory.find(sack_Ids);
  207.                     if (Sacks.length > 0) {
  208.                         final int Count = Inventory.getAll().length;
  209.                         if (Sacks[0].click("Fill")) {
  210.                             resultCondition = new SleepCondition(new Condition() {
  211.                                 @Override
  212.                                 public boolean active() {
  213.                                     return Inventory.getAll().length != Count;
  214.                                 }
  215.                             }, 1250);
  216.                         }
  217.                     }
  218.                 } else if (isInPotatoField() && !isGateOpen()) {
  219.                     if (openGate()) {
  220.                         resultCondition = new SleepCondition(new Condition() {
  221.                             @Override
  222.                             public boolean active() {
  223.                                 return isGateOpen();
  224.                             }
  225.                         }, 5000);
  226.                     }
  227.                 } else if (!Player.isMoving() && isGateOpen()) {
  228.                     runPath(potatoToBank);
  229.                 }
  230.             } else {
  231.                 RSObject[] potatoes = Objects.findNearest(15, OBJECT_POTATO_ID);
  232.                 if (isNearGate() && !isGateOpen() && !isInPotatoField()) {
  233.                     if (openGate()) {
  234.                         resultCondition = new SleepCondition(new Condition() {
  235.                             @Override
  236.                             public boolean active() {
  237.                                 return isGateOpen();
  238.                             }
  239.                         }, 6000);
  240.                     }
  241.                 } else if (isInPotatoField()) {
  242.                     if (potatoes.length > 0) {
  243.                         final int Count = Inventory.getAll().length;
  244.                         if (Interact(potatoes[0], "Pick")) {
  245.                             resultCondition = new SleepCondition(new Condition() {
  246.                                 @Override
  247.                                 public boolean active() {
  248.                                     return Inventory.getAll().length != Count;
  249.                                 }
  250.                             }, 4000);
  251.                             Potatoes_Picked++;
  252.                         }
  253.                     }
  254.                 } else if (!Player.isMoving()) {
  255.                     runPath(bankToPotato);
  256.                 }
  257.             }
  258.         } else if (currentActivity == Activity.Extract) {
  259.            
  260.         }
  261.         return resultCondition;
  262.     }
  263.  
  264.     public boolean isInBank() {
  265.         int x = Player.getPosition().getX(), y = Player.getPosition().getY();
  266.         return x >= bankArea.x && x <= (bankArea.x + bankArea.width)
  267.                 && y >= bankArea.y && y <= (bankArea.y + bankArea.height);
  268.     }
  269.  
  270.     public boolean isInPotatoField() {
  271.         return PotatoField.contains(Player.getPosition());
  272.     }
  273.  
  274.     public boolean isNearGate() {
  275.         RSObject[] gateObject = Objects.getAt(new RSTile(3145, 3291, 0));
  276.         if (gateObject.length == 0) {
  277.             return false;
  278.         } else {
  279.             return gateObject[0].getPosition().distanceTo(Player.getPosition()) < 5;
  280.         }
  281.     }
  282.  
  283.     public boolean isGateOpen() {
  284.         return Objects.getAt(new RSTile(3145, 3291, 0)).length == 0;
  285.     }
  286.  
  287.     public boolean openGate() {
  288.         if (!isGateOpen()) {
  289.             RSObject gateObject = getObjectAt(new RSTile(3145, 3291, 0), 1551);
  290.             if (gateObject != null) {
  291.                 if (!isNearGate() || !gateObject.isOnScreen()) {
  292.                     Camera.turnToTile(gateObject.getPosition());
  293.                     if (PathFinding.canReach(gateObject.getPosition(), true)) {
  294.                         PathFinding.aStarWalk(gateObject.getPosition());
  295.                     } else {
  296.                         Walking.walkTo(gateObject.getPosition());
  297.                     }
  298.                 }
  299.                 return Interact(gateObject, "Open");
  300.             }
  301.         }
  302.         return true;
  303.     }
  304.  
  305.     public static void runPath(RSTile[] path) {
  306.         Keyboard.pressKey((char) KeyEvent.VK_CONTROL);
  307.         Walking.walkPath(path);
  308.         Keyboard.releaseKey((char) KeyEvent.VK_CONTROL);
  309.     }
  310.  
  311.     public static boolean Interact(RSObject object, String option) {
  312.         if (!object.isOnScreen()) {
  313.             Camera.turnToTile(object.getPosition());
  314.         }
  315.         return object.click(option);
  316.     }
  317.  
  318.     public RSObject getObjectAt(RSTile tile, int Id) {
  319.         RSObject[] objects = Objects.getAt(tile);
  320.         for (RSObject object : objects) {
  321.             if (object.getID() == Id) {
  322.                 return object;
  323.             }
  324.         }
  325.         return null;
  326.     }
  327.    
  328.     public boolean containsSacks() {
  329.         return (containsEmptySacks() || Inventory.getCount(5438) > 0);
  330.     }
  331.  
  332.     private boolean haveAmountInterface() {
  333.         RSInterfaceChild amount = Interfaces.get(548, 94);
  334.         if ((amount != null) && (!amount.isHidden())) {
  335.           String txt = amount.getText();
  336.           if ((txt != null) && (txt.equals("*"))) {
  337.             Color c = org.tribot.api2007.Screen.getColorAt(259, 428);
  338.             Color b = new Color(0, 0, 128);
  339.             return org.tribot.api.Screen.coloursMatch(b, c, new Tolerance(10));
  340.           }
  341.         }
  342.         return false;
  343.     }
  344.    
  345.     public boolean containsEmptySacks() {
  346.         for (RSItem item : Inventory.getAll()) {
  347.             Integer Id = item.getID();
  348.             if (Id == 5418 || Id == 5420 || Id == 5422 ||
  349.                 Id == 5424 || Id == 5426 || Id == 5428 ||
  350.                 Id == 5430 || Id == 5432 || Id == 5434 ||
  351.                 Id == 5436) {
  352.                 return true;
  353.             }
  354.         }
  355.         return false;
  356.     }
  357.  
  358.     public static RSTile[] reversePath(RSTile[] path) {
  359.         RSTile[] reverse = new RSTile[path.length];
  360.         int index = 0;
  361.         for (int i = path.length - 1; i >= 0; i--) {
  362.             if (path[i] == null) {
  363.                 continue;
  364.             }
  365.             reverse[index] = path[i];
  366.             index++;
  367.         }
  368.         return reverse;
  369.     }
  370.    
  371.     public class PotatoPicker extends javax.swing.JFrame {
  372.  
  373.         private static final long serialVersionUID = -172174336364840482L;
  374.        
  375.         public PotatoPicker(AeroPotatoPicker main) {
  376.             initComponents(main);
  377.         }
  378.                
  379.         private void initComponents(final AeroPotatoPicker main) {
  380.  
  381.             jLabel1 = new javax.swing.JLabel();
  382.             jComboBox1 = new javax.swing.JComboBox();
  383.             jCheckBox1 = new javax.swing.JCheckBox();
  384.             jButton1 = new javax.swing.JButton();
  385.  
  386.             setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
  387.             setTitle("Aeronix's Potato Picker");
  388.             setLocationRelativeTo(null);
  389.             setAlwaysOnTop(true);
  390.             setResizable(false);
  391.  
  392.             jLabel1.setText("Select an activity:");
  393.  
  394.             jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(AeroPotatoPicker.Activity.values()));
  395.  
  396.             jCheckBox1.setText("Use Sacks");
  397.  
  398.             jButton1.setText("Start");
  399.             jButton1.addActionListener(new ActionListener()
  400.             {
  401.                 public void actionPerformed(ActionEvent e)
  402.                 {
  403.                     main.currentActivity = (Activity)jComboBox1.getSelectedItem();
  404.                     main.SackSupport = jCheckBox1.isSelected();
  405.                     main.Running = true;
  406.                     dispose();
  407.                 }
  408.             });
  409.  
  410.             javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  411.             getContentPane().setLayout(layout);
  412.             layout.setHorizontalGroup(
  413.                 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  414.                 .addGroup(layout.createSequentialGroup()
  415.                     .addContainerGap()
  416.                     .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  417.                         .addGroup(layout.createSequentialGroup()
  418.                             .addComponent(jLabel1)
  419.                             .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  420.                             .addComponent(jComboBox1, 0, 172, Short.MAX_VALUE))
  421.                         .addGroup(layout.createSequentialGroup()
  422.                             .addComponent(jCheckBox1)
  423.                             .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  424.                             .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
  425.                     .addContainerGap())
  426.             );
  427.             layout.setVerticalGroup(
  428.                 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  429.                 .addGroup(layout.createSequentialGroup()
  430.                     .addContainerGap()
  431.                     .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  432.                         .addComponent(jLabel1)
  433.                         .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  434.                     .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  435.                     .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  436.                         .addComponent(jCheckBox1)
  437.                         .addComponent(jButton1))
  438.                     .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  439.             );
  440.             addWindowListener(new WindowListener() {
  441.                 public void windowClosed(WindowEvent e) {
  442.                     if (!main.Running) {
  443.                         main.stopScript();
  444.                     }
  445.                 }
  446.                 public void windowOpened(WindowEvent e) { }
  447.                 public void windowIconified(WindowEvent e) { }
  448.                 public void windowDeiconified(WindowEvent e) { }
  449.                 public void windowDeactivated(WindowEvent e) { }
  450.                 public void windowClosing(WindowEvent e) { }
  451.                 public void windowActivated(WindowEvent e) {}
  452.             });
  453.            
  454.             pack();
  455.         }    
  456.        
  457.         private javax.swing.JButton jButton1;
  458.         private javax.swing.JCheckBox jCheckBox1;
  459.         private javax.swing.JComboBox jComboBox1;
  460.         private javax.swing.JLabel jLabel1;    
  461.     }    
  462.    
  463.     public class RSArea {
  464.         private final Polygon area;
  465.         private final int plane;
  466.  
  467.         public RSArea(final RSTile[] tiles, final int plane) {
  468.             area = tilesToPolygon(tiles);
  469.             this.plane = plane;
  470.         }
  471.  
  472.         public RSArea(final RSTile[] tiles) {
  473.             this(tiles, 0);
  474.         }
  475.  
  476.         public RSArea(final RSTile southwest, final RSTile northeast) {
  477.             this(southwest, northeast, 0);
  478.         }
  479.  
  480.         public RSArea(final int swX, final int swY, final int neX, final int neY) {
  481.             this(new RSTile(swX, swY), new RSTile(neX, neY), 0);
  482.         }
  483.  
  484.         public RSArea(final int swX, final int swY, final int neX,
  485.                 final int neY, final int plane) {
  486.             this(new RSTile(swX, swY), new RSTile(neX, neY), plane);
  487.         }
  488.  
  489.         public RSArea(final RSTile southwest, final RSTile northeast,
  490.                 final int plane) {
  491.             this(new RSTile[] { southwest,
  492.                     new RSTile(northeast.getX() + 1, southwest.getY()),
  493.                     new RSTile(northeast.getX() + 1, northeast.getY() + 1),
  494.                     new RSTile(southwest.getX(), northeast.getY() + 1) }, plane);
  495.         }
  496.  
  497.         public boolean contains(final RSTile... tiles) {
  498.             final RSTile[] areaTiles = getTiles();
  499.             for (final RSTile check : tiles) {
  500.                 for (final RSTile space : areaTiles) {
  501.                     if (check.equals(space)) {
  502.                         return true;
  503.                     }
  504.                 }
  505.             }
  506.             return false;
  507.         }
  508.  
  509.         public boolean contains(final int x, final int y) {
  510.             return this.contains(new RSTile(x, y));
  511.         }
  512.  
  513.         public boolean contains(final int plane, final RSTile... tiles) {
  514.             return this.plane == plane && this.contains(tiles);
  515.         }
  516.  
  517.         public Rectangle getDimensions() {
  518.             return new Rectangle(area.getBounds().x + 1,
  519.                     area.getBounds().y + 1, getWidth(), getHeight());
  520.         }
  521.  
  522.         public RSTile getNearestTile(final RSTile base) {
  523.             RSTile tempTile = null;
  524.             for (final RSTile tile : getTiles()) {
  525.                 if (tempTile == null
  526.                         || distanceBetween(base, tile) < distanceBetween(
  527.                                 tempTile, tile)) {
  528.                     tempTile = tile;
  529.                 }
  530.             }
  531.             return tempTile;
  532.         }
  533.  
  534.         public int getPlane() {
  535.             return plane;
  536.         }
  537.  
  538.         public Polygon getPolygon() {
  539.             return area;
  540.         }
  541.  
  542.         public RSTile[] getTiles() {
  543.             ArrayList<RSTile> tiles = new ArrayList<RSTile>();
  544.             for (int x = getX(); x <= getX() + getWidth(); x++) {
  545.                 for (int y = getY(); y <= getY() + getHeight(); y++) {
  546.                     if (area.contains(x, y)) {
  547.                         tiles.add(new RSTile(x, y));
  548.                     }
  549.                 }
  550.             }
  551.             return tiles.toArray(new RSTile[tiles.size()]);
  552.         }
  553.  
  554.         public int getWidth() {
  555.             return area.getBounds().width;
  556.         }
  557.  
  558.         public int getHeight() {
  559.             return area.getBounds().height;
  560.         }
  561.  
  562.         public int getX() {
  563.             return area.getBounds().x;
  564.         }
  565.  
  566.         public int getY() {
  567.             return area.getBounds().y;
  568.         }
  569.  
  570.         public Polygon tilesToPolygon(final RSTile[] tiles) {
  571.             final Polygon polygon = new Polygon();
  572.             for (final RSTile t : tiles) {
  573.                 polygon.addPoint(t.getX(), t.getY());
  574.             }
  575.             return polygon;
  576.         }
  577.  
  578.         public double distanceBetween(RSTile curr, RSTile dest) {
  579.             return Math.sqrt((curr.getX() - dest.getX())
  580.                     * (curr.getX() - dest.getX()) + (curr.getY() - dest.getY())
  581.                     * (curr.getY() - dest.getY()));
  582.         }
  583.     }
  584.  
  585.    
  586. }
Advertisement
Add Comment
Please, Sign In to add comment