Автор iR_. Название темы может немного
не совпадать с действительным назначением скрипта.
За шару огромное спасибо @NeonEye
uses
SysUtils, Classes, SettingsModule;
const
maxDist = 600;
minDist = 200;
Date1900 {: LongInt} = $0001AC05; {Julian day count for 01/01/1900 -- TDateTime Start Date}
Date1970 {: LongInt} = $00020FE4; {Julian day count for 01/01/1970 -- Unix Start Date}
Unix0Date: TDateTime = 25568; {Date1970 - Date1900}
SecondsInDay = 86400; {Number of seconds in a day}
SecondsInHour = 3600; {Number of seconds in an hour}
SecondsInMinute = 60; {Number of seconds in a minute}
HoursInDay = 24; {Number of hours in a day}
MinutesInHour = 60; {Number of minutes in an hour}
MinutesInDay = 1440; {Number of minutes in a day}
var
execKey: integer;
skillKey: integer;
timer: tdatetime;
function AbDateTimeToUnixTime(DateTime : TDateTime) : LongInt;
{ convert Delphi TDateTime to unix date }
var
Hrs, Mins, Secs, MSecs : Word;
Dt, Tm : TDateTime;
begin
Dt := Trunc(DateTime);
Tm := DateTime - Dt;
if Dt < Unix0Date then
Result := 0
else
Result := Trunc(Dt - Unix0Date) * SecondsInDay;
DecodeTime(Tm, Hrs, Mins, Secs, MSecs);
Result := Result + (Hrs * SecondsInHour) + (Mins * SecondsInMinute) + Secs;
end;
function validCharTarget(obj: TL2Live; minDist, maxDist: Integer): boolean;
begin
Result := not obj.dead and (obj.clanId <> user.clanId) and (obj.allyId <> user.allyId)
and (user.DistTo(obj) > minDist) and (user.DistTo(obj) < maxDist)
and obj.valid and (obj.PVP or obj.PK) and not obj.isMember;
end;
function validNpcTarget(obj: TL2Live; minDist, maxDist: Integer): boolean;
begin
Result := not obj.dead and (user.DistTo(obj) > minDist) and (user.DistTo(obj) < maxDist)
and obj.valid and obj.Attackable;
end;
function getValidTarget: TL2Live;
var
i: integer;
begin
for i:=CharList.Count-1 downto 0 do
begin
if (validCharTarget(charList.items(i), minDist, maxDist)) then
begin
Result := charList.items(i);
exit;
end;
end;
for i:=NpcList.Count-1 downto 0 do
begin
if (validNpcTarget(npcList.items(i), minDist, maxDist)) then
begin
Result := npcList.items(i);
exit;
end;
end;
end;
procedure keyThread;
var
KeyCode, param: integer;
Action: TL2Action;
currTarget: TL2Live;
begin
while Engine.Status = lsOnline do
begin
Action:= Engine.WaitAction([laKey], KeyCode, param);
if Action = laKey then
begin
if (KeyCode = execKey) and (User.Cast.EndTime = 0) then
begin
currTarget := getValidTarget;
if Assigned(currTarget) then
begin
if (user.target <> currTarget) then
Engine.SetTarget(getValidTarget);
Engine.UseKey(skillKey, true, false);
delay(50);
delay(user.cast.endtime);
end;
end;
end;
end;
end;
procedure loadConfig; //выгрузка из конфига в массив
var
MySet: TSettings;
begin
MySet.SetFile(Script.Path + 'rushConfig.ini');
execKey := MySet.Load('Params', 'Exec key', 0);
skillKey := MySet.Load('Params', 'Skill key', 0);
end;
procedure confirmDlg;
begin
while true do
begin
Engine.ConfirmDialog(true); //---- НАЖМЕТ ДА !!!!!
Delay(2000);
end;
end;
begin
{timer := EncodeDate(2015, 03, 16);
if (AbDateTimeToUnixTime(timer) < AbDateTimeToUnixTime(now)) then
begin
print('Test time fired');
print('Developer ICQ - 670465907');
exit;
end; }
loadConfig;
script.newThread(@keyThread);
script.newThread(@confirmDlg);
end.
SysUtils, Classes, SettingsModule;
const
maxDist = 600;
minDist = 200;
Date1900 {: LongInt} = $0001AC05; {Julian day count for 01/01/1900 -- TDateTime Start Date}
Date1970 {: LongInt} = $00020FE4; {Julian day count for 01/01/1970 -- Unix Start Date}
Unix0Date: TDateTime = 25568; {Date1970 - Date1900}
SecondsInDay = 86400; {Number of seconds in a day}
SecondsInHour = 3600; {Number of seconds in an hour}
SecondsInMinute = 60; {Number of seconds in a minute}
HoursInDay = 24; {Number of hours in a day}
MinutesInHour = 60; {Number of minutes in an hour}
MinutesInDay = 1440; {Number of minutes in a day}
var
execKey: integer;
skillKey: integer;
timer: tdatetime;
function AbDateTimeToUnixTime(DateTime : TDateTime) : LongInt;
{ convert Delphi TDateTime to unix date }
var
Hrs, Mins, Secs, MSecs : Word;
Dt, Tm : TDateTime;
begin
Dt := Trunc(DateTime);
Tm := DateTime - Dt;
if Dt < Unix0Date then
Result := 0
else
Result := Trunc(Dt - Unix0Date) * SecondsInDay;
DecodeTime(Tm, Hrs, Mins, Secs, MSecs);
Result := Result + (Hrs * SecondsInHour) + (Mins * SecondsInMinute) + Secs;
end;
function validCharTarget(obj: TL2Live; minDist, maxDist: Integer): boolean;
begin
Result := not obj.dead and (obj.clanId <> user.clanId) and (obj.allyId <> user.allyId)
and (user.DistTo(obj) > minDist) and (user.DistTo(obj) < maxDist)
and obj.valid and (obj.PVP or obj.PK) and not obj.isMember;
end;
function validNpcTarget(obj: TL2Live; minDist, maxDist: Integer): boolean;
begin
Result := not obj.dead and (user.DistTo(obj) > minDist) and (user.DistTo(obj) < maxDist)
and obj.valid and obj.Attackable;
end;
function getValidTarget: TL2Live;
var
i: integer;
begin
for i:=CharList.Count-1 downto 0 do
begin
if (validCharTarget(charList.items(i), minDist, maxDist)) then
begin
Result := charList.items(i);
exit;
end;
end;
for i:=NpcList.Count-1 downto 0 do
begin
if (validNpcTarget(npcList.items(i), minDist, maxDist)) then
begin
Result := npcList.items(i);
exit;
end;
end;
end;
procedure keyThread;
var
KeyCode, param: integer;
Action: TL2Action;
currTarget: TL2Live;
begin
while Engine.Status = lsOnline do
begin
Action:= Engine.WaitAction([laKey], KeyCode, param);
if Action = laKey then
begin
if (KeyCode = execKey) and (User.Cast.EndTime = 0) then
begin
currTarget := getValidTarget;
if Assigned(currTarget) then
begin
if (user.target <> currTarget) then
Engine.SetTarget(getValidTarget);
Engine.UseKey(skillKey, true, false);
delay(50);
delay(user.cast.endtime);
end;
end;
end;
end;
end;
procedure loadConfig; //выгрузка из конфига в массив
var
MySet: TSettings;
begin
MySet.SetFile(Script.Path + 'rushConfig.ini');
execKey := MySet.Load('Params', 'Exec key', 0);
skillKey := MySet.Load('Params', 'Skill key', 0);
end;
procedure confirmDlg;
begin
while true do
begin
Engine.ConfirmDialog(true); //---- НАЖМЕТ ДА !!!!!
Delay(2000);
end;
end;
begin
{timer := EncodeDate(2015, 03, 16);
if (AbDateTimeToUnixTime(timer) < AbDateTimeToUnixTime(now)) then
begin
print('Test time fired');
print('Developer ICQ - 670465907');
exit;
end; }
loadConfig;
script.newThread(@keyThread);
script.newThread(@confirmDlg);
end.
Скачать: Посмотреть вложение auto rush.rar