Skip to content

Commit 9a6340e

Browse files
fix: Merge pull request #251 from clubxj/master
fix: Compatibility with SRL-T
2 parents 2d3dc69 + 7ad6d9f commit 9a6340e

File tree

4 files changed

+12
-97
lines changed

4 files changed

+12
-97
lines changed

osr/basescript.simba

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -632,10 +632,11 @@ begin
632632
end;
633633

634634

635-
function TBaseBankScript.RanOut(out item: TRSBankItem; attempts: Int32 = 3): Boolean;
635+
function TBaseBankScript.RanOut(item: TRSBankItem; attempts: Int32 = 3): Boolean;
636636
var
637637
attempt: Int32;
638638
b: TBox;
639+
position: TRSBankPosition;
639640
begin
640641
for attempt := 1 to attempts do
641642
begin
@@ -654,11 +655,12 @@ begin
654655
Continue;
655656
end;
656657

657-
if item.Tab = -1 then Continue;
658-
if Bank.GetCurrentTab() <> item.Tab then Continue;
658+
position := Bank._GetCachedPosition(item.Item);
659+
if position.Tab = -1 then Continue;
660+
if Bank.GetCurrentTab() <> position.Tab then Continue;
659661

660-
if item.Scroll = -1 then Continue;
661-
if not InRange(Bank.GetScrollPosition(), item.Scroll-3, item.Scroll+3) then Continue;
662+
if position.Scroll = -1 then Continue;
663+
if not InRange(Bank.GetScrollPosition(), position.Scroll-3, position.Scroll+3) then Continue;
662664

663665
Break;
664666
end;

osr/deprecated.simba

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,6 @@ var
4545
StatsPayload: TStatsPayload;
4646
{$H+}
4747

48-
function TBaseBankScript.Withdraw(item: TRSBankWithdrawItem): Boolean; overload; deprecated 'Use the TRSBankItem version instead!';
49-
var
50-
tmp: TRSBankItem;
51-
begin
52-
tmp := TRSBankItem.Setup(item.item, item.Quantity, item.Noted);
53-
tmp.Tab := Self.BankTab;
54-
55-
Result := Self.Withdraw(tmp);
56-
57-
Self.BankTab := tmp.Tab;
58-
end;
59-
6048

6149
function TRSWalker.GetMMPoly(tpa: TPointArray): TPointArray; deprecated 'Use TRSWalker.WorldToMM() instead.';
6250
begin

osr/handlers/consumablehandler.simba

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ begin
9696
begin
9797
Self.DebugLn('Consumable found: ' + ToStr(item));
9898
consumable := Self.Setup(item);
99-
consumable.BankItem.Tab := Bank.GetCurrentTab(); //TODO: Search parent maybe?
100-
consumable.BankItem.Scroll := Bank.GetScrollPosition();
99+
Bank._CachePosition(consumable.BankItem.Item, [Bank.GetCurrentTab(), Bank.GetScrollPosition()]);
100+
//TODO: Search parent maybe?
101101

102102
Result += consumable;
103103
end;
@@ -400,7 +400,7 @@ begin
400400
if Self.FindItems(TRASH_ARRAY, trashSlots) then
401401
begin
402402
if Bank.IsOpen() then
403-
Bank.DepositSlot([trashSlots[0], -1], False)
403+
Bank.DepositHelper(Inventory.GetSlotBox(trashSlots[0]), Bank.QUANTITY_ALL, False)
404404
else
405405
Self.ShiftDrop(trashSlots.Intersection(Self.RandomPattern()));
406406
slots := slots.Difference(trashSlots);

osr/interfaces/mainscreen/bank.simba

Lines changed: 2 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ begin
2222
end;
2323

2424

25-
function TRSBank.ContainsItem(item: TRSBankWithdrawItem): Boolean; overload; deprecated 'Use the TRSBankItem version instead!';
26-
begin
27-
Result := Self.ContainsItem(item.Item);
28-
end;
29-
3025
function TRSBank.FindItem(bankTab: Int32; item: TRSItem; out Bounds: TBox): Boolean; overload;
3126
begin
3227
if Self.OpenTab(bankTab) then
@@ -39,16 +34,6 @@ begin
3934
Result := Self.ContainsItem(item);
4035
end;
4136

