SCAR Code:
Function FightNPC(Color, Tol : Integer): Boolean;
Var
TPA,TPA2 : TPointArray;
I,X,Y : Integer;
W, H : TIntegerArray;
Begin
If Not LoggedIn Then
Exit;
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color, MSX1, MSY1, MSX2, MSY2, Tol);
SetArrayLength(W, Length(TPA));
SetArrayLength(H, Length(TPA));
For I := 1 To High(TPA) Do
Begin
If (GetColor(TPA[I].X + 1, TPA[I].Y) = GetColor(TPA[I].X, TPA[I].Y)) Or (GetColor(TPA[I].X - 1, TPA[I].Y) = GetColor(TPA[I].X, TPA[I].Y)) Then
Begin
W[I] := 2;
H[I] := 1;
End;
If (GetColor(TPA[I].X, TPA[I].Y + 1) = GetColor(TPA[I].X, TPA[I].Y)) Or (GetColor(TPA[I].X, TPA[I].Y - 1) = GetColor(TPA[I].X, TPA[I].Y)) Then
Begin
W[I] := 1;
H[I] := 2;
End;
If (GetColor(TPA[I].X + 1, TPA[I].Y) = GetColor(TPA[I].X, TPA[I].Y)) And (GetColor(TPA[I].X, TPA[I].Y + 1) = GetColor(TPA[I].X, TPA[I].Y)) And (GetColor(TPA[I].X + 1, TPA[I].Y + 1) = GetColor(TPA[I].X, TPA[I].Y)) Or (GetColor(TPA[I].X + 1, TPA[I].Y) = GetColor(TPA[I].X, TPA[I].Y)) And (GetColor(TPA[I].X, TPA[I].Y - 1) = GetColor(TPA[I].X, TPA[I].Y)) And (GetColor(TPA[I].X + 1, TPA[I].Y - 1) = GetColor(TPA[I].X, TPA[I].Y)) Or (GetColor(TPA[I].X - 1, TPA[I].Y) = GetColor(TPA[I].X, TPA[I].Y)) And (GetColor(TPA[I].X, TPA[I].Y + 1) = GetColor(TPA[I].X, TPA[I].Y)) And (GetColor(TPA[I].X - 1, TPA[I].Y + 1) = GetColor(TPA[I].X, TPA[I].Y)) Or (GetColor(TPA[I].X - 1, TPA[I].Y) = GetColor(TPA[I].X, TPA[I].Y)) And (GetColor(TPA[I].X, TPA[I].Y - 1) = GetColor(TPA[I].X, TPA[I].Y)) And (GetColor(TPA[I].X - 1, TPA[I].Y - 1) = GetColor(TPA[I].X, TPA[I].Y)) Then
Begin
W[I] := 2;
H[I] := 2;
End;
FindColorsTolerance(TPA2, GetColor(TPA[I].X, TPA[I].Y), TPA[I].X - 2, TPA[I].Y - 2, TPA[I].X + 2, TPA[I].Y + 2, 0);
If Length(TPA2) = 25 Then
Begin
W[I] := 5;
H[I] := 5;
End;
If (W[I] = 0) And (H[I] = 0) Then
Begin
W[I] := 1;
H[I] := 1;
End;
End;
For I := 1 To High(TPA) Do
Begin
If FindObjTPA(X, Y, GetColor(TPA[I].X, TPA[I].Y), Tol, 1, W[I], H[I], 1, ['ttack']) Then
Begin
Mouse(X, Y, 3, 3, True);
FFlag(0);
Wait(250 + Random(250));
If IsChatBlackTextAnyLine('lready') Then
Begin
Writeln('Couldn''t attack monster');
Exit;
End;
Result := True;
Exit;
End Else
Begin
Writeln('Couldn''t find monster');
Exit;
End;
End;
End;