Skip to content

Commit 49af909

Browse files
committed
fix(Bank): better DepositDifferent
1 parent 2ef3a01 commit 49af909

File tree

3 files changed

+41
-14
lines changed

3 files changed

+41
-14
lines changed

osrs/interfaces/iteminterface.simba

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -367,26 +367,45 @@ begin
367367
end;
368368

369369

370+
function TRSItemInterface._GetShadowHash(slot: Integer): String;
371+
var
372+
b: TBox;
373+
begin
374+
with Self.Slots^.Box(slot) do
375+
begin
376+
b.X1 := X1 + Self.DiscoverOffset.X;
377+
b.Y1 := Y1 + Self.DiscoverOffset.Y;
378+
end;
370379

371-
function TRSItemInterface._Discover(slot: Integer): TRSItemArray;
380+
b.X2 := b.X1 + 35;
381+
b.Y2 := b.Y1 + 31;
382+
383+
Result := ItemFinder.GetBorderHash(Target.GetImage(b));
384+
end;
385+
386+
function TRSItemInterface._GetHash(slot: Integer): String;
372387
var
373388
b: TBox;
374-
img: TImage;
375-
hash: String;
376389
begin
377-
b := Self.Slots^.Box(slot);
378-
b.X1 += Self.DiscoverOffset.X;
379-
b.Y1 += Self.DiscoverOffset.Y;
390+
with Self.Slots^.Box(slot) do
391+
begin
392+
b.X1 := X1 + Self.DiscoverOffset.X;
393+
b.Y1 := Y1 + Self.DiscoverOffset.Y;
394+
end;
395+
380396
b.X2 := b.X1 + 35;
381397
b.Y2 := b.Y1 + 31;
382398

383-
if (b.Width <> 36) or (b.Height <> 32) then
384-
raise GetDebugLn(Self.Name, 'Discover box has to be 36x32. You passed w: ' + ToStr(b.Width) + ' h: ' + ToStr(b.Height));
399+
Result := ItemFinder.GetHash(Target.GetImage(b));
400+
end;
385401

386-
img := Target.GetImage(b);
387-
hash := ItemFinder.GetHash(img);
388-
if hash = '' then Exit;
389-
Result := ItemFinder.GetHashItems(hash);
402+
function TRSItemInterface._Discover(slot: Integer): TRSItemArray;
403+
var
404+
hash: String;
405+
begin
406+
hash := Self._GetHash(slot);
407+
if hash <> '' then
408+
Result := ItemFinder.GetHashItems(hash);
390409
end;
391410

392411
function TRSItemInterface.Discover(slot: Integer): TRSItemArray;

osrs/interfaces/mainscreen/bank.simba

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,13 +1191,21 @@ function TRSBank.DepositDifferent(items: TRSItemArray; useQuantityButton: Boolea
11911191
var
11921192
slots: TIntegerArray;
11931193
slot: Integer;
1194+
hash: String;
1195+
deposited: TStringArray;
11941196
begin
11951197
slots := Inventory.Items.FindDifferent(items);
11961198
if slots = [] then Exit(True);
11971199

11981200
for slot in slots do
1199-
if not Self._InteractionHelper(ERSBankInteraction.DEPOSIT, Inventory.Slots.Box(slot), 1, useQuantityButton) then
1201+
begin
1202+
hash := Inventory.Items._GetHash(slot);
1203+
if deposited.Contains(hash) then
1204+
Continue;
1205+
deposited += hash;
1206+
if not Self._InteractionHelper(ERSBankInteraction.DEPOSIT, Inventory.Slots.Box(slot), QUANTITY_ALL, useQuantityButton) then
12001207
Exit;
1208+
end;
12011209
Result := True;
12021210
end;
12031211

osrs/interfaces/minimap.simba

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ position on the minimap at 0º.
722722
Example:
723723
```pascal
724724
pt := Minimap.RandomPoint(Minimap.Center, 30);
725-
angle := Minimap.GetCompassAngle(False);
725+
angle := Minimap.CompassRadians;
726726
pt := Minimap.Normalize(pt, angle);
727727
ShowOnTarget(TCircle.Create(pt.X, pt.Y, 6));
728728
```

0 commit comments

Comments
 (0)