-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUSPrayer.java
More file actions
194 lines (156 loc) · 5.38 KB
/
USPrayer.java
File metadata and controls
194 lines (156 loc) · 5.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URL;
import java.text.DecimalFormat;
import java.util.ArrayList;
import javax.imageio.ImageIO;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import org.parabot.environment.api.interfaces.Paintable;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.api.utils.Timer;
import org.parabot.environment.scripts.Category;
import org.parabot.environment.scripts.Script;
import org.parabot.environment.scripts.ScriptManifest;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.Skill;
@ScriptManifest(author = "Brookpc",
category = Category.PRAYER,
description = "Uses Choice of Bone/Ash on altar",
name = "USPrayer",
servers = { "Ultimate Scape" },
version = 1.2)
public class USPrayer extends Script implements Paintable {
ArrayList<Strategy> strategies = new ArrayList<Strategy>();
//Bones,BigBones,DragBones,InfAsh
final int[] BONE_ID = {527,533,537,20269};
public static int useBone;
//Paint
private final Color textColor = new Color(255, 255, 255);
private final Font textFont = new Font("Arial", 0, 14);
private final Timer RUNTIME = new Timer();
private static Image img;
public static int blessCount;
private static int gainedLvl;
private static int startLvl;
//GUI
Gui x = new Gui();
boolean guiWait = true;
/***************************************************************************************************************************************/
@Override
public boolean onExecute() {
x.setVisible(true);
while (x.isRunning && guiWait) {
Time.sleep(200);
}
//startLvl = Skill.PRAYER.getLevel();
img = getImage("http://i.imgur.com/BlTvmiW.png");
strategies.add(new Relog());
strategies.add(new DoBank());
strategies.add(new PrayAlter());
provide(strategies);
return true;
}
/***************************************************************************************************************************************/
@Override
public void paint(Graphics arg0) {
Graphics2D g = (Graphics2D) arg0;
g.drawImage(img, 4, 23, null);
g.setFont(textFont);
g.setColor(textColor);
g.drawString("----", 82, 57);
g.drawString("----", 85, 70);
g.drawString("" + RUNTIME, 82, 83);
}
/***************************************************************************************************************************************/
public static int gainedLevel() {
//gainedLvl = Skill.COOKING.getLevel() - startLvl;
return gainedLvl;
}
/***************************************************************************************************************************************/
public static Image getImage(String url) {
try {
return ImageIO.read(new URL(url));
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
/***************************************************************************************************************************************/
public String addDecimals(int i) {
DecimalFormat x = new DecimalFormat("#,###");
return "" + x.format(i);
}
/***************************************************************************************************************************************/
public class Gui extends JFrame {
private static final long serialVersionUID = -6241803601296202605L;
public boolean isRunning = true;
private JPanel contentPane;
public void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Gui frame = new Gui();
frame.setVisible(true);
} catch (Exception e) {
System.out.println("Line 136");
}
}
});
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public Gui() {
setResizable(false);
setTitle("USPrayer");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 177, 139);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JComboBox comboBox = new JComboBox();
comboBox.setModel(new DefaultComboBoxModel(new String[] {"Bones", "Big Bones", "Dragon Bones", "Infernal Ashes"}));
comboBox.setBounds(26, 46, 109, 20);
contentPane.add(comboBox);
JLabel lblUsprayer = new JLabel("USPrayer");
lblUsprayer.setFont(new Font("Trebuchet MS", Font.PLAIN, 16));
lblUsprayer.setBounds(47, 0, 78, 48);
contentPane.add(lblUsprayer);
//Start Button
JButton btnStart = new JButton("Start");
btnStart.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(comboBox.getSelectedIndex() == 0) {
useBone = BONE_ID[0];
}
else if(comboBox.getSelectedIndex() == 1) {
useBone = BONE_ID[1];
}
else if(comboBox.getSelectedIndex() == 2) {
useBone = BONE_ID[2];
}
else if(comboBox.getSelectedIndex() == 3) {
useBone = BONE_ID[3];
}
guiWait = false;
isRunning = false;
x.dispose();
}
});
btnStart.setBounds(36, 77, 89, 23);
contentPane.add(btnStart);
}
}
}