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 org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.wrappers.RSGroundItem;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.script.wrappers.RSTilePath;
- import org.rsbot.script.ScriptManifest;
- @ScriptManifest (
- authors = ("Snowdroq"),
- version = 1.0,
- keywords = ("ogre, killer, fighter, castle, wars"),
- description = "OgreKiller By Snowdroq",
- name = "sqOgreKiller"
- )
- public class sqOgreKiller extends Script implements PaintListener {
- /*
- * ID'S
- */
- private final static int[] OGRE_ID = {3419, 3451, 8658};
- private final static int BIGBONES_ID = 532;
- private final static int CHEST_ID = 4483;
- private final static int TUNA_ID = 361;
- private final static int SWORDFISH_ID = 373;
- private final static int MONKFISH_ID = 7946;
- private final static int SHARK_ID = 385;
- private int foodToEat = 0;
- private int stats[][];
- private boolean OgreGUIWait = true;
- private final static RSTile[] tilesToBank = {new RSTile(2499,3094),new RSTile(2492,3085), new RSTile(2487,3077),
- new RSTile(2474,3073),new RSTile(2464,3075), new RSTile(2459,3074),
- new RSTile(2457,3083),new RSTile(2456,3090),
- new RSTile(2443,3090),
- new RSTile(2444,3083)};
- private RSTilePath pathToBank;
- private long startTime;
- private int expGained = 0;
- private int startExp = 0;
- private int Banked = 0;
- private int bonesBanked = 0;
- @Override
- public int loop() {
- if(getMyPlayer().getHPPercent() < 50) {
- eat();
- }
- if(inventory.getCount(foodToEat) <= 1) {
- if (atBank()) {
- doBank();
- } else {
- walk();
- }
- } else {
- if(atOgres() && (foodToEat) >=1) {
- if(!getMyPlayer().isInCombat()) {
- attackOgre();
- sleep(500,500);
- pickup (BIGBONES_ID);
- }
- } else {
- walkR();
- }
- }
- return random(600,800);
- }
- final boolean atOgres() {
- RSNPC ogre = npcs.getNearest(OGRE_ID);
- if(ogre != null) {
- if(ogre.isOnScreen()) {
- return true;
- }
- }
- return false;
- }
- boolean bones;
- private void attackOgre() {
- RSNPC ogre = npcs.getNearest(OGRE_ID);
- if(!ogre.isInCombat()) {
- ogre.interact("Attack");
- sleep(650,800);
- }
- }
- private void pickup(int id) {
- if(groundItems.getNearest(id) != null && !inventory.isFull()) {
- RSGroundItem item = groundItems.getNearest(id);
- if(calc.tileOnScreen(item.getLocation())) {
- item.interact("Take " + item.getItem().getName());
- } else {
- walking.walkTileMM(groundItems.getNearest(id).getLocation());
- }
- sleep(600,800);
- }
- }
- private void eat() {
- inventory.getItem(foodToEat).doClick(true);
- sleep(800,1000);
- }
- OgreGUI g = new OgreGUI();
- public boolean onStart() {
- startExp = skills.getCurrentExp(skills.STRENGTH);
- pathToBank = walking.newTilePath(tilesToBank);
- startTime = System.currentTimeMillis();
- g.setVisible(true);
- while(OgreGUIWait) sleep(500);
- return true;
- }
- private final void walkR() {
- pathToBank.reverse();
- pathToBank.traverse();
- pathToBank.reverse();
- }
- private final void walk() {
- pathToBank.traverse();
- }
- public void onFinish() {
- log("Thank You For Using Snowdroqs Ogre Killer!");
- }
- private final boolean atBank() {
- RSObject bank = objects.getNearest(CHEST_ID);
- if(bank != null) {
- if(bank.isOnScreen()) {
- return true;
- }
- }
- return false;
- }
- private final void doBank() {
- if (bank.isOpen()) {
- Banked = inventory.getCount(BIGBONES_ID);
- bonesBanked += Banked;
- bank.depositAll();
- sleep(800,1200);
- bank.withdraw (foodToEat, 28);
- } else {
- bank.open();
- sleep(1800,2200);
- }
- }
- //START: Code generated using Enfilade's Easel
- private final Color color1 = new Color(153, 0, 153);
- private final Color color2 = new Color(0, 0, 0);
- private final Color color3 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("BankGothic Lt BT", 0, 16);
- //END: Code generated using Enfilade's Easel
- @Override
- public void onRepaint(Graphics g) {
- expGained = skills.getCurrentExp(skills.STRENGTH) - startExp;
- 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;
- float xpsec = 0;
- if((minutes > 0 || hours > 0 || seconds > 0) && expGained > 0) {
- xpsec = ((float) expGained)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- float xpmin = xpsec * 60;
- float xphour = xpmin * 60;
- Graphics2D g1 = (Graphics2D)g;
- g1.setColor(color1);
- g1.fillRect(6, 344, 506, 129);
- g1.setColor(color2);
- g1.setStroke(stroke1);
- g1.drawRect(6, 344, 506, 129);
- g1.setFont(font1);
- g1.setColor(color3);
- g1.drawString("Snowdroqs Ogre Killer V1.0", 13, 361);
- g1.drawString("Runtime: " + hours + ":" + minutes + ":" + seconds, 12, 393);
- g1.drawString("Experience Gained: " + expGained, 250, 393);
- g1.drawString("Experience/h: " + (int)xphour, 250, 433);
- g1.drawString("Bones Banked: " + bonesBanked, 12, 433);
- g.drawLine(mouse.getLocation().x - 2000, mouse.getLocation().y,
- mouse.getLocation().x + 2000, mouse.getLocation().y);
- g.drawLine(mouse.getLocation
- ().x, mouse.getLocation().y - 2000,
- mouse.getLocation().x, mouse.getLocation().y + 2000);
- }class OgreGUI extends javax.swing.JFrame {
- /** Creates new form OgreGUI */
- public OgreGUI() {
- initComponents();
- }
- /** This method is called from within the constructor to
- * initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is
- * always regenerated by the Form Editor.
- */
- @SuppressWarnings("unchecked")
- // <editor-fold defaultstate="collapsed" desc="Generated Code">
- private void initComponents() {
- jLabel1 = new javax.swing.JLabel();
- jLabel2 = new javax.swing.JLabel();
- foodSelected = new javax.swing.JComboBox();
- startButton = new javax.swing.JButton();
- jLabel1.setFont(new java.awt.Font("BankGothic Lt BT", 1, 18)); // NOI18N
- jLabel1.setText("Snowdroqs Ogre Killer");
- jLabel2.setText("Food:");
- foodSelected.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Tuna", "Swordfish", "Monkfish", "Shark" }));
- startButton.setText("Start");
- startButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- startButtonActionPerformed(evt);
- }
- });
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabel1)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jLabel2)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(foodSelected, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addContainerGap(22, Short.MAX_VALUE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addContainerGap(207, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel1)
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel2)
- .addComponent(foodSelected, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 25, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- }// </editor-fold>
- private void startButtonActionPerformed(java.awt.event.ActionEvent e) {
- String chosen = foodSelected.getSelectedItem().toString();
- if(chosen.equals("Tuna")) {
- foodToEat = TUNA_ID;
- } else if(chosen.equals("Swordfish")) {
- foodToEat = SWORDFISH_ID;
- } else if(chosen.equals("Monkfish")) {
- foodToEat = MONKFISH_ID;
- } else {
- foodToEat = SHARK_ID;
- }
- OgreGUIWait = false;
- g.dispose();
- }
- /**
- * @param args the command line arguments
- */
- public void main(String args[]) {
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- new OgreGUI().setVisible(true);
- }
- });
- }
- // Variables declaration - do not modify
- private javax.swing.JComboBox foodSelected;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel2;
- private javax.swing.JButton startButton;
- // End of variables declaration
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement