This repository was archived by the owner on Dec 30, 2025. It is now read-only.
forked from crazyeyes-pb/Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWillowPowerCutter.java
More file actions
208 lines (169 loc) · 5.35 KB
/
WillowPowerCutter.java
File metadata and controls
208 lines (169 loc) · 5.35 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
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import org.rsbot.event.events.MessageEvent;
import org.rsbot.event.listeners.MessageListener;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.wrappers.RSObject;
@ScriptManifest(authors = { "SupahScripts" }, keywords = { "WillowPowerCutter" }, name = "WillowPwner", version = 1.06, description = "Universal Willow Tree Cutter. Only PowerCuts (Supports most hatchets)", website = "http://www.powerbot.org/vb/showthread.php?t=772773", requiresVersion = 244)
public class WillowPowerCutter extends Script implements PaintListener,
MessageListener {
private final int willowLogID = 1519;
private final int willowTree[] = { 5551, 5552, 5553, 1308, 8481, 8482,
8483, 8484, 8485, 8486, 8487, 8488, 38627, 38616, 38627, 2210, 142,
2372, 139 };
private final int hatchets[] = { 1349, 1351, 1353, 1355, 1357, 1359, 1361,
6739, 13470 };
private int startXP;
public long startTime = System.currentTimeMillis();
public int xpGained;
public int logsCut;
String status = "";
private final Color color1 = new Color(0, 0, 0);
private final Color color2 = new Color(0, 255, 0, 122);
private final Color color3 = new Color(0, 51, 204);
private final Font font1 = new Font("Impact", 0, 16);
private final Image img1 = getImage("http://therunehell.webs.com/Woodcutting_capes.png");
public void antiban() {
final int r = random(1, 10);
if (r == 1) {
camera.setAngle(random(0, 200));
sleep(random(400, 800));
}
if (r == 2) {
camera.setPitch(random(0, 85));
sleep(random(400, 800));
}
if (r == 3) {
mouse.moveSlightly();
sleep(random(400, 800));
}
if (r == 4) {
mouse.moveSlightly();
sleep(random(100, 200));
mouse.moveSlightly();
sleep(random(100, 200));
mouse.moveSlightly();
sleep(random(400, 800));
}
if (r == 5) {
mouse.moveSlightly();
mouse.moveSlightly();
mouse.moveSlightly();
sleep(random(400, 800));
}
if (r == 6) {
skills.doHover(Skills.INTERFACE_WOODCUTTING);
sleep(random(0, 1500));
}
if (r == 7) {
skills.doHover(Skills.INTERFACE_CONSTITUTION);
sleep(random(0, 1500));
}
if (r == 8) {
skills.doHover(Skills.INTERFACE_STRENGTH);
sleep(random(0, 1500));
}
if (r == 9) {
skills.doHover(Skills.INTERFACE_ATTACK);
sleep(random(0, 1500));
}
}
public void chop() {
if (getMyPlayer().getAnimation() == -1) {
final RSObject tree = objects.getNearest(willowTree);
if (tree != null) {
status = "Cutting tree";
if (!tree.isOnScreen() && tree != null) {
camera.turnTo(tree.getLocation());
if (calc.distanceTo(tree) > 6) {
walking.walkTileMM(tree.getLocation());
}
}
tree.doAction("Chop down Willow");
sleep(random(2000, 3000));
}
} else {
antiban();
}
}
private Image getImage(final String url) {
try {
return ImageIO.read(new URL(url));
} catch (final IOException e) {
return null;
}
}
@Override
public int loop() {
mouse.setSpeed(random(0, 10));
if (walking.getEnergy() > random(50, 100)) {
walking.setRun(true);
sleep(random(700, 800));
}
if (inventory.isFull()) {
status = "Dropping logs";
inventory.dropAllExcept(hatchets);
} else {
chop();
}
return 0;
}
@Override
public void messageReceived(final MessageEvent e) {
if (e.getMessage().contains("some willow logs")) {
logsCut++;
}
}
@Override
public void onFinish() {
log("Thank you for using my script. Please post a progress report.");
}
@Override
public void onRepaint(final Graphics g1) {
long millis = System.currentTimeMillis() - startTime;
final long hours = millis / (1000 * 60 * 60);
millis -= hours * 1000 * 60 * 60;
final long minutes = millis / (1000 * 60);
millis -= minutes * 1000 * 60;
final long seconds = millis / 1000;
final int percent = skills.getPercentToNextLevel(8);
xpGained = skills.getCurrentExp(Skills.WOODCUTTING) - startXP;
final Graphics2D g = (Graphics2D) g1;
g.setColor(color1);
g.fillRect(723, 27, 18, 15);
g.fillRect(743, 67, 13, 14);
g.fillRect(5, 457, 127, 17);
g.setColor(color2);
g.fillRoundRect(556, 213, 173, 144, 16, 16);
g.setFont(font1);
g.setColor(color3);
g.drawString("Percent TNL: " + percent + "%", 562, 327);
g.drawString("Time Running: " + hours + ":" + minutes + ":" + seconds, 562, 347);
g.drawString("XP Gained: " + xpGained, 562, 305);
g.drawString("Logs Cut: " + logsCut, 562, 284);
g.drawString("Status: " + status, 562, 264);
g.drawString("~SupahScripts~", 590, 236);
g.drawImage(img1, 595, 360, null);
g.setColor(Color.green);
g.drawLine(0, (int) mouse.getLocation().getY(), 800, (int) mouse.getLocation().getY());
g.drawLine((int) mouse.getLocation().getX(), 0, (int) mouse.getLocation().getX(), 800);
g.setColor(Color.green);
g.drawLine(0, (int) mouse.getLocation().getY() + 1, 800, (int) mouse.getLocation().getY() + 1);
g.drawLine((int) mouse.getLocation().getX() + 1, 0, (int) mouse.getLocation().getX() + 1, 800);
}
@Override
public boolean onStart() {
grandExchange.lookup(willowLogID).getGuidePrice();
startXP = skills.getCurrentExp(Skills.WOODCUTTING);
return true;
}
}