You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function TRSBank.FindItemTab(const item: TRSItem; const openTab: Boolean = True): Integer;
607
+
```
608
+
Find the bank tab of `item`.
609
+
610
+
```{note}
611
+
A known limitation of this is that if several items match the sprite of the item (for example multiple charged jewlry) the tab retrieved will be the first one found. If you have 'Games necklace(1)' in tab 1 and 'Games necklace(8)' in tab 5 and search for the latter, you will get tab 1.
612
+
```
523
613
524
-
function TRSBank._IsCustomQuantity(quantity: Integer): Boolean;
614
+
Example:
615
+
```pascal
616
+
WriteLn Bank.FindItemTab('Molten glass');
617
+
```
618
+
*)
619
+
function TRSBank.FindItemTab(const item: TRSItem): Integer;
620
+
var
621
+
bounds: TBox;
525
622
begin
526
-
Result := not (quantity in [1,5,10, Self.QUANTITY_ALL]);
623
+
(* TODO: Remove
624
+
if Self.Items.Contains(item) then
625
+
begin
626
+
if not Self.DynamicButtons[ERSBankDynamicButtons.SEARCH].Enabled() then
627
+
Exit(Self.GetCurrentTab());
628
+
629
+
if Self.WaitSearchOpen(600) then
630
+
if not Self.CloseSearch() then Exit(-1); //unknown state, reset search
631
+
end;
632
+
*)
633
+
634
+
if not Self.Search(item.SimplifyName()) then Exit(-1);
635
+
if not Self.Items.Find(item, bounds) then Exit(-1);
if Self._FindTabText(Target.FindColor(RSColors.TEXT_LIGHT_YELLOW, 0, bounds), bounds) then
641
+
Result := OCR.RecognizeNumber(bounds, RSFonts.PLAIN_11, [RSColors.TEXT_LIGHT_YELLOW], 0);
642
+
if Self._FindTabText(Target.FindColor(RSColors.TEXT_WHITE, 0, bounds), bounds) then
643
+
Result := OCR.RecognizeNumber(bounds, RSFonts.PLAIN_11, [RSColors.TEXT_WHITE], 0);
527
644
end;
528
645
529
646
(*
530
-
## Bank._SimplifyItemName
647
+
## Bank.FindItemScroll
531
648
```pascal
532
-
function TRSBank._SimplifyItemName(item: TRSItem): String;
649
+
function TRSBank.FindItemScroll(const item: TRSItem): Integer;
650
+
```
651
+
Find the scroll position of the bank where `item` is visible..
652
+
653
+
```{note}
654
+
A known limitation of this is that if several items match the sprite of the item (for example multiple charged jewlry) the tab retrieved will be the first one found. If you have 'Games necklace(1)' in tab 1 and 'Games necklace(8)' in tab 5 and search for the latter, you will get tab 1.
533
655
```
534
-
Internal function to get a human like search term for an item as humans
535
-
don't usually type the full item name when searching for something.
536
656
537
657
Example:
538
658
```pascal
539
-
WriteLn Bank._SimplifyItemName('Amulet of glory(6)');
659
+
WriteLn Bank.FindItemScroll('Molten glass');
540
660
```
541
661
*)
542
-
function TRSBank._SimplifyItemName(item: TRSItem): String;
662
+
function TRSBank.FindItemScroll(const item: TRSItem): Integer;
543
663
var
544
-
str: String;
545
-
short, long: Integer;
664
+
next: Integer;
665
+
down: Boolean;
546
666
begin
547
-
str := item.Before('(').ToLower();
548
-
long := Length(str);
549
-
short := Min(0, long - Ceil(long/3));
667
+
(* TODO: Remove
668
+
if Self.Items.Contains(item) then
669
+
begin
670
+
if not Self.DynamicButtons[ERSBankDynamicButtons.SEARCH].Enabled() then
671
+
Exit(Self.Scroll.GetLevel());
672
+
673
+
if Self.WaitSearchOpen(600) then
674
+
if not Self.CloseSearch() then Exit(-1); //unknown state, reset search
0 commit comments