Code: Select all
Program Blakcmisthy_Dagger;
const
Sunduk_With_Ignots_and_Bags=$402DE2C3;
Sunduk_With_Full_Bags=$402DE2C4;
Bag=$0E76;
Hammer=$13E3;
Ingot=$1BEF;
Dagger=$0F51;
Pig=$09BB;
var
k : integer;
TimeStart : TDateTime;
Neck_Bag : Cardinal;
Quantity : integer;
procedure Check_Food;
begin
UseObject(Sunduk_With_Ignots_and_Bags)
wait(500);
FindType(Pig,Sunduk_With_Ignots_and_Bags);
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_Ignots_and_Bags,0,0,0);
end
else
AddToSystemJournal('a Pig не был найден в сундуке.');
end;
procedure Check_Dagger;
begin
if Quantity<254 then
begin
FindType(Dagger,Backpack);
if FindCount>0 then
begin
MoveItem(FindItem,1,Neck_Bag,0,0,0);
wait(250);
end
end
else
begin
MoveItem(Neck_Bag,1,Sunduk_With_Full_Bags,0,0,0);
wait(250);
Quantity:=0;
end
end;
procedure Check_Bag;
begin
Neck_Bag:=FindType(Bag,Backpack);
if FindCount>0 then
begin
UseObject(Neck_Bag);
wait(250);
FindType(Dagger,Neck_Bag);
Quantity:=FindCount;
if Quantity>0 then AddToSystemJournal(IntToStr(Quantity)+' daggers на данный момент в мешке.');
if Quantity=0 then
begin
AddToSystemJournal('Начинаем новую партию изделий.');
Check_Food;
end
end
else
begin
AddToSystemJournal('Мешок не найден в backpacke. Берём новый');
UseObject(Sunduk_With_Ignots_and_Bags);
wait(500);
FindType(Bag,Sunduk_With_Ignots_and_Bags);
if FindCount>0 then
begin
MoveItem(FindItem,1,Backpack,0,0,0);
wait(1000);
end
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_Ingot;
begin
FindType(Ingot,Backpack);
if (FindCount=0) OR (Count(Ingot)<50) then
begin
UseObject(Sunduk_With_Ignots_and_Bags);
wait(250);
FindType(Ingot,Sunduk_With_Ignots_and_Bags);
if (FindCount>0) and (CountEx(Ingot,$0750,Sunduk_With_Ignots_and_Bags)>200) then
begin
MoveItem(FindItem,200,Backpack,0,0,0);
wait(250);
AddToSystemJournal('Добрали 200 rusty ingots. Осталось ещё '+IntToStr(CountEx(Ingot,$0750,Sunduk_With_Ignots_and_Bags))+' rusty ingots.');
end
else
AddToSystemJournal('Ошибка во время добора Rusty Ignots.');
exit;
end
end;
procedure Check_Tools;
begin
FindType(Hammer,Backpack);
if FindCount=0 then
begin
UseObject(Sunduk_With_Ignots_and_Bags);
wait(500);
FindType(Hammer,Sunduk_With_Ignots_and_Bags);
if FindCount>0 then
begin
MoveItem(FindItem,1,Backpack,0,0,0);
wait(250);
AddToSystemJournal('Добрали молоток из сундука.');
end
else
AddToSystemJournal('Ошибка во время добора молотка.');
exit;
end
end;
Begin
ClearJournal;
while not Dead do
begin
Check_Connect;
Check_Ingot;
Check_Tools;
Check_Bag;
k:=0;
TimeStart:=Now;
WaitMenu( 'Black' , 'Colored' );
WaitMenu( 'Colored' , 'Rusty Weapons' );
WaitMenu( 'Rusty Weapons' , 'Rusty Swords' );
WaitMenu( 'Rusty Swords' , 'Dagger' );
UseObject(FindType(Ingot,Backpack));
repeat
wait(100);
k := k + 1;
Check_World_Save;
until (InJournalBetweenTimes('You put|failed', TimeStart, Now)<>-1) or (k > 300);
wait(100);
FindType(Dagger,Backpack);
if Count(Dagger)>0 then Check_Dagger;
end
End.