3333 Bounds: TBox;
3434 Slots: TRSSlotInterface;
3535 Items: TRSItemInterface;
36+
37+ Title: TRSInterfaceTitle;
3638 Scroll: TRSScrollBar;
3739
3840 CachedQuantity: Int32;
4749 end;
4850 const QUANTITY_ALL: Integer = -1;
4951 const QUANTITY_ALL_BUT_ONE: Integer = -2;
52+ _IsOpenHelperBox: TBox;
5053 end;
5154
5255(*
@@ -115,6 +118,7 @@ begin
115118 Self.Scroll.ScrollArea.Y2 := Self.Bounds.Y2 - 44;
116119
117120 Self.Scroll.Setup();
121+ Self.Title.Setup(Self.Bounds);
118122
119123 Self.Tabs := TBoxArray.Create(Self.Bounds.TopLeft.Offset(47, 42), 10, 1, 35, 28, [5, 0]);
120124 Self.SlotBoxes := TBoxArray.Create(Self.Bounds.TopLeft.Offset(57, 77), 8, (Self.Bounds.Height - 135) div 35, 31, 31, [17, 5]);
@@ -136,9 +140,104 @@ begin
136140
137141 Self.Slots.Setup('Bank.Slots', Self.SlotBoxes, @Self.FindItemBoundaries);
138142 Self.Items.Setup('Bank.Items', @Self.Slots, [0, 10, 3, 0]);
143+
144+ Self._IsOpenHelperBox.X1 := Self.Bounds.X1 + 240;
145+ Self._IsOpenHelperBox.Y1 := Self.Bounds.Y2 - 39;
146+ Self._IsOpenHelperBox.X2 := Self.Bounds.X2 - 155;
147+ Self._IsOpenHelperBox.Y2 := Self.Bounds.Y2 - 25;
148+ end;
149+
150+
151+ (*
152+ ## Bank.IsOpen
153+ ```pascal
154+ function TRSBank.IsOpen(): Boolean;
155+ ```
156+ Returns true if the bank is open.
157+
158+ Example:
159+ ```pascal
160+ WriteLn Bank.IsOpen();
161+ ```
162+ *)
163+ function TRSBank.IsOpen(): Boolean;
164+ var
165+ count1, count2: Integer;
166+ begin
167+ count1 := Target.CountColor($0, 0, Self._IsOpenHelperBox);
168+ count2 := Target.CountColor(RSColors.TEXT_ORANGE, 0, Self._IsOpenHelperBox);
169+ Result := ((count1 = 94) and (count2 = 116)) or Self.Title.IsTitle('Bank') or Self.Title.IsTitle('Equip');
170+ end;
171+
172+ (*
173+ ## Bank.WaitOpen
174+ ```pascal
175+ function TRSBank.WaitOpen(const time: Integer; interval: Integer = -1): Boolean;
176+ ```
177+ Returns true if the bank is open within `time` milliseconds.
178+
179+ ### Example:
180+ ```pascal
181+ WriteLn Bank.WaitOpen();
182+ ```
183+ *)
184+ function TRSBank.WaitOpen(const time: Integer; interval: Integer = -1): Boolean;
185+ begin
186+ if interval < 0 then interval := RandomMode(100, 50, 1500);
187+ Result := SleepUntil(Self.IsOpen(), interval, time);
188+ end;
189+
190+ (*
191+ ## Bank.Close
192+ ```pascal
193+ function TRSBank.Close(escape: Boolean): Boolean;
194+ function TRSBank.Close(escapeProbability: Single = 0): Boolean; overload;
195+ ```
196+ Closes the bank, Depending on `escape` or `escapeProbability the function will
197+ either click the button or press escape key.
198+
199+ Example:
200+ ```pascal
201+ WriteLn Bank.Close();
202+ ```
203+ *)
204+ function TRSBank.Close(escape: Boolean): Boolean;
205+ begin
206+ Result := Self.Title.Close(escape);
207+ end;
208+
209+ function TRSBank.Close(escapeProbability: Single = 0): Boolean; overload;
210+ begin
211+ Result := Self.Close(escapeProbability);
139212end;
140213
141214
215+ function TRSBank.HasIncinerator(): Boolean;
216+ begin
217+ with Self.Incenerator do //TODO ADD COLOR
218+ Result := Target.HasColor(10551295, 0, 1, [X1, Y1+55, X2, Y2]);
219+ end;
220+
221+ function TRSBank.InceneratorTooltipVisible(): Boolean;
222+ begin
223+ Result := Target.HasColor(10551295, 0, 1, Self.Incenerator);
224+ end;
225+
226+ function TRSBank.UnHoverIncinerator(): Boolean;
227+ var
228+ boxes: TBoxArray;
229+ begin
230+ if not Self.Incenerator.Contains(Target.MouseXY) then
231+ Exit(True);
232+
233+ boxes := Self.Incenerator.Invert(Self.Bounds).SortFrom(Target.MouseXY);
234+ Async.MouseMove(boxes[RandomLeft(0, High(boxes))].RandomPoint());
235+ Result := SleepUntil(not Self.InceneratorTooltipVisible(), 100, 1000);
236+ Async.MouseStop();
237+ end;
238+
239+
240+
142241
143242var
144243 Bank: TRSBank;
0 commit comments