42-
function TRSBank.ContainsItem(bankTab: Int32; item: TRSBankWithdrawItem): Boolean; overload; deprecated 'Use the TRSBankItem version instead!';
43-
var
44-
bankItem: TRSBankItem;
45-
begin
46-
bankItem := TRSBankItem.Setup(item.item, item.Quantity, item.Noted);
47-
bankItem.Tab := bankTab;
48-
Result := Self.ContainsItem(bankItem);
49-
end;
50-
51-
5237

5338
function TRSBank.DepositAll(): Boolean; override;
5439
var
@@ -73,66 +58,6 @@ begin
7358
Result := buttons[i].Click();
7459
end;
7560

76-
77-
function TRSBank.WithdrawSlot(tab: Int32; item: TRSBankWithdrawSlot; useQuantityButtons: Boolean): Boolean; overload;
78-
var
79-
itemCount: Int32;
80-
begin
81-
if not Self.IsOpen or (tab = -1) then
82-
Exit;
83-
84-
Self.OpenTab(tab);
85-
86-
itemCount := Self.CountSlotStack(item.Slot);
87-
if Self.WithdrawSlot(item, useQuantityButtons) then
88-
Result := WaitUntil(Self.CountSlotStack(item.Slot) < itemCount, 100, 2000);
89-
end;
90-
91-
92-
function TRSBank.WithdrawItem(out tab: Int32; item: TRSBankWithdrawItem; useQuantityButtons: Boolean): Boolean; overload; deprecated 'Use TRSBankItem version instead!';
93-
var
94-
b: TBox;
95-
count: Int32;
96-
begin
97-
if not Self.IsOpen() then
98-
Exit;
99-
100-
if Inventory.IsFull() and (Length(Item.Item.GetArray()) = 1) and not Inventory.ItemIsStackable(Item.Item) then
101-
Exit;
102-
103-
if not Self.FindItem(item.Item, b) then
104-
begin
105-
if tab = -1 then
106-
tab := Self.FindItemTab(item.Item)
107-
else
108-
Self.OpenTab(tab);
109-
110-
if not Self.FindItem(item.Item, b) then
111-
Exit(False);
112-
end;
113-
114-
count := SRL.GetItemAmount(b);
115-
if Self.WithdrawHelper(b, item.Quantity, item.Noted, useQuantityButtons) then
116-
Result := WaitUntil(SRL.GetItemAmount(b) < count, 100, 2000);
117-
end;
118-
119-
function TRSBank.WithdrawItems(tab: Int32; items: array of TRSBankWithdrawItem; UseQuantityButtons: Boolean): Boolean; deprecated 'Use TRSBankItem version instead!';
120-
var
121-
item: TRSBankWithdrawItem;
122-
bankItem: TRSBankItem;
123-
begin
124-
for item in items do
125-
begin
126-
bankItem := TRSBankItem.Setup(item.Item, item.Quantity, item.Noted);
127-
bankItem.Tab := tab;
128-
if not Self.WithdrawItem(bankItem, UseQuantityButtons) then
129-
Exit(False);
130-
end;
131-
Result := True;
132-
end;
133-
134-
135-
13661
function TRSBank.DepositAllBut(Tab: Int32; Items: TRSItemArray): Boolean; deprecated 'Use Bank.DepositRandomItems() instead.';
13762
var
13863
Item: TRSItem;
@@ -155,7 +80,7 @@ begin
15580
if not Self.IsOpen then //Exit in case the bank somehow closed.
15681
Exit;
15782

158-
if Self.DepositSlot([DepositSlots[0], Self.QUANTITY_ALL], True) then
83+
if Self.DepositHelper(Inventory.GetSlotBox(DepositSlots[0]), Self.QUANTITY_ALL, True) then
15984
WaitUntil(not Inventory.IsSlotUsed(DepositSlots[0]), 100, 2000);
16085

16186
DepositSlots := Slots.Difference(Inventory.GetUsedSlots);
@@ -177,7 +102,7 @@ begin
177102
if not Self.IsOpen() then //Exit in case the bank somehow closed.
178103
Exit;
179104

180-
if Self.DepositSlot([slots[0], Bank.QUANTITY_ALL], True) then
105+
if Self.DepositHelper(Inventory.GetSlotBox(slots[0]), Bank.QUANTITY_ALL, True) then
181106
WaitUntil(not Inventory.IsSlotUsed(slots[0]), 100, 2000);
182107

183108
slots := Inventory.FindRandomItems(items);

0 commit comments

Comments
 (0)