Skip to content

Commit b0af126

Browse files
author
Wasp Bot
committed
Sync release with main and strip comments
1 parent c461694 commit b0af126

File tree

175 files changed

+1292
-19304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+1292
-19304
lines changed

osrs.simba

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,6 @@
1-
(*
2-
# WaspLib
3-
WaspLib is a library used to bot OldSchool RuneScape with Simba 2.0.
4-
WaspLib is heavily inspired in previous work done by the SRL Community.
5-
6-
This library is meant to do the job of both [SRL-T](https://github.com/Torwent/SRL-T)
7-
and the original [WaspLib](https://github.com/Torwent/WaspLib) in Simba 1.4 in a lighter,
8-
less confusing way.
9-
*)
10-
11-
(*
12-
## Compile Directives
13-
```pascal
14-
{$DEFINE WL_DEBUG_MOUSE}
15-
{$DEFINE WL_DISABLE_FAKE_INPUT}
16-
{$DEFINE WL_KEYBINDS_DEBUG}
17-
{$DEFINE WL_DEBUG_UPTEXT}
18-
{$DEFINE WL_DEBUG_INTERFACES}
19-
{$DEFINE WL_GENERATE_GRAPH_ALWAYS}
20-
{$DEFINE WL_TRANSPORTER_DEBUG}
21-
```
22-
These are the main compiler directives available in the library.
23-
24-
They should be self-explanatory.
25-
26-
You also have the following to override versions, for more information read {ref}`Version`
27-
```pascal
28-
{$DEFINE SCRIPT_SIMBA_VERSION := 'version_hash'}
29-
{$DEFINE SCRIPT_WASPLIB_VERSION := 'version_hash'}
30-
```
31-
32-
For the {ref}`WaspClient` you also have the following:
33-
```pascal
34-
{$DEFINE WASP_LOCAL_DEVELOPMENT}
35-
{$DEFINE WASP_REFRESH_TOKEN := 'refresh_token'}
36-
{$DEFINE SCRIPT_ID := 'script_UUID'}
37-
{$DEFINE SCRIPT_REVISION := 'script_revision'}
38-
```
39-
They also should be self-explanatory but you can read more about them in
40-
{ref}`WaspClient`.
41-
42-
All of the directives above must be added **before** including the library to
43-
use them, for example:
44-
```pascal
45-
{$DEFINE WL_DISABLE_FAKE_INPUT}
46-
{$I WaspLib/osrs.simba}
47-
```
48-
Otherwise WaspLib won't be aware of them.
49-
*)
1+
2+
3+
504

515
{$INCLUDE_ONCE version.simba}
526
{$INCLUDE_ONCE utils.simba}

osrs/antiban/antiban.simba

Lines changed: 9 additions & 191 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
(*
2-
# Antiban
3-
Methods to handle antiban.
4-
*)
1+
52

63
{$DEFINE WL_ANTIBAN_INCLUDED}
74
{$IFNDEF WL_OSR}
@@ -41,10 +38,7 @@ type
4138
Next: Double;
4239
end;
4340

44-
(*
45-
## TAntiban
46-
Main record to handle the built-in WaspLib antiban.
47-
*)
41+
4842
TAntiban = record
4943
DoingAntiban: Boolean;
5044
Debugging: Boolean;
@@ -122,28 +116,7 @@ begin
122116
end;
123117

124118

125-
(*
126-
## Antiban.AddTask
127-
```pascal
128-
procedure TAntiban.AddTask(method: TAntibanMethod; interval: Double; randomness: Double = 0.2);
129-
```
130-
Schedule a antiban task.
131-
An antiban task can be any procedure but they should be short actions that won't
132-
break your main script.
133-
134-
`method` is a pointer to the task you want to perform. WaspLib includes a couple of them but you may make your own if you want.
135-
136-
`interval` is the aproximate interval of time that has to pass for the antiban
137-
task to occur and it will be repeated everytime that the interval has passed
138-
and the antiban is checked with {ref}`Antiban.DoAntiban`.
139119

140-
This task will only occur when **TAntiban.DoAntiban** is called.
141-
142-
Example:
143-
```pascal
144-
Antiban.AddTask(@Antiban.HoverSkills, 15 * ONE_MINUTE); //Every 15 minutes the script will run Antiban.HoverSkills().
145-
```
146-
*)
147120
procedure TAntiban.AddTask(method: TAntibanMethod; interval: Double; randomness: Double = 0.2);
148121
var
149122
len: Integer;
@@ -153,26 +126,7 @@ begin
153126
Self._UpdateTask(len, @method, interval, randomness);
154127
end;
155128

156-
(*
157-
## Antiban.AddBreak
158-
```pascal
159-
procedure TAntiban.AddBreak(interval, length: Double; randomness: Double = 0.2; logoutChance: Double = 0.33);
160-
```
161-
Schedule a break. Breaks can be of short or medium length and should be shorter than any sleep breaks.
162-
163-
`interval` is the aproximate interval of time that has to pass for the break to
164-
occur and it will be repeated everytime that interval passes and the antiban is
165-
checked either with {ref}`Antiban.DoBreak` or {ref}`Antiban.DoAntiban`.
166-
167-
`length`, `randomness` and `logoutChance` are the same as {ref}`Antiban.AddSleep`.
168-
169-
This break will only occur when {ref}`Antiban.DoAntiban` is called.
170129

171-
Example:
172-
```pascal
173-
Antiban.AddBreak(30 * ONE_MINUTE, 5 * ONE_MINUTE); //Every 30 minutes the script will take a 5 minute break, subject to variance from the randomness variable.
174-
```
175-
*)
176130
procedure TAntiban.AddBreak(interval, length: Double; randomness: Double = 0.2; logoutChance: Double = 0.33);
177131
var
178132
len: Integer;
@@ -182,34 +136,7 @@ begin
182136
Self._UpdateBreak(len, interval, length, randomness, logoutChance);
183137
end;
184138

185-
(*
186-
## Antiban.AddSleep
187-
```pascal
188-
procedure TAntiban.AddSleep(time: String; length: Double; randomness: Double = 0.1; logoutChance: Double = 0.5);
189-
```
190-
Schedule a sleep break. A sleep break is a large break, it can be any length but
191-
it's usually the several hours and also the largest one/ones.
192-
193-
`time` is the aproximate time you want the break to occur and should be written
194-
in a "bare" time format (00:00:00).
195-
196-
`length` is how long we will sleep for in milliseconds.
197-
198-
`randomness` is self explanatory, gives variance to the time our script will
199-
sleep at and it's length too.
200-
One thing to keep in mind is that randomness only affects time past `time`.
201-
In other words, you will never sleep before `time`.
202-
203-
`logoutChance` is the probability of logging out for the sleep break or to
204-
simply afk and logout from inactivity.
205139

206-
This sleep break will only occur when {ref}`Antiban.DoAntiban` is called and our sleep break is due.
207-
208-
Example:
209-
```pascal
210-
Antiban.AddSleep('01:30:45', 8 * ONE_HOUR, 0.1, 0.8); //At 01:30:45 on our computer time the script will take a break for 8 hours, subject to variance from the randomness variable.
211-
```
212-
*)
213140
procedure TAntiban.AddSleep(time: String; length: Double; randomness: Double = 0.1; logoutChance: Double = 0.5);
214141
var
215142
len: Integer;
@@ -220,15 +147,7 @@ begin
220147
end;
221148

222149

223-
(*
224-
## Antiban.TakeBreak
225-
```pascal
226-
procedure TAntiban.TakeBreak(var task: TBreakTask);
227-
```
228-
Internal function used by {ref}`Antiban.DoAntiban` and is responsible for
229-
performing the specified break `task`.
230-
In other words, this is what makes the script take the break.
231-
*)
150+
232151
procedure TAntiban.TakeBreak(var task: TBreakTask);
233152
var
234153
countdown: TCountDown;
@@ -281,15 +200,7 @@ begin
281200
task.Next := GetTimeRunning() + Abs(GaussRand(task.Interval, task.Interval * task.StdVar));
282201
end;
283202

284-
(*
285-
## Antiban.TakeSleep
286-
```pascal
287-
procedure TAntiban.TakeSleep(var task: TSleepTask);
288-
```
289-
Internal function used by {ref}`Antiban.DoAntiban` and is responsible for
290-
performing the specified sleep `task`.
291-
In other words, this is what makes the script take the sleep break.
292-
*)
203+
293204
procedure TAntiban.TakeSleep(var task: TSleepTask);
294205
var
295206
countdown: TCountDown;
@@ -344,22 +255,7 @@ begin
344255
end;
345256

346257

347-
(*
348-
## Antiban.DoTask
349-
```pascal
350-
function TAntiban.DoTask(): Boolean;
351-
```
352-
Checks for scheduled antiban tasks, if any is due it will do it.
353-
354-
You should only call this when taking doing an antiban task won't break your script.
355258

356-
Returns true if a task was performed.
357-
358-
Example:
359-
```pascal
360-
Antiban.DoTask();
361-
```
362-
*)
363259
function TAntiban.DoTask(): Boolean;
364260
var
365261
i: Int32;
@@ -394,22 +290,7 @@ begin
394290
activeTasks[i]^.Countdown.Resume();
395291
end;
396292

397-
(*
398-
## Antiban.DoBreak
399-
```pascal
400-
function TAntiban.DoBreak(): Boolean;
401-
```
402-
Checks for scheduled breaks, if any is due it will take it.
403-
404-
You should only call this when taking a break won't break your script.
405-
406-
Returns true if a break was taken.
407293

408-
Example:
409-
```pascal
410-
Antiban.DoBreak();
411-
```
412-
*)
413294
function TAntiban.DoBreak(): Boolean;
414295
var
415296
i: Integer;
@@ -427,22 +308,7 @@ begin
427308
end;
428309
end;
429310

430-
(*
431-
## Antiban.DoSleep
432-
```pascal
433-
function TAntiban.DoSleep(): Boolean;
434-
```
435-
Checks for scheduled sleep breaks, if any is due it will take it.
436-
437-
You should only call this when taking a sleep break won't break your script.
438-
439-
Returns true if a sleep break was taken.
440311

441-
Example:
442-
```pascal
443-
Antiban.DoSleep();
444-
```
445-
*)
446312
function TAntiban.DoSleep(): Boolean;
447313
var
448314
i: Integer;
@@ -461,27 +327,7 @@ begin
461327
end;
462328

463329

464-
(*
465-
## Antiban.DoAntiban
466-
```pascal
467-
function TAntiban.DoAntiban(checkTasks, checkBreaks, checkSleeps: Boolean = True): Boolean;
468-
```
469-
This should be called in your script when antiban sleeps, breaks or tasks won't
470-
break your script.
471-
472-
When this is called, the setup sleep breaks, breaks and tasks will be checked,
473-
if enough time has passed to perform any of them
474-
(subject to the parameters you pass in too), they will be performed, otherwise,
475-
nothing will happen.
476-
477-
Example:
478-
```pascal
479-
Antiban.AddTask(15 * ONE_MINUTE, @Antiban.HoverSkills);
480-
481-
while True do //Infinite loop
482-
Antiban.DoAntiban(); //Antiban.HoverSkills will be called every time 15 minutes passed when this is called.
483-
```
484-
*)
330+
485331
function TAntiban.DoAntiban(checkTasks, checkBreaks, checkSleeps: Boolean = True): Boolean;
486332
begin
487333
if Self.DoingAntiban then
@@ -512,44 +358,19 @@ begin
512358
end;
513359

514360

515-
(*
516-
## Antiban.TimeUntilBreak
517-
```pascal
518-
function TAntiban.TimeUntilBreak(constref task: TBreakTask; fmt: String = TIME_FORMAL): String;
519-
```
520-
Check how much time is left until the specified break `task` should be taken.
521-
*)
361+
522362
function TAntiban.TimeUntilBreak(constref task: TBreakTask; fmt: String = TIME_FORMAL): String;
523363
begin
524364
Result := FormatMilliseconds(Max(0, Round(task.Next - GetTimeRunning())), fmt);
525365
end;
526366

527-
(*
528-
## Antiban.TimeUntilSleep
529-
```pascal
530-
function TAntiban.TimeUntilSleep(constref task: TSleepTask; fmt: String = TIME_FORMAL): String;
531-
```
532-
Check how much time is left until the specified sleep break `task` should be taken.
533-
*)
367+
534368
function TAntiban.TimeUntilSleep(constref task: TSleepTask; fmt: String = TIME_FORMAL): String;
535369
begin
536370
Result := FormatMilliseconds(Max(0, Round(task.Next - GetTimeRunning())), fmt);
537371
end;
538372

539-
(*
540-
## Antiban.SimulateBreaks
541-
```pascal
542-
procedure TAntiban.SimulateBreaks(bottingDays: UInt64 = 1000);
543-
```
544-
Performs a simulation of `bottingDays` amount of days with the currently setup
545-
breaks and prints the results.
546-
547-
Example
548-
```pascal
549-
Antiban.AddBreak(30 * ONE_MINUTE, 5 * ONE_MINUTE);
550-
Antiban.SimulateBreaks();
551-
```
552-
*)
373+
553374
procedure TAntiban.SimulateBreaks(bottingDays: UInt64 = 1000);
554375
var
555376
active, inactive, len, prev: Double;
@@ -586,8 +407,5 @@ begin
586407
end;
587408

588409
var
589-
(*
590-
## Antiban variable
591-
Global {ref}`TAntiban` variable.
592-
*)
410+
593411
Antiban: TAntiban;

0 commit comments

Comments
 (0)