|
| 1 | +(* |
| 2 | +# Logout |
| 3 | +Methods to interact with the logout tab. |
| 4 | +*) |
| 5 | +{$DEFINE SRLT_LOGOUT_INCLUDED} |
| 6 | +{$IFNDEF SRLT_OSR} |
| 7 | + {$I SRLT/osrs.simba} |
| 8 | +{$ENDIF} |
| 9 | + |
| 10 | +type |
| 11 | + ERSLogoutButton = (WORLD_SWITCHER, CLICK_HERE); |
| 12 | + ERSLogoutRating = (ONE, TWO, THREE, FOUR, FIVE); |
| 13 | + |
| 14 | + TRSLogout = record |
| 15 | + Buttons: array [ERSLoginButton] of TRSButton; |
| 16 | + Ratings: array [ERSLogoutRating] of TRSButton; |
| 17 | + end; |
| 18 | + |
| 19 | +procedure TRSLogout.SetupInterface(); |
| 20 | +var |
| 21 | + btns: TBoxArray; |
| 22 | + i: Integer; |
| 23 | +begin |
| 24 | + btns := TBoxArray.Create(GameTab.TopLeft.Offset(2,61), 5, 1, 31, 35, [6, 0]); |
| 25 | + for i := 0 to High(btns) do |
| 26 | + begin |
| 27 | + Self.Ratings[i].EnabledColors := [[$0F1043, 0], [$23269F, 0.227]]; |
| 28 | + Self.Ratings[i].Bounds := btns[i]; |
| 29 | + end; |
| 30 | + |
| 31 | + Self.Buttons[ERSLogoutButton.WORLD_SWITCHER].EnabledColors := [[$0F1043, 0], [$23269F, 0.227]]; |
| 32 | + Self.Buttons[ERSLogoutButton.CLICK_HERE].EnabledColors := [[$0F1043, 0], [$23269F, 0.227]]; |
| 33 | + |
| 34 | + with GameTab.Bounds do |
| 35 | + begin |
| 36 | + Self.Buttons[ERSLogoutButton.WORLD_SWITCHER].Bounds := TBox.Create(X1+22, Y2-97, X2-22, Y2-66); |
| 37 | + Self.Buttons[ERSLogoutButton.CLICK_HERE].Bounds := TBox.Create(X1+22, Y2-49, X2-22, Y2-18); |
| 38 | + end; |
| 39 | +end; |
| 40 | + |
| 41 | +(* |
| 42 | +## Logout.IsOpen |
| 43 | +```pascal |
| 44 | +function TRSLogout.IsOpen(): Boolean; |
| 45 | +``` |
| 46 | +Returns true if the logout gametab is open, false if it's not. |
| 47 | + |
| 48 | +Example: |
| 49 | +```pascal |
| 50 | +WriteLn Logout.IsOpen(); |
| 51 | +``` |
| 52 | +*) |
| 53 | +function TRSLogout.IsOpen(): Boolean; |
| 54 | +begin |
| 55 | + Result := GameTabs.IsOpen(ERSGameTab.LOGOUT); |
| 56 | +end; |
| 57 | + |
| 58 | +(* |
| 59 | +## Logout.Open |
| 60 | +```pascal |
| 61 | +function TRSLogout.Open(): Boolean; |
| 62 | +``` |
| 63 | +Attempts to open the logout tab, returns true if it succeeds. |
| 64 | + |
| 65 | +Example: |
| 66 | +```pascal |
| 67 | +WriteLn Logout.Open(); |
| 68 | +``` |
| 69 | +*) |
| 70 | +function TRSLogout.Open(): Boolean; |
| 71 | +begin |
| 72 | + Result := GameTabs.Open(ERSGameTab.LOGOUT); |
| 73 | +end; |
| 74 | + |
| 75 | + |
| 76 | +(* |
| 77 | +## Logout.IsRated |
| 78 | +```pascal |
| 79 | +function TRSLogout.IsRated(): Boolean; |
| 80 | +``` |
| 81 | +Returns true if a star button was clicked. |
| 82 | + |
| 83 | +Example: |
| 84 | +```pascal |
| 85 | +WriteLn Logout.IsRated(); |
| 86 | +``` |
| 87 | +*) |
| 88 | +function TRSLogout.IsRated(): Boolean; |
| 89 | +begin |
| 90 | + Result := Self.Ratings[ERSLogoutRating.ONE].Enabled(); |
| 91 | +end; |
| 92 | + |
| 93 | +var |
| 94 | + Logout: TRSLogout; |
| 95 | + |
0 commit comments