Program Fishing;
type
TileRecord = Record
t,x,y : integer;
end;
var
Tile : array [0..5000] of TileRecord;
TileCount : integer;
b : TMapCell;
uh, dh, enter, tab : String;
{$Include 'CheckSave.inc'};
{$Include 'Hungry.inc'};
{$Include 'waitconnection.inc'};
function CheckTarget(SecTime : integer) : Boolean;
var
t : integer;
begin
SecTime := SecTime * 10;
t := 0;
repeat
if not Connected then exit;
checksave;
wait(100);
t := t + 1;
until TargetPresent or (t >= SecTime);
if t >= SecTime then result := false;
if not Connected then exit;
if TargetPresent then result := true;
end;
procedure OpenBackpack;
begin
if (LastContainer <> Backpack) and (dead = false) then
begin
repeat
if not Connected then exit;
Checksave;
UseObject(Backpack);
wait(1000);
until LastContainer = Backpack;
end;
end;
procedure SetSayinfo;
begin
uh := #13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#9#9#9#9
;
dh := #13#10#13#10#13#10;
enter := #13#10;
tab := '#9';
end;
procedure EndScript;
begin
if not GetPauseScriptOnDisconnectStatus then SetPauseScriptOnDisconnectStatus(true);
Disconnect;
AddToSystemJournal(uh+'>>>>>> Перезапусти скрипт! <<<<<<'+dh);
repeat
wait(100);
until false;
end;
procedure CheckDead;
begin
if Dead then
begin
AddToSystemJournal(dh+'Я мёртв!');
EndScript;
end;
end;
procedure SearchPoint;
var
x, y, i, i0 : integer;
ArrayTile : array [0..5] of integer;
begin
ArrayTile[0] := 168;
ArrayTile[1] := 169;
ArrayTile[2] := 170;
ArrayTile[3] := 171;
ArrayTile[4] := 310;
ArrayTile[5] := 311;
if not Connected then exit;
CheckDead;
AddToSystemJournal(uh);
AddToSystemJournal('Ищем воду в радиусе 6 тайлов...');
for x := GetX(self)-6 to GetX(self)+6 do
begin
for y := GetY(self)-6 to GetY(self)+6 do
begin
b := GetMapCell(x, y, WorldNum);
for i := 0 to High(ArrayTile) do
begin
if b.Tile = ArrayTile
then
begin
Tile[i0].t := b.Tile;
Tile[i0].x := x;
Tile[i0].y := y;
break;
end;
end;
if Tile[i0].t > 0 then
begin
TileCount := TileCount + 1;
i0 := i0 + 1;
end;
end;
end;
AddToSystemJournal('Нашли тайлов: '+IntToStr(TileCount)+'.');
if TileCount = 0 then EndScript;
AddToSystemJournal('Рыбачим...'+dh);
end;
procedure CheckItem;
var
i, Trash : integer;
Item : array [0..13] of cardinal;
begin
Item[0] := $170A; //тапки
Item[1] := $170B;
Item[2] := $170C;
Item[3] := $170D;
Item[4] := $170E;
Item[5] := $170F;
Item[6] := $1710;
Item[7] := $1711;
Item[8] := $0DC8; //сети
Item[9] := $14ED; //карты
Item[10] := $099F; //бутылки
Item[11] := $09CC; //рыба
Item[12] := $09CD;
Item[13] := $09CE;
if not Connected then exit;
CheckDead;
OpenBackpack;
FindTypeEx($0E77, $FFFF, Backpack, False);
if FindCount < 1 then
begin
AddToSystemJournal('Нет бочки Trash.');
EndScript;
end;
Trash := finditem;
for i := 0 to 13 do
begin
repeat
FindTypeEx(Item, $FFFF, Backpack, False);
if FindCount > 0 then
begin
if (i <
or (i > 10) then MoveItem(finditem, 0, Ground, 0,0,0);
if (i >=8) and (i <= 10) then MoveItem(finditem, 0, Trash, 0,0,0);
if not Connected then exit;
CheckDead;
CheckSave;
CheckLag(10);
end;
until FindCount < 1;
end;
end;
procedure UsePole;
begin
if not Connected then exit;
CheckDead;
if ObjAtLayer(LhandLayer) <= 0 then
begin
OpenBackpack;
FindTypeEx($0DBF, $FFFF, Backpack, False);
if FindCount < 1 then
begin
AddToSystemJournal('Нет удочек.');
EndScript;
end;
UseType($0DBF, $FFFF);
end
else
begin
UseObject(ObjAtLayer(LhandLayer));
end;
end;
procedure StartFishing;
var
i, t : integer;
time : TDateTime;
begin
for i := 0 to TileCount-1 do
begin
if not Connected then exit;
CheckDead;
CheckSave;
CancelTarget;
Hungry(Backpack);
t := 0;
repeat
CancelTarget;
if t >= 5 then wait(5000);
UsePole;
if not Connected then exit;
CheckDead;
CheckTarget(5);
if not Connected then exit;
CheckDead;
t := t + 1;
until TargetPresent;
time := Now;
TargetToTile(0, Tile.x, Tile.y, -254);
CheckLag(10);
t := 0;
repeat
wait(100);
t := t + 1;
CheckSave;
if not Connected then exit;
CheckDead;
until (InJournalBetweenTimes('That is too far away|There doesn|I am already doing|You find|You catch|They don', time, Now) <> -1) or (t >= 200);
if FoundedParamID >= 3 then i := i - 1;
end;
end;
begin
SetARStatus(true);
SetPauseScriptOnDisconnectStatus(false);
if not Connected then waitconnection(5000);
SetSayinfo;
SearchPoint;
repeat
if not Connected then waitconnection(5000);
CheckItem;
StartFishing;
until false;
end.