@@ -8,7 +8,7 @@ Methods to interact with the sailing gametab:
88{$INCLUDE_ONCE WaspLib/osrs.simba}
99
1010type
11- ESailingFacility = enum(HELM, REPAIR, CANNON, HOOK);
11+ ESailingFacility = enum(HELM, REPAIR, WIND_CATCHER, CANNON, HOOK);
1212
1313 ERSCrewAsignee = enum(NONE, ME, CREW);
1414
@@ -88,14 +88,14 @@ ERSSailingTab = enum(FACILITIES, STATS, CREW);
8888```
8989Enum represinting the available sailing tabs.
9090*)
91- ERSSailingTab = enum(FACILITIES, STATS, CREW);
91+ ERSSailingTab = enum(UNKNOWN, FACILITIES, STATS, CREW);
9292
9393(*
9494## TRSSailing
9595Main record responsible with handling the Sailing gametab.
9696*)
9797 TRSSailing = record
98- CombatBox, ShipNameBox, ShipHealthBox , TabTitle: TBox;
98+ CombatBox, BoatNameBox, BoatHealthBox , TabTitle: TBox;
9999 Tabs: TBoxArray;
100100 Scrolls: array [ERSSailingTab] of TRSScrollBar;
101101 end;
@@ -105,8 +105,8 @@ begin
105105 with GameTab.Bounds do
106106 begin
107107 Self.CombatBox := [X1-3, Y1+1, X1+22, Y1+26];
108- Self.ShipNameBox := [X1+26, Y1+4, X2-2, Y1+26];
109- Self.ShipHealthBox := [X1+8, Y1+30, X2-6, Y1+42];
108+ Self.BoatNameBox := [X1+26, Y1+4, X2-2, Y1+26];
109+ Self.BoatHealthBox := [X1+8, Y1+30, X2-6, Y1+42];
110110
111111 Self.Tabs := TBoxArray.Create([X1+2, Y1+46], 3, 1, 55, 20, [7,0]);
112112 Self.TabTitle := [X1+32, Y1+68, X2-32, Y1+82];
@@ -135,7 +135,7 @@ WriteLn Sailing.IsOpen();
135135*)
136136function TRSSailing.IsOpen(): Boolean;
137137begin
138- Result := Target.HasColor([$1ABD1A, 7, EColorSpace.RGB, [1.247, 0.507, 1.247]], 1, Self.ShipHealthBox );
138+ Result := Target.HasColor([$1ABD1A, 7, EColorSpace.RGB, [1.247, 0.507, 1.247]], 1, Self.BoatHealthBox );
139139end;
140140
141141(*
@@ -161,16 +161,40 @@ begin
161161end;
162162
163163
164- property TRSSailing.ShipName: String;
164+ (*
165+ ## Sailing.BoatName
166+ ```pascal
167+ property TRSSailing.BoatName: String;
168+ ```
169+ Returns the boat name
170+
171+ Example:
172+ ```pascal
173+ WriteLn Sailing.BoatName;
174+ ```
175+ *)
176+ property TRSSailing.BoatName: String;
165177begin
166- Result := OCR.Recognize(Self.ShipNameBox , RSFonts.BOLD_SHADOW, [RSFonts.ORANGE], 0);
178+ Result := OCR.Recognize(Self.BoatNameBox , RSFonts.BOLD_SHADOW, [RSFonts.ORANGE], 0);
167179end;
168180
169- property TRSSailing.ShipHealth: Integer;
181+ (*
182+ ## Sailing.BoatHealth
183+ ```pascal
184+ property TRSSailing.BoatHealth: Integer;
185+ ```
186+ Returns the boat current health
187+
188+ Example:
189+ ```pascal
190+ WriteLn Sailing.BoatName;
191+ ```
192+ *)
193+ property TRSSailing.BoatHealth: Integer;
170194var
171195 str: String;
172196begin
173- str := OCR.Recognize(Self.ShipHealthBox , RSFonts.PLAIN_11, [RSFonts.WHITE], 0);
197+ str := OCR.Recognize(Self.BoatHealthBox , RSFonts.PLAIN_11, [RSFonts.WHITE], 0);
174198 Result := str.Before('/').ExtractInteger();
175199end;
176200
@@ -196,6 +220,16 @@ begin
196220 'Facilities': Result := ERSSailingTab.FACILITIES;
197221 'Stats': Result := ERSSailingTab.STATS;
198222 'Crew': Result := ERSSailingTab.CREW;
223+ else
224+ begin
225+ if not title.EndsWith(')') then
226+ Exit;
227+ title := title.After('(');
228+ if Length(title) > 1 then
229+ case title[1] of
230+ 'H', 'P', 'D': Result := ERSSailingTab.FACILITIES;
231+ end;
232+ end;
199233 end;
200234end;
201235
@@ -227,6 +261,21 @@ begin
227261end;
228262
229263
264+ (*
265+ ## Sailing.GetFacilitySlots
266+ ```pascal
267+ function TRSSailing.GetFacilitySlots(): TSailingFacilitySlotArray;
268+ ```
269+ Returns a {ref}`TSailingFacilitySlotArray` of the facility slots that are
270+ currently visible.
271+
272+ This will only return those that have their buttons and/or icons fully visible.
273+
274+ Example:
275+ ```pascal
276+ WriteLn Sailing.GetFacilitySlots();
277+ ```
278+ *)
230279function TRSSailing.GetFacilitySlots(): TSailingFacilitySlotArray;
231280var
232281 tpa: TPointArray;
0 commit comments