------------------------------------------------------------------------------------------------------------------------------
EDIT:
I didn't know before I posted this but; there is a better version out which is similar to this:
http://osbot.org/forum/store/product/18-xmpkinghelper/
However I will continue to develop this script and perhaps come up with quickpray support.
------------------------------------------------------------------------------------------------------------------------------
So this is my first ever released script and it might be a bummer if I found out something like this is already released (I'm relatively new here so I wouldn't know either way) but oh well.
Features Version 0.1:
Shows Current HP/Pray and changes colors to yellow or red when either of them are below <50% or 25%.Future Plans:
Adding a run button which will show current run percentage along with change colours and if u click it, the ctrl key will be pressed down.
Adding A GUI where users can select where they want to change the text colors at and if they want to show username.
Aiming for the stars:
Adding Quickprays.What it looks like:
Download (.JAR)
https://www.dropbox.com/s/ywiuerrf6xumt7x/pvpbuddy.jar
Source Code:
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import org.osbot.script.Painter;
import org.osbot.script.Script;
import org.osbot.script.ScriptManifest;
import org.osbot.script.rs2.skill.Skill;
@ScriptManifest(author = "Ajwadi", info = "Shows HP, PRAY", name = "PVPBuddy", version = 0.1)
public class PVPBuddy extends Script implements Painter {
String status = "";
private final Color green = new Color(0, 255, 0);
private final Color black = new Color(0, 0, 0);
private final Color red = new Color(255, 0, 0);
private final Color yellow = new Color(255, 255, 0);
private int fontsize = 10;
private final Font font1 = new Font("Arial", 1, fontsize);
// private final Image hpicon = getImage("http://puu.sh/3j0Hm.png");
private final Image hpicon2 = getImage("http://puu.sh/3jva7.png");
private final Image prayicon = getImage("http://puu.sh/3juTS.png");
// private final Image runnom = getImage("http://puu.sh/3kpcW.png");
// private final Image runm = getImage("http://puu.sh/3kpdq.png");
// private final Image runon = getImage("http://puu.sh/3kpdQ.png");
private int hit = 0;
private int pray = 0;
private final int hity = 128;
private final int hitx = 545;
private final int prayy = 153;
private final int prayx = 545;
private Image getImage(String url) {
try {
return ImageIO.read(new URL(url));
} catch (IOException e) {
}
return null;
}
public void onPaint(Graphics g1) {
Graphics2D g = (Graphics2D) g1;
g.setFont(this.font1);
g.fill3DRect(5, 458, 70, 18, true);
if (pray > client.getSkills().getLevel(Skill.PRAYER) * .5
|| hit < client.getSkills().getLevel(Skill.HITPOINTS) * .5) {
g.setColor(this.black); // FOR DA SHADOW
g.drawImage(this.hpicon2, 520, 110, null);
g.drawImage(this.prayicon, 520, 135, null);
g.drawString("" + hit, hitx + 1, hity + 1);
g.drawString("" + pray, prayx + 1, prayy + 1);
g.setColor(this.green);
g.drawString("" + hit, hitx, hity);
g.drawString("" + pray, 545, prayy);
}
// ////////////////////////////////////////////
// RED WARNINGS
// ///////////////////////////////////////////
// prayer
if (pray >= 0
&& pray <= client.getSkills().getLevel(Skill.PRAYER) * .25) {
g.drawImage(this.prayicon, 520, 135, null);
g.setColor(this.black);
g.drawString("" + pray, prayx + 1, prayy + 1);
g.setColor(this.red);
g.drawString("" + pray, 545, prayy);
if (hit >= 0
&& hit <= client.getSkills().getLevel(Skill.HITPOINTS) * .25) {
g.drawImage(this.hpicon2, 520, 110, null);
g.setColor(this.black);
g.drawString("" + hit, hitx + 1, hity + 1);
g.setColor(this.red);
g.drawString("" + hit, hitx, hity);
} else if (hit <= client.getSkills().getLevel(Skill.HITPOINTS) * .5
&& hit > client.getSkills().getLevel(Skill.HITPOINTS) * .25) {
g.drawImage(this.hpicon2, 520, 110, null);
g.setColor(this.black);
g.drawString("" + hit, hitx + 1, hity + 1);
g.setColor(this.yellow);
g.drawString("" + hit, hitx, hity);
} else {
g.drawImage(this.hpicon2, 520, 110, null);
g.setColor(this.black);
g.drawString("" + hit, hitx + 1, hity + 1);
g.setColor(this.green);
g.drawString("" + hit, hitx, hity);
}
// println("PRAY IS LESS THAT 25 %");
}
// hp
if (hit >= 0
&& hit <= client.getSkills().getLevel(Skill.HITPOINTS) * .25) {
g.drawImage(this.hpicon2, 520, 110, null);
g.setColor(this.black);
g.drawString("" + hit, hitx + 1, hity + 1);
g.setColor(this.red);
g.drawString("" + hit, hitx, hity);
if (pray >= 0
&& pray <= client.getSkills().getLevel(Skill.PRAYER) * .25) {
g.drawImage(this.prayicon, 520, 135, null);
g.setColor(this.black);
g.drawString("" + pray, prayx + 1, prayy + 1);
g.setColor(this.red);
g.drawString("" + pray, 545, prayy);
} else if (pray <= client.getSkills().getLevel(Skill.PRAYER) * .5
&& pray > client.getSkills().getLevel(Skill.PRAYER) * .25) {
g.drawImage(this.prayicon, 520, 135, null);
g.setColor(this.black);
g.drawString("" + pray, prayx + 1, prayy + 1);
g.setColor(this.yellow);
g.drawString("" + pray, 545, prayy);
} else {
g.drawImage(this.prayicon, 520, 135, null);
g.setColor(this.black);
g.drawString("" + pray, prayx + 1, prayy + 1);
g.setColor(this.green);
g.drawString("" + pray, 545, prayy);
}
}
// ////////////////////////////////////////////
// YELLOW WARNINGS
// ///////////////////////////////////////////
// prayer
if (pray <= client.getSkills().getLevel(Skill.PRAYER) * .5
&& pray > client.getSkills().getLevel(Skill.PRAYER) * .25) {
g.drawImage(this.prayicon, 520, 135, null);
g.setColor(this.black);
g.drawString("" + pray, prayx + 1, prayy + 1);
g.setColor(this.yellow);
g.drawString("" + pray, 545, prayy);
if (hit >= 0
&& hit <= client.getSkills().getLevel(Skill.HITPOINTS) * .25) {
g.drawImage(this.hpicon2, 520, 110, null);
g.setColor(this.black);
g.drawString("" + hit, hitx + 1, hity + 1);
g.setColor(this.red);
g.drawString("" + hit, hitx, hity);
} else if (hit <= client.getSkills().getLevel(Skill.HITPOINTS) * .5
&& hit > client.getSkills().getLevel(Skill.HITPOINTS) * .25) {
g.drawImage(this.hpicon2, 520, 110, null);
g.setColor(this.black);
g.drawString("" + hit, hitx + 1, hity + 1);
g.setColor(this.yellow);
g.drawString("" + hit, hitx, hity);
} else {
g.drawImage(this.hpicon2, 520, 110, null);
g.setColor(this.black);
g.drawString("" + hit, hitx + 1, hity + 1);
g.setColor(this.green);
g.drawString("" + hit, hitx, hity);
}
// println("PRAY IS LESS THAT 25 %");
}
// hp
if (hit <= client.getSkills().getLevel(Skill.HITPOINTS) * .5
&& hit > client.getSkills().getLevel(Skill.HITPOINTS) * .25) {
g.drawImage(this.hpicon2, 520, 110, null);
g.setColor(this.black);
g.drawString("" + hit, hitx + 1, hity + 1);
g.setColor(this.yellow);
g.drawString("" + hit, hitx, hity);
if (pray >= 0
&& pray <= client.getSkills().getLevel(Skill.PRAYER) * .25) {
g.drawImage(this.prayicon, 520, 135, null);
g.setColor(this.black);
g.drawString("" + pray, prayx + 1, prayy + 1);
g.setColor(this.red);
g.drawString("" + pray, 545, prayy);
} else if (pray <= client.getSkills().getLevel(Skill.PRAYER) * .5
&& pray > client.getSkills().getLevel(Skill.PRAYER) * .25) {
g.drawImage(this.prayicon, 520, 135, null);
g.setColor(this.black);
g.drawString("" + pray, prayx + 1, prayy + 1);
g.setColor(this.yellow);
g.drawString("" + pray, 545, prayy);
} else {
g.drawImage(this.prayicon, 520, 135, null);
g.setColor(this.black);
g.drawString("" + pray, prayx + 1, prayy + 1);
g.setColor(this.green);
g.drawString("" + pray, 545, prayy);
}
}
// g.drawString("Status: " + this.status, 350, 400);
}
public int onLoop() throws InterruptedException {
hit = client.getSkills().getCurrentLevel(Skill.HITPOINTS);
// println("HP: " + hit);
// RSInterface
pray = client.getSkills().getCurrentLevel(Skill.PRAYER);
// run = ;
// println(run);
return 100;
}
public void onStart() {
}
}