Skip to content

Commit e7dcbe9

Browse files
committed
feat: start of achievements gametab
1 parent f1a209c commit e7dcbe9

File tree

7 files changed

+303
-17
lines changed

7 files changed

+303
-17
lines changed

docs/images/achievements.png

57.4 KB
Loading

osrs.simba

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ They should be self-explanatory.
6767
{$IFNDEF SRLT_PRAYER_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/gametabs/prayer.simba}
6868
{$IFNDEF SRLT_WORLDSWITCHER_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/gametabs/worldswitcher.simba}
6969
{$IFNDEF SRLT_LOGOUT_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/gametabs/logout.simba}
70+
{$IFNDEF SRLT_STATS_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/gametabs/stats.simba}
71+
{$IFNDEF SRLT_ACHIEVEMENTS_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/gametabs/achievements.simba}
7072
{$IFNDEF SRLT_MOUSEZOOM_INCLUDED} {$INCLUDE_ONCE osrs/mousezoom.simba}
7173

7274
{$IFNDEF SRLT_MM2MS_PROJECTOR_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/mm2ms_projector.simba}
7375
{$IFNDEF SRLT_MM2MS_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/mm2ms.simba}
7476
{$IFNDEF SRLT_XPBAR_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/xpbar.simba}
75-
{$IFNDEF SRLT_STATS_INCLUDED} {$INCLUDE_ONCE osrs/interfaces/gametabs/stats.simba}
7677
{$IFNDEF SRLT_ANTIBAN_INCLUDED} {$INCLUDE_ONCE osrs/antiban/antiban.simba}
7778

7879
{$IFNDEF SRLT_WALKER_INCLUDED} {$INCLUDE_ONCE osrs/walker.simba}
@@ -139,3 +140,4 @@ They should be self-explanatory.
139140
{$ENDIF}
140141
{$ENDIF}
141142
{$ENDIF}
143+
{$ENDIF}

osrs/cacheparser.simba

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,3 +439,5 @@ var
439439
Global {ref}`TRSCacheParser` variable.
440440
*)
441441
RSCacheParser: TRSCacheParser;
442+
443+

osrs/interfaces/chat/chat.simba

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ receive game messages and even interact with some options and menus it hosts
66
like the {ref}`Make` menu.
77

88
```{figure} ../../images/chat_interface.png
9-
The chat interface.
109
```
1110
*)
1211
{$DEFINE SRLT_CHAT_INCLUDED}
@@ -38,7 +37,7 @@ Enum representing each of the available ironman types.
3837
ERSIronMan = enum(NONE, IRONMAN, HARDCORE, ULTIMATE, GROUP, HARCORE_GROUP, UNRANKED_GROUP);
3938

4039
(*
41-
## TRSChat
40+
## Chat
4241
Main record used to interact with the {ref}`Chat` interface.
4342
*)
4443
TRSChat = record
@@ -53,7 +52,7 @@ Main record used to interact with the {ref}`Chat` interface.
5352
end;
5453

