Advertisement
Guest User

FCPaint

a guest
Aug 12th, 2015
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.58 KB | None | 0 0
  1. package scripts.fc.fcpaint;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Graphics;
  5.  
  6. import org.tribot.api.Timing;
  7. import org.tribot.script.Script;
  8.  
  9. public class FCPaint
  10. {
  11.     private final int   PAINT_X     = 4; //The x coordinate for the paint text
  12.     private final int   PAINT_BOT_Y = 336; //The y coordinate for the paint string on the bottom
  13.     private final int   PAINT_SPACE = 15; //The space between paint fields     
  14.    
  15.     private FCPaintable paintable; //Paintable object we're painting (we get our paint info from this)
  16.     private Script      script; //Script we're painting for --> This is so we can call getRunningTime() from this class
  17.     private Color       color;  //The color of the paint
  18.    
  19.     public FCPaint(FCPaintable paintable, Color color)
  20.     {
  21.         this.script = (Script)paintable;
  22.         this.paintable = paintable;
  23.         this.color = color;
  24.     }
  25.    
  26.     public void paint(Graphics g)
  27.     {
  28.         //set paint text color
  29.         g.setColor(color);
  30.        
  31.         String[] info = paintable.getPaintInfo();
  32.        
  33.         //FOR(each paint information field in paintInfo)
  34.         for(int index = 0; index < info.length; index++)
  35.         {
  36.             //draw paint field at the appropriate position on the screen, as defined by constants
  37.             g.drawString(info[index], PAINT_X, PAINT_BOT_Y - (PAINT_SPACE * (info.length - (index + 1))));
  38.            
  39.         } //END FOR
  40.     }
  41.        
  42.     public String getTimeRan()
  43.     {  
  44.         //return the properly formatted string
  45.         return Timing.msToString(script.getRunningTime());
  46.        
  47.     } //END getTimeRan()
  48.    
  49.     public long getPerHour(int amount)
  50.     {  
  51.         //return the projected amount per hour
  52.         return Math.round(amount / (script.getRunningTime() / 3600000.0));
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement