Skip to content

Commit 199729d

Browse files
committed
feat: RSMouseZoom
- added RSMouseZoom, this time much better integrated since everything is in a single library - added overrides.simba, this is not what it used to be in wasplib, this is a place for me to place all the library overrides at the very end of the library, which is easier to read than doing it across 10 files.
1 parent 817aa13 commit 199729d

File tree

7 files changed

+397
-19
lines changed

7 files changed

+397
-19
lines changed

osrs.simba

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
{$IFNDEF SRLT_PRAYER_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/gametabs/prayer.simba}
3737
{$IFNDEF SRLT_WORLDSWITCHER_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/gametabs/worldswitcher.simba}
3838
{$IFNDEF SRLT_LOGOUT_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/gametabs/logout.simba}
39+
{$IFNDEF SRLT_MOUSEZOOM_INCLUDED} {$INCLUDE_ONCE osrs/mousezoom.simba}
3940

4041
{$IFNDEF SRLT_MM2MS_PROJECTOR_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/mm2ms_projector.simba}
4142
{$IFNDEF SRLT_MM2MS_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/mm2ms.simba}
@@ -55,6 +56,7 @@
5556
{$IFNDEF SRLT_ANTIBAN_TASKS_INCLUDED} {$INCLUDE_ONCE osrs/antiban/antibantasks.simba}
5657

5758
{$IFNDEF SRLT_SETUP_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/setup.simba}
59+
{$IFNDEF SRLT_OVERRIDES_INCLUDED} {$INCLUDE_ONCE osrs/overrides.simba}
5860

5961

6062
{$ENDIF}
@@ -99,3 +101,5 @@
99101
{$ENDIF}
100102
{$ENDIF}
101103
{$ENDIF}
104+
{$ENDIF}
105+
{$ENDIF}

osrs/interfaces/gametabs/options.simba

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ end;
186186
(*
187187
## Options.OpenTab
188188
```pascal
189-
function TRSOptions.OpenTab(const tab: ERSOptionsTab): Boolean;
189+
function TRSOptions.OpenTab(tab: ERSOptionsTab): Boolean;
190190
```
191191
Attempts to open the specified `tab` `ERSOptionsTab`.
192192

@@ -195,7 +195,7 @@ Example:
195195
WriteLn Options.OpenTab(ERSOptionsTab.DISPLAY);
196196
```
197197
*)
198-
function TRSOptions.OpenTab(const tab: ERSOptionsTab): Boolean;
198+
function TRSOptions.OpenTab(tab: ERSOptionsTab): Boolean;
199199
begin
200200
if not Self.Open() then Exit;
201201
if not Self.CloseHouseOptions() then Exit;
@@ -209,7 +209,7 @@ end;
209209
(*
210210
## Options.GetZoomLevel
211211
```pascal
212-
function TRSOptions.GetZoomLevel(const useCache: Boolean = True): Integer;
212+
function TRSOptions.GetZoomLevel(useCache: Boolean = True): Integer;
213213
```
214214
Retrieves the current zoom level.
215215
By default it uses the value cached in `TRSOptions.ZoomLevel` if it is already set.
@@ -221,7 +221,7 @@ Example:
221221
WriteLn Options.GetZoomLevel();
222222
```
223223
*)
224-
function TRSOptions.GetZoomLevel(const useCache: Boolean = True): Integer;
224+
function TRSOptions.GetZoomLevel(useCache: Boolean = True): Integer;
225225
begin
226226
if useCache and (Self.ZoomLevel > -1) then
227227
Exit(Self.ZoomLevel);
@@ -240,7 +240,7 @@ end;
240240
(*
241241
## Options.SetZoomLevel
242242
```pascal
243-
function TRSOptions.SetZoomLevel(const level: Integer): Boolean;
243+
function TRSOptions.SetZoomLevel(level: Integer): Boolean;
244244
```
245245
Sets a new zoom level through the options gametab.
246246
If we successfully update the zoom level we update the cached
@@ -251,7 +251,7 @@ Example:
251251
Options.SetZoomLevel(30);
252252
```
253253
*)
254-
function TRSOptions.SetZoomLevel(const level: Integer): Boolean;
254+
function TRSOptions.SetZoomLevel(level: Integer): Boolean;
255255
begin
256256
Result := Self.Sliders[ERSOptionsSlider.ZOOM].SetLevel(level);
257257

@@ -261,7 +261,6 @@ begin
261261
Self.ZoomLevel := -1;
262262
end;
263263

264-
265264
var
266265
(*
267266
(Options)=
@@ -270,15 +269,6 @@ Global TRSOptions variable.
270269
*)
271270
Options: TRSOptions;
272271

273-
function TRSGameTabs.GetCurrent(): ERSGameTab; override;
274-
begin
275-
Result := inherited;
276-
277-
if Result <> ERSGameTab.NONE then Exit;
278-
if Options.IsHouseOptionsOpen() then
279-
Result := ERSGameTab.OPTIONS;
280-
end;
281-
282272
begin
283273
Options.ZoomLevel := -1;
284274
end;

osrs/interfaces/interface.simba

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ begin
8686
Result := SleepUntil(not Self.IsOpen(), 50, 600);
8787
end;
8888

89-
function TRSInterfaceTitle.Close(escapeProbability: Single = 0): Boolean; overload;
89+
function TRSInterfaceTitle.Close(escapeProbability: Single = -1): Boolean; overload;
9090
begin
91+
if escapeProbability = -1 then escapeProbability := Biometrics.RandomDouble(0.5);
9192
Result := Self.Close(RandomBoolean(escapeProbability));
9293
end;

osrs/interfaces/mainscreen/bank.simba

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,9 @@ begin
356356
Result := Self.Title.Close(escape);
357357
end;
358358

359-
function TRSBank.Close(escapeProbability: Single = 0): Boolean; overload;
359+
function TRSBank.Close(escapeProbability: Single = -1): Boolean; overload;
360360
begin
361-
Result := Self.Close(escapeProbability);
361+
Result := Self.Title.Close(escapeProbability);
362362
end;
363363

364364

0 commit comments

Comments
 (0)