выложил полностью скрипт
Code: Select all
program autobuy;
{$Include 'all.inc'}
const
kolvo = 300;
s_reag = $411E68D5;
r_home = $411206A3;
rmax = 1;
b=0;
run=$1F14;
br_bag = $40325CCF;
r_bag = $40F1374C;
type
buy_rail = array[1..rmax] of Integer;
rune_rail = array[1..30] of Integer;
regs_rail = array[1..3] of Integer;
ven_rail = array[1..2] of Integer;
var
buy : buy_rail;
rune : rune_rail;
rumax, r, oldx, oldy, mark_key : Integer;
r_homes : Cardinal;
Times : TDateTime;
procedure IntRune;
var r : integer;
begin
AddToSystemJournal('Инициализация рун');
UseObject(r_bag);
wait(1000);
findtype(run,r_bag);
rumax:=FindCount;
for r:=1 to rumax do
begin
checksave;
findtype(run,r_bag);
rune[r]:=FindItem;
Ignore(FindItem);
end;
AddToSystemJournal('Инициализированно '+IntToStr(rumax)+' рун');
IgnoreReset;
end;
procedure Intbuy;
begin
AddToSystemJournal('Инициализация покупок');
buy[1] := $0F87; //EoN
//buy[2] := $0F7A; //BP
//buy[3] := $0F88; //NS
//buy[4] := $0E34; //BLS
//buy[5] := $0F7B; //BM
//buy[6] := $0F84; //GA
//buy[7] := $0F85; //GI
//buy[8] := $0F86; //MR
if not GetAutoBuyMode then SetAutoBuyMode(true); // ТУТ ОШИБКА !
SetAutoBuyDelay(2);
end;
procedure Reags;
var Reg : regs_rail;
i : Integer;
begin
Reg[1]:=$0F7B;
Reg[2]:=$0F7A;
Reg[3]:=$0F86;
AddToSystemJournal('Берем реги');
Useobject(s_reag);
wait(1000);
for i:=1 to 3 do
begin
findtype(Reg[i],backpack)
if (FindCount = 0) or (Count(Reg[i]) < 20) then
begin
findtype(Reg[i],s_reag);
if findcount > 0 then
begin
checksave;
MoveItem(FindItem,50,Backpack,0,0,0);
wait(800);
end;
end;
end;
end;
procedure check_mana;
begin
AddToSystemJournal('Проверка маны');
if Mana < 30 then
begin
repeat
useskill('Meditation');
checksave;
wait(5000);
until Mana = Int;
end;
end;
procedure vendor_buy;
var ven : ven_rail;
vx,vy,i,z,bs : Integer;
vn : string;
begin
AddToSystemJournal('Ищем вендоров и покупаем');
ven[1]:=$0190;
ven[2]:=$0191;
FindDistance:=5;
ignore(Self);
for i:=1 to 2 do
begin
findtype(ven[i],ground)
if FindCount > 0 then
begin
for z:=1 to FindCount do
begin
FindType(ven[i],ground);
ClickOnObject(FindItem);
vx:=GetX(FindItem);
vy:=GetY(FindItem);
vn:=GetName(FindItem);
if (GetDistance(FindItem) > 3) then
begin
checksave;
move(vx, vy, 2);
end;
for bs:=1 to rmax do
begin
checksave;
AutoBuy(buy[i],$0000,kolvo);
UOSay(vn+' buy');
AutoBuy(buy[i],$0000,0);
wait(2000);
end;
UOSay(vn+' bye');
Ignore(FindItem);
wait(1000);
end;
end;
end;
IgnoreReset;
end;
procedure razgruz;
var i,cnt : Integer;
begin
AddToSystemJournal('Разгрузка');
for i:=1 to rmax do
begin
findtype(buy[i],backpack);
if FindCount > 0 then
begin
cnt:=GetQuantity(FindItem);
checksave;
moveitem(FindItem,cnt,s_reag,0,0,0);
wait(800);
end;
end;
end;
begin
AddToSystemJournal('Запуск скрипта');
Intbuy;
IntRune;
r_homes:=r_home;
useobject(r_bag);
wait(1000);
useobject(br_bag);
wait(1000);
repeat
Reags;
findtype(run,r_bag);
rumax:=FindCount;
for r:=1 to rumax do
begin
oldx:=GetX(Self);
oldy:=GetY(Self);
AddToSystemJournal('Прыгаем по руне №'+IntToStr(r));
repeat
checksave;
check_mana;
cast('Recall');
WaitForTarget(1500);
TargetToObject(Rune[r]);
wait(6000);
until (oldx <> GetX(Self)) AND (oldy <> GetY(Self));
ClearJournal;
wait(500);
Times:=Now;
ClickOnObject(Rune[r]);
wait(4000);
if (inJournalBetweenTimes('(2 charges)', Times, Now) <> -1) or (inJournalBetweenTimes('(1 charges)', Times, Now) <> -1) then
begin
AddToSystemJournal('Ремарк руны №'+IntToStr(r));
UseObject(br_bag)
wait(1000);
findtype(run,br_bag)
wait(1000);
moveitem(FindItem,1,Backpack,0,0,0);
wait(1000);
repeat
checksave;
check_mana;
FindType(run,backpack);
cast('Mark');
WaitForTarget(1500);
TargetToObject(FindItem);
wait(10000);
Times:=Now;
mark_key:=1;
if (inJournalBetweenTimes('spell', Times, Now) <> -1) then
begin
mark_key:=0;
end;
until mark_key=1;
mark_key:=0;
DropHere(Rune[r]);
Rune[r]:=FindItem;
moveitem(FindItem,1,r_bag,0,0,0);
wait(800);
end;
vendor_buy;
end;
oldx:=GetX(Self);
oldy:=GetY(Self);
AddToSystemJournal('Летим домой');
repeat
checksave;
check_mana;
cast('Recall');
WaitForTarget(1500);
TargetToObject(r_homes);
wait(6000);
until (oldx <> GetX(Self)) AND (oldy <> GetY(Self));
ClearJournal;
wait(500);
Times:=Now;
ClickOnObject(r_homes);
wait(2000);
if (inJournalBetweenTimes('(2 charges)', Times, Now) <> -1) or (inJournalBetweenTimes('(1 charges)', Times, Now) <> -1) then
begin
AddToSystemJournal('Ремарк руны домой');
UseObject(br_bag)
wait(1000);
findtype(run,br_bag)
wait(1000);
moveitem(FindItem,1,Backpack,0,0,0);
wait(1000);
repeat
checksave;
check_mana;
FindType(run,backpack);
cast('Mark');
WaitForTarget(1500);
TargetToObject(FindItem);
wait(8000);
Times:=Now;
mark_key:=1;
if (inJournalBetweenTimes('spell', Times, Now) <> -1) then
begin
mark_key:=0;
end;
until mark_key=1;
mark_key:=0;
DropHere(r_homes);
r_homes:=FindItem;
wait(800);
end;
razgruz;
wait(1000);
repeat
useskill('Hiding');
checksave;
wait(5000);
until Hidden;
wait(350000);
until Dead;
End.