Code: Select all
Program Carpentry_fishing_pole;
const
Sunduk_With_logs_and_Tools=$403EDF5F;
Sunduk_With_Empty_Bags=$403F226C;
Sunduk_With_Full_Bags=$403F2266;
Bag=$0E76;
Tools=$1034;
log=$1BDD;
Pig=$09BB;
Pole=$0DBF;
color=$-1;
var
k, l : integer;
TimeStart : TDateTime;
poles_Bag : Cardinal;
procedure Check_Pole;
begin
FindType(Pole,Backpack);
if FindCount>0 then
begin
MoveItem(FindItem,1,poles_bag,0,0,0);
wait(500);
end
end;
procedure Check_Hidden;
begin
if not Hidden then
begin
while not Hidden do
begin
SetWarMode(False);
useskill('Hiding');
wait(3600);
end
AddToSystemJournal('Спрятались.');
end
end;
procedure Get_Bag;
begin
FindType(Bag,Backpack);
if FindCount=0 then
begin
UseObject(Sunduk_With_Empty_Bags);
wait(1000);
FindType(Bag,Sunduk_With_Empty_Bags);
if FindCount>0 then
begin
MoveItem(FindItem,1,Backpack,0,0,0);
wait(1000);
UseObject(FindItem);
wait(1000);
end
end
poles_bag:=FindType(Bag,Backpack);
end;
procedure Out_Bag;
begin
AddToSystemJournal('Мешок заполнен берём новый');
FindType(Bag,Backpack);
if FindCount>0 then
begin
MoveItem(FindItem,1,Sunduk_With_Full_Bags,0,0,0);
wait(1000)
end
end;
procedure Check_World_Save;
begin
if InJournal('saving')<>-1 then
begin
ClearJournal;
k:=0;
repeat
wait(10000)
k:=k+1;
AddToSystemJournal('World is saving more than '+IntToStr(k*10)+' seconds.');
until (InJournal('data')<>-1) or (k>30)
end
end;
procedure Check_Connect;
begin
if not Connected then
while not Connected do
begin
Connect;
wait(1000);
end
end;
procedure Check_logs;
begin
FindType(log,Backpack);
if (FindCount=0) OR (Count(log)<5) then
begin
UseObject(Sunduk_With_logs_and_Tools);
wait(1000);
FindType(log,Sunduk_With_logs_and_Tools);
if (FindCount>0) and (CountEx(log,color,Sunduk_With_logs_and_Tools)>100) then
begin
MoveItem(FindType(log,Sunduk_With_logs_and_Tools),100,Backpack,0,0,0);
wait(1000);
AddToSystemJournal('Добрали 100 логов. На данный момент имеем '+IntToStr(Count(log))+' штук. Осталось ещё '+IntToStr(CountEx(log,color,Sunduk_With_logs_and_Tools))+' Логов. l='+IntToStr(l)+'; Count='+IntToStr(Count(Pole))+';');
end
else
AddToSystemJournal('Ошибка во время добора Логов.');
exit;
end
FindType(log,Ground);
if FindCount>0 then
begin
MoveItem(FindItem,0,Sunduk_With_logs_and_Tools,0,0,0);
wait(500);
end
end;
procedure Check_Food;
begin
UseObject(Sunduk_With_logs_and_Tools)
wait(250);
FindType(Pig,Sunduk_With_logs_and_Tools);
if FindCount>0 then
begin
MoveItem(FindItem,1,Backpack,0,0,0);
wait(250);
UseObject(FindItem);
FindType(Pig,Backpack);
if FindCount=0 then AddToSystemJournal('Покушали.');
if FindCount>0 then MoveItem(FindItem,1,Sunduk_With_logs_and_Tools,0,0,0);
end
else
AddToSystemJournal('a Pig не был найден в сундуке.');
end;
procedure Check_Last_Bag;
begin
FindType(Bag,Backpack);
if FindCount>0 then
begin
UseObject(FindItem);
wait(500)
poles_bag:=FindType(Bag,Backpack);
FindType(Pole,poles_bag);
l:=FindCount;
AddToSystemJournal('В мешке '+IntToStr(l)+' Удочек.');
end
end;
Begin
ClearJournal;
CancelMenu;
AutoMenu( 'Carpentry' , 'Weapons & Tools' );
AutoMenu( 'Weapons & Tools' , 'fishing pole' );
while not Dead do
begin
Check_Last_Bag;
Get_Bag;
repeat
if Weight>700 then exit;
Check_logs;
k:=0;
TimeStart:=Now;
UseObject(FindType(Tools,Backpack));
repeat
wait(100);
k := k + 1;
Check_World_Save;
Check_Hidden;
until (InJournalBetweenTimes('You put|failed', TimeStart, Now)<>-1) or (k > 300);
wait(100);
if InJournal('put')<>-1 then
begin
AddToSystemJournal(IntToStr(CountEx(Pole,$0000,poles_bag))+' удочек на данный момент в мешке.');
l:=l+1;
Check_Pole;
end
ClearJournal;
until l>=201
if l>=201 then
begin
l:=0;
Out_Bag;
end
end
End.