Code: Select all
program mining;
{$Include 'all.inc'}
const
pickaxe = $0E85;
pickaxe_color=$0000;
sunduk=$400B360E;//Сундук с регами, кирками и т.д.
sunduk2=$4022FCD3; // Сундук для руды
Sumkadrop = $0E75; //Сумка в паке для руды
Sumka = $4026C264;//ID сумки для руды
RB=$4040D772; // рунбука
RunaHome = 8; // номер руны домой
Xhome=4249;
Yhome=736;
trash=$400B360E; // pomoyka dl9 sbrosa mapov <Need Setup>
tonaj=990;
recal=$1F4C;
BM=$0F7B;//Blood Moss
MR=$0F86;//Mandrake Root
BP=$0F7A;//Black Pearl
Invis=$0F0E;//Invis potion
InvisColor=$09F2;
bottle=$0F0E;
bColor=$0000;
HowGet=3;
Rune=$1F14;//руна для быстрого рекола
// Журнал
M_nothing1 = 'no ore here to mine';
M_nothing2 = 'That is too far';
M_nothing3 = 'Try mining in rock';
M_nothing4 = 'elsewhere';
M_nothing5 = 'location';
M_nothing6 = 'reach';
M_fizzles1 = 'You loosen some rocks';
M_needwait = 'must wait';
M_success = 'in your pack.';
var L,x,y,k,g,p,r:integer;
mn1, mf1, mw1, ms1 : Integer;
ctime:TDateTime;
Enemy : array[1..13] of cardinal;
Ruda : array[1..4] of cardinal;
Runa : array[1..21] of integer;
procedure CheckDead;
Begin
if Dead then
begin
AddToSystemJournal('Персонаж мертв: '+TimeToStr(now));
SetARStatus(False);
Disconnect;
end
end;
procedure Recall;
begin
Runa[1] := 22;
Runa[2] := 2;
Runa[3] := 3;
Runa[4] := 4;
Runa[5] := 10;
Runa[6] := 6;
Runa[7] := 7;
Runa[8] := 9;
Runa[9] := 11;
Runa[10] := 19;
Runa[11] := 12
Runa[12] := 1;
Runa[13] := 14;
Runa[14] := 6;
Runa[15] := 22;
Runa[16] := 4;
Runa[17] := 7;
Runa[18] := 13;
Runa[19] := 3;
Runa[20] := 21;
Runa[21] := 22;
UseObject(RB);
WaitGump(IntToStr(Runa[r]));
wait(10000);
r:=r+1;
if (r > 21) then r:=1;
end;
procedure Home;
begin
repeat
checksave;
disarm;
wait(200);
UseObject(RB);
WaitGump(IntToStr(RunaHome));
wait(10000);
NewMoveXY(Xhome, Yhome, false, 0, false);
until (GetX(self) = Xhome) and (GetY(self) = Yhome) or dead
end;
function CheckPickaxe : Boolean;
var tmpser : Cardinal;
begin
Result := true;
if (ObjAtLayer(RhandLayer) = 0) then
begin
tmpser := findtype(pickaxe,backpack);
if tmpser = 0 then
begin
Result := false;
exit;
end;
wait(500);
checksave;
end;
end;
procedure CheckHide;
begin
if Hidden then exit;
if WarMode = true then SetWarMode(false);
repeat
if WarMode = true then SetWarMode(false);
UseSkill('Hiding');
wait(7000);
checksave;
until Hidden or (not Connected);
end;
function CheckEnemy : Boolean;
begin
Result := false;
for p:=1 to 13 do
begin
findtype(Enemy[p],ground)
if (findcount > 0) then
begin
Result := true;
Addtosystemjournal('Тут кто-то есть, валим отсюда!');
exit;
end;
wait(100)
checksave;
end;
end;
procedure pk_save; //: Boolean;
var mx, my, Res : Integer;
begin
Ruda[1] := $19B7;
Ruda[2] := $19BA;
Ruda[3] := $19B8;
Ruda[4] := $19B9;
Repeat
Res:=0;
If not Dead then
begin
for k := 1 to 4 do
begin
repeat
findtype(Ruda[k],BackPack);
if (findcount > 0) then MoveItems(backpack, Ruda[k], $FFFF, Sumka, 0, 0, 0, 500);
wait(500);
checksave;
until findcount = 0;
end;
Addtosystemjournal('Реколимся при помощи магии');
FindType(Sumkadrop, Backpack)
DropHere(FindItem);
cast('Recall');
WaitTargetType(Rune);
wait(1500);
UseObject(FindType(Invis,Backpack));
wait(1000);
FindType(Sumkadrop,Ground);
DragItem(FindItem,1);
end;
mx := GetX(self);
my := GetY(self);
k := 0;
Repeat
wait(500);
k := k + 1;
until (mx<>GetX(self)) or (my<>GetY(self)) or Dead or (k=10)
if (GetX(self) = 4249) and (GetY(self) = 737) then Res :=1;
Until Res = 1;
Addtosystemjournal('Фуф, свалили.');
DropItem(backpack,0,0,0);
Repeat
checksave;
disarm;
wait(200);
NewMoveXY(Xhome, Yhome, false, 0, false);
Until (GetX(self) = Xhome) and (GetY(self) = Yhome) or dead
end;
procedure Min;
var Kletka : integer;
begin
Ruda[1] := $19B7;
Ruda[2] := $19BA;
Ruda[3] := $19B8;
Ruda[4] := $19B9;
while (connected) do
begin
Kletka :=80;
if (ObjAtLayer(RHandLayer) = 0) then equipt(RHandLayer,pickaxe);
for x := -4 to 4 do
begin
for y := -4 to 4 do
begin
repeat
wait(100);
ctime := Now;
if (CheckEnemy) then
begin
pk_save;
Kletka:=80;
exit;
end;
CheckHide;
if (CheckEnemy) then
begin
pk_save;
Kletka:=80;
exit;
end;
UseObject(ObjAtLayer(RHandLayer));
WaitForTarget(1000);
checksave;
Addtosystemjournal(IntToStr(Kletka));
If TargetPresent then TargetToTile(0, GetX(self)+x, GetY(self)+y, GetZ(self));
k:=0
repeat
checksave;
wait(100);
k:= k+1;
mn1 := InJournalBetweenTimes('think of a way to use this item|Rusty|Old Copper|Dull Copper|Copper|Bronze|Steel|Silver|Gold|Shadow|Bluesteel|Rose|Agapite|Blood|Verite|Moon|no ore here to mine|location|elsewhere|in rock|far|У этой кирки', ctime, Now);
mf1 := InJournalBetweenTimes('loosen', ctime, Now);
ms1 := InJournalBetweenTimes('Iron|Realsilver|Valorite|Mytheril|Blackrock|Fire|Water|Earth|Air|Kvendenjare', ctime, Now);
mw1 := InJournalBetweenTimes('think of a way to use this item|location|elsewhere|in rock|far|no ore here to mine|must wait', ctime, Now);
until (mn1<>-1) or (mf1<>-1) or (ms1<>-1) or (mw1<>-1) or Dead or (k > 50);
if (CheckEnemy) then
begin
pk_save;
Kletka:=80;
exit;
end;
if (weight > tonaj) then
begin
wait(300);
Home;
Kletka:=80;
exit;
end;
for g := 1 to 4 do
begin
repeat
findtype(Ruda[g],BackPack);
if (findcount > 0) then MoveItems(backpack, Ruda[g], $FFFF, Sumka, 0, 0, 0, 600);
wait(100);
checksave;
until findcount = 0;
end;
if (ObjAtLayer(RHandLayer) = 0) then
begin
if (not CheckPickaxe) then exit;
equipt(RHandLayer,pickaxe);
end;
until (mn1<>-1);
Kletka:=Kletka-1;
end;
end;
end;
end;
BEGIN
SetARStatus(true);
r:=1;
Ruda[1] := $19B7;
Ruda[2] := $19BA;
Ruda[3] := $19B8;
Ruda[4] := $19B9;
Enemy[1] := $0191;
Enemy[2] := $0190;
Enemy[3] := $0F0D;
Enemy[4] := $0005;
Enemy[5] := $0006;
Enemy[6] := $00D0;
Enemy[7] := $00C9;
Enemy[8] := $00D9;
Enemy[9] := $0015;
Enemy[10] := $0009;
Enemy[11] := $000A;
Enemy[12] := $0004;
Enemy[13] := $003C;
ignore(self);
finddistance := 20;
if (not dead) then home;
while true do
begin
while Connected do
begin
if (GetX(self) = Xhome) and (GetY(self) = Yhome) and not dead then
begin
Addtosystemjournal('Home, sweet home');
useobject(sunduk2);
wait(1000);
UseObject(Sumka);
for k := 1 to 4 do
begin
repeat
findtype(Ruda[k],Sumka);
if (findcount > 0) then MoveItems(Sumka, Ruda[k], $FFFF, sunduk2, 0, 0, 0, 1000);
wait(1000);
checksave;
until findcount = 0;
end;
wait(1000);
useobject(sunduk);
Hungry(0,-1);
wait(1000);
checksave;
findtype(recal,sunduk);
if (findcount > 0) then
begin
MoveItem(FindItem, 65, Backpack, 0, 0, 0)
wait(1000);
UOSAY('.travelbook_recharge');
WaitTargetType(recal);
wait(1000);
WaitTargetObject(RB);
wait(1000);
checksave;
MoveItems(Backpack, recal, $FFFF, sunduk, 0, 0, 0, 500);
wait(1000);
end;
checksave;
wait(1000);
//Добор регов
FindType(BM,Backpack);
if (FindCount = 0) or (Count(BM) < 2) then
begin
FindType(BM,Sunduk);
if FindCount > 0 then
begin
MoveItem(FindItem,5,Backpack,0,0,0);
wait(1000);
end;
end;
FindType(MR,Backpack);
if (FindCount = 0) or (Count(MR) < 2) then
begin
FindType(MR,Sunduk);
if FindCount > 0 then
begin
MoveItem(FindItem,5,Backpack,0,0,0);
wait(1000);
end;
end;
FindType(BP,Backpack);
if (FindCount = 0) or (Count(BP) < 2) then
begin
FindType(BP,Sunduk);
if FindCount > 0 then
begin
MoveItem(FindItem,5,Backpack,0,0,0);
wait(1000);
end;
end;
FindTypeEx(Invis,InvisColor,Backpack,False);
if (FindCount < 3) or (Count(FindItem) < 3) then
begin
FindTypeEx(Invis,InvisColor,Sunduk,False);
MoveItem(FindItem,3,Backpack,0,0,0);
wait(1000);
end;
FindTypeEx(bottle,bColor,Backpack,False)
If Findcount > 0 then
begin
DropHere(FindItem);
end;
///////////////////////////////////////////
FindTypeEx(pickaxe,pickaxe_color,Backpack,False);
if findcount < 5 then
begin
FindTypeEx(pickaxe,pickaxe_color,sunduk,False);
if findcount > 0 then
begin
FindTypeEx(pickaxe,pickaxe_color,backpack,False);
L:=Findcount;
While L < 5 do
begin
FindTypeEx(pickaxe,pickaxe_color,sunduk,False);
MoveItem(FindItem, 1, BackPack, 0, 0, 0);
wait(1000);
FindTypeEx(pickaxe,pickaxe_color,backpack,False);
L:=Findcount;
end;
end;
end;
wait(1000);
disarm;
recall;
end;
if CheckPickaxe and (not dead) then Min
else
begin
if dead then
begin
Addtosystemjournal('y6uJIu!!!');
SetARStatus(False);
Disconnect;
end;
end;
end;
wait(100);
end;
END.
Все норм, один минус, при копке почему то большая задержка между попытками в 4 секунды, была вообще 8, поигрался с until (mn1<>-1) or (mf1<>-1) or (ms1<>-1) or (mw1<>-1) or Dead or (k > 50).
k>300 было, попробовал так - until (mn1<>-1) or (mf1<>-1) or (ms1<>-1) or (mw1<>-1) or Dead, не помогает, поставил k>50, более мене терпимо, но все равно 4 сек много. Подскажите где косяк.