Skip to content

Commit

Permalink
feat: read notes
Browse files Browse the repository at this point in the history
TScriptForm:
- Added dark mode title bars to it, on by default since I figure is what most people will prefer. To disable dark mode title bar: `TScriptForm.LightMode := True;`

WLSettings:
- WLSettings has been completely rewritten to handle better saving settings, previous way was a spaghetti mess.
- All old WLSettings are now obsolute and server no purpose, they are only staying for now for compatibility reasons, please don't use them anymore.
- TScriptForm had a few things rewritten to handle this changes. Settings should probably be saved, loaded and ran as they show in the forms

A lot of core WL things were changed wit this, there could be some unexpected consequences.
  • Loading branch information
Torwent committed Jul 14, 2024
1 parent 1e2f4f2 commit ecb1bc7
Show file tree
Hide file tree
Showing 16 changed files with 560 additions and 428 deletions.
64 changes: 38 additions & 26 deletions osr/antiban/antiban.simba
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ begin
ProgressReport.ProgressArray[1] := str;

{$IFNDEF SRL_DISABLE_REMOTEINPUT}
if WLSettings.RemoteInput.Enabled and WLSettings.RemoteInput.HUDReport and not WLSettings.RemoteInput.HUDDebug then
ProgressReport.Update();
if not WLSettings.GetObject('remote_input').getBoolean('enabled') then
Exit;
if not WLSettings.GetObject('remote_input').getBoolean('hud_report') then
Exit;
if WLSettings.GetObject('remote_input').getBoolean('hud_debug') then
Exit;
ProgressReport.Update();
{$ENDIF}
end;

Expand All @@ -34,8 +39,13 @@ begin
ProgressReport.ProgressArray[1] := str;

{$IFNDEF SRL_DISABLE_REMOTEINPUT}
if WLSettings.RemoteInput.Enabled and WLSettings.RemoteInput.HUDReport and not WLSettings.RemoteInput.HUDDebug then
ProgressReport.Update();
if not WLSettings.GetObject('remote_input').getBoolean('enabled') then
Exit;
if not WLSettings.GetObject('remote_input').getBoolean('hud_report') then
Exit;
if WLSettings.GetObject('remote_input').getBoolean('hud_debug') then
Exit;
ProgressReport.Update();
{$ENDIF}
end;

Expand All @@ -52,8 +62,14 @@ begin
ProgressReport.ProgressArray[1] := str;

{$IFNDEF SRL_DISABLE_REMOTEINPUT}
if WLSettings.RemoteInput.Enabled and WLSettings.RemoteInput.HUDReport and not WLSettings.RemoteInput.HUDDebug then
ProgressReport.Update();
if not WLSettings.GetObject('remote_input').getBoolean('enabled') then
Exit;
if not WLSettings.GetObject('remote_input').getBoolean('hud_report') then
Exit;
if WLSettings.GetObject('remote_input').getBoolean('hud_debug') then
Exit;

ProgressReport.Update();
{$ENDIF}
end;

Expand Down Expand Up @@ -625,28 +641,28 @@ begin
if Self.Tasks <> [] then
Exit;

if WLSettings.Antiban.Camera then
if WLSettings.GetObject('antiban').getJSONObject('tasks').getBoolean('camera') then
begin
Self.AddTask(3 * ONE_MINUTE, @Self.AdjustZoom, 0.33);
Self.AddTask(7 * ONE_MINUTE, @Self.RandomPOVTask, 0.33);
end;

if WLSettings.Antiban.Mouse then
if WLSettings.GetObject('antiban').getJSONObject('tasks').getBoolean('mouse') then
Self.AddTask(8 * ONE_MINUTE, @Self.RandomMouseTask, 0.33);

if WLSettings.Antiban.Chat then
if WLSettings.GetObject('antiban').getJSONObject('tasks').getBoolean('chat') then
Self.AddTask(9 * ONE_MINUTE, @Self.RandomChatTask, 0.33);

if WLSettings.Antiban.Mouse then
if WLSettings.GetObject('antiban').getJSONObject('tasks').getBoolean('mouse') then
Self.AddTask(10 * ONE_MINUTE, @Self.LoseFocus, 0.33);

if WLSettings.Antiban.GameTabs then
if WLSettings.GetObject('antiban').getJSONObject('tasks').getBoolean('gametabs') then
Self.AddTask(12 * ONE_MINUTE, @Self.RandomGameTabTask, 0.33);

if WLSettings.Antiban.Bank then
if WLSettings.GetObject('antiban').getJSONObject('tasks').getBoolean('bank') then
Self.AddTask(13 * ONE_MINUTE, @Self.RandomBankTask, 0.33);

if WLSettings.Antiban.GameTabs then
if WLSettings.GetObject('antiban').getJSONObject('tasks').getBoolean('gametabs') then
Self.AddTask(18 * ONE_MINUTE, @Self.HoverSkills, 0.33);

