Skip to content

Commit 4e69b6f

Browse files
committed
feat(CargoHull): read notes
- Added the cargohull interface, should have all the basic functionality needed - made some tweaks to some doc titles, the idea is to do this for all docs slowly POSSIBLE BREAKING CHANGE: Made some tweaks to `TRSInterfaceArea.CreateBounds` to have more consistent results, no interfaces were tested with this and some that rely on the bounds to be pixel perfectly accurate could be broken due to this and will need adjusting.
1 parent 3582162 commit 4e69b6f

File tree

8 files changed

+232
-30
lines changed

8 files changed

+232
-30
lines changed

osrs.simba

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ Summary: It includes this file until the current file is reached.
154154
{$IFNDEF WL_GRANDEXCHANGE_CHAT_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/mainscreen/grandexchange/grandexchange_chat.simba}
155155
{$IFNDEF WL_GRANDEXCHANGE_OFFER_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/mainscreen/grandexchange/grandexchange_offer.simba}
156156
{$IFNDEF WL_SHOP_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/mainscreen/shop.simba}
157+
{$IFNDEF WL_CARGOHOLD_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/mainscreen/cargohold.simba}
157158

158159
{$IFNDEF WL_HITSPLATS_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/mainscreen/finders/hitsplats.simba}
159160
{$IFNDEF WL_HPBARS_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/mainscreen/finders/hpbars.simba}
@@ -184,4 +185,4 @@ Summary: It includes this file until the current file is reached.
184185
{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}
185186
{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}
186187
{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}
187-
{$ENDIF}{$ENDIF}{$ENDIF}
188+
{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}

osrs/interfaces/interfacearea.simba

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ end;
149149

150150
function TRSInterfaceArea.CreateBounds(offset: TBox; width, height: Integer = 0): TBox;
151151
var
152-
center, half, halfMax: Single;
152+
center, half, halfMax: Integer;
153153
begin
154154
offset.X1 += Self.Bounds.X1;
155155
offset.Y1 += Self.Bounds.Y1;
@@ -158,12 +158,12 @@ begin
158158

159159
if width > 0 then
160160
begin
161-
half := (offset.X2 - offset.X1) / 2;
161+
half := (offset.X2 - offset.X1) div 2;
162162
center := offset.X1 + half;
163-
halfMax := (width - 1) / 2;
163+
halfMax := (width - 1) div 2;
164164

165-
Result.X1 := Max(Floor(center - half), Floor(center - halfMax));
166-
Result.X2 := Min(Floor(center + half), Floor(center + halfMax));
165+
Result.X1 := Max(center - half, center - halfMax);
166+
Result.X2 := Min(center + half, center + halfMax);
167167
end
168168
else
169169
begin
@@ -173,12 +173,12 @@ begin
173173

174174
if height > 0 then
175175
begin
176-
half := (offset.Y2 - offset.Y1) / 2;
176+
half := (offset.Y2 - offset.Y1) div 2;
177177
center := offset.Y1 + half;
178-
halfMax := (height - 1) / 2;
178+
halfMax := (height - 1) div 2;
179179

180-
Result.Y1 := Max(Floor(center - half), Floor(center - halfMax));
181-
Result.Y2 := Min(Floor(center + half), Floor(center + halfMax));
180+
Result.Y1 := Max(center - half, center - halfMax);
181+
Result.Y2 := Min(center + half, center + halfMax);
182182
end
183183
else
184184
begin

osrs/interfaces/interfacecontrols.simba

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ These can be buttons, scrollbars, dropdowns, checkboxes, etc.
88

