NissanNut

Superheater.java 0.1

Nov 14th, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.90 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Graphics;
  3. import java.awt.Graphics2D;
  4. import java.awt.Point;
  5.  
  6. import org.veloxbot.api.ActiveScript;
  7. import org.veloxbot.api.Manifest;
  8. import org.veloxbot.api.Validatable;
  9. import org.veloxbot.api.methods.Game;
  10. import org.veloxbot.api.methods.Inventory;
  11. import org.veloxbot.api.methods.Mouse;
  12. import org.veloxbot.api.utils.Random;
  13. import org.veloxbot.api.wrappers.DTM;
  14.  
  15. @Manifest(authors = { "Nissan Nut", "Velox" },
  16.     name = "Nissan's Superheater",
  17.     version = 0.1,
  18.     description= "Basic Superheater.")
  19.  
  20. /**
  21. * Simple Superheater Script
  22. * 11/10/2012 Dev Started
  23. * @author Tanner (Nissan Nut)
  24. */
  25.  
  26. public class Superheater extends ActiveScript implements Validatable {
  27.    
  28.     private SuperheaterUI UI = new SuperheaterUI();
  29.     private boolean antiban = true;
  30.     private int o1 = 0, o2 = 0, brs = 0, angle = 90, mouseSpeed = 5;
  31.  
  32.     private DTM ore, ore2, bar;
  33.     private final DTM NATURE_RUNE = DTM.fromString("17_123_20_5/103_99_98_-11_-5_5/74_71_71_-2_10_5/147_140_140_9_-3_5"),
  34.             COAL = DTM.fromString("38_38_29_5/92_74_52_-12_2_5/92_74_52_-3_8_5/38_38_29_8_5_5/105_84_59_10_-5_5"),
  35.             IRON_ORE = DTM.fromString("54_32_24_5/86_69_48_-13_3_5/94_76_53_-3_10_5/54_32_24_7_6_5/103_82_57_10_-4_5"),
  36.             MITHRIL_ORE = DTM.fromString("54_55_81_5/100_81_57_-11_3_5/90_72_51_-5_10_5/46_46_69_7_5_5/109_87_61_11_-6_5"),
  37.             ADAMANTITE_ORE = DTM.fromString("64_74_64_5/98_79_56_-11_2_5/92_74_52_-5_11_5/62_71_62_8_6_5/109_87_61_11_-5_5"),
  38.             RUNITE_ORE = DTM.fromString("71_85_92_5/87_70_49_-15_3_5/98_79_56_-5_10_5/55_66_71_7_5_5/105_84_59_9_-6_5"),
  39.             GOLD_ORE = DTM.fromString("190_151_28_5/98_79_56_-11_2_5/87_70_49_-7_10_5/172_137_25_7_6_5/100_81_57_11_-4_5"),
  40.             SILVER_ORE = DTM.fromString("126_127_132_5/95_76_52_-11_4_5/91_72_50_-3_11_5/103_82_57_12_-4_1"),
  41.             COPPER_ORE = DTM.fromString("189_108_57_5/97_77_54_-10_1_5/91_72_50_-4_7_5/105_84_58_10_-6_5"),
  42.             TIN_ORE = DTM.fromString("105_101_101_5/82_65_45_-14_4_5/97_77_54_-3_10_5/99_79_55_12_-4_5"),
  43.             BRONZE_BAR = DTM.fromString("79_59_35_5/59_45_26_-8_-2_5/33_25_14_-13_5_5/81_61_36_-1_6_5"),
  44.             IRON_BAR = DTM.fromString("83_80_80_5/39_38_38_-14_5_5/26_25_25_-14_11_5/86_82_82_-1_7_5"),
  45.             STEEL_BAR = DTM.fromString("128_123_123_5/99_95_94_-8_1_5/39_38_38_-15_11_5/132_127_126_-1_8_5"),
  46.             MITHRIL_BAR = DTM.fromString("66_66_99_5/49_50_74_-8_-3_5/28_29_43_-10_5_5/67_68_101_0_4_5"),
  47.             ADAMANT_BAR = DTM.fromString("72_83_72_5/53_62_54_-7_1_5/28_33_29_-13_6_5/72_83_72_-1_7_5"),
  48.             RUNE_BAR = DTM.fromString("81_97_105_5/62_75_81_-7_1_5/37_45_48_-11_7_5/82_99_107_0_6_5"),
  49.             SILVER_BAR = DTM.fromString("165_165_172_5/128_128_134_-9_-1_5/75_75_79_-15_3_5/168_168_176_-1_6_5"),
  50.             GOLD_BAR = DTM.fromString("207_165_29_5/159_126_22_-8_-2_5/90_72_13_-11_4_5/212_169_30_0_6_5");
  51.  
  52.     @Override
  53.     public boolean onStart(){
  54.        
  55.         UI.setVisible(true);
  56.        
  57.         while (UI.isVisible())
  58.             sleep(10);
  59.        
  60.         switch (UI.list.getSelectedIndex()){
  61.         case 0:
  62.             ore = TIN_ORE;
  63.             ore2 = COPPER_ORE;
  64.             bar = BRONZE_BAR;
  65.             break;
  66.         case 1:
  67.             ore = IRON_ORE;
  68.             bar = IRON_BAR;
  69.             break;
  70.         case 2:
  71.             ore = IRON_ORE;
  72.             ore2 = COAL;
  73.             bar = STEEL_BAR;
  74.             break;
  75.         case 3:
  76.             ore = SILVER_ORE;
  77.             bar = SILVER_BAR;
  78.             break;
  79.         case 4:
  80.             ore = GOLD_ORE;
  81.             bar = GOLD_BAR;
  82.             break;
  83.         case 5:
  84.             ore = MITHRIL_ORE;
  85.             ore2 = COAL;
  86.             bar = MITHRIL_BAR;
  87.             break;
  88.         case 6:
  89.             ore = ADAMANTITE_ORE;
  90.             ore2 = COAL;
  91.             bar = ADAMANT_BAR;
  92.             break;
  93.         case 7:
  94.             ore = RUNITE_ORE;
  95.             ore2 = COAL;
  96.             bar = RUNE_BAR;
  97.         }
  98.        
  99.         if (UI.boxNorth.isSelected())
  100.             angle = 0;
  101.         else if (UI.boxEast.isSelected())
  102.             angle = 90;
  103.         else if (UI.boxSouth.isSelected())
  104.             angle = 180;
  105.         else if (UI.boxWest.isSelected())
  106.             angle = 270;
  107.        
  108.         mouseSpeed = UI.slider.getValue();
  109.        
  110.         return UI.start;
  111.     }
  112.    
  113.     @Override
  114.     public long loop() {
  115.         if (antiban)
  116.             Mouse.setMultiplier(Random.nextDouble(mouseSpeed - 1, mouseSpeed + 1)*.1);
  117.        
  118.         if (Game.Tab.INVENTORY.isOpen()){
  119.             brs = Inventory.getCount(bar);
  120.             o1 = Inventory.getCount(ore);
  121.             if (ore2 != null)
  122.                 o2 = Inventory.getCount(ore2);
  123.         }
  124.        
  125.         return 10;
  126.     }
  127.    
  128.     @Override
  129.     public void onRepaint(Graphics G){
  130.         Graphics2D g = (Graphics2D) G;
  131.    
  132.         g.setColor(Color.BLACK);
  133.         g.fillRect(0, 0, 765, 50);
  134.        
  135.         g.setColor(Color.WHITE);
  136.         g.drawString(Integer.toString(brs) + UI.list.getSelectedValue() + " bars", 15, 20);
  137.         g.drawString("Ores: " +  + o1 + "/" + o2, 15, 40);
  138.        
  139.         Point p = getPointNearPlayer(angle, 30);
  140.         g.drawString("X", p.x, p.y);
  141.        
  142.        
  143.     }
  144.    
  145.     /**
  146.      * Credits to Velox
  147.      * @param angle
  148.      * @param distance
  149.      * @return the point
  150.      */
  151.     public static Point getPointNearPlayer(final int angle, final int distance) {
  152.          final double rads = Math.toRadians(angle + 90 - Game.getCompassAngle());
  153.          return new Point((int) (Game.VIEWPORT_CENTER.x - distance * Math.cos(rads)), (int) (Game.VIEWPORT_CENTER.y - distance * Math.sin(rads)));
  154.     }
  155.  
  156.  
  157. }
Advertisement
Add Comment
Please, Sign In to add comment