Skip to content

Commit a8a228e

Browse files
committed
fix: rating enum, bank import
1 parent 3a6c4a6 commit a8a228e

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

osrs/interfaces/gametabs/logout.simba

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ Methods to interact with the logout tab.
88
{$ENDIF}
99

1010
type
11+
ERSRating = (ONE, TWO, THREE, FOUR, FIVE);
1112
ERSLogoutButton = (WORLD_SWITCHER, CLICK_HERE);
1213
TRSLogout = record
1314
Buttons: array [ERSLoginButton] of TRSButton;
14-
Ratings: array [0..4] of TRSButton;
15+
Ratings: array [ERSRating] of TRSButton;
1516
end;
1617

1718
procedure TRSLogout.SetupInterface();
@@ -85,13 +86,35 @@ WriteLn Logout.IsRated();
8586
*)
8687
function TRSLogout.IsRated(): Boolean;
8788
begin
88-
Result := Self.Ratings[0].Enabled();
89+
Result := Self.Ratings[ERSRating.ONE].Enabled();
8990
end;
9091

9192
(*
92-
## Logout.ClickLogout
93+
## Logout.Rate
9394
```pascal
94-
function TRSLogout.ClickLogout(attempts: Int32 = 5; time: Int32 = 20000): Boolean;
95+
function TRSLogout.Rate(const star: ERSRating): Boolean;
96+
```
97+
Click a star button to rate the game.
98+
99+
Example:
100+
```pascal
101+
WriteLn Logout.Rate(ERSRating.FOUR);
102+
```
103+
*)
104+
function TRSLogout.Rate(const star: ERSRating): Boolean;
105+
begin
106+
if Self.Ratings[star].Enabled() and
107+
((star = ERSRating.FIVE) or not Self.Ratings[star+1].Enabled()) then
108+
Exit(True);
109+
110+
Self.Ratings[star].Click(EMouseButton.LEFT);
111+
Result := Self.Ratings[star].WaitEnabled();
112+
end;
113+
114+
(*
115+
## Logout.Logout
116+
```pascal
117+
function TRSLogout.Logout(attempts: UInt32 = 5; time: UInt32 = 20000): Boolean;
95118
```
96119
Clicks the logout button. Returns true if we succesfully logout of the game.
97120

@@ -115,7 +138,7 @@ begin
115138
else
116139
i := RandomLeft(0, 4);
117140

118-
WriteLn GetDebugLn('Logout', 'Rating the game with ' + ToStr(i+1) + ' stars before logging out.');
141+
WriteLn GetDebugLn('Logout', 'Rating the game with ' + ToStr(ERSRating(i)) + ' stars before logging out.');
119142
Self.Ratings[i].Enable();
120143
end;
121144

osrs/interfaces/mainscreen/bank.simba

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ Methods to interact with the bank interface
44
*)
55

66
{$DEFINE SRLT_BANK_INCLUDED}
7-
{$IFNDEF SRLT_OSR}
8-
{$I SRLT/osrs.simba}
9-
{$ENDIF}
7+
{$INCLUDE_ONCE SRLT/osrs.simba}
108

119
type
1210
(*

0 commit comments

Comments
 (0)