Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Map;
- import java.awt.*;
- import java.util.*;
- import org.rsbot.script.Constants;
- import org.rsbot.script.Script;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.wrappers.RSInterface;
- import org.rsbot.script.wrappers.RSItem;
- import org.rsbot.script.wrappers.RSItemTile;
- import org.rsbot.script.wrappers.RSNPC;
- import java.awt.Graphics;
- import org.rsbot.script.wrappers.RSTile;
- @ScriptManifest(authors = {"Hellxx"}, category = "Combat", name = "AvianKiller", version = 0.1, description = "<html><body><b>Kill every mob you want</b><br /><h3>Thanks for scripters, used some code =]</h3><BR></font></font></body></html>")
- public class AvianKiller extends Script implements PaintListener {
- int MID[] = {6241,6242,6244,6234};
- int mobdied = 6956;
- RSItemTile itemtile1;
- RSItemTile itemtile2;
- RSItemTile itemtile3;
- RSItemTile itemtile4;
- RSItemTile itemtile5;
- RSItemTile itemtile6;
- RSItemTile itemtile7;
- RSItemTile itemtile8;
- RSItemTile itemtile9;
- RSItemTile itemtile;
- long startTime = System.currentTimeMillis();
- int startexpR, startexpA, startexpS, startexpD, startexpH;
- int xpGained;
- int xpGained2;
- int startexp;
- RSTile StartSpot;
- final int[] FOOD_IDS = { 1895, 1893, 1891, 4293, 2142, 291, 2140, 3228, 9980,
- 7223, 6297, 6293, 6295, 6299, 7521, 9988, 7228, 2878, 7568, 2343,
- 1861, 13433, 315, 325, 319, 3144, 347, 355, 333, 339, 351, 329,
- 3381, 361, 10136, 5003, 379, 365, 373, 7946, 385, 397, 391, 3369,
- 3371, 3373, 2309, 2325, 2333, 2327, 2331, 2323, 2335, 7178, 7180,
- 7188, 7190, 7198, 7200, 7208, 7210, 7218, 7220, 2003, 2011, 2289,
- 2291, 2293, 2295, 2297, 2299, 2301, 2303, 1891, 1893, 1895, 1897,
- 1899, 1901, 7072, 7062, 7078, 7064, 7084, 7082, 7066, 7068, 1942,
- 6701, 6703, 7054, 6705, 7056, 7060, 2130, 1985, 1993, 1989, 1978,
- 5763, 5765, 1913, 5747, 1905, 5739, 1909, 5743, 1907, 1911, 5745,
- 2955, 5749, 5751, 5753, 5755, 5757, 5759, 5761, 2084, 2034, 2048,
- 2036, 2217, 2213, 2205, 2209, 2054, 2040, 2080, 2277, 2225, 2255,
- 2221, 2253, 2219, 2281, 2227, 2223, 2191, 2233, 2092, 2032, 2074,
- 2030, 2281, 2235, 2064, 2028, 2187, 2185, 2229, 6883, 1971, 4608,
- 1883, 1885, 1942 };
- int peaches = 6883;
- final int[] tablet = { 8015 };
- final int[] ITEMIDS = { 2362, 561, 526, 565, 5678, 9431, 1249, 373 };
- int[] alchItem = {5678, 9431};
- String status;
- public int loop() {
- try {
- status = "loop";
- int curHP = skills.getCurrentSkillLevel(STAT_HITPOINTS);
- if (curHP <= 49)
- {
- wait(1000);
- eat();
- }
- if (getMyPlayer().isInCombat())
- {
- return 80;
- }
- if (getMyPlayer().isMoving())
- {
- return 80;
- }
- final RSItemTile itemtile = getGroundItemByID(ITEMIDS);
- if (itemtile != null)
- {
- item();
- }
- if(inventoryContainsOneOf(FOOD_IDS))
- {
- fight();
- }
- else
- {
- return 80;
- }
- }
- catch (final Exception e)
- {
- log("loop() error, caught.");
- e.printStackTrace();
- }
- return(random(100,200));
- }
- public int item(){
- status = "item..";
- if (getInventoryCount(alchItem) >= 1) {
- doAlch();
- }
- if (getInventoryCount(FOOD_IDS) <= 1)
- {
- clickInventoryItem(tablet, "Break");
- wait(1500);
- return 200;
- }
- final RSItemTile itemtile1 = getGroundItemByID(2362);
- final RSItemTile itemtile2 = getGroundItemByID(563);
- final RSItemTile itemtile3 = getGroundItemByID(561);
- final RSItemTile itemtile4 = getGroundItemByID(526);
- final RSItemTile itemtile5 = getGroundItemByID(2362);
- final RSItemTile itemtile6 = getGroundItemByID(5678);
- final RSItemTile itemtile7 = getGroundItemByID(9431);
- final RSItemTile itemtile9 = getGroundItemByID(373);
- if (itemtile1 != null || itemtile2 != null || itemtile3 != null || itemtile4 != null || itemtile5 != null || itemtile6 != null || itemtile7 != null || itemtile8 != null || itemtile9 != null)
- {
- if (itemtile1 != null &&(getMyPlayer().getAnimation() == -1))
- {
- atTile(itemtile1, "Take Adamantite bar");
- wait(random(2000,2500));
- }
- if (itemtile2 != null &&(getMyPlayer().getAnimation() == -1))
- {
- atTile(itemtile2, "Take Law rune");
- wait(random(2000,2500));
- }
- if (itemtile3 != null &&(getMyPlayer().getAnimation() == -1))
- {
- atTile(itemtile3, "Take Nature rune");
- wait(random(2000,2500));
- }
- if (itemtile4 != null && (getMyPlayer().getAnimation() == -1) && getInventoryCount() < 27)
- {
- atTile(itemtile4, "Take Bones");
- wait(random(2000,2500));
- }
- if (itemtile5 != null && (getMyPlayer().getAnimation() == -1))
- {
- atTile(itemtile5, "Take Blood rune");
- wait(random(2000,2500));
- }
- if (itemtile6 != null && (getMyPlayer().getAnimation() == -1) && !isInventoryFull())
- {
- atTile(itemtile6, "Take Rune dagger (p+)");
- wait(random(2000,2500));
- }
- if (itemtile7 != null && (getMyPlayer().getAnimation() == -1) && !isInventoryFull())
- {
- atTile(itemtile7, "Take Runite limbs");
- wait(random(2000,2500));
- }
- final RSItemTile itemtile8 = getGroundItemByID(1249);
- if (itemtile8 != null && (getMyPlayer().getAnimation() == -1) && !isInventoryFull())
- {
- atTile(itemtile8, "Take Dragon spear");
- wait(random(2000,2500));
- }
- if (itemtile9 != null && (getMyPlayer().getAnimation() == -1) && !isInventoryFull())
- {
- atTile(itemtile9, "Take Swordfish");
- wait(random(2000,2500));
- }
- return 80;
- }
- else
- {
- return 80;
- }
- }
- public int eat()
- {
- status = "eat";
- int curHP = skills.getCurrentSkillLevel(STAT_HITPOINTS);
- double eat = random(skills.getRealSkillLevel(STAT_HITPOINTS) * 0.7, skills.getRealSkillLevel(STAT_HITPOINTS)* 0.6);
- if (curHP <= eat) {
- clickInventoryItem(FOOD_IDS, "Eat");
- wait(500);
- return 80;
- }
- status = "eat ended";
- return loop();
- }
- public Point getAlchItemPos() {
- final RSItem[] iItems = getInventoryItems();
- for (final int element : alchItem) {
- final Point nip = getNearInvItemPoint(element);
- if (nip != null) {
- return nip;
- }
- for (int j = 27; j >= 0; j--) {
- if (iItems[j].getID() == element) {
- final Point aip = getInventoryItemPoint(j);
- return new Point(aip.x + random(10, 15), aip.y
- + random(10, 15));
- }
- }
- }
- return null;
- }
- private Point getNearInvItemPoint(final int itemID) {
- final RSItem[] iItems = getInventoryItems();
- // SPELL_HIGH_LEVEL_ALCHEMY
- final int spellX = RSInterface.getInterface(192).getChild(34)
- .getAbsoluteX()
- + random(7, 16);
- final int spellY = RSInterface.getInterface(192).getChild(34)
- .getAbsoluteY()
- + random(7, 16);
- final int col = (int) Math.floor((spellX - 559) / 42);
- final int row = (int) Math.floor((spellY - 210) / 36);
- if (col >= 0 && col <= 3 && row >= 0 && row <= 6) {
- if (iItems[(row * 4 + col)].getID() == itemID) {
- return randomiseInventoryItemPoint(getInventoryItemPoint((row * 4 + col)));
- }
- }
- return null;
- }
- public void doAlch() {
- openTab(Constants.TAB_MAGIC);
- castSpell(Constants.SPELL_HIGH_LEVEL_ALCHEMY);
- final Point alchItemPos = getAlchItemPos();
- clickMouse(alchItemPos, true);
- wait(1000);
- }
- private boolean clickInventoryItem(final int[] ids, final String command) {
- try {
- if (getCurrentTab() != Constants.TAB_INVENTORY
- && !RSInterface.getInterface(Constants.INTERFACE_BANK)
- .isValid()
- && !RSInterface.getInterface(Constants.INTERFACE_STORE)
- .isValid()) {
- openTab(Constants.TAB_INVENTORY);
- }
- final int[] items = getInventoryArray();
- final java.util.List<Integer> possible = new ArrayList<Integer>();
- for (int i = 0; i < items.length; i++) {
- for (final int item : ids) {
- if (items[i] == item) {
- possible.add(i);
- }
- }
- }
- if (possible.size() == 0) {
- return false;
- }
- final int idx = possible.get(random(0, possible.size()));
- final Point t = getInventoryItemPoint(idx);
- moveMouse(t, 5, 5);
- wait(random(100, 290));
- if (getMenuActions().get(0).equals(command)) {
- clickMouse(true);
- return true;
- } else {
- // clickMouse(false);
- return atMenu(command);
- }
- } catch (final Exception e) {
- log("clickInventoryFood(int...) error");
- return false;
- }
- }
- public int fight()
- {
- status = "fight";
- try
- {
- if (getMyPlayer().getInteracting() == null)
- {
- RSNPC mob = getNearestFreeNPCToAttackByID(MID);
- if (mob != null)
- {
- if (tileOnScreen(mob.getLocation()) && (!getMyPlayer().isMoving()))
- {
- atNPC(mob,"Attack");
- wait(500);
- return random(1000,1200);
- }
- else
- {
- walkTileMM(mob.getLocation());
- return random(10,20);
- }
- }
- }
- }
- catch (final Exception e)
- {
- log("fight() error, caught.");
- e.printStackTrace();
- }
- return random(400,600);
- }
- public void onFinish() {
- log("Turning off...");
- }
- public boolean onStart(final Map<String, String> args) {
- StartSpot = getMyPlayer().getLocation();
- return true;
- }
- public void onRepaint(Graphics g) {
- if (isLoggedIn()) {
- long millis = System.currentTimeMillis() - startTime;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- if (startexp == 0) {
- startexpR = skills.getCurrentSkillExp(STAT_RANGE);
- startexpA = skills.getCurrentSkillExp(STAT_ATTACK);
- startexpS = skills.getCurrentSkillExp(STAT_STRENGTH);
- startexpD = skills.getCurrentSkillExp(STAT_DEFENSE);
- startexpH = skills.getCurrentSkillExp(STAT_HITPOINTS);
- startexp = 1;
- }
- xpGained = skills.getCurrentSkillExp(STAT_STRENGTH)
- + skills.getCurrentSkillExp(STAT_RANGE)
- + skills.getCurrentSkillExp(STAT_ATTACK)
- + skills.getCurrentSkillExp(STAT_DEFENSE)
- - startexpR
- - startexpA - startexpS - startexpD;
- xpGained2 = skills.getCurrentSkillExp(STAT_HITPOINTS)
- - startexpH;
- int x = 300;
- int y = 16;
- g.setFont(new Font("Verdana", Font.BOLD, 12));
- g.setColor(new Color(0, 60, 0, 255));
- g.fill3DRect(295, 3, 222, 100, true); // 132 if not
- g.draw3DRect(295, 3, 222, 100, true);
- g.setColor(Color.green);
- g.drawString("Combat experience: " + xpGained, x, y + 48);
- g.drawString("Time running :" + hours + ":" + minutes + ":"
- + seconds + "", x, y + 32);
- g.drawString("status: " + status, x, y + 16);
- }
- }
- }
Add Comment
Please, Sign In to add comment