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: RSObject-action.patch (2.8 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
Index: RSObject.java
===================================================================
--- RSObject.java (revision 6)
+++ 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() {
@@ -87,13 +93,6 @@

if (location.x == -1 || location.y == -1)
return false;
-
- //Light up the point to be clicked
- CanvasWrapper c = (CanvasWrapper)(((Applet)Bot.getClient()).getComponent(0));
- Graphics g = c.getGraphics();
-
- g.setColor(Color.WHITE);
- g.drawRect(location.x-1, location.y-1,location.x+1, location.y+1);
}

location.x += methods.random(-5,5);
@@ -167,7 +166,6 @@
}

/**
- * *************
* Gets the model points
*
* @param rsObject: accessors.RSObject
@@ -221,4 +219,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);
+ }
}
Powered by Google Project Hosting