My favorites | Sign in
Project Home Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 2 attachment: bot-updates.patch (19.1 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
Index: org/rsbot/bot/Bot.java
===================================================================
--- org/rsbot/bot/Bot.java (revision 6)
+++ org/rsbot/bot/Bot.java (working copy)
@@ -1,5 +1,7 @@
package org.rsbot.bot;

+import java.util.logging.Logger;
+
import org.rsbot.accessors.Client;
import org.rsbot.event.EventManager;
import org.rsbot.event.events.CharacterMovedEvent;
@@ -13,10 +15,10 @@
import org.rsbot.script.Skills;
import org.rsbot.script.Store;

-import java.util.ArrayList;
-import java.util.logging.Logger;
-
public class Bot {
+ public static boolean debugLogging = false;
+ public void debug(String s) { if (debugLogging) log.info(s); }
+
private static String account;
private static BotStub botStub;
private static Client client;
@@ -59,9 +61,6 @@
* The {@link java.util.logging.Logger} for this class.
*/
protected final Logger log = Logger.getLogger(this.getClass().getName());
-
- public static boolean debugLogging = false;
- public void debug(String s) { if (debugLogging) log.info(s); }

public static void characterMoved(final org.rsbot.accessors.RSCharacter c, final int i) {
try {
Index: org/rsbot/event/impl/DrawNPCs.java
===================================================================
--- org/rsbot/event/impl/DrawNPCs.java (revision 6)
+++ org/rsbot/event/impl/DrawNPCs.java (working copy)
@@ -5,7 +5,6 @@
import java.awt.Graphics;
import java.awt.Point;

-import org.rsbot.accessors.Client;
import org.rsbot.accessors.Node;
import org.rsbot.accessors.RSNPCNode;
import org.rsbot.bot.Bot;
Index: org/rsbot/gui/BotGUI.java
===================================================================
--- org/rsbot/gui/BotGUI.java (revision 6)
+++ org/rsbot/gui/BotGUI.java (working copy)
@@ -66,6 +66,7 @@
import org.rsbot.event.impl.DrawObjects;
import org.rsbot.event.impl.DrawPlayers;
import org.rsbot.event.impl.DrawSettings;
+import org.rsbot.event.impl.DrawSingleModel;
import org.rsbot.event.impl.ServerMessageLogger;
import org.rsbot.event.impl.TActualMousePosition;
import org.rsbot.event.impl.TAnimation;
@@ -117,6 +118,8 @@
private JButton logButton;
private TrayIcon trayIcon;
private final Dimension minsize;
+
+ public static DrawSingleModel drawModel = DrawSingleModel.inst;

public BotGUI() {
try {
@@ -745,6 +748,7 @@
registerListener("Items", DrawItems.inst);
registerListener("Calc Test", DrawBoundaries.inst);
registerListener("Current Model", DrawModel.inst);
+ registerListener("Object Model", DrawSingleModel.inst);
registerListener("Settings", DrawSettings.inst);

// Other
@@ -817,8 +821,6 @@
final Map<Integer, Script> running = sh.getRunningScripts();
if (running.size() > 0) {
final int id = running.keySet().iterator().next();
- final Script s = running.get(id);
- final ScriptManifest prop = s.getClass().getAnnotation(ScriptManifest.class);
sh.stopScript(id);
pauseResumeScript.setText("Pause Script");
pauseResumeScript.setEnabled(false);
Index: org/rsbot/gui/ImageFrameDelay.java
===================================================================
--- org/rsbot/gui/ImageFrameDelay.java (revision 6)
+++ org/rsbot/gui/ImageFrameDelay.java (working copy)
@@ -24,6 +24,7 @@
import org.rsbot.util.GlobalConfiguration;

public class ImageFrameDelay extends JDialog {
+ private static final long serialVersionUID = 1L;
private JSlider slider;
private JButton confirmationButton;
private Dimension minSize = new Dimension(175, 75);
Index: org/rsbot/gui/LogGUI.java
===================================================================
--- org/rsbot/gui/LogGUI.java (revision 6)
+++ org/rsbot/gui/LogGUI.java (working copy)
@@ -1,18 +1,23 @@
package org.rsbot.gui;

-import java.awt.*;
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.Toolkit;
import java.io.File;
+
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.WindowConstants;
+
import org.rsbot.bot.Bot;
-
import org.rsbot.util.GlobalConfiguration;
import org.rsbot.util.logging.TextAreaLogHandler;


public class LogGUI extends JFrame {
- private JScrollPane textScroll;
+ private static final long serialVersionUID = 1L;
+
+ private JScrollPane textScroll;
private Dimension minSize = new Dimension(767, 530);

private void setTitle() {
Index: org/rsbot/gui/PickRewardsGUI.java
===================================================================
--- org/rsbot/gui/PickRewardsGUI.java (revision 6)
+++ org/rsbot/gui/PickRewardsGUI.java (working copy)
@@ -5,8 +5,24 @@
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.io.*;
-import javax.swing.*;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import javax.swing.AbstractListModel;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.GroupLayout;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JList;
+import javax.swing.JScrollPane;
+import javax.swing.LayoutStyle;
+import javax.swing.WindowConstants;
+
import org.rsbot.util.GlobalConfiguration;

/*
@@ -15,7 +31,9 @@
*/
public class PickRewardsGUI extends JFrame {

- String os = System.getProperty("os.name");
+ private static final long serialVersionUID = 1L;
+
+ String os = System.getProperty("os.name");
String filename;
static File PickRewardsFile;

@@ -62,8 +80,6 @@
showGUI();
}

- @SuppressWarnings("unchecked")
-
private void showGUI() {

jScrollPane1 = new JScrollPane();
@@ -79,7 +95,8 @@
setResizable(false);

jList1.setModel(new javax.swing.AbstractListModel() {
- String[] strings = choices;
+ private static final long serialVersionUID = 1L;
+ String[] strings = choices;

public int getSize() {
return strings.length;
@@ -171,7 +188,8 @@
choices[selected - 1] = choices[selected];
choices[selected] = temp;
jList1.setModel(new AbstractListModel() {
- String[] strings = choices;
+ private static final long serialVersionUID = 1L;
+ String[] strings = choices;

public int getSize() {
return strings.length;
@@ -191,7 +209,8 @@
choices[selected + 1] = choices[selected];
choices[selected] = temp;
jList1.setModel(new AbstractListModel() {
- String[] strings = choices;
+ private static final long serialVersionUID = 1L;
+ String[] strings = choices;

public int getSize() {
return strings.length;
Index: org/rsbot/gui/ScriptEditor.java
===================================================================
--- org/rsbot/gui/ScriptEditor.java (revision 6)
+++ org/rsbot/gui/ScriptEditor.java (working copy)
@@ -99,7 +99,6 @@
+ " }\n"
+ "}");

- @SuppressWarnings("deprecation")
public ScriptEditor() {
setTitle("Script Editor");
setBackground(new Color(245, 245, 245));
@@ -410,17 +409,14 @@
return text;
}

- @Override
public void changedUpdate(DocumentEvent de) {
lines.setText(getText());
}

- @Override
public void insertUpdate(DocumentEvent de) {
lines.setText(getText());
}

- @Override
public void removeUpdate(DocumentEvent de) {
lines.setText(getText());
}
Index: org/rsbot/Lexer/JavaLexer.java
===================================================================
--- org/rsbot/Lexer/JavaLexer.java (revision 6)
+++ org/rsbot/Lexer/JavaLexer.java (working copy)
@@ -30,7 +30,10 @@

package org.rsbot.Lexer;

-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;

/**
* JavaLexer is a java lexer. Created with JFlex. An example of how it is used:
@@ -515,10 +518,7 @@

/* error codes */
final private static int YY_UNKNOWN_ERROR = 0;
- final private static int YY_ILLEGAL_STATE = 1;
final private static int YY_NO_MATCH = 2;
- final private static int YY_PUSHBACK_2BIG = 3;
-
/* error messages for the codes above */
final private static String YY_ERROR_MSG[] = {
"Unkown internal scanner error",
@@ -591,17 +591,6 @@
/** the number of characters up to the start of the matched text */
private int yychar;

- /**
- * the number of characters from the last newline up to the start of the
- * matched text
- */
- private int yycolumn;
-
- /**
- * yy_atBOL == true <=> the scanner is currently at the beginning of a line
- */
- private boolean yy_atBOL = true;
-
/** yy_atEOF == true <=> the scanner is at the EOF */
private boolean yy_atEOF;

@@ -676,7 +665,6 @@
yyreset(reader);
this.yyline = yyline;
this.yychar = yychar;
- this.yycolumn = yycolumn;
}


@@ -802,11 +790,10 @@
final public void yyreset(java.io.Reader reader) throws java.io.IOException {
yyclose();
yy_reader = reader;
- yy_atBOL = true;
yy_atEOF = false;
yy_endRead = yy_startRead = 0;
yy_currentPos = yy_markedPos = yy_pushbackPos = 0;
- yyline = yychar = yycolumn = 0;
+ yyline = yychar = 0;
yy_lexical_state = YYINITIAL;
}

@@ -889,22 +876,6 @@


/**
- * Pushes the specified amount of characters back into the input stream.
- *
- * They will be read again by then next call of the scanning method
- *
- * @param number the number of characters to be read again.
- * This number must not be greater than yylength()!
- */
- private void yypushback(int number) {
- if ( number > yylength() )
- yy_ScanError(YY_PUSHBACK_2BIG);
-
- yy_markedPos -= number;
- }
-
-
- /**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
@@ -917,7 +888,6 @@

// cached fields:
int yy_currentPos_l;
- int yy_startRead_l;
int yy_markedPos_l;
int yy_endRead_l = yy_endRead;
char [] yy_buffer_l = yy_buffer;
@@ -980,7 +950,7 @@
}
yy_action = -1;

- yy_startRead_l = yy_currentPos_l = yy_currentPos =
+ yy_currentPos_l = yy_currentPos =
yy_startRead = yy_markedPos_l;

yy_state = yy_lexical_state;
Index: org/rsbot/script/Methods.java
===================================================================
--- org/rsbot/script/Methods.java (revision 6)
+++ org/rsbot/script/Methods.java (working copy)
@@ -21,7 +21,14 @@
import java.util.logging.Logger;
import java.util.regex.Pattern;

-import org.rsbot.accessors.*;
+import org.rsbot.accessors.ActionDataNode;
+import org.rsbot.accessors.LDModel;
+import org.rsbot.accessors.Model;
+import org.rsbot.accessors.Node;
+import org.rsbot.accessors.RSAnimable;
+import org.rsbot.accessors.RSAnimableNode;
+import org.rsbot.accessors.RSNPCNode;
+import org.rsbot.accessors.Settings;
import org.rsbot.bot.Bot;
import org.rsbot.bot.input.CanvasWrapper;
import org.rsbot.event.listeners.PaintListener;
@@ -108,6 +115,10 @@
private static ArrayList<String> menuActionsCache = new ArrayList<String>(0);
private static boolean menuListenerStarted = false;

+ public Methods() {
+ this.init();
+ }
+
/** zzSleepzz
* Initializes the bank, store, etc singletons.
* This method can only be called AFTER Bot.java's init()
@@ -119,7 +130,20 @@
this.bank = Bot.bank;
this.input = Bot.getInputManager();
this.grandExchange = Bot.grandExchange;
- this.skills = Bot.skills;
+ this.skills = Bot.skills;
+
+ if (Bot.debugLogging) {
+ if (bank==null)
+ log("methods.bank is null");
+ if (store==null)
+ log("methods.store is null");
+ if (input==null)
+ log("methods.input is null");
+ if (grandExchange==null)
+ log("methods.grandExchange is null");
+ if (skills==null)
+ log("methods.skills is null");
+ }
}

/**
@@ -4844,7 +4868,6 @@
*
*/
public boolean Walk(RSTile[] path) {
- final RSTile[] Randompath = randomizePath(path, 2, 2);
try {
if (distanceTo(getDestination()) < random(5, 7)
|| distanceTo(getDestination()) > 40) {
Index: org/rsbot/script/Script.java
===================================================================
--- org/rsbot/script/Script.java (revision 6)
+++ org/rsbot/script/Script.java (working copy)
@@ -1,13 +1,12 @@
package org.rsbot.script;

-import java.util.ArrayList;
import java.util.EventListener;
import java.util.Map;
import java.util.logging.Level;

import org.rsbot.bot.Bot;
-import org.rsbot.script.randoms.antiban.BreakHandler;
import org.rsbot.script.randoms.LoginBot;
+import org.rsbot.script.randoms.antiban.BreakHandler;

public abstract class Script extends Methods implements EventListener {

@@ -40,7 +39,7 @@
* @param map The arguments passed in from the description.
* @return <tt>true</tt> if the script should be started.
*/
- @SuppressWarnings("deprecation")
+
public boolean onStart(final Map<String, String> map) {
final String args = map.get("args");
return args == null ? onStart(new String[0]) : onStart(args.split(","));
@@ -55,7 +54,6 @@
* @deprecated Use {@link #onStart(Map)} instead.
*/
@Deprecated
- @SuppressWarnings("unused")
public boolean onStart(final String[] args) {
return true;
}
Index: org/rsbot/script/wrappers/RSObject.java
===================================================================
--- org/rsbot/script/wrappers/RSObject.java (revision 6)
+++ org/rsbot/script/wrappers/RSObject.java (working copy)
@@ -5,27 +5,33 @@
import java.awt.Graphics;
import java.awt.Point;
import java.util.ArrayList;
+import java.util.logging.Logger;

import org.rsbot.accessors.LDModel;
import org.rsbot.accessors.Model;
import org.rsbot.accessors.RSAnimable;
import org.rsbot.bot.Bot;
import org.rsbot.bot.input.CanvasWrapper;
+import org.rsbot.event.impl.DrawSingleModel;
import org.rsbot.script.Calculations;
import org.rsbot.script.Methods;

public class RSObject {
- final org.rsbot.accessors.RSObject obj;
- int x, y, type;
- org.rsbot.accessors.Model model;
- Methods methods = Bot.methods;
-
+ private final org.rsbot.accessors.RSObject obj;
+ private final int x, y, type;
+ private final org.rsbot.accessors.Model model;
+ private final Methods methods = Bot.methods;
+ private final Logger log = Logger.getLogger(this.getClass().getName());
+ private boolean beingDrawn = false;
+ private DrawSingleModel drawer = new DrawSingleModel();
+
public RSObject(final org.rsbot.accessors.RSObject obj, final int x, final int y, final int type) {
this.obj = obj;
this.x = x;
this.y = y;
this.type = type;
this.model = this.getModel();
+ this.drawer.setModel(this);
}

public RSObjectDef getDef() {
@@ -167,7 +173,6 @@
}

/**
- * *************
* Gets the model points
*
* @param rsObject: accessors.RSObject
@@ -221,4 +226,33 @@
return screenCoords;
}

+ /**
+ * Starts drawing of the wire-frame of the object on the screen
+ *
+ * @param rsObject: accessors.RSObject
+ * @return Model points
+ */
+ public void startDraw() {
+ if (beingDrawn) return;
+
+ if (Bot.debugLogging)
+ log.info("Starting model draw for ID="+this.getID());
+
+ beingDrawn = true;
+ Bot.getEventManager().registerListener(this.drawer);
+ }
+
+ /**
+ * Draws the wire-frame of the object on the screen
+ *
+ * @param rsObject: accessors.RSObject
+ * @return Model points
+ */
+ public void stopDraw() {
+ if (Bot.debugLogging)
+ log.info("Starting model draw for ID="+this.getID());
+
+ beingDrawn = false;
+ Bot.getEventManager().removeListener(this.drawer);
+ }
}
Index: org/rsbot/util/GlobalConfiguration.java
===================================================================
--- org/rsbot/util/GlobalConfiguration.java (revision 6)
+++ org/rsbot/util/GlobalConfiguration.java (working copy)
@@ -1,6 +1,15 @@
package org.rsbot.util;

-import java.io.*;
+import java.io.BufferedWriter;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
Index: org/rsbot/util/logging/LoggingBootstrap.java
===================================================================
--- org/rsbot/util/logging/LoggingBootstrap.java (revision 6)
+++ org/rsbot/util/logging/LoggingBootstrap.java (working copy)
@@ -1,7 +1,5 @@
package org.rsbot.util.logging;

-import org.rsbot.util.GlobalConfiguration;
-
import java.io.PrintStream;
import java.util.logging.Level;
import java.util.logging.Logger;
Index: org/rsbot/util/SplashScreen.java
===================================================================
--- org/rsbot/util/SplashScreen.java (revision 6)
+++ org/rsbot/util/SplashScreen.java (working copy)
@@ -1,18 +1,22 @@
package org.rsbot.util;

-import java.awt.*;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GridLayout;
+import java.awt.Image;
import java.io.IOException;

import javax.imageio.ImageIO;
-import javax.swing.*;
+import javax.swing.JPanel;
+import javax.swing.JWindow;

/* @auther Sorcermus
* April 21, 2010 runedev
*/
public class SplashScreen extends JWindow {
+ private static final long serialVersionUID = 1L;
+ private boolean sleep;

- private boolean sleep;
-
public SplashScreen() {
sleep = true;

@@ -59,7 +63,8 @@
}

private class SplashPanel extends JPanel {
- Image image;
+ private static final long serialVersionUID = 1L;
+ Image image;

public SplashPanel(Image i) {
image = i;
Index: org/rsbot/util/UpdateUtil.java
===================================================================
--- org/rsbot/util/UpdateUtil.java (revision 6)
+++ org/rsbot/util/UpdateUtil.java (working copy)
@@ -4,10 +4,15 @@
package org.rsbot.util;

import java.awt.Window;
-import java.io.*;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.logging.Logger;
+
import javax.swing.JOptionPane;

/*
Powered by Google Project Hosting