Self.OnStartTask := @OnStartAntibanTask;
Expand All @@ -667,13 +683,9 @@ end;

procedure TAntiban.SetupSleep();
begin
if Self.Sleeps <> [] then
Exit;

Self.SetSleepHour();
Self.SetSleepLength();
Self.AddSleep(WLSettings.Sleep.Hour, WLSettings.Sleep.Length, 0.1, 0.8 + BioHash);
if Self.Sleeps <> [] then Exit;

Self.AddSleep(Self.GetSleepHour(), Self.GetSleepLength() * ONE_HOUR, 0.1, 0.8 + BioHash);
Self.OnSleeping := @OnSleepingTask;
end;

Expand All @@ -683,27 +695,27 @@ begin
case Random(0, 500) of //only about 1% chance of antiban while walking
0:
begin
if not WLSettings.Antiban.Chat then Exit
if not WLSettings.GetObject('antiban').getJSONObject('tasks').getBoolean('chat') then Exit
else if (Random(20) <= 17) then Self.RandomChatButton();
//else Self.RandomChatButtonState(); //TODO...
end;

1..5:
begin
if not WLSettings.Antiban.Camera then Exit
if not WLSettings.GetObject('antiban').getJSONObject('tasks').getBoolean('camera') then Exit
else if (Random(10) <= 3) then Self.RandomRotate();
end;

6..10:
begin
if not WLSettings.Antiban.Mouse then Exit
if not WLSettings.GetObject('antiban').getJSONObject('tasks').getBoolean('mouse') then Exit
else if (Random(10) <= 3) then Self.RandomRightClick()
else Self.SmallRandomMouse();
end;

10, 14:
begin
if not WLSettings.Antiban.GameTabs then Exit
if not WLSettings.GetObject('antiban').getJSONObject('tasks').getBoolean('gametabs') then Exit
else if (Random(10) <= 9) then Self.RandomTab()
else Self.CheckCharges();
end;
Expand All @@ -723,13 +735,13 @@ begin
Mouse.Wind := 3 + Round(Self.GetBehavior(EBioBehavior.MOUSE_WIND) / 2);
Mouse.MissChance := 11 + Self.GetBehavior(EBioBehavior.MOUSE_MISS);

if WLSettings.Antiban.Enabled then
if WLSettings.GetObject('antiban').getJSONObject('tasks').getBoolean('enabled') then
Self.SetupTasks();

if WLSettings.Breaks then
if WLSettings.GetObject('antiban').getBoolean('breaks') then
Self.SetupBreaks();

if WLSettings.Sleep.Enabled then
if WLSettings.GetObject('antiban').getJSONObject('sleep').getBoolean('enabled') then
Self.SetupSleep();

if not InRange(MM2MS.GetZoomLevel(), Self.MinZoom, Self.MaxZoom) then
Expand Down
24 changes: 15 additions & 9 deletions osr/basescript.simba
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ Wrapper function used internally to decide if we should handle TWaspProgressRepo
*)
function TBaseScript.ShouldHandlePaint(): Boolean;
begin
Result := WLSettings.RemoteInput.Enabled and WLSettings.RemoteInput.HUDReport and not WLSettings.RemoteInput.HUDDebug;
if not WLSettings.GetObject('remote_input').getBoolean('enabled') then
Exit;
if not WLSettings.GetObject('remote_input').getBoolean('hud_report') then
Exit;
if WLSettings.GetObject('remote_input').getBoolean('hud_debug') then
Exit;
Result := True;
end;

