Skip to content

Commit 3938746

Browse files
committed
feat: more GE
- also renamed GE "Progress" to "Status" - added more GE Offer UI boxes
1 parent 2e9e515 commit 3938746

File tree

3 files changed

+91
-25
lines changed

3 files changed

+91
-25
lines changed

osrs/interfaces/mainscreen/grandexchange/grandexchange.simba

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ Methods to interact with the GrandExchange interface:
1010

1111
type
1212
(*
13-
## EGEOfferProgress
13+
## EGEOfferStatus
1414
```pascal
15-
EGEOfferProgress = enum(NONE, PROGRESSING, COMPLETED, ABORTED);
15+
EGEOfferStatus = enum(NONE, PROGRESSING, COMPLETED, ABORTED);
1616
```
1717
Enum to represent the Grand Exchange offer slot states.
1818
*)
19-
EGEOfferProgress = enum(NONE, PROGRESSING, COMPLETED, ABORTED);
19+
EGEOfferStatus = enum(NONE, PROGRESSING, COMPLETED, ABORTED);
2020

2121
(*
2222
## EGESlotType
@@ -211,35 +211,35 @@ begin
211211
end;
212212

213213
(*
214-
## TRSGrandExchangeSlot.ReadItem
214+
## TRSGrandExchangeSlot.Item
215215
```pascal
216-
function TRSGrandExchangeSlot.ReadItem(): TRSItem;
216+
property TRSGrandExchangeSlot.Item: TRSItem;
217217
```
218218
Reads the item text in the offer slot.
219219

220220
Example:
221221
```pascal
222-
WriteLn GrandExchange.Slots[7].ReadItem();
222+
WriteLn GrandExchange.Slots[7].Item;
223223
```
224224
*)
225-
function TRSGrandExchangeSlot.ReadItem(): TRSItem;
225+
property TRSGrandExchangeSlot.Item: TRSItem;
226226
begin
227227
Result := OCR.RecognizeLines(Self.ItemNameBox, RSFonts.PLAIN_11, [RSColors.TEXT_LIGHT_ORANGE], 0).Join(' ');
228228
end;
229229

230230
(*
231231
## TRSGrandExchangeSlot.Value
232232
```pascal
233-
function TRSGrandExchangeSlot.Value(): Integer;
233+
property TRSGrandExchangeSlot.Value: Integer;
234234
```
235235
Reads the value text in the offer slot and returns it as an `Integer`.
236236

237237
Example:
238238
```pascal
239-
WriteLn GrandExchange.Slots[3].Value();
239+
WriteLn GrandExchange.Slots[3].Value;
240240
```
241241
*)
242-
function TRSGrandExchangeSlot.Value(): Integer;
242+
property TRSGrandExchangeSlot.Value: Integer;
243243
var
244244
str: String;
245245
begin
@@ -248,31 +248,30 @@ begin
248248
end;
249249

250250
(*
251-
## TRSGrandExchangeSlot.GetProgress
251+
## TRSGrandExchangeSlot.Status
252252
```pascal
253-
function TRSGrandExchangeSlot.GetProgress(): EGEOfferProgress;
253+
property TRSGrandExchangeSlot.Status: EGEOfferStatus;
254254
```
255-
Returns the slot {ref}`EGEOfferProgress`.
255+
Returns the slot {ref}`EGEOfferStatus` status.
256256

257257
Example:
258258
```pascal
259-
WriteLn GrandExchange.Slots[2].GetProgress();
259+
WriteLn GrandExchange.Slots[2].Status;
260260
```
261261
*)
262-
function TRSGrandExchangeSlot.GetProgress(): EGEOfferProgress;
262+
property TRSGrandExchangeSlot.Status: EGEOfferStatus;
263263
begin
264264
if Target.HasColor($005F00, 0, 1, Self.StatusBox) then
265-
Exit(EGEOfferProgress.COMPLETED);
265+
Exit(EGEOfferStatus.COMPLETED);
266266
if Target.HasColor($2080D8, 0, 1, Self.StatusBox) then
267-
Exit(EGEOfferProgress.PROGRESSING);
267+
Exit(EGEOfferStatus.PROGRESSING);
268268
if Target.HasColor($00008F, 0, 1, Self.StatusBox) then
269-
Exit(EGEOfferProgress.ABORTED);
269+
Exit(EGEOfferStatus.ABORTED);
270270

271-
Result := EGEOfferProgress.NONE;
271+
Result := EGEOfferStatus.NONE;
272272
end;
273273

274274

275-
276275
type
277276
(*
278277
## TRSGrandExchange

osrs/interfaces/mainscreen/grandexchange/grandexchange_offer.simba

Lines changed: 71 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,43 @@ Enum to represent the type of Grand Exchange offers.
2727
*)
2828
EGEOfferType = enum(SELL, BUY);
2929

30+
(*
31+
## EGEOfferSpinButton
32+
```pascal
33+
EGEOfferSpinButton = enum(DECREASE, INCREASE);
34+
```
35+
Enum that represents the buttons to decrease/increase the quantity and price
36+
spinners of Grand Exchange offers.
37+
38+
```{figure} ../../images/geo_spinners.png
39+
```
40+
*)
41+
EGEOfferSpinButton = enum(DECREASE, INCREASE);
42+
43+
(*
44+
## EGEOfferQuantity
45+
```pascal
46+
EGEOfferQuantity = enum(ONE, TEN, HUNDRED, THOUSAND, CUSTOM);
47+
```
48+
Enum that represents the quantity buttons of Grand Exchange offers.
49+
50+
```{figure} ../../images/geo_quantity_buttons.png
51+
```
52+
*)
53+
EGEOfferQuantity = enum(ONE, TEN, HUNDRED, THOUSAND, CUSTOM);
54+
55+
(*
56+
## EGEOfferPrice
57+
```pascal
58+
EGEOfferPrice = enum(MINUS_CUSTOM, MINUS_FIVE, GUIDE, CUSTOM, PLUS_FIVE, PLUS_CUSTOM);
59+
```
60+
Enum that represents the price buttons of Grand Exchange offers.
61+
62+
```{figure} ../../images/geo_price_buttons.png
63+
```
64+
*)
65+
EGEOfferPrice = enum(MINUS_CUSTOM, MINUS_FIVE, GUIDE, CUSTOM, PLUS_FIVE, PLUS_CUSTOM);
66+
3067
(*
3168
## TRSGrandExchangeOffer
3269
Record responsible to handle the {ref}`GrandExchangeOffer` interface.
@@ -41,14 +78,14 @@ Record responsible to handle the {ref}`GrandExchangeOffer` interface.
4178

4279
QuantityBounds: record
4380
Quantity: TBox;
44-
Decrease, Increase: TBox;
45-
One, Ten, Hundred, Thousand, Custom: TBox;
81+
Spinner: TBoxArray;
82+
Buttons: TBoxArray;
4683
end;
4784

4885
PriceBounds: record
4986
Price: TBox;
50-
Decrease, Increase: TBox;
51-
MinusCustom, MinusFive, Guide, Custom, PlusFive, PlusCustom: TBox;
87+
Spinner: TBoxArray;
88+
Buttons: TBoxArray;
5289
end;
5390

5491
TotalBounds: TBox;
@@ -75,9 +112,32 @@ begin
75112
with Self.Bounds do
76113
begin
77114
Self.InfoBounds.OfferType := [X1+40, Y1+45, X1+130, Y1+61];
115+
Self.InfoBounds.Item := [X1+64, Y1+71, X1+103, Y1+106];
78116
Self.InfoBounds.GuidePrice := [X1+40, Y1+114, X1+130, Y1+122];
79117
Self.InfoBounds.Name := [X1+166, Y1+45, X2-20, Y1+61];
80118
Self.InfoBounds.Examine := [X1+166, Y1+65, X2-20, Y1+128];
119+
120+
Self.QuantityBounds.Quantity := [X1+39, Y1+158, X1+191, Y1+177];
121+
end;
122+
123+
with Self.QuantityBounds.Quantity do
124+
begin
125+
Self.PriceBounds.Price := [X2+60, Y1, X2+253, Y2];
126+
127+
Self.QuantityBounds.Spinner := [
128+
[X1-21, Y1+3, X1-9, Y2-4], [X2+9, Y1+3, X2+21, Y2-4]
129+
];
130+
131+
Self.QuantityBounds.Buttons := TBoxArray.Create([X1-23, Y2+4], 5, 1, 34, 24, [7,0]);
132+
end;
133+
134+
with Self.PriceBounds.Price do
135+
begin
136+
Self.PriceBounds.Spinner := [
137+
[X1-21, Y1+3, X1-9, Y2-4], [X2+10, Y1+3, X2+22, Y2-4]
138+
];
139+
140+
Self.PriceBounds.Buttons := TBoxArray.Create([X1-23, Y2+4], 6, 1, 34, 24, [7,0]);
81141
end;
82142
end;
83143

@@ -348,6 +408,13 @@ begin
348408
Exit(SleepUntil(Self.Item.ToLower() = item.ToLower(), 200, 2000));
349409
end;
350410

411+
if not GrandExchangeChat.IsOpen() then
412+
begin
413+
Mouse.Click(Self.InfoBounds.Item, EMouseButton.LEFT);
414+
if not GrandExchangeChat.WaitOpen(2000) then
415+
Exit;
416+
end;
417+
351418
if not GrandExchangeChat.Contains(item) then
352419
begin
353420
if not GrandExchangeChat.SearchText[item] then

wasplib-docs

0 commit comments

Comments
 (0)