Некоторые функции и алгаритмы позаимствованы у Scripts Writer
Code: Select all
Program color_daggers;
// (c) v26RuS (Galiano{ASTARTA} DRW)
{$Include 'all.inc'}
const
rmax = 12;
Cnt=$403FED23; //Сундук с ингами
Container=$404261A5; //Сундук с ингами
Containerb=$40325D14; //Сундук с багами
Unload=$404D54D9; //Куда все кидать
CountIng=400; // Сколько ингов брать
bag=$0E76; //Тип бага
dagger=$0F51; //Тип дагера
type
in_rail = array[1..rmax] of String;
i_rail = array[1..rmax] of Integer;
var
ColorIng,TypeIng : i_rail;
NameIng : in_rail;
i, l : Integer;
Flag1 : Boolean;
k : integer;
TimeStart : TDateTime;
dagger_bag : Cardinal;
procedure Ruda_int;
begin
NameIng[1]:=' ';
NameIng[2]:='Rusty ';
NameIng[3]:='Old Copper ';
NameIng[4]:='Dull Copper ';
NameIng[5]:='Copper ';
NameIng[6]:='Bronze ';
NameIng[7]:='Silver ';
NameIng[8]:='Shadow ';
NameIng[9]:='Agapite ';
NameIng[10]:='Rose ';
NameIng[11]:='Blood Rock ';
NameIng[12]:='Verite ';
ColorIng[1]:=$0000;
ColorIng[2]:=$0750;
ColorIng[3]:=$0590;
ColorIng[4]:=$060A;
ColorIng[5]:=$FFFF;
ColorIng[6]:=$0488;
ColorIng[7]:=$0000;
ColorIng[8]:=$096B;
ColorIng[9]:=$0193;
ColorIng[10]:=$0014;
ColorIng[11]:=$04C2;
ColorIng[12]:=$07D5;
TypeIng[1]:=$1BEF;
TypeIng[2]:=$1BEF;
TypeIng[3]:=$1BEF;
TypeIng[4]:=$1BEF;
TypeIng[5]:=$1BE3;
TypeIng[6]:=$1BEF;
TypeIng[7]:=$1BF5;
TypeIng[8]:=$1BEF;
TypeIng[9]:=$1BEF;
TypeIng[10]:=$1BEF;
TypeIng[11]:=$1BEF;
TypeIng[12]:=$1BEF;
AddToSystemJournal('Загружена руда');
end;
procedure Check_dagger;
begin
FindType(dagger,Backpack);
if FindCount>0 then
begin
while FindCount <> 0 do
begin
l:=l+1;
MoveItem(FindItem,1,dagger_bag,0,0,0);
wait(500);
FindType(dagger,Backpack);
end;
end;
end;
procedure Get_Bag;
begin
FindType(Bag,Backpack);
if FindCount=0 then
begin
UseObject(cnt);
wait(500);
UseObject(Containerb);
wait(1000);
FindType(Bag,Containerb);
if FindCount>0 then
begin
MoveItem(FindItem,1,Backpack,0,0,0);
wait(1000);
UseObject(FindItem);
wait(1000);
end
end
dagger_bag:=FindType(Bag,Backpack);
end;
procedure Check_Last_Bag;
begin
FindType(Bag,Backpack);
if FindCount>0 then
begin
UseObject(FindItem);
wait(500)
dagger_bag:=FindType(Bag,Backpack);
FindType(dagger,dagger_bag);
l:=FindCount;
AddToSystemJournal('В мешке '+IntToStr(l)+' daggers.');
end
end;
procedure Out_Bag;
begin
UseObject(Cnt);
wait(500);
FindType(Bag,Backpack);
if FindCount>0 then
begin
MoveItem(FindItem,1,Unload,0,0,0);
wait(1000)
end
end;
procedure Checkrd(TypeIngs,ColorIngs: Integer; NameIngs : String);
begin
FindTypeEx(TypeIngs,ColorIngs,Backpack,False);
if (FindCount=0) OR (GetQuantity(FindItem)<5) then
begin
AddToSystemJournal('Добираем инги.')
UseObject(cnt);
wait(500);
UseObject(Container);
wait(1000);
FindTypeEx(TypeIngs,ColorIngs,Container,False);
if (FindCount>0) and (GetQuantity(FindItem)>10) then
begin
MoveItem(FindItem,CountIng,Backpack,0,0,0);
wait(1000);
AddToSystemJournal('Добрали '+IntToStr(CountIng)+' '+NameIngs+'. На данный момент имеем '+IntToStr(Count(TypeIngs))+' штук. Осталось ещё '+IntToStr(CountEx(TypeIngs,ColorIngs,Container))+' '+NameIngs+'. l='+IntToStr(l));
end
else
AddToSystemJournal('Ошибка во время добора '+NameIngs);
Flag1 := false;
exit;
end
FindType(TypeIngs,Ground);
if FindCount>0 then
begin
MoveItem(FindItem,0,Container,0,0,0);
wait(500);
end
end;
Begin
Ruda_int;
for i:= 1 to 11 do
begin
AddToSystemJournal(IntToStr(i)+' руда '+NameIng[i]);
UseObject(cnt);
wait(1000);
UseObject(Container);
wait(1000);
FindTypeEx(TypeIng[i],ColorIng[i],Container,false);
if (FindCount > 0) AND (CountEx(TypeIng[i],ColorIng[i],Container) > 10) then
begin
CancelMenu;
if i = 1 then
begin
AutoMenu('Blacksmithing','Weapons');
wait(200);
AutoMenu('Weapons','Swords');
wait(200);
AutoMenu('Swords','dagger');
end;
if i > 1 then
begin
AutoMenu('Blacksmithing','Colored');
wait(200);
AutoMenu('Colored',NameIng[i]+'Weapons');
wait(200);
AutoMenu(NameIng[i]+'Weapons',NameIng[i]+'Swords');
wait(200);
AutoMenu(NameIng[i]+'Swords',NameIng[i]+'Dagger');
end;
AddToSystemJournal('Делаем дагеры из: '+NameIng[i]);
Flag1 := true;
repeat
Check_Last_Bag;
Get_bag;
Checkrd(TypeIng[i],ColorIng[i],NameIng[i]);
checksave;
TimeStart:=Now;
k:=0;
UseObject(FindTypeEx(TypeIng[i],ColorIng[i],backpack,false));
repeat
wait(500);
k := k + 1;
checksave;
until (InJournalBetweenTimes('You put|failed', TimeStart, Now)<>-1) or (k > 50);
wait(200);
if InJournalBetweenTimes('You put|failed', TimeStart, Now)<>-1 then
begin
Check_dagger;
end;
if l=255 then
begin
l:=0;
Out_Bag;
end;
until Flag1 = false;
wait(3000);
end;
end;
End.