Skip to content

Commit de8d67e

Browse files
committed
fix(TRSInventory): Combine now works properly
1 parent f44926d commit de8d67e

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

osrs/interfaces/gametabs/inventory.simba

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,17 @@ begin
183183
if slot > -1 then
184184
begin
185185
b := boxes[slot];
186-
if Self.IsSelected(b) then Exit(True);
186+
if Self.IsSelected(b) then
187+
Exit(True);
187188
Delete(boxes, slot, 1);
188189
end;
189190

190191
for tmp in boxes do
191192
if Self.IsSelected(tmp) then
192193
begin
193194
Mouse.Click(tmp, EMouseButton.LEFT);
194-
if slot = -1 then Exit(True);
195+
if slot = -1 then
196+
Exit(True);
195197
Break;
196198
end;
197199

@@ -244,12 +246,25 @@ end;
244246
function TRSInventory.Combine(itemA, itemB: TRSItem): Boolean; overload;
245247
var
246248
slotsA, slotsB: TIntegerArray;
247-
bestA, bestB: Integer;
249+
selected, bestA, bestB: Integer;
248250
dist, best: Double;
249251
centers: TPointArray;
250252
i, j: Integer;
251253
begin
252-
if not Self.Open() then Exit;
254+
if not Self.Open() then
255+
Exit;
256+
257+
selected := Self.GetSelected();
258+
if selected > -1 then
259+
begin
260+
Mouse.Click(Self.Slots.Box(selected), EMouseButton.LEFT);
261+
if not SleepUntil(
262+
Target.HasColor(ITEM_BORDER, 0, 1, Self.Slots.Box(selected)) and
263+
not Target.HasColor(ITEM_BORDER_WHITE, 0, 1, Self.Slots.Box(selected)), 200, 2*TICK
264+
) then
265+
Exit;
266+
end;
267+
253268
slotsA := Self.Items.IndicesOf([itemA]);
254269
if slotsA = [] then Exit;
255270

0 commit comments

Comments
 (0)