Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.scripts.nmzAssist;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Point;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.Map;
- import org.tribot.api2007.Skills.SKILLS;
- import org.tribot.script.Script;
- import org.tribot.script.ScriptManifest;
- import org.tribot.script.interfaces.MessageListening07;
- import org.tribot.script.interfaces.MousePainting;
- import org.tribot.script.interfaces.MouseSplinePainting;
- import org.tribot.script.interfaces.Painting;
- import scripts.lib.dataType.Money;
- import scripts.scripts.nmzAssist.paintTasks.OutOfCombat;
- import scripts.scripts.nmzAssist.paintTasks.Overload;
- import scripts.scripts.nmzAssist.paintTasks.Prayer_;
- @ScriptManifest(authors = {"Dorkinator"}, name = "NMZAssistant", description = "", version = 1.0, category = "tools")
- public class NMZAssist extends Script implements Painting, MessageListening07, MouseSplinePainting, MousePainting {
- public boolean overload = false;
- public boolean prayer = false;
- public boolean reOvl;
- public int ppots1st;
- public int ppots2nd;
- private int contHeight = 0;
- private double prayDrain = 0;
- private int sessionRemaining = 0;
- public Prayer_ pr;
- public Overload ol;
- private Painting[] paintables = {pr = new Prayer_(this), ol = new Overload(this), new OutOfCombat(this)};
- private ArrayList<Integer> startXp;
- @Override
- public void onPaint(Graphics g) {
- for (Painting p : paintables)
- p.onPaint(g);
- g.setColor(new Color(0, 0, 0, 125));
- g.drawRect(15, 20, 100, contHeight + 7);
- g.fillRect(15, 20, 100, contHeight + 7);
- g.setColor(Color.green);
- g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 13));
- int y = 0;
- g.drawString("NMZAssistant", 20, 35 + y);
- y = y + 15;
- if (overload) {
- g.drawString("Ovlcd: " + intToTime(303 - (ol.ovlTimer.timeRunning() / 1000)), 20, 35 + y);
- y = y + 15;
- }
- if (prayer) {
- double doses = (double) pr.missingPrayerPoints() / (double) pr.pointsPerDose();
- if (Math.floor(doses) > 0) {
- g.drawString("Doses avail: " + (int) Math.floor(doses), 20, 35 + y);
- y = y + 15;
- }
- if (sessionRemaining > 0) {
- g.drawString("Time left: " + intToTime(sessionRemaining), 20, 35 + y);
- y = y + 15;
- }
- }
- Map<String, Integer> xpHr = getXpHr();
- for (String s : xpHr.keySet())
- if (xpHr.get(s) > 5) {
- g.drawString(s + ": " + new Money(xpHr.get(s)), 20, 35 + y);
- y = y + 15;
- }
- contHeight = y;
- }
- @Override
- public void run() {
- setLoginBotState(false);
- setAutoResponderState(false);
- setRandomSolverState(false);
- startXp = new ArrayList<Integer>();
- startXp.add(SKILLS.HITPOINTS.getXP());
- startXp.add(SKILLS.ATTACK.getXP());
- startXp.add(SKILLS.STRENGTH.getXP());
- startXp.add(SKILLS.DEFENCE.getXP());
- startXp.add(SKILLS.RANGED.getXP());
- startXp.add(SKILLS.MAGIC.getXP());
- while (true) {
- long sTime = System.currentTimeMillis();
- ppots1st = pr.missingPrayerPoints();
- sleep(10000);
- ppots2nd = pr.missingPrayerPoints();
- if (pr.missingPrayerPoints() > 0) {
- prayer = true;
- }
- if (ppots1st < ppots2nd) {
- long eTime = System.currentTimeMillis();
- if (prayDrain == 0)
- prayDrain = ((double) (ppots2nd - ppots1st)) / ((eTime - sTime) / 1000);
- else
- prayDrain = ((((double) (ppots2nd - ppots1st)) / ((eTime - sTime) / 1000)) + (prayDrain * 19)) / 20;
- sessionRemaining = (int) (((pr.pointsPerDose() * pr.remainingDoses()) + SKILLS.PRAYER.getCurrentLevel()) / prayDrain);
- }
- }
- }
- private Map<String, Integer> getXpHr() {
- Map<String, Integer> xpHr = new HashMap<String, Integer>();
- xpHr.put("hp", (int) ((SKILLS.HITPOINTS.getXP() - startXp.get(0)) / (((double) getRunningTime()) / 1000 / 60 / 60)) + 1);
- xpHr.put("Atk", (int) ((SKILLS.ATTACK.getXP() - startXp.get(1)) / (((double) getRunningTime()) / 1000 / 60 / 60)) + 1);
- xpHr.put("Str", (int) ((SKILLS.STRENGTH.getXP() - startXp.get(2)) / (((double) getRunningTime()) / 1000 / 60 / 60)) + 1);
- xpHr.put("Def", (int) ((SKILLS.DEFENCE.getXP() - startXp.get(3)) / (((double) getRunningTime()) / 1000 / 60 / 60)) + 1);
- xpHr.put("Rng", (int) ((SKILLS.RANGED.getXP() - startXp.get(4)) / (((double) getRunningTime()) / 1000 / 60 / 60)) + 1);
- xpHr.put("Mag", (int) ((SKILLS.MAGIC.getXP() - startXp.get(5)) / (((double) getRunningTime()) / 1000 / 60 / 60)) + 1);
- return xpHr;
- }
- private String intToTime(int time) {
- return (int) Math.floor(time / 60) + ":" + ((time % 60 + "").length() == 1 ? "0" : "") + time % 60;
- }
- @Override
- public void clanMessageReceived(String arg0, String arg1) {
- }
- @Override
- public void duelRequestReceived(String arg0, String arg1) {
- }
- @Override
- public void personalMessageReceived(String arg0, String arg1) {
- }
- @Override
- public void playerMessageReceived(String arg0, String arg1) {
- }
- @Override
- public void serverMessageReceived(String m) {
- if (m.contains("You drink some of your overload potion")) {
- ol.resetTimer();
- overload = true;
- } else if (m.contains("The effects of overload have worn off, and you feel normal again.")) {
- overload = true;
- ol.dropTimer();
- }
- }
- @Override
- public void tradeRequestReceived(String arg0) {
- }
- @Override
- public void paintMouse(Graphics arg0, Point arg1, Point arg2) {
- }
- @Override
- public void paintMouseSpline(Graphics arg0, ArrayList<Point> arg1) {
- }
- }
- ----------------------------------------------------------------------------------------------------------------------------
- package scripts.scripts.nmzAssist.paintTasks;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.Skills.SKILLS;
- import org.tribot.api2007.types.RSItem;
- import org.tribot.script.interfaces.Painting;
- import scripts.lib.timer.Timer;
- import scripts.lib.tone.Tone;
- import scripts.scripts.nmzAssist.NMZAssist;
- public class Prayer_ implements Painting {
- private NMZAssist s;
- private int frame;
- private Timer bepDelay;
- public Prayer_(NMZAssist s) {
- this.s = s;
- bepDelay = new Timer(0);
- }
- @Override
- public void onPaint(Graphics g) {
- if (s.prayer) {
- frame++;
- frame = frame % 60;
- if (pointsPerDose() >= prayerPoints() && hasPrayPots()) {
- g.setColor(new Color(0, 255, 255, 80 + (int) (Math.sin((frame) / (Math.PI * 2)) * frame)));
- g.fillRect(0, 0, 765, 503);
- int doses = (int) Math.floor((double) missingPrayerPoints() / (double) pointsPerDose());
- g.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 40));
- g.drawString("DRINK " + doses + " DOSE" + (doses > 1 ? "S" : ""), 120, 230);
- if (!bepDelay.isRunning()) {
- Tone.tone(1000, 100, 1.0);
- bepDelay = new Timer(3000);
- }
- }
- }
- }
- public int missingPrayerPoints() {
- return SKILLS.PRAYER.getActualLevel() - SKILLS.PRAYER.getCurrentLevel();
- }
- public int pointsPerDose() {
- return (SKILLS.PRAYER.getActualLevel() / 4) + 7;
- }
- private int prayerPoints() {
- return SKILLS.PRAYER.getCurrentLevel();
- }
- private boolean hasPrayPots() {
- RSItem[] inv = Inventory.getAll();
- for (RSItem i : inv)
- switch (i.getID()) {
- case 143:
- case 141:
- case 139:
- case 2434://4dose
- return true;
- }
- return false;
- }
- public int remainingDoses() {
- RSItem[] inv = Inventory.getAll();
- int out = 0;
- for (RSItem i : inv)
- switch (i.getID()) {
- case 143:
- out = out + 1;
- case 141:
- out = out + 2;
- case 139:
- out = out + 3;
- case 2434://4dose
- out = out + 4;
- }
- return out;
- }
- }
- ----------------------------------------------------------------------------------------------------------------------------
- package scripts.scripts.nmzAssist.paintTasks;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.types.RSItem;
- import org.tribot.script.interfaces.Painting;
- import scripts.lib.timer.Timer;
- import scripts.lib.tone.Tone;
- import scripts.scripts.nmzAssist.NMZAssist;
- public class Overload implements Painting {
- private NMZAssist s;
- int frame;
- public Timer ovlTimer;
- private Timer bepDelay;
- public Overload(NMZAssist s) {
- this.s = s;
- bepDelay = new Timer(0);
- ovlTimer = new Timer(0);
- }
- @Override
- public void onPaint(Graphics g) {
- if (s.overload) {
- frame++;
- frame = frame % 60;
- if (!ovlTimer.isRunning() && hasOvlPots()) {
- g.setColor(new Color(0, 0, 0, 80 + (int) (Math.sin((frame) / (Math.PI * 2)) * frame)));
- g.fillRect(0, 0, 765, 503);
- g.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 40));
- g.drawString("OVERLOAD FOOL", 120, 270);
- if (!bepDelay.isRunning()) {
- Tone.tone(1000, 100, 1.0);
- bepDelay = new Timer(3000);
- }
- }
- }
- }
- public void resetTimer() {
- ovlTimer = new Timer(5 * 60 * 1000);
- }
- private boolean hasOvlPots() {
- RSItem[] inv = Inventory.getAll();
- for (RSItem i : inv)
- switch (i.getID()) {
- case 11733:
- case 11732:
- case 11731:
- case 11730://4dose
- return true;
- }
- return false;
- }
- public void dropTimer() {
- ovlTimer = new Timer(0);
- }
- }
- ----------------------------------------------------------------------------------------------------------------------------
- package scripts.scripts.nmzAssist.paintTasks;
- import java.awt.Graphics;
- import org.tribot.script.interfaces.Painting;
- import scripts.scripts.nmzAssist.NMZAssist;
- public class OutOfCombat implements Painting {
- public OutOfCombat(NMZAssist s) {//Should probably put some actual code here at some point
- }
- @Override
- public void onPaint(Graphics arg0) {
- // TODO Auto-generated method stub
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement