Code: Select all
Program Tinker_Necklace;
const
Sunduk_With_Iron_and_Tools=$402DE2C4;
Sunduk_With_Empty_Bags=$402DE2C4;
Sunduk_With_Full_Bags=$404CAA07;
Bag=$0E76;
Tools=$1EBC;
Ingot=$1BEF;
Pig=$09BB;
Necklace=$1085;
var
k, l : integer;
TimeStart : TDateTime;
Neck_Bag : Cardinal;
procedure Check_Necklace;
begin
FindType(Necklace,Backpack);
if FindCount>0 then
begin
while FindCount <> 0 do
begin
l:=l+1;
MoveItem(FindItem,1,Neck_Bag,0,0,0);
wait(500);
FindType(Necklace,Backpack);
end
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
Neck_Bag:=FindType(Bag,Backpack);
end;
procedure Out_Bag;
begin
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>10)
end
end;
procedure Check_Connect;
begin
if not Connected then
while not Connected do
begin
Connect;
wait(1000);
end
end;
procedure Check_Iron;
begin
FindTypeEx(Ingot,$0000,Backpack,False);
if (FindCount=0) OR (GetQuantity(FindItem)<5) then
begin
AddToSystemJournal('Добираем инги.')
UseObject(Sunduk_With_Iron_and_Tools);
wait(1000);
FindTypeEx(Ingot,$0000,Sunduk_With_Iron_and_Tools,False);
if (FindCount>0) and (GetQuantity(FindItem)>100) then
begin
MoveItem(FindItem,100,Backpack,0,0,0);
wait(1000);
AddToSystemJournal('Добрали 100 iron ingots. На данный момент имеем '+IntToStr(Count(Ingot))+' штук. Осталось ещё '+IntToStr(CountEx(Ingot,$0000,Sunduk_With_Iron_and_Tools))+' iron ingots. l='+IntToStr(l)+'; Count='+IntToStr(Count(Necklace))+';');
end
else
AddToSystemJournal('Ошибка во время добора Iron Ignots.');
exit;
end
FindType(Ingot,Ground);
if FindCount>0 then
begin
MoveItem(FindItem,0,Sunduk_With_Iron_and_Tools,0,0,0);
wait(500);
end
end;
procedure Check_Food;
begin
UseObject(Sunduk_With_Iron_and_Tools)
wait(250);
FindType(Pig,Sunduk_With_Iron_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_Iron_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)
Neck_Bag:=FindType(Bag,Backpack);
FindType(Necklace,Neck_Bag);
l:=FindCount;
AddToSystemJournal('В мешке '+IntToStr(l)+' necklace.');
end
end;
Begin
UseObject(Sunduk_With_Iron_and_Tools);
wait(1000);
ClearJournal;
CancelMenu;
AutoMenu( 'Tinkering' , 'Jew' );
AutoMenu( 'Jew' , 'neck' );
while not Dead do
begin
Check_Last_Bag;
Get_Bag;
repeat
if Weight>500 then exit;
Check_Iron;
k:=0;
TimeStart:=Now;
UseObject(FindType(Tools,Backpack));
repeat
wait(100);
k := k + 1;
Check_World_Save;
until (InJournalBetweenTimes('You put|failed', TimeStart, Now)<>-1) or (k > 300);
wait(100);
if InJournal('put')<>-1 then
begin
Check_Necklace;
end
ClearJournal;
until l>=254
if l>=254 then
begin
l:=0;
Out_Bag;
end
end
End.