99
type
1010
(*
11-
## TRSButton
11+
## TRSButton type
1212
RuneScape has several types of buttons, {ref}`TRSButton` can be used for
1313
several of them but it's made specifically for buttons that have an
1414
"enabled" and "disabled" state:
@@ -184,7 +184,7 @@ end;
184184

185185
type
186186
(*
187-
## TRSSlider
187+
## TRSSlider type
188188
A record meant to handle sliders in the game interfaces:
189189
```{figure} ../../images/sliders.png
190190
```
@@ -258,7 +258,7 @@ end;
258258

259259
type
260260
(*
261-
## TRSScrollBar
261+
## TRSScrollBar type
262262
Record to handle the game interface's scrollbars:
263263
```{figure} ../../images/scrollbar.png
264264
```
@@ -272,7 +272,7 @@ Record to handle the game interface's scrollbars:
272272
(*
273273
### TRSScrollBar.Setup
274274
```pascal
275-
procedure TRSScrollBar.Setup();
275+
procedure TRSScrollBar.Setup(rightSide: Boolean = True);
276276
```
277277
Method used to setup several {ref}`TRSScrollBar` internal variables.
278278
When creating a {ref}`TRSScrollBar` you should first setup it's `Area` variable
@@ -287,13 +287,17 @@ scroll.Area.Y2 := Bank.Bounds.Y2 - 44;
287287
scroll.Setup();
288288
```
289289
*)
290-
procedure TRSScrollBar.Setup();
290+
procedure TRSScrollBar.Setup(rightSide: Boolean = True);
291291
begin
292292
if Self.Area = Default(TBox) then
293293
raise GetDebugLn('ScrollBar', 'You need to set a Area to use the TRSScrollBar.Setup() method.');
294294

295-
Self.Bounds.X1 := Self.Area.X2 + 1;
296-
Self.Bounds.Y1 := Self.Area.Y1 + 16;
295+
if rightSide then
296+
Self.Bounds.X1 := Self.Area.X2 + 1
297+
else
298+
Self.Bounds.X1 := Self.Area.X1 - 16;
299+
300+
Self.Bounds.Y1 := Self.Area.Y1 + 16;
297301
Self.Bounds.X2 := Self.Bounds.X1 + 15;
298302
Self.Bounds.Y2 := Self.Area.Y2 - 16;
299303

@@ -543,7 +547,7 @@ end;
543547

544548
type
545549
(*
546-
## TRSDropDownOption
550+
## TRSDropDownOption type
547551
Helper record to handle {ref}`TRSDropDown` options.
548552
*)
549553
TRSDropDownOption = record
@@ -553,7 +557,7 @@ Helper record to handle {ref}`TRSDropDown` options.
553557
end;
554558

555559
(*
556-
## TRSDropDown
560+
## TRSDropDown type
557561
Record to handle drop downs in the game interfaces:
558562
```{figure} ../../images/dropdowns.png
559563
```

osrs/interfaces/mainscreen/bank.simba

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Methods to interact with the bank interface:
1010

1111
type
1212
(*
13-
## ERSBankButtons
13+
## ERSBankButtons enum
1414
```pascal
1515
ERSBankButtons = enum(WORN, MENU);
1616
```
@@ -19,7 +19,7 @@ Enum representing the 2 top buttons of the {ref}`Bank` interface.
1919
ERSBankButtons = enum(WORN, MENU);
2020

2121
(*
22-
## ERSBankArrangement
22+
## ERSBankArrangement enum
2323
```pascal
2424
ERSBankArrangement = enum(SWAP, INSERT);
2525
```
@@ -28,7 +28,7 @@ Enum representing the 2 arrangement buttons of the {ref}`Bank` interface.
2828
ERSBankArrangement = enum(SWAP, INSERT);
2929

3030
(*
31-
## ERSWithdrawMode
31+
## ERSWithdrawMode enum
3232
```pascal
3333
ERSWithdrawMode = enum(ITEM, NOTE);
3434
```
@@ -37,7 +37,7 @@ Enum representing the 2 withdraw mode buttons of the {ref}`Bank` interface.
3737
ERSWithdrawMode = enum(ITEM, NOTE);
3838

3939
(*
40-
## ERSBankDynamicButtons
40+
## ERSBankDynamicButtons enum
4141
```pascal
4242
ERSBankDynamicButtons = enum(PLACEHOLDERS, SEARCH, DEPOSIT_INVENTORY, DEPOSIT_WORN);
4343
```
@@ -47,7 +47,7 @@ These buttons are dynamic because they can be enabled/disabled and shift places.
4747
ERSBankDynamicButtons = enum(PLACEHOLDERS, SEARCH, DEPOSIT_INVENTORY, DEPOSIT_WORN);
4848

4949
(*
50-
## ERSBankInteraction
50+
## ERSBankInteraction enum
5151
```pascal
5252
ERSBankInteraction = enum(WITHDRAW, DEPOSIT);
5353
```
@@ -56,7 +56,7 @@ Enum representing 2 core actions you can perform on the {ref}`Bank` interface.
5656
ERSBankInteraction = enum(WITHDRAW, DEPOSIT);
5757

5858
(*
59-
## TBankPosition
59+
## TBankPosition type
6060
Helper record to cache items positions on the {ref}`Bank` interface.
6161
*)
6262
TBankPosition = record
@@ -66,7 +66,7 @@ Helper record to cache items positions on the {ref}`Bank` interface.
6666
end;
6767

6868
(*
69-
## TRSBank
69+
## TRSBank type
7070
Record responsible to handle the {ref}`Bank` interface.
7171
*)
7272
TRSBank = record
@@ -391,12 +391,12 @@ end;
391391
function TRSBank.Close(escape: Boolean): Boolean;
392392
function TRSBank.Close(escapeProbability: Single = 0): Boolean; overload;
393393
```
394-
Closes the bank, Depending on `escape` or `escapeProbability the function will
394+
Closes the bank, depending on `escape` or `escapeProbability the function will
395395
either click the button or press escape key.
396396

397397
Example:
398398
```pascal
399-
WriteLn Bank.Close();
399+
WriteLn Bank.Close();
400400
```
401401
*)
402402
function TRSBank.Close(escape: Boolean): Boolean;

0 commit comments

Comments
 (0)