SHOW:
|
|
- or go back to the newest paste.
1 | - | public enum AgilityCourse { |
1 | + | public class AlphaRunner extends Script implements Painting { |
2 | private static final Font FONT = new Font("Arial", Font.PLAIN, 14); | |
3 | - | GNOME_COURSE( |
3 | + | private static final int MINIMUM_HP_RATIO = 10; |
4 | - | new Obstacle( |
4 | + | |
5 | - | "Log balance", |
5 | + | private final AtomicReference<String> status = new AtomicReference<>(""); |
6 | - | new RSArea(new RSTile[]{ |
6 | + | private final AgilityCourse course = AgilityCourse.AL_KHARID_ROOF; |
7 | - | new RSTile(2468, 3435, 0), |
7 | + | private final ABCUtil abcUtil = new ABCUtil(); |
8 | - | new RSTile(2491, 3436, 0), |
8 | + | |
9 | - | new RSTile(2487, 3441, 0), |
9 | + | @Override |
10 | - | new RSTile(2472, 3441, 0) |
10 | + | public void run() { |
11 | - | }) |
11 | + | ThreadSettings.get().setClickingAPIUseDynamic(true); |
12 | - | ), |
12 | + | |
13 | - | new Obstacle( |
13 | + | while (true) { |
14 | - | "Obstacle net", |
14 | + | //pick up marks |
15 | - | new RSArea(new RSTile[]{ |
15 | + | if (course.isRoof()) { |
16 | - | new RSTile(2470, 3430, 0), |
16 | + | RSGroundItem[] marks = GroundItems.find(Filters.GroundItems.nameEquals("Mark of grace").combine(new Filter<RSGroundItem>() { |
17 | - | new RSTile(2470, 3425, 0), |
17 | + | @Override |
18 | - | new RSTile(2478, 3425, 0), |
18 | + | public boolean accept(RSGroundItem rsGroundItem) { |
19 | - | new RSTile(2478, 3430, 0) |
19 | + | return MyWalking.canReach(rsGroundItem.getPosition()); |
20 | - | }) |
20 | + | } |
21 | - | ), |
21 | + | }, false)); |
22 | - | new Obstacle( |
22 | + | |
23 | - | "Tree branch", |
23 | + | if (marks.length > 0) { |
24 | - | new RSArea(new RSTile[]{ |
24 | + | if (!marks[0].isOnScreen()) { |
25 | - | new RSTile(2471, 3425, 1), |
25 | + | MyWalking.walk(marks[0]); |
26 | - | new RSTile(2471, 3422, 1), |
26 | + | continue; |
27 | - | new RSTile(2477, 3422, 1), |
27 | + | } |
28 | - | new RSTile(2477, 3425, 1) |
28 | + | final int count = Inventory.getCount("Mark of grace"); |
29 | - | }) |
29 | + | if (!marks[0].click("Take") || !Timing.waitCondition(new Condition() { |
30 | - | ), |
30 | + | @Override |
31 | - | new Obstacle( |
31 | + | public boolean active() { |
32 | - | "Balancing rope", |
32 | + | return Game.getCrosshairState() == 2; |
33 | - | new RSArea(new RSTile[]{ |
33 | + | } |
34 | - | new RSTile(2472, 3422, 2), |
34 | + | }, 500) || !Timing.waitCondition(new Condition() { |
35 | - | new RSTile(2472, 3418, 2), |
35 | + | @Override |
36 | - | new RSTile(2478, 3418, 2), |
36 | + | public boolean active() { |
37 | - | new RSTile(2478, 3422, 2) |
37 | + | return Inventory.getCount("Mark of grace") > count; |
38 | - | }) |
38 | + | } |
39 | - | ), |
39 | + | }, 4000)) continue; |
40 | - | new Obstacle( |
40 | + | } |
41 | - | "Tree branch", |
41 | + | |
42 | - | new RSArea(new RSTile[]{ |
42 | + | |
43 | - | new RSTile(2483, 3418, 2), |
43 | + | //eat food |
44 | - | new RSTile(2489, 3418, 2), |
44 | + | if (course != AgilityCourse.GNOME_COURSE) { |
45 | - | new RSTile(2489, 3422, 2), |
45 | + | final RSItem[] food = Inventory.find(Filters.Items.actionsContains("Eat")); |
46 | - | new RSTile(2483, 3422, 2) |
46 | + | final int hpRatio = Combat.getHPRatio(); |
47 | - | }) |
47 | + | if (food.length > 0 && hpRatio <= abcUtil.INT_TRACKER.NEXT_EAT_AT.next()) { |
48 | - | ), |
48 | + | if (!food[0].click("Eat") || !Timing.waitCondition(new Condition() { |
49 | - | new Obstacle( |
49 | + | @Override |
50 | - | "Obstacle net", |
50 | + | public boolean active() { |
51 | - | new RSArea(new RSTile[]{ |
51 | + | return Combat.getHPRatio() > hpRatio; |
52 | - | new RSTile(2483, 3416, 0), |
52 | + | } |
53 | - | new RSTile(2489, 3416, 0), |
53 | + | }, 3000)) continue; |
54 | - | new RSTile(2488, 3426, 0), |
54 | + | |
55 | - | new RSTile(2483, 3426, 0) |
55 | + | abcUtil.INT_TRACKER.NEXT_EAT_AT.reset(); |
56 | - | }) |
56 | + | } else if (hpRatio < MINIMUM_HP_RATIO) { |
57 | - | ), |
57 | + | System.out.println("Logging out: Out of food"); |
58 | - | new Obstacle( |
58 | + | Login.logout(); |
59 | - | "Obstacle pipe", |
59 | + | return; |
60 | - | new RSArea(new RSTile[]{ |
60 | + | } |
61 | - | new RSTile(2483, 3427, 0), |
61 | + | |
62 | - | new RSTile(2489, 3427, 0), |
62 | + | |
63 | - | new RSTile(2489, 3432, 0), |
63 | + | //enable run |
64 | - | new RSTile(2483, 3432, 0) |
64 | + | if (Game.getRunEnergy() <= abcUtil.INT_TRACKER.NEXT_RUN_AT.next() && Options.setRunOn(true)) { |
65 | - | }) |
65 | + | abcUtil.INT_TRACKER.NEXT_RUN_AT.reset(); |
66 | - | ) |
66 | + | |
67 | - | ), |
67 | + | |
68 | stepCourse(course); | |
69 | - | DRAYNOR_ROOF( |
69 | + | sleep(100); |
70 | - | new Obstacle( |
70 | + | |
71 | - | "Rough wall", |
71 | + | |
72 | - | new RSArea(new RSTile[] { |
72 | + | |
73 | - | new RSTile(3102, 3259, 0), |
73 | + | |
74 | - | new RSTile(3105, 3259, 0), |
74 | + | * Step over the next obstacle in the course. |
75 | - | new RSTile(3106, 3282, 0), |
75 | + | * @param course The course that you want to traverse |
76 | - | new RSTile(3103, 3282, 0) |
76 | + | |
77 | - | })), |
77 | + | public void stepCourse(final AgilityCourse course) { |
78 | - | new Obstacle( |
78 | + | final Obstacle obstacle = course.getNextObstacle(); |
79 | - | "Tightrope", |
79 | + | if (obstacle == null) { |
80 | - | new RSArea(new RSTile[] { |
80 | + | final Obstacle nearest = course.getNearestObstacle(); |
81 | - | new RSTile(3097, 3277, 3), |
81 | + | MyWalking.walk(Utility.getCenterTile(nearest.area)); |
82 | - | new RSTile(3103, 3277, 3), |
82 | + | return; |
83 | - | new RSTile(3103, 3282, 3), |
83 | + | |
84 | - | new RSTile(3097, 3282, 3) |
84 | + | |
85 | - | })), |
85 | + | final Rectangle bounds = obstacle.area.polygon.getBounds(); |
86 | - | new Obstacle( |
86 | + | final RSObject[] object = Objects.findNearest(Math.max(bounds.width, bounds.height) + 1, obstacle.name); |
87 | - | "Tightrope", |
87 | + | if (object.length > 0) { |
88 | - | new RSArea(new RSTile[] { |
88 | + | if (object[0].getPosition().distanceTo(Player.getPosition()) > 4) { |
89 | - | new RSTile(3093, 3275, 3), |
89 | + | status.set("Walking to " + obstacle.name + "..."); |
90 | - | new RSTile(3090, 3278, 3), |
90 | + | MyWalking.walk(object[0].getPosition()); |
91 | - | new RSTile(3087, 3274, 3), |
91 | + | return; |
92 | - | new RSTile(3090, 3270, 3) |
92 | + | |
93 | - | })), |
93 | + | if (!object[0].isOnScreen()) { |
94 | - | new Obstacle( |
94 | + | status.set("Turning camera to " + object[0].getPosition()); |
95 | - | "Narrow wall", |
95 | + | Camera.turnToTile(object[0]); |
96 | - | new RSArea(new RSTile[] { |
96 | + | |
97 | - | new RSTile(3089, 3265, 3), |
97 | + | |
98 | - | new RSTile(3096, 3264, 3), |
98 | + | RSObjectDefinition def = object[0].getDefinition(); |
99 | - | new RSTile(3096, 3269, 3), |
99 | + | if (def == null) return; |
100 | - | new RSTile(3089, 3268, 3) |
100 | + | |
101 | - | })), |
101 | + | final String action = def.getActions()[0]; |
102 | - | new Obstacle( |
102 | + | status.set("Clicking " + obstacle.name + "..."); |
103 | - | "Wall", |
103 | + | if (object[0].click(action) && Timing.waitCondition(new Condition() { |
104 | - | new RSArea(new RSTile[] { |
104 | + | @Override |
105 | - | new RSTile(3089, 3262, 3), |
105 | + | public boolean active() { |
106 | - | new RSTile(3089, 3256, 3), |
106 | + | return Game.getCrosshairState() == 2; |
107 | - | new RSTile(3087, 3256, 3), |
107 | + | } |
108 | - | new RSTile(3087, 3261, 3) |
108 | + | }, 500)) { |
109 | - | })), |
109 | + | status.set("Performing action " + action + "..."); |
110 | - | new Obstacle("Gap", |
110 | + | if (Timing.waitCondition(new Condition() { |
111 | - | new RSArea(new RSTile[] { |
111 | + | @Override |
112 | - | new RSTile(3087, 3256, 3), |
112 | + | public boolean active() { |
113 | - | new RSTile(3095, 3256, 3), |
113 | + | Obstacle next = course.getNextObstacle(); |
114 | - | new RSTile(3095, 3254, 3), |
114 | + | return next != null && next != obstacle; |
115 | - | new RSTile(3087, 3254, 3) |
115 | + | } |
116 | - | })), |
116 | + | }, 10000)) { |
117 | - | new Obstacle("Crate", |
117 | + | status.set("Successfully " + action + " " + obstacle.name); |
118 | - | new RSArea(new RSTile[] { |
118 | + | } |
119 | - | new RSTile(3096, 3262, 3), |
119 | + | } else status.set("Failed to click " + obstacle.name); |
120 | - | new RSTile(3102, 3262, 3), |
120 | + | |
121 | - | new RSTile(3101, 3256, 3), |
121 | + | |
122 | - | new RSTile(3096, 3256, 3) |
122 | + | |
123 | - | })) |
123 | + | @Override |
124 | - | ), |
124 | + | public void onPaint(Graphics g) { |
125 | g.setFont(FONT); | |
126 | - | AL_KHARID_ROOF( |
126 | + | g.setColor(Color.LIGHT_GRAY); |
127 | - | new Obstacle( |
127 | + | g.drawString(status.get(), 10, 30); |
128 | - | "Rough wall", |
128 | + | |
129 | - | new RSArea(new RSTile[] { |
129 | + | } |
130 | - | new RSTile(3301, 3195, 0), |
130 | + | |
131 | - | new RSTile(3298, 3198, 0), |
131 | + | /** |
132 | - | new RSTile(3270, 3199, 0), |
132 | + | * Obstacle wrapper |
133 | - | new RSTile(3270, 3195, 0), |
133 | + | */ |
134 | - | new RSTile(3296, 3191, 0) |
134 | + | class Obstacle { |
135 | - | })), |
135 | + | public final String name; |
136 | - | new Obstacle( |
136 | + | public final RSArea area; |
137 | - | "Tightrope", |
137 | + | |
138 | - | new RSArea(new RSTile[] { |
138 | + | Obstacle(String name, RSArea area) { |
139 | - | new RSTile(3270, 3196, 3), |
139 | + | this.name = name; |
140 | - | new RSTile(3279, 3196, 3), |
140 | + | this.area = area; |
141 | - | new RSTile(3278, 3179, 3), |
141 | + | |
142 | - | new RSTile(3270, 3179, 3) |
142 | + |