@@ -76,8 +76,6 @@ Record responsible to handle the {ref}`Bank` interface.
7676 Title: TRSInterfaceTitle;
7777 Scroll: TRSScrollBar;
7878
79- CachedQuantity: Integer;
80-
8179 Incenerator, PotionStorage, SlotsArea: TBox;
8280
8381 Tabs, SlotBoxes: TBoxArray;
@@ -943,7 +941,7 @@ if Bank.Items.Find('Abyssal whip', slot) the
943941function TRSBank._InteractionHelper(mode: ERSBankInteraction; slot: TBox; amount: Integer; useQuantityButton: Boolean): Boolean;
944942var
945943 quantity: ERSItemQuantity;
946- amountStr, modeStr: String;
944+ amountStr, modeStr, upText : String;
947945begin
948946 amountStr := ToString(amount);
949947 quantity := ERSItemQuantity.Integer2Quantity(amount);
@@ -955,7 +953,8 @@ begin
955953
956954 if useQuantityButton then
957955 begin
958- if not Self.SetQuantity(quantity) then Exit;
956+ if not Self.SetQuantity(quantity) then
957+ Exit;
959958
960959 Mouse.Move(slot);
961960 if quantity <> ERSItemQuantity.CUSTOM then
@@ -964,14 +963,34 @@ begin
964963 Exit(True);
965964 end;
966965
967- if MainScreen.IsUpText(modeStr + amountStr) then
966+ if Self._Cache.Quantity = amount then
967+ begin
968+ Mouse.Click(EMouseButton.LEFT);
969+ Exit(True);
970+ end;
971+
972+ upText := MainScreen.UpText;
973+ if not upText.Contains(modeStr) then
974+ Exit;
975+
976+ upText := upText.Between(modeStr, ' ');
977+
978+ if upText = amountStr then
968979 begin
980+ Self._Cache.Quantity := amount;
969981 Mouse.Click(EMouseButton.LEFT);
970982 Exit(True);
971983 end;
972984
973- if not ChooseOption.Select(modeStr + 'X') then Exit;
974- Exit(Chat.AnswerQuery('Enter amount', amountStr, RandomLeft(1400, 2400)));
985+ if not ChooseOption.Select(modeStr + 'X') then
986+ Exit;
987+ if Chat.AnswerQuery('Enter amount', amountStr, RandomLeft(1400, 2400)) then
988+ begin
989+ Self._Cache.Quantity := amount;
990+ Exit(True);
991+ end
992+ else
993+ Exit;
975994 end;
976995
977996 Mouse.Move(slot);
0 commit comments