-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUSCooker.java
More file actions
214 lines (178 loc) · 5.91 KB
/
USCooker.java
File metadata and controls
214 lines (178 loc) · 5.91 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
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 = "Ark",
category = Category.COOKING,
description = "Ultimate Scape 2 - AIO Cooker",
name = "USCook by Ark",
servers = { "Ultimate Scape" },
version = 1.5)
public class USCooker extends Script implements Paintable {
//Strategies List
private final ArrayList<Strategy> strategies = new ArrayList<Strategy>();
//General variables
public static int cookID = 0;
public static int rawID = 0;
public static int burnID = 0;
//Paint Variables
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 cookCount;
private static int gainedLvl;
private static int startLvl;
//GUI
Gui x = new Gui();
public boolean guiWait = true;
/***************************************************************************************************************************************/
public boolean onExecute() {
x.setVisible(true);
while (x.isRunning && guiWait) {
Time.sleep(200);
}
strategies.add(new Log());
strategies.add(new Walking());
strategies.add(new Cook());
strategies.add(new Banking());
startLvl = Skill.COOKING.getRealLevel();
img = getImage("http://i.imgur.com/gTXu4Ww.png");
provide(strategies);
System.out.println("Loaded...");
return true;
}
/***************************************************************************************************************************************/
@Override
public void paint(Graphics arg0) {
Graphics2D g = (Graphics2D) arg0;
if(startLvl == 1)
gainedLvl = Skill.COOKING.getRealLevel() - startLvl - 1;
gainedLvl = Skill.COOKING.getRealLevel() - startLvl;
g.drawImage(img, 4, 23, null);
g.setFont(textFont);
g.setColor(textColor);
g.drawString(addDecimals(gainedLvl), 82, 57);
g.drawString(addDecimals(cookCount), 82, 70);
g.drawString("" + RUNTIME, 82, 83);
}
/***************************************************************************************************************************************/
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() {
setTitle("USCooker by Ark");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 233, 160);
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[] {"Shrimp", "Trout", "Tuna", "Lobster", "Shark", "Rocktail"}));
comboBox.setBounds(55, 50, 95, 20);
contentPane.add(comboBox);
JLabel lblUscooker = new JLabel("USCooker");
lblUscooker.setFont(new Font("Agency FB", Font.PLAIN, 24));
lblUscooker.setBounds(67, 0, 105, 39);
contentPane.add(lblUscooker);
JLabel lblByArk = new JLabel("By Ark");
lblByArk.setBounds(77, 35, 46, 14);
contentPane.add(lblByArk);
//Start Button
JButton btnStart = new JButton("Start Script");
btnStart.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(comboBox.getSelectedIndex() == 0) {
//shrimp
rawID = 318;
cookID = 316;
burnID = 324;
} else if (comboBox.getSelectedIndex() == 1) {
//trout
rawID = 336;
cookID = 334;
burnID = 344;
} else if (comboBox.getSelectedIndex() == 2) {
//lobster
rawID = 378;
cookID = 380;
burnID = 382;
} else if (comboBox.getSelectedIndex() == 3) {
//tuna
rawID = 360;
cookID = 362;
burnID = 368;
} else if (comboBox.getSelectedIndex() == 4) {
//shark
rawID = 384;
cookID = 386;
burnID = 388;
} else if (comboBox.getSelectedIndex()== 5) {
//rocktail
rawID = 15271;
cookID = 15273;
burnID = 15275;
}
guiWait = false;
isRunning = false;
x.dispose();
}
});
btnStart.setBounds(55, 81, 95, 23);
contentPane.add(btnStart);
}
}
}