Code: Select all
Program TinkerUP;
// v.1.00b (c) Edred
{$Include 'all.inc'}
var
ctime : TDateTime;
k : integer;
b : integer;
const
ToolsType = $1EBC; // Инструмент тинкера
TypBottles = $0F0E; // Тип бутылок
CountIngsForBottle = 20;
HowGetIngs = 100;
HowDropBottles = 20;
TypIngots = $1BEF;
procedure CheckIngots;
begin
waitconnection(5000);
If Count(TypIngots) < CountIngsForBottle then
begin
FindType(TypIngots, ground);
if FindCount > 0 then
begin
k := FindQuantity;
Grab( FindItem, HowGetIngs );
wait(1000);
checksave;
Addtosystemjournal('Взял еще ' + inttostr(HowGetIngs) + ' ингов из ' + inttostr(k));
end
else
begin
Addtosystemjournal('Нет ингов на полу, добавьте');
repeat
wait(1000);
findtype(TypIngots, ground);
until FindCount > 0;
k := FindQuantity;
Grab(FindItem, HowGetIngs);
wait(1000);
checksave;
Addtosystemjournal('Взял еще ' + inttostr(HowGetIngs) + ' ингов из ' + inttostr(k));
end;
end;
end;
procedure CheckBottles;
begin
waitconnection(5000);
If Count(TypBottles) > (HowDropBottles - 1) then
begin
b := Count(TypBottles);
FindType(TypBottles, backpack);
while FindCount > 0 do
begin
Drop(FindItem, 0, 0, 0, 0);
wait(1000);
checksave;
Addtosystemjournal('Сбросил ' + inttostr(b) + ' бутылок');
FindType(TypBottles, backpack);
end;
end;
end;
Begin
FindDistance := 2;
CancelMenu;
AutoMenu('Tinkering', 'Tools');
AutoMenu('Tools', 'empty bottle');
while not Dead do
begin
CheckIngots;
findtype(ToolsType, backpack);
if FindCount > 0 then
begin
ctime := Now;
k := 0;
UseObject( FindItem );
repeat
wait(100);
k := k + 1;
checksave;
until (InJournalBetweenTimes('You put|failed.', ctime, Now)<>-1) or (k > 200);
CheckBottles;
end
else
begin
repeat
waitconnection(5000);
findtype(ToolsType, ground);
if FindCount > 0 then
begin
Grab( FindItem, 0 );
wait(1000);
checksave;
end
else
begin
Addtosystemjournal('Нет инструментов в паке, киньте на пол');
repeat
wait(1000);
findtype(ToolsType, ground);
until (FindCount > 0);
Grab( FindItem, 0 );
wait(1000);
checksave;
end;
until (Count(ToolsType) > 0);
end;
end;
End.