(*
Expand Down Expand Up @@ -167,11 +173,11 @@ begin
end;

{$IFNDEF SRL_DISABLE_REMOTEINPUT}
if not WLSettings.RemoteInput.HUDDebug and Self.ShouldDrawPaint() then
if Self.ShouldDrawPaint() then
ProgressReport.Update();
{$ENDIF}

if not WLSettings.TextReport then
if not WLSettings.GetBoolean('report') then
begin
Self.PreviousAction := Self.Action;
Exit;
Expand Down Expand Up @@ -335,13 +341,13 @@ begin
Self.IsSetup := True;

{$IFNDEF SRL_DISABLE_REMOTEINPUT}
if WLSettings.RemoteInput.Enabled then
if WLSettings.GetObject('remote_input').getBoolean('enabled') then
begin
{$IFDEF SCRIPT_GUI}
RSClient.RemoteInput.Setup();
{$ENDIF}

if WLSettings.RemoteInput.HUDReport then
if WLSettings.GetObject('remote_input').getBoolean('hud_report') then
ProgressReport.Setup();
end;
{$ENDIF}
Expand All @@ -353,7 +359,7 @@ begin

//wasp-stats
if not APIClient.Disabled then
APIClient.Disabled := not WLSettings.Stats;
APIClient.Disabled := not WLSettings.GetBoolean('stats');
APIClient.TimeStamp := GetTickCount();
//override me to add more stuff.
end;
Expand Down Expand Up @@ -390,10 +396,10 @@ begin
Self.TimeRunning.Pause();
Self.OnAntiban := True;

checkBreaks := checkBreaks and WLSettings.Breaks;
checkSleeps := checkSleeps and WLSettings.Sleep.Enabled;
checkBreaks := checkBreaks and WLSettings.GetObject('antiban').getBoolean('breaks');
checkSleeps := checkSleeps and WLSettings.GetObject('antiban').getJSONObject('sleep').getBoolean('enabled');

if WLSettings.Antiban.Enabled or checkBreaks or checkSleeps then
if WLSettings.GetObject('antiban').getJSONObject('tasks').getBoolean('enabled') or checkBreaks or checkSleeps then
Result := Antiban.DoAntiban(checkBreaks, checkSleeps);

Self.TimeRunning.Resume();
Expand Down
4 changes: 2 additions & 2 deletions osr/interfaces/gametabs/worldhopper.simba
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ begin
Exit;

{$IFNDEF SRL_DISABLE_REMOTEINPUT}
if not WLSettings.RemoteInput.BlockInput then
if not WLSettings.GetObject('remote_input').getBoolean('block_real_input') then
RSClient.RemoteInput.DisableRealInput();
{$ENDIF}

Mouse.Scroll(Self.GetScrollArea(scrollBar), Random(1, 3), down, forceMove);

{$IFNDEF SRL_DISABLE_REMOTEINPUT}
if not WLSettings.RemoteInput.BlockInput then
if not WLSettings.GetObject('remote_input').getBoolean('block_real_input') then
RSClient.RemoteInput.EnableRealInput();
{$ENDIF}
end;
Expand Down
14 changes: 7 additions & 7 deletions osr/progress.simba
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ begin
Self.ImagePath := {$MACRO CURRENT_DIRECTORY} + 'WaspProgress.png';

Self.TopLeft := [Chat.Bounds().X1, Chat.Bounds().Y1 - 12];
if WLSettings.RemoteInput.HUDTransparent then
if WLSettings.GetObject('remote_input').getBoolean('hud_transparent') then
begin
Self.TopLeft.Y -= Chat.Height - 12;
Self.BGImg.SetSize(Chat.Width(), Chat.Height() + 12);
Expand Down Expand Up @@ -120,12 +120,12 @@ begin
if not Self.IsSetup then
begin
Self.BGImg.setFontSize(18);
Self.BGImg.DrawTextShadow(ScriptName.Before('.simba').Replace('_', ' ').Capitalize(), [Round(Self.BGImg.GetWidth()/2) + 25, 7], Self.TextColor, WLSettings.RemoteInput.HUDTransparent);
Self.BGImg.DrawTextShadow(ScriptName.Before('.simba').Replace('_', ' ').Capitalize(), [Round(Self.BGImg.GetWidth()/2) + 25, 7], Self.TextColor, WLSettings.GetObject('remote_input').getBoolean('hud_transparent'));

Self.BGImg.setFontSize(14);

hi := Self.ProgressArray[High(Self.ProgressArray)];
if WLSettings.RemoteInput.HUDTransparent then
if WLSettings.GetObject('remote_input').getBoolean('hud_transparent') then
Self.BGImg.DrawTextShadow(hi, [10, 135], Self.AdColor, True)
else
Self.BGImg.DrawText(hi, [10, 135], Self.AdColor);
Expand All @@ -149,25 +149,25 @@ var
i: Int32;
begin
p := [Self.TopLeft.X + 10, Self.TopLeft.Y + 40];
if WLSettings.RemoteInput.HUDTransparent then
if WLSettings.GetObject('remote_input').getBoolean('hud_transparent') then
p.Y -= 12;
q := [Round(Chat.Bounds().Width()/2) + 20, p.Y];

for i := 0 to High(ProgressArray) - 1 do
begin
if Frac(i/2) = 0 then
begin
ClientImg.DrawTextShadow(ProgressArray[i], p, Self.TextColor, WLSettings.RemoteInput.HUDTransparent);
ClientImg.DrawTextShadow(ProgressArray[i], p, Self.TextColor, WLSettings.GetObject('remote_input').getBoolean('hud_transparent'));
p.Y += 20;
end
else
begin
ClientImg.DrawTextShadow(ProgressArray[i], q, Self.TextColor, WLSettings.RemoteInput.HUDTransparent);
ClientImg.DrawTextShadow(ProgressArray[i], q, Self.TextColor, WLSettings.GetObject('remote_input').getBoolean('hud_transparent'));
q.Y += 20;
end;
end;

if WLSettings.RemoteInput.HUDTransparent then
if WLSettings.GetObject('remote_input').getBoolean('hud_transparent') then
Self.ClientImg.DrawBoxFilled(Self.UsernameBox, False, $819DAC);
end;

Expand Down
4 changes: 2 additions & 2 deletions osr/rsclient.simba
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ begin
if XPBar.Tracker.Current = 0 then
XPBar.Read();

if WLSettings.SaveVideo.Enabled and not WL.IsRecording then
if WLSettings.GetObject('video').getBoolean('enabled') and not WL.IsRecording then
begin
userB := Chat.GetDisplayNameBox();
if userB = Chat.GetLineBoxes()[CHAT_INPUT_LINE] then
userB := [];

expB := XPBar.Bounds();

Recorder.Start(WLSettings.SaveVideo.Time, WL_DATAPATH + 'videos', userB, expB);
Recorder.Start(WLSettings.GetObject('video').GetInt('time'), WL_DATAPATH + 'videos', userB, expB);
end;
end;

Expand Down
2 changes: 1 addition & 1 deletion osr/walker/walker.simba
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ begin
Exit;

if region = [] then
region := RSBankRegions[WLSettings.BankLocation];
region := RSBankRegions[WLSettings.GetInt('bank_map')];

Self.SetupRegion(region.Bounds);
end;
Expand Down
2 changes: 1 addition & 1 deletion utils.simba
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ var

{$SCOPEDENUMS ON}

{$IFNDEF WL_UTILTYPES_INCLUDED} {$I utils/utiltypes.simba}
{$IFNDEF WL_CONFIG_INCLUDED} {$I utils/config.simba}
{$IFNDEF WL_SETTINGS_INCLUDED} {$I utils/settings.simba}
{$IFNDEF WL_ITEMS_EX_INCLUDED} {$I utils/items/items.simba}
{$IFNDEF WL_RSREGIONS_UTILS_INCLUDED} {$I utils/rsregions/rsregionsutils.simba}
{$IFNDEF WL_RSREGIONS_INCLUDED} {$I utils/rsregions/rsregions.simba}
Expand Down
35 changes: 14 additions & 21 deletions utils/biometrics.simba
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ end;


(*
## Antiban.SetSleepHour
## Antiban.GetSleepHour
```pascal
procedure TAntiban.SetSleepHour();
function TAntiban.GetSleepHour(): String;
```
Sets WLSettings.Sleep.Hour based on the current BioHash.
WLSettings.Sleep.HourOverride will override this.
Expand All @@ -417,30 +417,26 @@ Antiban.SetSleepHour();
WriteLn WLSettings.Sleep.Hour;
```
*)
procedure TAntiban.SetSleepHour();
function TAntiban.GetSleepHour(): String;
var
sleep: UInt64;
begin
if WLSettings.Sleep.HourOverride <> '' then
begin
WLSettings.Sleep.Hour := WLSettings.Sleep.HourOverride;
Exit;
end;
if not WLSettings.GetObject('antiban').getJSONObject('sleep').getBoolean('biohash') then
Exit(WLSettings.GetObject('antiban').getJSONObject('sleep').getString('hour'));

sleep := 22 + Round(5 * BioHash * ONE_HOUR + 59 * BioHash * ONE_MINUTE);

if sleep > ONE_DAY then
sleep -= ONE_DAY;
if sleep > ONE_DAY then sleep -= ONE_DAY;

WLSettings.Sleep.Hour := SRL.MsToTime(sleep, Time_Bare);
Result := SRL.MsToTime(sleep, Time_Bare);
end;

(*
## Antiban.SetSleepLength
## Antiban.GetSleepLength
```pascal
procedure TAntiban.SetSleepLength();
function TAntiban.GetSleepLength(): Single;
```
Sets WLSettings.Sleep.Length based on the current BioHash.
Gets WLSettings.Sleep.Length based on the current BioHash.
WLSettings.Sleep.LengthOverride will override this.
Example:
Expand All @@ -449,15 +445,12 @@ Antiban.SetSleepLength();
WriteLn WLSettings.Sleep.Length;
```
*)
procedure TAntiban.SetSleepLength();
function TAntiban.GetSleepLength(): Single;
begin
if WLSettings.Sleep.LengthOverride > 0 then
begin
WLSettings.Sleep.Length := WLSettings.Sleep.LengthOverride * ONE_HOUR;
Exit;
end;
if WLSettings.GetObject('antiban').getJSONObject('sleep').getBoolean('biohash') then
Exit(7 + Round(1.33 * BioHash, 3));

WLSettings.Sleep.Length := 7 * ONE_HOUR + Round(200 * ONE_MINUTE * BioHash, 3);
Result := WLSettings.GetObject('antiban').getJSONObject('sleep').getDouble('length');
end;


Expand Down
Loading

0 comments on commit ecb1bc7

Please sign in to comment.