Sir R. M8gic1an
2010-10-15 11:21:55
// /Alpha/capnarnav.simba
{$IFDEF NCDS_ARNAV}
TeleRandoms[14].SolveRandom := @NCDS_SolveArnav;
//-----------------------------------------------------------------//
//-- MSI --//
//-- � Cap'n Arnav Solver Routines --//
//-----------------------------------------------------------------//
// * function NCDS_arnav_FixLock: Boolean; // * by Nielsie95, NCDS
// * function NCDS_SolveArnav: Boolean; // * by Nielsie95, NCDS
//-----------------------------------------------------------------//
{*******************************************************************************
function NCDS_arnav_FixLock: Boolean;
by: Nielsie95
Description: Moves the required items into line.
*******************************************************************************}
function arnav_FixLock: Boolean;
var
t, Target, r, c: Integer;
tpa: TPointArray;
b: TBox;
Col: array[0..2] of Boolean;
begin
ColorToleranceSpeed(2);
Result := False;
if (not arnav_LockScreen) then
Exit;
t := GetSystemTime;
FindColorsTolerance(tpa, 0, 7, 150, 80, 185, 1);
WriteLn('Arnav Target Text Color Count: ' + inttostr(Length(tpa)));
case Length(tpa) of
116: Target := 0;//'ring';
84: Target := 1;//'bar';
108: Target := 2;//'bowl';
102: Target := 3;//'coins'; 4.
else
begin
WriteLn('Could not get Arnav target!');
Exit;
end;
end;
while (not Result) and ((GetSystemTime - t) < 30000) and arnav_LockScreen do
begin
for c := 0 to 2 do
begin
if Col[c] then
Continue;
for r := 0 to 2 do
begin
b := IntToBox(91 + (88 * c), 45 + (88 * r), 166 + (88 * c), 112 + (88 * r));
SetColorSpeed2Modifiers(0.02, 0.22);
FindColorsTolerance(tpa, 1204356, b.x1, b.y1, b.x2, b.y2, 20);
if (Length(tpa) > 500) then
begin
arnav_ClickArrow(c, Target - r);
Col[c] := True;
Break;
end;
SetColorSpeed2Modifiers(0.02, 0.05);
FindColorsTolerance(tpa, 2916754, b.x1, b.y1, b.x2, b.y2, 20);
if (Length(tpa) > 500) then
begin
arnav_ClickArrow(c, Target - r - 1);
Col[c] := True;
Break;
end;
end;
end;
Result := Col[0] and Col[1] and Col[2];
Wait(60);
end;
end;
{*******************************************************************************
function NCD_SolveArnav: Boolean;
by: Nielsie95, NCDS
Description: Solves the Cap'n Arnav random.
*******************************************************************************}
function SolveArnav: Boolean;
var
deg, cts, x, t: Integer;
begin
Result := False;
if (not arnav_InRandom) then
begin
WriteLn('Not in Arnav!');
Exit;
end;
cts := GetColorToleranceSpeed;
deg := Round(rs_GetCompassAngleDegrees);
MakeCompass('n');
t := GetSystemTime;
SetAngle(True);
while ((GetSystemTime - t) < 40000) and (not arnav_LockScreen) do
begin
Wait(1500);
if AreTalking then
begin
if FindNPCChatText('hop through', ClickLeft) then
begin
arnav_ExitPortal;
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(cts);
Exit;
end;
if (not ClickContinue(True,True)) then
FindNPCChatText('ready to try', ClickLeft);
end
else
arnav_TalkToCapnArnav;
end;
if (not NCDS_arnav_FixLock) then
begin
WriteLn('Could not identify arnav objects!');
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(cts);
Exit;
end;
Mouse(405, 245, 70, 20, True);
x := GetSystemTime;
while arnav_LockScreen and ((GetSystemTime - x) < 5000) do Wait(100);
if arnav_LockScreen then
begin
MouseFlag(MMCX, MMCY - 10, 5, 5, 0);
Wait(1000 + Random(1000));
end;
t := GetSystemTime;
while arnav_InRandom and ((GetSystemTime - t) < 30000) do
begin
Wait(100);
if InConvo then
ClickContinue(True,True)
else
arnav_ExitPortal;
end;
Result := (not arnav_InRandom);
if (not Result) then
begin
arnav_ExitPortal;
Result := (not arnav_InRandom);
end;
arnav_ExitPortal;
MakeCompass(Deg);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(cts);
end;
{$ENDIF}
This is how it could be included in MSI. You could even add MSI's debugging and tracking into it. Up to you if you wanna do it.
~RM