Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import javax.swing.*; import org.powerbot.concurrent.Task; import org.powerbot.concurrent.strategy.Condition; import org.powerbot.concurrent.strategy.Strategy; import org.powerbot.game.api.ActiveScript; import org.powerbot.game.api.Manifest; import org.powerbot.game.api.methods.Tabs; import org.powerbot.game.api.methods.Walking; import org.powerbot.game.api.methods.interactive.NPCs; import org.powerbot.game.api.methods.interactive.Players; import org.powerbot.game.api.methods.node.GroundItems; import org.powerbot.game.api.methods.tab.Inventory; import org.powerbot.game.api.methods.widget.Camera; import org.powerbot.game.api.util.Random; import org.powerbot.game.api.util.Time; import org.powerbot.game.api.wrappers.Area; import org.powerbot.game.api.wrappers.Tile; import org.powerbot.game.api.wrappers.node.GroundItem; import org.powerbot.game.bot.event.listener.PaintListener; @Manifest(name = "Asher", description = "Picks Ashes At Various Locations", version = 1.1, authors = {"Thondar"}) public class Asher extends ActiveScript implements PaintListener { int Ash = 592; int Banker[] = {553, 3418}; long startTime; long runTime; long hr, min, sec; long xpGain; int AshCount; int AshInv; int AshPrice; int AshHour; int Profit; int ProfitHour; int Location; private int getPrice(int id) throws IOException { URL url = new URL("http://open.tip.it/json/ge_single_item?item=" + 592); URLConnection con = url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader( con.getInputStream())); String line = ""; String inputLine; while ((inputLine = in.readLine()) != null) { line += inputLine; } in.close(); if (!line.contains("mark_price")) return -1; line = line.substring(line.indexOf("mark_price\":\"") + "mark_price\":\"".length()); line = line.substring(0, line.indexOf("\"")); return Integer.parseInt(line.replaceAll(",", "")); } GUI g; private boolean guiWait = true; String time; String status; Tile BankTile = new Tile(3185, 3439, 0); Tile AshTile = new Tile(3184, 3429, 0); boolean start = false; @Override protected void setup() { log.info("Welcome to Asher 1.0"); log.info("Made by Thondar"); start = true; AshCount = 0; try { AshPrice = getPrice(592); } catch (IOException e) { e.printStackTrace(); } g = new GUI(); g.setVisible(true); startTime = System.currentTimeMillis(); final WaitGui guiTask = new WaitGui(); provide(new Strategy(guiTask, guiTask)); provide(new Strategy(new WaitGui(), new WaitGui())); AntiBan ab = new AntiBan(); Strategy abStrategy = new Strategy(ab, ab); provide(abStrategy); PickAsh pickash = new PickAsh(); Strategy pickashStrategy = new Strategy(pickash, pickash); provide(pickashStrategy); Bank bank = new Bank(); Strategy bankStrategy = new Strategy(bank, bank); provide(bankStrategy); BankOpen bankopen = new BankOpen(); Strategy bankopenStrategy = new Strategy(bankopen, bankopen); provide(bankopenStrategy); BankWalk bankwalk = new BankWalk(); Strategy bankwalkStrategy = new Strategy(bankwalk, bankwalk); provide(bankwalkStrategy); AshWalk ashwalk = new AshWalk(); Strategy ashwalkStrategy = new Strategy(ashwalk, ashwalk); provide(ashwalkStrategy); Tabs.INVENTORY.open(false); } private class WaitGui implements Task, Condition { @Override public void run() { while (guiWait) { Time.sleep(500); } } public boolean validate() { return guiWait; } } private class AntiBan implements Task, Condition { @Override public void run() { switch(Random.nextInt(1, 200)){ case 3: Camera.setAngle(Random.nextInt(1, 150)); case 33: Camera.setAngle(Random.nextInt(1, 310)); case 75: Camera.setAngle(Random.nextInt(1, 210)); default: } Time.sleep(Random.nextInt(100, 200)); } @Override public boolean validate() { return start; } } private class PickAsh implements Task, Condition { @Override public void run() { GroundItem Ashes = GroundItems.getNearest(Ash); if(Ashes != null) { if(Ashes.isOnScreen()) { Ashes.interact("Take"); status = "Looting"; } else { Walking.walk(Ashes.getLocation()); } } } @Override public boolean validate() { return !Inventory.isFull() && GroundItems.getNearest(Ash).isOnScreen(); } } private class BankWalk implements Task, Condition { @Override public void run() { status = ("Walking to Bank"); Camera.setPitch(Random.nextInt(88, 96)); Camera.setAngle(Random.nextInt(160, 200)); Walking.walk(BankTile); } @Override public boolean validate() { return Inventory.isFull() && !NPCs.getNearest(Banker).isOnScreen(); } } private class AshWalk implements Task, Condition { @Override public void run() { status = ("Looking for Ashes"); Camera.setPitch(Random.nextInt(40, 80)); Camera.setAngle(Random.nextInt(90, 270)); Walking.walk(AshTile); } @Override public boolean validate() { return !Inventory.isFull() && !GroundItems.getNearest(Ash).isOnScreen(); } } private class BankOpen implements Task, Condition { @Override public void run() { status = ("Banking"); NPCs.getNearest(Banker).interact("Bank"); Time.sleep(Random.nextInt(2000, 3500)); } @Override public boolean validate() { return Inventory.isFull() && NPCs.getNearest(Banker).isOnScreen() && (Players.getLocal().getAnimation() == -1); } } private class Bank implements Task, Condition { @Override public void run() { status = ("Banking"); AshInv = Inventory.getCount(Ash); AshCount += AshInv; org.powerbot.game.api.methods.widget.Bank.depositInventory(); Time.sleep(Random.nextInt(500, 900)); org.powerbot.game.api.methods.widget.Bank.close(); } @Override public boolean validate() { return Inventory.isFull() && org.powerbot.game.api.methods.widget.Bank.isOpen(); } } private AlphaComposite makeComposite(float alpha) { int type = AlphaComposite.SRC_OVER; return(AlphaComposite.getInstance(type, alpha)); } private final Font font1 = new Font("Verdana", 0, 16); private final Font font2 = new Font("Verdana", 0, 12); private final Font font3 = new Font("Verdana", 0, 13); private final Font font4 = new Font("Verdana", 0, 9); @Override public void onRepaint(Graphics g) { Graphics2D g2d = (Graphics2D) g; runTime = System.currentTimeMillis() - startTime; time = ""; hr = runTime / (1000 * 60 * 60); min = (runTime % (1000 * 60 * 60)) / (1000 * 60); sec = ((runTime % (1000 * 60 * 60)) % (1000 * 60)) / 1000; int AshHour = (int) ((AshCount) * 3600000D / (System .currentTimeMillis() - startTime)); Profit = AshCount * AshPrice; ProfitHour = AshHour * AshPrice; Rectangle bg = new Rectangle(10, 10, 200, 180); g2d.setComposite(makeComposite(.4f)); g2d.setColor(Color.BLACK); g2d.fill(bg); g2d.setFont(font1); g2d.setComposite(makeComposite(1f)); g2d.setColor(Color.RED); g2d.drawString("Asher", 85, 30); g2d.setFont(font3); g2d.drawString("by Thondar", 70, 45); g2d.setFont(font2); g2d.setComposite(makeComposite(.8f)); g2d.setColor(Color.WHITE); g2d.drawString("Time Run: " + hr + ":" + min + ":" + sec, 30, 70); g2d.setComposite(makeComposite(.8f)); g2d.setColor(Color.WHITE); g2d.drawString("Status: " + status, 30, 90); g2d.setComposite(makeComposite(.8f)); g2d.setColor(Color.WHITE); g2d.drawString("Ashes Banked: " + AshCount, 30, 110); g2d.setComposite(makeComposite(.8f)); g2d.setColor(Color.WHITE); g2d.drawString("Ashes Banked/H: " + AshHour, 30, 130); g2d.setComposite(makeComposite(.8f)); g2d.setColor(Color.WHITE); g2d.drawString("Profit: " + Profit, 30, 150); g2d.setComposite(makeComposite(.8f)); g2d.setColor(Color.WHITE); g2d.drawString("Profit/H: " + ProfitHour, 30, 170); g2d.setFont(font4); g2d.setComposite(makeComposite(.8f)); g2d.setColor(Color.RED); g2d.drawString("Version 1.1", 140, 180); } class GUI extends JFrame { public GUI() { initComponents(); } private void StartButtonActionPerformed(ActionEvent e) { String u = LocationCB.getSelectedItem().toString(); { if (u.equals("Varrock West")) { Location = 1; BankTile = new Tile(3185, 3439, 0); AshTile = new Tile(3184, 3429, 0); }else if (u.equals("Varrock East")) { Location = 2; BankTile = new Tile(3253, 3421, 0); AshTile = new Tile(3253, 3428, 0); }else if (u.equals("Grand Exchange")) { Location = 3; BankTile = new Tile(3176, 3478, 0); AshTile = new Tile(3165, 3480, 0); } } guiWait = false; g.dispose(); } private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Jonas Bill Jensen label1 = new JLabel(); label2 = new JLabel(); LocationCB = new JComboBox(); StartButton = new JButton(); //======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(null); //---- label1 ---- label1.setText("Asher"); label1.setHorizontalAlignment(SwingConstants.CENTER); label1.setFont(new Font("Segoe Print", Font.BOLD, 27)); contentPane.add(label1); label1.setBounds(0, 0, 290, 60); //---- label2 ---- label2.setText("Location?"); label2.setHorizontalAlignment(SwingConstants.CENTER); label2.setFont(new Font("Verdana", Font.PLAIN, 12)); contentPane.add(label2); label2.setBounds(0, 85, 290, 30); //---- LocationCB ---- LocationCB.setModel(new DefaultComboBoxModel(new String[] { "Varrock West", "Varrock East", "Grand Exchange" })); contentPane.add(LocationCB); LocationCB.setBounds(90, 110, 110, 30); //---- StartButton ---- StartButton.setText("Start"); StartButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { StartButtonActionPerformed(e); } }); contentPane.add(StartButton); StartButton.setBounds(5, 180, 280, 55); { // compute preferred size Dimension preferredSize = new Dimension(); for(int i = 0; i < contentPane.getComponentCount(); i++) { Rectangle bounds = contentPane.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = contentPane.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; contentPane.setMinimumSize(preferredSize); contentPane.setPreferredSize(preferredSize); } pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents } // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables // Generated using JFormDesigner Evaluation license - Jonas Bill Jensen private JLabel label1; private JLabel label2; private JComboBox LocationCB; private JButton StartButton; // JFormDesigner - End of variables declaration //GEN-END:variables } }
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
setups
3 hours ago | 0.16 KB
Untitled
4 hours ago | 0.36 KB
my-push Script
4 hours ago | 0.61 KB
cholibrium
1 day ago | 1.65 KB
SMB BIS - Dimble Woods - Virtual Piano
1 day ago | 3.15 KB
buscar-productos.blade.php
PHP | 2 days ago | 2.44 KB
simple youtube video to product
PHP | 2 days ago | 3.71 KB
OoT rando seed 6/1
2 days ago | 68.21 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!