Advertisement
Guest User

Paint Tutorial Example 4

a guest
Aug 16th, 2015
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.88 KB | None | 0 0
  1. import java.awt.Graphics;
  2. import java.text.DecimalFormat;
  3. import java.util.concurrent.TimeUnit;
  4.  
  5. import org.dreambot.api.methods.skills.Skill;
  6. import org.dreambot.api.methods.tabs.Tab;
  7. import org.dreambot.api.script.AbstractScript;
  8. import org.dreambot.api.script.Category;
  9. import org.dreambot.api.script.ScriptManifest;
  10. import org.dreambot.api.utilities.Timer;
  11. import org.dreambot.api.wrappers.interactive.GameObject;
  12.  
  13.  
  14. @ScriptManifest(author = "Pug", name = "paint tutorial", version = 0.01, description = "0.01", category = Category.MISC)
  15. public class test extends AbstractScript
  16. {
  17.  
  18.     // PAINT VARIABLE DECLARATIONS
  19.     private int costOfItem;
  20.     private int itemsMade;
  21.     private double gpGained;
  22.     private double totalGpGained;
  23.    
  24.     // ONSTART() METHOD
  25.     public void onStart()
  26.     {
  27.         costOfItem = 500;
  28.     }
  29.  
  30.     // ONLOOP() METHOD
  31.     @Override
  32.     public int onLoop()
  33.     {
  34.         itemsMade += 1;
  35.         return 0;
  36.     }
  37.    
  38.     //OUR PAINT METHOD
  39.     public void onPaint(Graphics g)
  40.     {
  41.         gpGained = itemsMade - costOfItem;
  42.         totalGpGained = gpGained / 1000;
  43.         DecimalFormat df = new DecimalFormat("#");
  44.         g.drawString("" + df.format(totalGpGained) + " k", 295, 417);
  45.     }
  46.    
  47.     private String ft(long duration)
  48.     {
  49.         String res = "";
  50.         long days = TimeUnit.MILLISECONDS.toDays(duration);
  51.         long hours = TimeUnit.MILLISECONDS.toHours(duration)
  52.         - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
  53.         long minutes = TimeUnit.MILLISECONDS.toMinutes(duration)
  54.         - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS
  55.         .toHours(duration));
  56.         long seconds = TimeUnit.MILLISECONDS.toSeconds(duration)
  57.         - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS
  58.         .toMinutes(duration));
  59.         if (days == 0) {
  60.         res = (hours + ":" + minutes + ":" + seconds);
  61.         } else {
  62.         res = (days + ":" + hours + ":" + minutes + ":" + seconds);
  63.         }
  64.         return res;
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement