-
Notifications
You must be signed in to change notification settings - Fork 14
/
wasp_chompy_hunter.simba
280 lines (219 loc) · 6.77 KB
/
wasp_chompy_hunter.simba
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
{$DEFINE SCRIPT_ID := '7c40c4ac-0009-4a08-ab61-4887d9456420'}
{$DEFINE SCRIPT_REVISION := '32'}
{$DEFINE SCRIPT_GUI}
{$I SRL-T/osr.simba}
{$I WaspLib/osr.simba}
{$I WaspLib/optional/handlers/combathandler.simba}
type
EChompyState = (
WAIT_STATE, WAIT_COMBAT, FILL_TOAD, FILL_BELLOWS, PLACE_TOAD, CLICK_CHOMPY
);
TChompyHunter = record(TBaseWalkerScript)
State: EChompyState;
Chompy, Toad: TRSNPCV2;
Bubbles: TRSObjectV2;
OgreBellows: TRSItemArray;
FillingBellows: Boolean;
end;
procedure TAntiban.Setup(); override;
begin
Self.Skills := [ERSSkill.TOTAL, ERSSkill.RANGE];
Self.MinZoom := 5;
Self.MaxZoom := 35;
inherited;
end;
procedure TChompyHunter.Init(maxActions: UInt32; maxTime: UInt64); override;
var
chompy: TRSNPCV2;
begin
inherited;
ItemFinder.Similarity := 0.9999;
Map.SetupChunk(Chunk(Box(36,48,38,47), 0));
Objects.Setup(Map.Objects(), @Map.Walker);
chompy := TRSNPCV2.Setup(70, 4, [[5488, 38238]]);
chompy.SetupUpText('Chompy bird');
chompy.Finder.Colors := [
CTS2(8557684, 13, 0.06, 0.32),
CTS2(10603982, 11, 0.04, 0.58)
];
chompy.Walker := @Map.Walker;
CombatHandler.Setup(chompy, 2000);
Self.Toad.SetupEx(40, [0.5, 0.5, 0], [[5488, 38238]]);
Self.Toad.SetupUpText(['Inflate', 'Swamp', 'toad']);
Self.Toad.Finder.Colors += CTS2(3373670, 17, 0.02, 0.10);
Self.Toad.Walker := @Map.Walker;
Self.Bubbles := Objects.Get('Swamp bubbles');
Self.Bubbles.Finder.Colors := [CTS2(5464637, 3, 0.23, 0.28)];
Self.OgreBellows := ['Ogre bellows (3)', 'Ogre bellows (2)', 'Ogre bellows (1)'];
Options.SetNPCAttackOption(ERSAttackOption.ALWAYS_LEFT_CLICK);
end;
function TChompyHunter.CountBellows(): Int32;
begin
Result := Inventory.CountItem('Ogre bellows (3)') +
Inventory.CountItem('Ogre bellows (2)') +
Inventory.CountItem('Ogre bellows (1)');
end;
function TChompyHunter.FillBellows(): Boolean;
var
InvCount: Int32 := Self.CountBellows();
TempCount: Int32;
begin
if Self.Bubbles.WalkClick() then
begin
Minimap.WaitMoving();
Result := WaitUntil(InvCount <> (TempCount := Self.CountBellows), 100, 5000);
end;
if Result then
while Inventory.ContainsItem('Ogre bellows') do
begin
InvCount := TempCount;
if not WaitUntil(InvCount <> (TempCount := Self.CountBellows), 100, 5000) then
Break;
end;
end;
function TChompyHunter.MoveAround(): Boolean;
var
MinimapTPA: TPointArray;
SwampTPA: TPointArray;
P: TPoint;
FinalTPA: TPointArray;
MMDots: TPointArray;
begin
MinimapTPA := Minimap.GetPolygon().Connect();
MinimapTPA.Fill();
MinimapTPA := MinimapTPA.Erode(3);
SRL.FindColors(SwampTPA, CTS0(9083745, 0), Minimap.Bounds());
MMDots := Minimap.GetDots(ERSMinimapDot.NPC).Offset(2, 2);
MMDots := MMDots.Grow(2);
SwampTPA := SwampTPA + MMDots;
for P in MinimapTPA do
if SwampTPA.Find(P) = -1 then
FinalTPA += P;
Mouse.Click(FinalTPA.RandomValue(), MOUSE_LEFT);
Minimap.WaitMoving();
Result := not Minimap.HasDotUnder();
end;
function TChompyHunter.PlaceToad(): Boolean;
begin
if Minimap.HasDotUnder() then
Self.MoveAround();
if Inventory.ClickItem('Bloated toad') then
begin
Wait(1400, 1800);
Result := WaitUntil(not Inventory.ContainsItem('Bloated toad'), 100, 5000);
end;
end;
function TChompyHunter.FillToad(): Boolean;
var
count: Int32;
begin
count := Inventory.Count();
if Self.Toad.WalkClick(True, 10) then
begin
Minimap.WaitMoving();
Result := WaitUntil(count < Inventory.Count(), 300, 5000);
end;
if Result then
Self.PlaceToad();
end;
function TChompyHunter.ClickedChompy(featherCount: Int32): Boolean;
begin
Result := MainScreen.InCombat() or (featherCount < Inventory.CountItemStack('Feather'));
end;
function TChompyHunter.ClickChompy(): Boolean;
var
featherCount: Int32;
begin
if CombatHandler.Monster.WalkSelectOption(['Attack', 'Pluck']) then
begin
featherCount := Inventory.CountItemStack('Feather');
Minimap.WaitMoving();
Result := WaitUntil(Self.ClickedChompy(featherCount) or MainScreen.InCombat(), 100, 3000);
end;
if Result then TotalActions += 1;
end;
function TChompyHunter.GetState(): EChompyState;
begin
if Self.FillingBellows then
begin
if Self.FillingBellows := Inventory.ContainsItem('Ogre bellows') then
Exit(EChompyState.WAIT_STATE);
Exit(EChompyState.WAIT_STATE);
end;
if Inventory.ContainsItem('Bloated toad') then
Exit(EChompyState.PLACE_TOAD);
if MainScreen.InCombat() then
Exit(EChompyState.WAIT_COMBAT);
if CombatHandler.Monster.IsVisible() then
Exit(EChompyState.CLICK_CHOMPY);
if Inventory.ContainsAny(OgreBellows) then
Exit(EChompyState.FILL_TOAD);
Exit(EChompyState.FILL_BELLOWS);
end;
procedure TChompyHunter.Run(maxActions: UInt32; maxTime: UInt64);
begin
Self.Init(maxActions, maxTime);
repeat
Self.State := Self.GetState();
Self.SetAction(ToStr(Self.State));
case Self.State of
EChompyState.WAIT_STATE: Wait(1200, 2400);
EChompyState.WAIT_COMBAT: WaitUntil(not MainScreen.WaitInCombat(2400), 100, 5000);
EChompyState.FILL_TOAD: Self.FillToad();
EChompyState.FILL_BELLOWS: Self.FillBellows();
EChompyState.PLACE_TOAD: Self.PlaceToad();
EChompyState.CLICK_CHOMPY: Self.ClickChompy();
end;
Self.DoAntiban();
until Self.ShouldStop();
end;
var
ChompyHunter: TChompyHunter;
function TRSMainScreen.InCombat(): Boolean; override;
begin
if Self.FindDepletedHPBar then
Exit(False);
Result := (CombatHandler.IsSetup and not CombatHandler.InCombatTimer.IsFinished())
or XPBar.EarnedXP or (Self.FindHitsplats <> []);
end;
{$IFDEF SCRIPT_GUI}
type
TChompyHunterConfig = record(TScriptForm)
ChompyHunterInfo: TLabel;
end;
procedure TChompyHunterConfig.Run(); override;
var
tab: TTabSheet;
begin
Self.Setup('Wasp Chompy Hunter');
Self.Start.SetOnClick(@Self.StartScript);
Self.AddTab('Script Settings');
tab := Self.Tabs[High(Self.Tabs)];
Self.CreateAccountManager(tab);
with Self.ChompyHunterInfo do
begin
Create(tab);
SetCaption('Have ogre bellows in your inventory and an ogre bow/arrows equipped.' +
LineEnding +
'Start south of castle wars, in the middle pools close to the smoke dungeon.' +
LineEnding + LineEnding +
'This is a simple script only meant to get the job done!' +
LineEnding +
'It''s probably a good idea to baby sit!');
SetLeft(TControl.AdjustToDPI(50));
SetTop(TControl.AdjustToDPI(200));
end;
Self.CreateAntibanManager();
Self.CreateWaspLibSettings();
Self.CreateAPISettings();
inherited;
end;
var
ChompyHunterConfig: TChompyHunterConfig;
{$ENDIF}
begin
{$IFDEF SCRIPT_GUI}
ChompyHunterConfig.Run();
{$ENDIF}
ChompyHunter.Run(WLSettings.MaxActions, WLSettings.MaxTime);
end.