5554
(*
56-
## TRSChat.SetupInterface
55+
## Chat.SetupInterface
5756
```pascal
5857
procedure TRSChat.SetupInterface();
5958
```
@@ -92,7 +91,7 @@ begin
9291
end;
9392

9493
(*
95-
## TRSChat.GetColors
94+
## Chat.GetColors
9695
```pascal
9796
function TRSChat.GetColors(colors: ERSChatColorArray): TColorArray;
9897
```
@@ -101,7 +100,7 @@ into a `TColorArray` which has the colors in BGR format.
101100

102101
Example:
103102
```pascal
104-
WriteLn Chat.GetColors([ERSChatColor.RED]);
103+
WriteLn Chat.GetColors([ERSChatColor.RED, ERSChatColor.WHITE]);
105104
```
106105
*)
107106
function TRSChat.GetColors(colors: ERSChatColorArray): TColorArray;
@@ -113,7 +112,7 @@ end;
113112

114113

115114
(*
116-
## TRSChat.GetDisplayNameBox
115+
## Chat.GetDisplayNameBox
117116
```pascal
118117
function TRSChat.GetDisplayNameBox(out color: Integer): TBox;
119118
function TRSChat.GetDisplayNameBox(): TBox; overload;
@@ -151,7 +150,7 @@ begin
151150
end;
152151

153152
(*
154-
## TRSChat.GetDisplayName
153+
## Chat.GetDisplayName
155154
```pascal
156155
function TRSChat.GetDisplayName(): String;
157156
```
@@ -179,7 +178,7 @@ end;
179178

180179

181180
(*
182-
## TRSChat.GetIronManType
181+
## Chat.GetIronManType
183182
```pascal
184183
function TRSChat.GetIronManType() : ERSIronMan;
185184
```
@@ -225,7 +224,7 @@ end;
225224

226225

227226
(*
228-
## TRSChat.IsTransparent
227+
## Chat.IsTransparent
229228
```pascal
230229
function TRSChat.IsTransparent(): Boolean;
231230
```
@@ -250,7 +249,7 @@ end;
250249

251250

252251
(*
253-
## TRSChat.IsOpen
252+
## Chat.IsOpen
254253
```pascal
255254
function TRSChat.IsOpen(): Boolean;
256255
```
@@ -269,7 +268,7 @@ begin
269268
end;
270269

271270
(*
272-
## TRSChat.Close
271+
## Chat.Close
273272
```pascal
274273
function TRSChat.Close(): Boolean;
275274
```
@@ -302,7 +301,7 @@ A chat query.
302301
*)
303302

304303
(*
305-
### TRSChat.GetQuery
304+
### Chat.GetQuery
306305
```pascal
307306
function TRSChat.GetQuery(): String;
308307
```
@@ -319,7 +318,7 @@ begin
319318
end;
320319

321320
(*
322-
### TRSChat.GetQueryAnswer
321+
### Chat.GetQueryAnswer
323322
```pascal
324323
function TRSChat.GetQueryAnswer(): String;
325324
```
@@ -337,7 +336,7 @@ begin
337336
end;
338337

339338
(*
340-
### TRSChat.FindQuery
339+
### Chat.FindQuery
341340
```pascal
342341
function TRSChat.FindQuery(query: String; caseSensitive: Boolean = False): Boolean;
343342
```
@@ -355,7 +354,7 @@ begin
355354
end;
356355

357356
(*
358-
### TRSChat.WaitQuery
357+
### Chat.WaitQuery
359358
```pascal
360359
function TRSChat.WaitQuery(query: String; caseSensitive: Boolean = False; time: Integer = 600; interval: Integer = -1): Boolean;
361360
```
@@ -374,7 +373,7 @@ begin
374373
end;
375374

376375
(*
377-
### TRSChat.AnswerQuery
376+
### Chat.AnswerQuery
378377
```pascal
379378
function TRSChat.AnswerQuery(query, answer: String; waitTime: Integer = 600; interval: Integer = -1): Boolean;
380379
```
@@ -485,6 +484,24 @@ begin
485484
end;
486485

487486

487+
(*
488+
## Chat.InputHasText
489+
```pascal
490+
function TRSChat.InputHasText(): Boolean;
491+
```
492+
Returns True/False if input line has text written that was never sent.
493+
494+
Example:
495+
```pascal
496+
WriteLn Chat.InputHasText();
497+
```
498+
*)
499+
function TRSChat.InputHasText(): Boolean;
500+
begin
501+
Result := Target.HasColor(Self.Colors[ERSChatColor.BLUE], 0, 15, Self.InputLine);
502+
end;
503+
504+
488505
procedure TRSChat.Draw(img: TImage);
489506
var
490507
tab: TRSChatTab;
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
(*
2+
# Achievements
3+
This page is dedicated to the achievements game tab and methods to interact with it.
4+
```{figure} ../../images/achievements.png
5+
```
6+
*)
7+
{$DEFINE SRLT_ACHIEVEMENTS_INCLUDED}
8+
{$INCLUDE_ONCE SRLT/osrs.simba}
9+
10+
type
11+
(*
12+
## ERSAchievementTab
13+
```pascal
14+
ERSAchievementTab = enum(SUMMARY, QUESTS, DIARIES);
15+
```
16+
An enum representing each of the {ref}`Achievements` gametab tabs.
17+
*)
18+
ERSAchievementTab = enum(SUMMARY, QUESTS, DIARIES);
19+
20+
(*
21+
## ERSSummary
22+
```pascal
23+
ERSSummary = enum(USERNAME, COMBAT, TOTAL, XP, QUESTS, DIARIES, COMBAT_ACHIEVEMENTS, COLLECTION_LOG, TIME);
24+
```
25+
An enum representing each of the {ref}`Achievements` gametab summary blocks:
26+
TODO: ADD IMG
27+
28+
You can access the tabs boxes through {ref}`TRSAchievement.Tabs`.
29+
*)
30+
ERSSummary = enum(USERNAME, COMBAT, TOTAL, XP, QUESTS, DIARIES, COMBAT_ACHIEVEMENTS, COLLECTION_LOG, TIME);
31+
32+
(*
33+
## ERSAchievementDiary
34+
```pascal
35+
ERSAchievementDiary = enum(
36+
ARDOUGNE,
37+
DESERT,
38+
FALADOR,
39+
FREMENNIK,
40+
KANDARIN,
41+
KARAMJA,
42+
KOUREND_AND_KEBOS,
43+
LUMBRIDGE_AND_DRAYNOR,
44+
MORYTANIA,
45+
VARROCK,
46+
WESERT_PROVINCES,
47+
WILDERNESS
48+
);
49+
```
50+
An enum representing each of the achievement diaries available.
51+
*)
52+
ERSAchievementDiary = enum(
53+
ARDOUGNE,
54+
DESERT,
55+
FALADOR,
56+
FREMENNIK,
57+
KANDARIN,
58+
KARAMJA,
59+
KOUREND_AND_KEBOS,
60+
LUMBRIDGE_AND_DRAYNOR,
61+
MORYTANIA,
62+
VARROCK,
63+
WESERT_PROVINCES,
64+
WILDERNESS
65+
);
66+
67+
TRSAchievements = record
68+
Tabs: array [ERSAchievementTab] of TBox;
69+
TabCount: Integer;
70+
end;
71+
72+
function TRSAchievements.CountTabs(): Integer;
73+
var
74+
tpa: TPointArray;
75+
begin
76+
with GameTab.Bounds do
77+
tpa := Target.FindColor(RSColors.ITEM_BORDER, 0, [X1, Y1, X2, Y1 + 23]);
78+
Result := Length(tpa.Cluster(1.5));
79+
end;
80+
81+
procedure TRSAchievements.SetupTabs();
82+
var
83+
tpa: TPointArray;
84+
begin
85+
if Self.TabCount = 0 then Self.TabCount := Self.CountTabs();
86+
87+
end;
88+
89+
90+
91+
var
92+
Achievements: TRSAchievements;

0 commit comments

Comments
 (0)