Skip to content

Commit dc17bd3

Browse files
committed
fix: removed TRSButton.Index, not needed anymore
started logout tab
1 parent 719e6d4 commit dc17bd3

File tree

8 files changed

+100
-40
lines changed

8 files changed

+100
-40
lines changed

osrs.simba

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
{$IFNDEF SRLT_MAGIC_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/gametabs/magic.simba}
3535
{$IFNDEF SRLT_OPTIONS_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/gametabs/options.simba}
3636
{$IFNDEF SRLT_PRAYER_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/gametabs/prayer.simba}
37+
{$IFNDEF SRLT_LOGOUT_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/gametabs/logout.simba}
3738

3839
{$IFNDEF SRLT_MM2MS_PROJECTOR_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/mm2ms_projector.simba}
3940
{$IFNDEF SRLT_MM2MS_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/mm2ms.simba}
@@ -91,3 +92,4 @@
9192
{$ENDIF}
9293
{$ENDIF}
9394
{$ENDIF}
95+
{$ENDIF}

osrs/interfaces/chat/chat.simba

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ var
2727
b: TBox;
2828
begin
2929
Self.Tabs.SetupInterface();
30-
31-
Self.ReportButton.Index := 0;
3230
Self.ReportButton.EnabledColors := [[1555,6], [5399922, 0], [795452, 0]];
3331

3432
with Self.Tabs.Bounds do

osrs/interfaces/chat/chattabs.simba

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ begin
2828
for i := 0 to 6 do
2929
begin
3030
Self.Tabs[i].Tab := ERSChatTab(i+1);
31-
Self.Tabs[i].Button.Index := i;
3231
Self.Tabs[i].Button.EnabledColors := [[1555,6], [5399922, 0], [795452, 0]];
3332
Self.Tabs[i].Button.Bounds := Box(X1 + 3 + (i * 62), Y1, X1 + 58 + (i * 62), Y2 - 1);
3433
end;

osrs/interfaces/gametabs/equipment.simba

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ begin
6060

6161
for i := 0 to 3 do
6262
begin
63-
Self.Buttons[i].Index := i;
6463
Self.Buttons[i].EnabledColors := [];
6564
Self.Buttons[i].Bounds := btns[i];
6665
end;
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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+

osrs/interfaces/interfacecontrols.simba

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ type
88
Tolerance: Single;
99
end;
1010

11-
Index: Integer;
1211
Bounds: TBox;
1312
end;
1413

@@ -51,23 +50,11 @@ end;
5150

5251
procedure TRSButton.Draw(img: TImage; color: Integer = $00FFFF);
5352
var
54-
oldSize: Single;
5553
oldColor: Integer;
56-
oldAntialiasing: Boolean;
5754
begin
58-
oldSize := img.FontSize;
59-
oldAntialiasing := img.FontAntialiasing;
6055
oldColor := img.DrawColor;
61-
62-
img.FontSize := 20;
63-
img.FontAntialiasing := True;
6456
img.DrawColor := color;
65-
6657
img.DrawBox(Self.Bounds);
67-
img.DrawText(ToStr(Self.Index), Self.Bounds, [EImageTextAlign.CENTER]);
68-
69-
img.FontSize := oldSize;
70-
img.FontAntialiasing := oldAntialiasing;
7158
img.DrawColor := oldColor;
7259
end;
7360

@@ -83,27 +70,15 @@ end;
8370

8471
procedure TRSButtonArray.Draw(img: TImage; color: Integer = $00FFFF);
8572
var
86-
oldSize: Single;
8773
oldColor: Integer;
88-
oldAntialiasing: Boolean;
8974
button: TRSButton;
9075
begin
91-
oldSize := img.FontSize;
92-
oldAntialiasing := img.FontAntialiasing;
9376
oldColor := img.DrawColor;
94-
95-
img.FontSize := 20;
96-
img.FontAntialiasing := True;
9777
img.DrawColor := color;
9878

9979
for button in Self do
100-
begin
10180
img.DrawBox(button.Bounds);
102-
img.DrawText(ToString(button.Index), button.Bounds, [EImageTextAlign.CENTER]);
103-
end;
10481

105-
img.FontSize := oldSize;
106-
img.FontAntialiasing := oldAntialiasing;
10782
img.DrawColor := oldColor;
10883
end;
10984

osrs/interfaces/mainscreen/bank.simba

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,25 +170,16 @@ begin
170170

171171
for i := 0 to 1 do
172172
begin
173-
Self.Buttons[i].Index := i;
174-
Self.Buttons[i].EnabledColors := [[$0F1043, 0], [$23269F, 0.227]];
175-
Self.ArrangementButtons[i].Index := i;
176-
Self.ArrangementButtons[i].EnabledColors := [[$0F1043, 0], [$23269F, 0.227]];
177-
Self.WithdrawModeButtons[i].Index := i;
173+
Self.Buttons[i].EnabledColors := [[$0F1043, 0], [$23269F, 0.227]];
174+
Self.ArrangementButtons[i].EnabledColors := [[$0F1043, 0], [$23269F, 0.227]];
178175
Self.WithdrawModeButtons[i].EnabledColors := [[$0F1043, 0], [$23269F, 0.227]];
179176
end;
180177

181178
for i := 0 to 4 do
182-
begin
183-
Self.QuantityButtons[i].Index := i;
184179
Self.QuantityButtons[i].EnabledColors := [[$0F1043, 0], [$23269F, 0.227]];
185-
end;
186180

187181
for i := 0 to 3 do
188-
begin
189-
Self.DynamicButtons[i].Index := i;
190182
Self.DynamicButtons[i].EnabledColors := [[$0F1043, 0], [$23269F, 0.227]];
191-
end;
192183

193184
with Self.Bounds do
194185
begin

osrs/interfaces/setup.simba

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ begin
1313
Inventory.SetupInterface();
1414
Equipment.SetupInterface();
1515
Options.SetupInterface();
16+
Logout.SetupInterface();
1617
MM2MS.Projector.SetupProjection();
1718
Chat.SetupInterface();
1819
InterfaceArea.SetupInterface();

0 commit comments

Comments
 (0)