if (AltB)
then begin
if RegExp.Exec(Engine.cbText) then
repeat List.Add(RegExp.Match[0]);
until (not RegExp.ExecNext);
end else
begin
if RegExp.Exec(Engine.DlgText)
then begin
repeat List.Add(RegExp.Match[0]);
until (not RegExp.ExecNext);
end;
end;
for i := 0 to List.Count - 1 do
begin
if (Pos(dlg, List[i]) > 0)
then begin
if (AltB)
then begin
RegExp.Expression:= '"bypass *(.+?)"';
if RegExp.Exec(List[i])
then bps:= TrimLeft(Copy(RegExp.Match[0], 9, Length(RegExp.Match[0]) - 9));
end else
begin
RegExp.Expression:= '"bypass -h *(.+?)"';
if RegExp.Exec(List[i])
then bps:= TrimLeft(Copy(RegExp.Match[0], 12, Length(RegExp.Match[0]) - 12));
end;
end;
end;
if (Length(bps) > 0)
then Engine.BypassToServer(bps);
RegExp.Free;
List.Free;
end;
/////////////////////////////////////////////////// ////////
//
// USER PATH
//
///////////////////////////////////////////////////////////
function MobInZone(): boolean;
var
i: integer;
target: TL2Npc;
begin
for i := 0 to NpcList.Count - 1 do
begin
target := NpcList.Items(i);
if (target.InZone) and (not target.Dead)
then begin
if (target.Z > (User.Z - MOB_RANGE))
then begin
if (target.Z < (User.Z + MOB_RANGE))
then begin
result := true;
exit;
end;
end;
end;
end;
result := false;
end;
function Farm(map: string; path: UsePath): boolean;
begin
Engine.LoadZone(map);
Engine.FaceControl(0, true);
while MobInZone() do
begin
if (not Status)
then begin
result := false;
Engine.FaceControl(0, false);
exit;
end;
delay(2000);
end;
procedure FarmThread();
begin
while True do
begin
if (Status)
then begin
if (not Farm('s1.zmap', @UserPath1)) then continue;
if (not Farm('s2.zmap', @UserPath2)) then continue;
if (not Farm('s3.zmap', @UserPath3)) then continue;
if (not Farm('s4.zmap', @UserPath4)) then continue;
if (not Farm('s5.zmap', @UserPath5)) then continue;
if (not Farm('s6.zmap', @UserPath6)) then continue;
end;
delay(10);
end;
end;
procedure BuffCheckThread();
var
Buff: TL2Buff;
begin
if not User.Buffs.ByID(1059,Buff)
and (not User.Dead)
or (Buff.EndTime<300000)then
begin
delay(555);
Engine.FaceControl(0,false);
delay(555);
Engine.Unstuck;
Delay(25000);
end;
end;
procedure DeathCheckThread();
begin
while True do
begin
if (User.Dead)
then begin
Status := false;
Engine.FaceControl(0, false);
delay(DEATH_DELAY);
Engine.GoHome();
delay(30000);
GoToSpot();
end;
delay(100);
end;
end;
procedure EnemyCheckThread();
var
i:integer;
char2:TL2char;
  ;radius, radius_max:integer;
begin
while delay(150) do
begin
radius := 900; // Take target range
radius_max := 2500; // Max target search range
for i := 0 to CharList.count -1 do
begin
Char2 := CharList.Items(i);
if (user.DistTo(char2) < radius_max)
and not (char2.ismember)
and not (char2.dead)
and (char2.pvp)then
begin
if user.DistTo(char2) <= radius
then Engine.SetTarget(Char2);
Engine.UseSkill(1417, True);
Engine.UseSkill(1265, True);
Engine.UseSkill(1231, True);
Engine.UseSkill(1231, True);
Engine.UseSkill(1231, True);
Engine.UseSkill(1231, True);
Engine.UseSkill(1288, True);
break
end;
end;
end;
end;
///////////////////////////////////////////////////// //////
//
// MAIN FUNCTION
//
///////////////////////////////////////////////////////// //
begin
while (not Engine.SetGameWindow(true)) do
delay(5000);