Skip to content

Commit

Permalink
Fix: lodestoneScreen.__find()
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTS committed Aug 5, 2015
1 parent 598d1d4 commit 5f90a4c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
3 changes: 1 addition & 2 deletions lib/interfaces/interfaces.simba
Expand Up @@ -113,8 +113,7 @@ const
ID_INTERFACE_LOBBY_WORLDS = 50;

(*
type TRSInterface
~~~~~~~~~~~~~~~~~
**type TRSInterface**

A record that stores useful information about RS interfaces.
*)
Expand Down
41 changes: 21 additions & 20 deletions lib/interfaces/lodestone.simba
Expand Up @@ -165,7 +165,7 @@ Scripters should use lodestoneScreen.isOpen() below.
.. note::

- by Ashaman88
- Last Updated: 27 February 2014 by Ashaman88
- Last Updated: 5 August 2015 by The Mayor

Example:

Expand All @@ -177,34 +177,35 @@ Example:
{$IFNDEF CODEINSIGHT}
function TRSLodestoneScreen.__find(): boolean;
const
TOP_COLOR = 855595; //red color behind lodestone
MENU_LENGTH = 165; //length of large red background
MENU_OFFSET_COLOR = 5333103; //p2p offset color on map
MENU_OFFSET_COLOR_FTP = 6250064; //f2p offset color on map
RED_COLOR = [1448256, 26]; // [Col, Tol] background of 'LODESTONE NETWORK'
var
tpa : TPointArray;
atpa : T2DPointArray;
i, hh: integer;
i: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
b: TBox;
begin
result := false;
findColorsTolerance(TPA, RED_COLOR[0], getClientBounds(), RED_COLOR[1]);

if (not findColors(tpa, TOP_COLOR, getClientBounds())) then
exit();
if length(TPA) < 10 then
begin
print('TRSLodestoneScreen.__find(): Didn''t find enough RED_COLOR', TDebug.WARNING);
exit(false);
end;

atpa := tpa.cluster(5);
hh := high(atpa);
ATPA := TPA.cluster(2);
ATPA.sortBySize(true);

for i := 0 to hh do
if (length(atpa[i]) = MENU_LENGTH) then
begin
b := getTPABounds(atpa[i]);
if (getColor(b.x2, b.y2 + 5) = MENU_OFFSET_COLOR) or (getColor(b.x2, b.y2 + 5) = MENU_OFFSET_COLOR_FTP) then
for i := 0 to high(ATPA) do
begin
b := ATPA[i].getBounds();

if inRange(b.getWidth(), 190, 210) and (b.getHeight() < 60) then
if (pos('LODE', upperCase(tesseract_GetText(b, TESS_FILTER_SMALL_CHARS))) > 0) then
begin
self.setBounds([b.x1 - 13, b.y1 - 14, b.x2 + 304, b.y2 + 297]);
self.setBounds([b.x1 - 3, b.y1 - 5, b.x2 + 307, b.y2 + 300]);
exit(true);
end;
end;
end;
end;
{$ENDIF}

Expand Down

0 comments on commit 5f90a4c

Please sign in to comment.