Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- TAlchemyValue = record
- Name: string;
- Points: Int32;
- PatternId: Int32;
- end;
- TAlchemyValues = array of TAlchemyValue;
- const
- pattern: TStringArray := [
- 'Leather boots', 'Adamant kiteshield', 'Adamant med helm', 'Emerald',
- 'Rune longsword','','',''
- ];
- function GetAlchValues(): TAlchemyValues;
- var
- b: TBox;
- TSA: TStringArray;
- TPA: TPointArray;
- ATPA: T2DPointArray;
- i,j,z: Int32;
- function Compare(constref a,b: TAlchemyValue): Int32; static;
- begin
- Result := Sign(B.Points-A.Points);
- end;
- begin
- try
- b := Minimap.Bounds;
- b := [b.x1-250, b.y1+80, b.x2-250, b.y2+50];
- SRL.FindColors(TPA, CTS2(45620, 6, 0.14, 0.01), b);
- ATPA := TPA.Cluster(20, 2);
- ATPA.SortByX(True);
- ATPA.SortByY(True);
- RSClient.Image.DrawBox(b, 255);
- for i:=0 to High(ATPA) do
- begin
- TSA += ocr.Recognize(ATPA[i].Bounds().Expand(2), TOCRColorFilter.Create([45620], [30]), RS_FONT_PLAIN_11);
- z := TSA[High(TSA)].Pos('I');
- if z > 1 then
- begin
- if LowerCase(TSA[High(TSA)][z-1]) = TSA[High(TSA)][z-1] then
- TSA[High(TSA)][z] := 'l';
- end;
- TSA[High(TSA)] := TSA[High(TSA)].Replace('Helm', 'med helm', [rfReplaceAll]);
- end;
- for i:=0 to High(TSA) with 2 do
- for j:=0 to High(pattern) do
- if LowerCase(TSA[i]).Pos(LowerCase(pattern[j])) > 0 then
- begin
- Result += [pattern[j], StrToIntDef(TSA[i+1], 0), j];
- break;
- end;
- Sort(Result, @Compare);
- except
- SetLength(Result, 8); //hack!
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement