Skip to content

Commit 139054c

Browse files
authored
Merge pull request #145 from jacz24/DepositBoxAntiban
Added DepositBox Antibans
2 parents dd0f10f + a2aa949 commit 139054c

File tree

2 files changed

+77
-6
lines changed

2 files changed

+77
-6
lines changed

osrs/antiban/antibantasks.simba

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,63 @@ begin
388388
Bank.OpenTab(tab);
389389
end;
390390

391+
// DepositBox antibans
392+
procedure TAntiban.HoverDepositItem();
393+
var
394+
boxes: TBoxArray;
395+
begin
396+
if not DepositBox.IsOpen() then Exit;
397+
WriteLn GetDebugLn('Antiban', 'Hovering a random deposit box item');
398+
boxes := DepositBox.ISlots.Boxes();
399+
if boxes = [] then Exit;
400+
Mouse.Move(boxes.Random());
401+
Biometrics.Sleep(500, 2000, ERandomDir.LEFT);
402+
end;
403+
404+
procedure TAntiban.HoverDepositQuantity();
405+
var
406+
btn: TRSButton;
407+
begin
408+
if not DepositBox.IsOpen() then Exit;
409+
WriteLn GetDebugLn('Antiban', 'Hovering a random deposit box quantity button');
410+
btn := DepositBox.QuantityButtons[ERSItemQuantity(Random(0, Length(DepositBox.QuantityButtons)-1))];
411+
Mouse.Move(btn.Bounds);
412+
Biometrics.Sleep(500, 2000, ERandomDir.LEFT);
413+
end;
414+
415+
procedure TAntiban.HoverDepositButton();
416+
var
417+
btn: TRSButton;
418+
begin
419+
if not DepositBox.IsOpen() then Exit;
420+
WriteLn GetDebugLn('Antiban', 'Hovering a random deposit box button');
421+
btn := DepositBox.DepositButtons[ERSDepositButtons(Random(0, Length(DepositBox.DepositButtons)-1))];
422+
Mouse.Move(btn.Bounds);
423+
Biometrics.Sleep(500, 2000, ERandomDir.LEFT);
424+
end;
425+
426+
procedure TAntiban.ToggleDepositQuantity();
427+
var
428+
currentIdx, newIdx, totalButtons: Integer;
429+
begin
430+
if not DepositBox.IsOpen() then Exit;
431+
WriteLn GetDebugLn('Antiban', 'Toggling deposit box quantity buttons');
432+
433+
totalButtons := Length(DepositBox.QuantityButtons);
434+
435+
for currentIdx := 0 to totalButtons-1 do
436+
if DepositBox.QuantityButtons[ERSItemQuantity(currentIdx)].Enabled() then
437+
Break;
438+
439+
newIdx := (currentIdx + Random(1, totalButtons-1)) mod totalButtons;
440+
441+
DepositBox.QuantityButtons[ERSItemQuantity(newIdx)].Click();
442+
Biometrics.Sleep(1000, 3000, ERandomDir.LEFT);
443+
444+
if DepositBox.IsOpen() then
445+
DepositBox.QuantityButtons[ERSItemQuantity(currentIdx)].Click();
446+
end;
447+
391448
// GrandExchange antibans
392449
procedure TAntiban.CheckHistory();
393450
begin
@@ -764,6 +821,16 @@ begin
764821
end;
765822
end;
766823

824+
procedure TAntiban.RandomDepositTask();
825+
begin
826+
case Random(0, 10) of
827+
0..3: Self.HoverDepositItem();
828+
4..6: Self.HoverDepositQuantity();
829+
7..8: Self.HoverDepositButton();
830+
9..10: Self.ToggleDepositQuantity();
831+
end;
832+
end;
833+
767834
procedure TAntiban.RandomGETask();
768835
begin
769836
case Random(0, 10) of
@@ -998,6 +1065,11 @@ const
9981065
['BankScrolling', @Antiban.BankScrolling],
9991066
['RandomBankTab', @Antiban.RandomBankTab],
10001067
['ToggleBankTab', @Antiban.ToggleBankTab],
1068+
['HoverDepositItem', @Antiban.HoverDepositItem],
1069+
['HoverDepositQuantity', @Antiban.HoverDepositQuantity],
1070+
['HoverDepositButton', @Antiban.HoverDepositButton],
1071+
['ToggleDepositQuantity', @Antiban.ToggleDepositQuantity],
1072+
['RandomDepositTask', @Antiban.RandomDepositTask],
10011073
['CheckHistory', @Antiban.CheckHistory],
10021074
['RandomOffer', @Antiban.RandomOffer],
10031075
['RandomRightClick', @Antiban.RandomRightClick],

osrs/interfaces/mainscreen/depositbox.simba

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,15 @@ begin
7373
end;
7474
end;
7575

76+
function TRSDepositBox.IsOpen(): Boolean; forward;
77+
7678
(*
7779
## DepositBox.SetupInterface
7880
```pascal
7981
procedure TRSDepositBox.SetupInterface;
8082
```
81-
Initializes depositbox variables.
82-
83-
```{note}
84-
This is automatically called on the **DepositBox** variable.
85-
```
83+
Internal method used to setup the {ref}`TRSDepositBox` coordinates.
84+
This is automatically called for you on the {ref}`DepositBox variable`.
8685
*)
8786
procedure TRSDepositBox.SetupInterface();
8887
var
@@ -100,7 +99,7 @@ begin
10099
Self.InvSlotBoxes := TBoxArray.Create([Self.SlotsArea.X1,Self.SlotsArea.Y1], 4, 7, 32, 32, [10, 4]);
101100

102101
Self.ISlots.Setup('DepositBox.ISlots', Self.InvSlotBoxes, @Self.FindItemBoundaries);
103-
Self.Items.Setup('DepositBox.Items', @Self.ISlots, [0,1]);
102+
Self.Items.Setup('DepositBox.Items', @Self.ISlots, [0,1], @Self.IsOpen);
104103

105104
Self.EquipSlotBoxes := [
106105
Box(77,54,110,88), Box(36,93,69,127), // Helm, Cape

0 commit comments

Comments
 (0)