Skip to content

Commit ae15770

Browse files
committed
fix(stats): sailing support
1 parent 62f2a80 commit ae15770

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This is a library for [Simba 2.0](https://github.com/Villavu/Simba) and it's a tribute to the original [SRL-Development](https://github.com/Villavu/SRL-Development).
33
The library layout is heavily inspired in [SRL-T](https://github.com/Torwent/SRL-T) and the original [WaspLib](https://github.com/Torwent/WaspLib).
44

5-
Documentation can be found here: <https://waspscripts.github.io/WaspLib/>
5+
Documentation can be found here: <https://docs.waspscripts.dev/>
66

77
Credits to certain code might be temporarily missing, refer to the original libraries above for proper credits, if a piece of code exists in both this and one of the libraries above,
88
the credits to the original author will probably be there.

osrs/interfaces/gametabs/stats.simba

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,16 @@ Enum representing all skills in oldschool runescape.
3232
PRAYER, CRAFTING, FIREMAKING,
3333
MAGIC, FLETCHING, WOODCUTTING,
3434
RUNECRAFTING, SLAYER, FARMING,
35-
CONSTRUCTION, HUNTER, TOTAL
35+
CONSTRUCTION, HUNTER, SAILING,
36+
TOTAL
3637
);
3738

3839
(*
3940
## TRSSkillInfo
4041
Helper record to read skill information when you hover them in the {ref}`Stats` gametab.
4142
*)
4243
TRSSkillInfo = record
43-
Level: Integer;
44-
XP: Integer;
45-
Next: Integer;
46-
Remainder: Integer;
44+
Level, XP, Next, Remainder: Integer;
4745
end;
4846

4947
(*
@@ -66,7 +64,11 @@ This is automatically called for you on the {ref}`Stats variable`.
6664
*)
6765
procedure TRSStats.SetupGameTab();
6866
begin
69-
Self.Skills := TBoxArray.Create(GameTab.TopLeft.Offset(2, 6), 3, 8, 53, 23, [10, 9]);
67+
with GameTab.Bounds do
68+
begin
69+
Self.Skills := TBoxArray.Create([X1, Y1+4], 3, 8, 57, 26, [6, 4]);
70+
Self.Skills += TBox.Create(X1, Y2-18, X2, Y2-2);
71+
end;
7072
end;
7173

7274
(*
@@ -219,6 +221,8 @@ WriteLn Stats.GetLevel(ERSSkill.HITPOINTS);
219221
```
220222
*)
221223
function TRSStats.GetLevel(skill: ERSSkill; useCache: Boolean = True): Integer;
224+
var
225+
b: TBox;
222226
begin
223227
if useCache then
224228
begin
@@ -228,8 +232,12 @@ begin
228232

229233
if not Self.Open() then Exit(-1);
230234

231-
with Self.Skills[skill] do
232-
Result := OCR.RecognizeNumber([X1, Y2 - (Height div 2), X2, Y2], RSFonts.PLAIN_11, [ERSStack.YELLOW.Color], 0);
235+
if skill = ERSSkill.TOTAL then
236+
b := Self.Skills[skill]
237+
else
238+
with Self.Skills[skill] do b := [X1, Y2 - (Height div 2), X2, Y2];
239+
240+
Result := OCR.RecognizeNumber(b, RSFonts.PLAIN_11, [ERSStack.YELLOW.Color], 0);
233241

234242
if Result > 0 then
235243
Self.Levels[skill] := Result;

0 commit comments

Comments
 (0)