Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.BasicStroke;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Point;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseMotionListener;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.util.Filter;
- import org.rsbot.script.wrappers.GEItemInfo;
- import org.rsbot.script.wrappers.RSArea;
- import org.rsbot.script.wrappers.RSGroundItem;
- import org.rsbot.script.wrappers.RSItem;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- @ScriptManifest(authors = { "Ahmedbasil1" }, keywords = "Combat,Flesh,Crawlers,Strength,Pure", name = "Flesh Crawler Devourer", version = 0.34, description = ("Prepare typical inventory, and press start! Enjoy!"))
- public class FleshCrawler extends Script implements PaintListener,
- ServerMessageListener, MouseMotionListener {
- public RSNPC allNPC[];
- private int NumOfPots = 0;
- private int PotionID = 0;
- private int FoodID;
- private boolean dist = false;
- long startTime, ABTime, currentTime;
- private RSArea FleshCrawlers = new RSArea(2036, 5185, 2046, 5193);
- private RSArea FleshCrawlers2 = new RSArea(2036, 5185, 2046, 5194);
- private RSArea Bank = new RSArea(3091, 3488, 3098, 3499);
- private RSArea Door1 = new RSArea(2044, 5237, 2045, 5239);
- private RSArea Door2 = new RSArea(2036, 5201, 2037, 5203);
- private RSArea Door3 = new RSArea(2045, 5195, 2046, 5197);
- private RSTile[] PathToBank = { new RSTile(3081, 3421),
- new RSTile(3087, 3428), new RSTile(3092, 3436),
- new RSTile(3091, 3445), new RSTile(3090, 3457),
- new RSTile(3100, 3465), new RSTile(3100, 3472),
- new RSTile(3100, 3481), new RSTile(3095, 3484),
- new RSTile(3093, 3491) };
- // ------------------------------------------------------------------------------------------------------------\\
- private RSItem GetEdibleFoods() {
- RSItem[] EdibleFood = inventory.getItems();
- for (RSItem i : EdibleFood) {
- if (i.getComponent().getActions() == null
- || i.getComponent().getActions()[0] == null) {
- continue;
- }
- if (i.getComponent().getActions()[0].contains("Eat")) {
- return i;
- }
- }
- return null;
- }
- private RSItem GetPotion() {
- RSItem[] EdibleFood = inventory.getItems();
- for (RSItem i : EdibleFood) {
- if (i.getComponent().getActions() == null
- || i.getComponent().getActions()[0] == null) {
- continue;
- }
- if (i.getComponent().getActions()[0].contains("Drink")) {
- return i;
- }
- }
- return null;
- }
- private void DrinkPotion() {
- RSItem Potion = GetPotion();
- if (Potion != null) {
- Potion.doAction("Drink");
- mouse.moveRandomly(20);
- if (getState() == State.NeedToDrinkPotion
- || getState() == State.Waiting) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToDrinkPotion
- || getState() == State.Waiting) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToDrinkPotion
- || getState() == State.Waiting) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToDrinkPotion
- || getState() == State.Waiting) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToDrinkPotion
- || getState() == State.Waiting) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToDrinkPotion
- || getState() == State.Waiting) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToDrinkPotion
- || getState() == State.Waiting) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToDrinkPotion
- || getState() == State.Waiting) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToDrinkPotion
- || getState() == State.Waiting) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToDrinkPotion
- || getState() == State.Waiting) {
- sleep(500, 700);
- }
- }
- }
- private void EatFood() {
- RSItem Food = GetEdibleFoods();
- if (Food != null) {
- Food.doAction("Eat");
- mouse.moveRandomly(20);
- if (getState() == State.NeedToEat) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToEat) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToEat) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToEat) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToEat) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToEat) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToEat) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToEat) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToEat) {
- sleep(500, 700);
- }
- if (getState() == State.NeedToEat) {
- sleep(500, 700);
- }
- }
- }
- private void openDoor(int x, int y, boolean tf) {
- RSTile doorTile = new RSTile(x, y);
- RSObject tempObject = objects.getTopAt(doorTile);
- if (tf == true) {
- if (isIn(x, y + 1, 2, 6)) {
- if (tempObject != null) {
- if (tempObject.isOnScreen()) {
- if (tempObject.doAction("Open")) {
- mouse.moveRandomly(20);
- WaitToMove();
- }
- }
- }
- }
- }
- if (tf == false) {
- if (tempObject != null) {
- if (tempObject.isOnScreen()) {
- if (tempObject.doAction("Open")) {
- mouse.moveRandomly(20);
- WaitToMove();
- }
- }
- }
- }
- }
- public void WaitToMove() {
- RSTile me = getMyPlayer().getLocation();
- boolean shouldWait;
- int i;
- i = 0;
- shouldWait = true;
- do {
- sleep(500, 600);
- i++;
- if (getMyPlayer().getLocation() != me || i > 10) {
- shouldWait = false;
- }
- } while (shouldWait);
- sleep(1000, 1500);
- }
- public void climbUp() {
- RSTile me = getMyPlayer().getLocation();
- RSObject object;
- RSArea F1 = new RSArea(1905, 5217, 1915, 5227);
- object = objects.getNearest(new Filter<RSObject>() {
- public boolean accept(RSObject n) {
- if ((n.getID() == 16078 || n.getID() == 16080 || n.getID() == 16148)
- && calc.distanceTo(n) <= 4) {
- return true;
- }
- return false;
- }
- });
- if (object != null && !F1.contains(me)) {
- if (object.doAction("Climb-up")) {
- mouse.moveRandomly(20);
- WaitToMove();
- }
- }
- }
- public void climbDown() {
- RSObject object;
- object = objects.getNearest(new Filter<RSObject>() {
- public boolean accept(RSObject n) {
- if ((n.getID() == 16154 || n.getID() == 16150 || n.getID() == 16149)
- && calc.distanceTo(n) <= 6) {
- return true;
- }
- return false;
- }
- });
- if (object != null) {
- if (object.getID() == 16150) {
- if (object.doAction("Enter")) {
- mouse.moveRandomly(20);
- WaitToMove();
- }
- }
- if (object.getID() == 16149 || object.getID() == 16154) {
- if (object.doAction("Climb-down")) {
- mouse.moveRandomly(20);
- WaitToMove();
- }
- }
- }
- }
- public boolean isIn(int x1, int y1, int xc, int yc) {
- xc--;
- yc--;
- RSArea zone = new RSArea(x1, y1, x1 + xc, y1 + yc);
- RSTile me = getMyPlayer().getLocation();
- if (zone.contains(me)) {
- return true;
- } else {
- return false;
- }
- }
- public void checkDoors() {
- RSTile me = getMyPlayer().getLocation();
- openDoor(2044, 5239, true);
- openDoor(2036, 5203, true);
- openDoor(2045, 5197, true);
- if (Door1.contains(me)) {
- openDoor(2045, 5237, false);
- }
- if (Door2.contains(me)) {
- openDoor(2036, 5201, false);
- }
- if (Door3.contains(me)) {
- openDoor(2045, 5195, false);
- }
- }
- public boolean walkToFleshCrawlers() {
- RSTile me = getMyPlayer().getLocation();
- RSTile[] PathToCave = walking.reversePath(PathToBank);
- RSTile MainF2Path[] = { new RSTile(2042, 5228), new RSTile(2044, 5219),
- new RSTile(2037, 5211), new RSTile(2037, 5204) };
- RSArea MainZone = new RSArea(2030, 5205, 2047, 5236);
- climbDown();
- checkDoors();
- if (isIn(2036, 5199, 3, 2)) {
- walking.walkTileMM(new RSTile(2046, 5196));
- mouse.moveRandomly(20);
- WaitToMove();
- return true;
- }
- if (isIn(2045, 5194, 2, 1)) {
- walking.walkTileMM(new RSTile(2041, 5188));
- mouse.moveRandomly(20);
- WaitToMove();
- return true;
- }
- if (isIn(2041, 5244, 3, 3)) {
- if (walking.walkTileMM(new RSTile(2045, 5238))) {
- mouse.moveRandomly(20);
- WaitToMove();
- return true;
- }
- }
- if (isIn(1858, 5242, 3, 3)) {
- if (walking.walkTileMM(new RSTile(1863, 5236))) {
- mouse.moveRandomly(20);
- WaitToMove();
- return true;
- }
- }
- if (me.getX() >= 1910 && me.getX() <= 1920 && me.getY() >= 5218
- && me.getX() <= 5230) {
- if (walking.walkTileMM(new RSTile(1903, 5219))) {
- mouse.moveRandomly(20);
- WaitToMove();
- return true;
- }
- }
- if (MainZone.contains(me)
- && calc.distanceTo(MainF2Path[MainF2Path.length - 1]) >= 5) {
- walking.walkPathMM(MainF2Path, 1, 1);
- mouse.moveRandomly(20);
- WaitToMove();
- return true;
- }
- if (me.getX() > 3000
- && calc.distanceTo(PathToCave[PathToCave.length - 1]) >= 6) {
- walking.walkPathMM(PathToCave, 1, 1);
- mouse.moveRandomly(20);
- WaitToMove();
- return true;
- }
- return true;
- }
- public boolean WalkToBank() {
- RSTile me = getMyPlayer().getLocation();
- climbUp();
- if (FleshCrawlers2.contains(me) && me.getY() >= 5194) {
- openDoor(2045, 5195, false);
- return true;
- }
- if (FleshCrawlers2.contains(me) && me.getY() < 5194) {
- walking.walkTileMM(new RSTile(2050, 5196));
- mouse.moveRandomly(20);
- WaitToMove();
- return true;
- }
- if (Door3.contains(me)) {
- openDoor(2046, 5197, false);
- return true;
- }
- if (isIn(2045, 5198, 2, 3)) {
- walking.walkTileMM(new RSTile(2041, 5208));
- mouse.moveRandomly(20);
- WaitToMove();
- return true;
- }
- if (me.getX() > 3000
- && calc.distanceTo(PathToBank[PathToBank.length - 1]) >= 3) {
- walking.walkPathMM(PathToBank, 1, 1);
- mouse.moveRandomly(20);
- WaitToMove();
- return true;
- }
- return true;
- }
- enum State {
- Banking, WalkingToFleshCrawlers, Waiting, NeedToEat, NeedToDrinkPotion, Attack, IDLE
- }
- State getState() {
- if (combat.getLifePoints() <= (6 * (skills
- .getRealLevel(Skills.CONSTITUTION)))) {
- return State.NeedToEat;
- }
- if (GetPotion() != null
- && FleshCrawlers.contains(getMyPlayer().getLocation())
- && skills.getCurrentLevel(Skills.STRENGTH) <= (skills
- .getRealLevel(Skills.STRENGTH) + 3)) {
- return State.NeedToDrinkPotion;
- }
- if (getMyPlayer().getAnimation() != -1 || getMyPlayer().isMoving()
- || getMyPlayer().getInteracting() != null) {
- return State.Waiting;
- }
- if (GetEdibleFoods() == null) {
- return State.Banking;
- }
- if (!FleshCrawlers.contains(getMyPlayer().getLocation())
- && GetEdibleFoods() != null) {
- return State.WalkingToFleshCrawlers;
- }
- if (FleshCrawlers.contains(getMyPlayer().getLocation())
- && GetEdibleFoods() != null
- && getMyPlayer().getInteracting() == null) {
- return State.Attack;
- }
- return State.IDLE;
- }
- public boolean onStart() {
- sleep(1000, 2000);
- env.disableRandom("Improved Rewards Box");
- ABTime = System.currentTimeMillis();
- startTime = System.currentTimeMillis();
- E_startTime = skills.getCurrentExp(Skills.STRENGTH)
- + skills.getCurrentExp(Skills.ATTACK)
- + skills.getCurrentExp(Skills.DEFENSE)
- + skills.getCurrentExp(Skills.RANGE)
- + skills.getCurrentExp(Skills.CONSTITUTION);
- if (GetEdibleFoods() != null) {
- FoodID = GetEdibleFoods().getID();
- } else {
- log("Start with food you want to use!");
- }
- if (GetPotion() != null) {
- PotionID = GetPotion().getID();
- NumOfPots = inventory.getCount(PotionID);
- } else {
- log("Start with ammount of potions per inventory you want to use!");
- }
- loop();
- return true;
- }
- public RSNPC getNextNPC() {
- RSNPC o = npcs.getNearest(new Filter<RSNPC>() {
- public boolean accept(RSNPC n) {
- if (n.getName().equals("Flesh Crawler") && !n.isInCombat()) {
- return true;
- }
- return false;
- }
- });
- if (o != null) {
- return o;
- } else {
- return null;
- }
- }
- public boolean GA() {
- RSNPC closest = null;
- int d = 100000;
- for (RSNPC i : npcs.getAll()) {
- if (i.getName() == "Flesh Crawler" && i.getInteracting() != null
- && i.getInteracting().equals(getMyPlayer())) {
- int di = calc.distanceTo(i);
- if (di < d) {
- closest = i;
- d = di;
- }
- }
- }
- if (closest != null && getMyPlayer().isInCombat()) {
- return false;
- } else {
- return true;
- }
- }
- public void doAttack() {
- RSNPC npc;
- npc = getNextNPC();
- double x = 0;
- double y = 0;
- double xf = 0;
- double yf = 0;
- int i;
- int z;
- i = 0;
- z = 0;
- do {
- x += npc.getScreenLocation().getX();
- i++;
- } while (i <= 50);
- do {
- y += npc.getScreenLocation().getY();
- z++;
- } while (z <= 50);
- xf = x / i;
- yf = y / z;
- Point AveragePoint = new Point((int) xf, (int) yf);
- mouse.move(AveragePoint);
- xf = 0;
- yf = 0;
- if (menu.contains("Attack")) {
- menu.doAction("Attack");
- if (random(1, 10) == 1) {
- mouse.moveSlightly();
- } else {
- mouse.moveRandomly(20);
- }
- sleep(1200, 1400);
- dist = false;
- } else {
- sleep(200, 300);
- }
- }
- public void processAttack() {
- RSNPC npc = getNextNPC();
- if (npc != null && !npc.isInCombat() && GA()) {
- if (npc.isOnScreen()) {
- doAttack();
- } else {
- walking.walkTileMM(npc.getLocation());
- sleep(700, 800);
- }
- }
- }
- public void Bank() {
- if (Bank.contains(getMyPlayer().getLocation())) {
- bank.open();
- int z = 0;
- do {
- z++;
- if (z >= 10) {
- bank.open();
- z = 0;
- }
- sleep(150, 200);
- } while (!bank.isOpen());
- if (bank.isOpen()) {
- sleep(1000, 2000);
- if (inventory.getCount() != 0) {
- bank.depositAll();
- int q = 0;
- do {
- sleep(350, 400);
- q++;
- } while (q <= 10 && inventory.getCount() != 0);
- }
- if (NumOfPots != 0 && NumOfPots != 1) {
- int e = 0;
- do {
- bank.withdraw(PotionID, 1);
- e++;
- sleep(500, 1000);
- } while (e <= (NumOfPots - 1));
- }
- if (NumOfPots != 0 && NumOfPots == 1) {
- bank.withdraw(PotionID, 1);
- sleep(500, 1000);
- }
- if (bank.getCount(FoodID) < 5) {
- bank.close();
- sleep(2000, 2500);
- game.logout(false);
- sleep(1000, 1500);
- stopScript();
- }
- if (!inventory.contains(FoodID) && bank.getCount(FoodID) >= 5) {
- bank.withdraw(FoodID, 5);
- int t = 0;
- do {
- sleep(150, 200);
- t++;
- } while (t <= 10 && !inventory.contains(FoodID));
- }
- bank.close();
- }
- } else {
- WalkToBank();
- }
- }
- public void RoundlyChecks() {
- mouse.setSpeed(random(4, 7));
- if (camera.getPitch() < 70) {
- camera.setPitch(random(80, 95));
- }
- if (walking.getEnergy() >= random(45, 65) && !walking.isRunEnabled()) {
- walking.setRun(true);
- mouse.moveRandomly(20);
- if (!walking.isRunEnabled()) {
- sleep(1000, 1200);
- }
- if (!walking.isRunEnabled()) {
- sleep(1000, 1200);
- }
- if (!walking.isRunEnabled()) {
- sleep(1000, 1200);
- }
- if (!walking.isRunEnabled()) {
- sleep(1000, 1200);
- }
- if (!walking.isRunEnabled()) {
- sleep(1000, 1200);
- }
- if (!walking.isRunEnabled()) {
- sleep(1000, 1200);
- }
- if (!walking.isRunEnabled()) {
- sleep(1000, 1200);
- }
- if (!walking.isRunEnabled()) {
- sleep(1000, 1200);
- }
- }
- if (inventory.contains(14664)) {
- inventory.getItem(14664).doAction("Drop");
- }
- if (isIn(2034, 5185, 3, 2)) {
- openDoor(2036, 5185, false);
- }
- }
- public int loop() {
- RoundlyChecks();
- switch (getState()) {
- case Banking:
- Bank();
- break;
- case WalkingToFleshCrawlers:
- walkToFleshCrawlers();
- break;
- case NeedToEat:
- if (GetEdibleFoods() != null) {
- EatFood();
- } else {
- Bank();
- }
- break;
- case NeedToDrinkPotion:
- DrinkPotion();
- break;
- case Attack:
- if (FleshCrawlers.contains(getMyPlayer().getLocation())) {
- if (getGroundItem() != null && !inventory.isFull()
- && getGroundItem().isOnScreen()) {
- pickGroundItem();
- } else {
- processAttack();
- }
- } else {
- walkToFleshCrawlers();
- }
- break;
- case Waiting:
- if (!FleshCrawlers.contains(getMyPlayer().getLocation())
- & getMyPlayer().isInCombat()) {
- walkToFleshCrawlers();
- }
- long i = System.currentTimeMillis();
- if (i - ABTime > random(60000, 240000)
- && FleshCrawlers.contains(getMyPlayer().getLocation())) {
- Antiban();
- ABTime = System.currentTimeMillis();
- } else {
- sleep(300, 400);
- }
- break;
- }
- return 10;
- }
- public RSGroundItem getGroundItem() {
- RSGroundItem a = null;
- final int[] DataBaseDrops = { 1731, 379, 1619, 211, 217, 209, 213,
- 2485, 207, 3051, 3049, 219, 14836, 987, 985, 1617, 1621 };
- a = groundItems.getNearest(new Filter<RSGroundItem>() {
- public boolean accept(RSGroundItem n) {
- for (int i : DataBaseDrops) {
- if (n.getItem().getID() != i) {
- continue;
- }
- return true;
- }
- return false;
- }
- });
- if (a != null) {
- return a;
- } else {
- return null;
- }
- }
- public void pickGroundItem() {
- RSGroundItem item = getGroundItem();
- if (item.doAction("Take")) {
- if (random(1, 10) == 1) {
- mouse.moveSlightly();
- } else {
- mouse.moveRandomly(20);
- }
- sleep(1200, 1400);
- } else {
- sleep(200, 300);
- }
- }
- @SuppressWarnings("static-access")
- public void Antiban() {
- int[] skillsIDIndex = { 6, 14, 5, 4, 20, 18, 13, 2, 23, 17, 8, 16, 0,
- 3, 22, 7, 12, 1, 24, 19, 11, 10, 9, 15, 21, 2, 2, 2 };
- int NOS = skillsIDIndex.length;
- switch (random(1, 10)) {
- case 1:
- camera.moveRandomly(1800);
- sleep(1000, 1200);
- break;
- case 2:
- mouse.moveRandomly(500, 800);
- sleep(1000, 2000);
- break;
- case 3:
- mouse.moveOffScreen();
- sleep(2000, 3000);
- break;
- case 4:
- camera.setPitch(random(20, 70));
- break;
- case 5:
- game.openTab(game.TAB_STATS);
- sleep(random(0, 3000));
- switch (random(1, 5)) {
- case 1:
- skills.doHover(Skills.STRENGTH);
- break;
- case 2:
- skills.doHover(Skills.ATTACK);
- break;
- case 3:
- skills.doHover(Skills.DEFENSE);
- break;
- case 4:
- skills.doHover(Skills.CONSTITUTION);
- break;
- case 5:
- skills.doHover(skillsIDIndex[random(1, NOS)]);
- break;
- }
- sleep(1000, 2000);
- break;
- case 6:
- camera.setAngle(camera.getAngle() + random(-100, 100));
- sleep(400, 500);
- break;
- case 7:
- camera.setAngle(camera.getAngle() + random(-100, 100));
- sleep(400, 500);
- break;
- case 8:
- game.openTab(game.TAB_STATS);
- sleep(random(0, 3000));
- switch (random(1, 5)) {
- case 1:
- skills.doHover(Skills.STRENGTH);
- break;
- case 2:
- skills.doHover(Skills.ATTACK);
- break;
- case 3:
- skills.doHover(Skills.DEFENSE);
- break;
- case 4:
- skills.doHover(Skills.CONSTITUTION);
- break;
- case 5:
- skills.doHover(skillsIDIndex[random(1, NOS)]);
- break;
- }
- sleep(1000, 2000);
- break;
- case 9:
- camera.moveRandomly(1800);
- sleep(1000, 1200);
- break;
- case 10:
- mouse.moveRandomly(1500, 1800);
- sleep(1000, 2000);
- break;
- }
- }
- public void onFinish() {
- }
- public void serverMessageRecieved(ServerMessageEvent e) {
- if (e.toString().contains("under attack")) {
- sleep(1000, 1200);
- }
- if (e.toString().contains("else is fighting")) {
- dist = true;
- sleep(200, 300);
- processAttack();
- }
- }
- public boolean isHover(int x1, int y1, int x2, int y2) {
- if (p != null) {
- if (p.getX() >= x1 && p.getY() >= y1 && p.getX() <= x2
- && p.getY() <= y2) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
- public void mouseMoved(MouseEvent e) {
- p = e.getPoint();
- }
- private String formatTime() {
- long time = System.currentTimeMillis() - startTime;
- final StringBuilder stringAppend = new StringBuilder();
- final long TSec = time / 1000;
- final long TMin = TSec / 60;
- final long THour = TMin / 60;
- final int s = (int) TSec % 60;
- final int m = (int) TMin % 60;
- final int h = (int) THour;
- if (time <= 0) {
- return "00:00:00";
- }
- if (h < 10) {
- stringAppend.append("0");
- }
- stringAppend.append(h);
- stringAppend.append(":");
- if (m < 10) {
- stringAppend.append("0");
- }
- stringAppend.append(m);
- stringAppend.append(":");
- if (s < 10) {
- stringAppend.append("0");
- }
- stringAppend.append(s);
- return stringAppend.toString();
- }
- private final BasicStroke stroke2 = new BasicStroke(2);
- private final Color color1 = new Color(204, 255, 255);
- private final Color color2 = new Color(0, 0, 204);
- private final Color color3 = new Color(153, 0, 0);
- private final BasicStroke stroke1 = new BasicStroke(5);
- private final Font font1 = new Font("Lucida Sans", 1, 12);
- public Point p;
- private double RoE = 0;
- private double E = 0;
- private long E_currentTime = 0;
- private long E_startTime = 0;
- private long timeRunning = 0;
- public void updateVariables() {
- currentTime = System.currentTimeMillis();
- timeRunning = currentTime - startTime;
- E_currentTime = skills.getCurrentExp(Skills.STRENGTH)
- + skills.getCurrentExp(Skills.ATTACK)
- + skills.getCurrentExp(Skills.DEFENSE)
- + skills.getCurrentExp(Skills.RANGE)
- + skills.getCurrentExp(Skills.CONSTITUTION);
- E = (E_currentTime - E_startTime);
- RoE = E / (1000 * timeRunning / (1000 * 60 * 60));
- }
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D) g1;
- Point l = mouse.getLocation();
- g.setColor(color1);
- g.setStroke(stroke2);
- g.drawLine(l.x, 0, l.x, 600);
- g.drawLine(800, l.y, 0, l.y);
- if (isHover(550, 435, 730, 465)) {
- updateVariables();
- g.setColor(color1);
- g.fillRoundRect(548, 434, 187, 27, 16, 16);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRoundRect(548, 434, 187, 27, 16, 16);
- g.setFont(font1);
- g.setColor(color3);
- g.drawString("Unhover to hide progress", 563, 453);
- g.setColor(color1);
- g.fillRoundRect(548, 340, 184, 88, 16, 16);
- g.setColor(color2);
- g.drawRoundRect(548, 340, 184, 88, 16, 16);
- g.setColor(color3);
- g.drawString("Experience/Hour: " + Math.round(RoE) + " K/PH", 557,
- 420);
- if (E < 1000) {
- g.drawString("Experience: " + Math.round(E), 557, 390);
- } else {
- g.drawString("Experience: " + (Math.round(E) / 1000) + " K",
- 557, 390);
- }
- g.drawString("Time: " + formatTime(), 557, 360);
- } else {
- g.setColor(color1);
- g.setColor(color1);
- g.fillRoundRect(548, 434, 187, 27, 16, 16);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRoundRect(548, 434, 187, 27, 16, 16);
- g.setFont(font1);
- g.setColor(color3);
- g.drawString("Hover to show progress", 565, 453);
- }
- }
- public void mouseDragged(MouseEvent arg0) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement