diff --git a/osrs/interfaces/mainscreen/goldscreen.simba b/osrs/interfaces/mainscreen/goldscreen.simba index 730254e9..0739d7af 100644 --- a/osrs/interfaces/mainscreen/goldscreen.simba +++ b/osrs/interfaces/mainscreen/goldscreen.simba @@ -239,15 +239,15 @@ function TRSGoldScreen.CanCraftItem(Item: ERSGoldItem): Boolean; ``` Returns `True` if the given item icon is available for crafting. *) -function TRSGoldScreen.CanCraftItem(i: ERSGoldItem): Boolean; +function TRSGoldScreen.CanCraftItem(i: ERSGoldItem): Boolean; const - GOLD_COLOR: TColor := 2806763; + GOLD_COLOR : TColorTolerance := [$1FB2BC, 3.285, EColorSpace.LCH, [0.433, 0.512, 2.056]]; begin if not Self.IsOpen() then Exit; - Result := Target.FindColor(GOLD_COLOR, 1, Self.ItemBoxes[i]).Length > 0; -end; + Result := Target.HasColor(GOLD_COLOR, 10, Self.ItemBoxes[i]); +end; (* ## GoldScreen.IsItemHighlighted @@ -256,9 +256,9 @@ function TRSGoldScreen.IsItemHighlighted(Item: ERSGoldItem): Boolean; ``` Returns `True` if the given item is currently highlighted. *) -function TRSGoldScreen.IsItemHighlighted(i: ERSGoldItem): Boolean; +function TRSGoldScreen.IsItemHighlighted(i: ERSGoldItem): Boolean; var - highlight: TColorTolerance := [4807018,2]; + goldColor : TColorTolerance := [$1FB2BC, 3.285, EColorSpace.LCH, [0.433, 0.512, 2.056]]; begin if not Self.IsOpen() then Exit; @@ -266,8 +266,8 @@ begin if not Self.CanCraftItem(i) then Exit; - Result := Target.FindColor(highlight, Self.ItemBoxes[i]).Length > 0; -end; + Result := Target.HasColor(goldColor, 10 ,Self.ItemBoxes[i]); +end; (* ## GoldScreen.CraftItem @@ -287,10 +287,13 @@ begin if not Result then Exit; if UseSpaceBar and Self.IsItemHighlighted(Item) then - Keyboard.KeyPress(EKeyCode.SPACE) - else + begin + Keyboard.KeyPress(EKeyCode.SPACE); + if not Self.IsOpen() then + Exit; + end; Mouse.Click(Self.ItemBoxes[Item], EMouseButton.LEFT); -end; +end; var (* diff --git a/osrs/interfaces/mainscreen/silverscreen.simba b/osrs/interfaces/mainscreen/silverscreen.simba index c6b99a90..84880f0a 100644 --- a/osrs/interfaces/mainscreen/silverscreen.simba +++ b/osrs/interfaces/mainscreen/silverscreen.simba @@ -238,7 +238,7 @@ if SilverScreen.CanCraftItem('Opal ring', box) then WriteLn 'Can craft opal ring'; ``` *) -function TRSSilverScreen.CanCraftItem(Item : TRSItem; out Box : TBox) : Boolean; +function TRSSilverScreen.CanCraftItem(var Item : TRSItem; out Box : TBox) : Boolean; const READY_GOLD = $1F98FF; // gold text (craftable) READY_WHITE = $FFFFFF; // white (selected/ready) @@ -248,6 +248,9 @@ var begin if not Self.IsOpen() then Exit; + if Item.Contains('amulet' , False) then + Item := Item + ' (u)'; + if not Self.Items.Find([Item], Slot) then Exit; @@ -255,7 +258,7 @@ begin TPA := Target.FindColor(READY_GOLD, 1, Box) + Target.FindColor(READY_WHITE, 1, Box); Result := TPA.Length > 0; -end; +end; (*