Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Graphics2D;
- import java.text.DecimalFormat;
- import java.util.concurrent.TimeUnit;
- import org.osbot.rs07.script.Script;
- import org.osbot.rs07.script.ScriptManifest;
- @ScriptManifest(name="ExampleScript", author="author", info="1.0", logo="", version=1.0D)
- public final class paintScript
- extends Script
- {
- // PAINT VARIABLE DECLARATIONS
- private long timeRan;
- private long timeBegan;
- private int costOfItem;
- private int itemsMade;
- private double gpGained;
- private double totalGpGained;
- private int gpPerHour;
- private int totalGpPerHour;
- // ONSTART() METHOD
- public final void onStart()
- {
- timeBegan = System.currentTimeMillis();
- costOfItem = 500;
- }
- // ONLOOP() METHOD
- @Override
- public int onLoop() throws InterruptedException
- {
- itemsMade += 1;
- return 123;
- }
- // ONPAINT() METHOD
- public void onPaint(Graphics2D g)
- {
- Graphics2D gr = g;
- timeRan = System.currentTimeMillis() - timeBegan;
- gpGained = itemsMade - costOfItem;
- gpPerHour = (int)(gpGained / ((System.currentTimeMillis() - this.timeBegan) / 3600000.0D));
- totalGpPerHour = gpPerHour / 1000;
- DecimalFormat df = new DecimalFormat("#");
- g.drawString(ft(timeRan), 295, 349);
- g.drawString("" + df.format(totalGpPerHour) + " k", 295, 417);
- }
- private String ft(long duration)
- {
- String res = "";
- long days = TimeUnit.MILLISECONDS.toDays(duration);
- long hours = TimeUnit.MILLISECONDS.toHours(duration)
- - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
- long minutes = TimeUnit.MILLISECONDS.toMinutes(duration)
- - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS
- .toHours(duration));
- long seconds = TimeUnit.MILLISECONDS.toSeconds(duration)
- - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS
- .toMinutes(duration));
- if (days == 0) {
- res = (hours + ":" + minutes + ":" + seconds);
- } else {
- res = (days + ":" + hours + ":" + minutes + ":" + seconds);
- }
- return res;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement