Встаем на корабле, ориентированном в направлении клавиши 1 на цифровой клавиатуре, встаем на трюм, в трюм коробку (тип в константах) с пустыми мешками (тип там же), сериал трюма в скрипт. Все.
Code: Select all
program FishingFW;
// Фишинг с корабля на FW.
// v.1.04b (c) Edred
//
// 1.00 - Только рыбачим по кругу, удочка уже в руках выловленное - в трюм
// Контроля кол-ва стопок в трюме нет! Контроля, может ли чар поднять
// стопку рыбы нет!
// 1.01 - ввел подсчет предметов в трюме. Добавил доп проверку на успешность
// перемещения объекта в трюм - если не переместился - переоткрыть
// трюм и снова переместить.
// 1.02 - В трюм положить коробку (тип прописывается в начале скрипта), в ней
// кучу мешков (с типом аналогично). Скрипт при ловле карты раскладывает
// по мешкам по 240 шт., мешки кладет в трюм. Весь остальной улов по-прежнему
// скидывается просто в трюм (он складывается в стопки).
// Внимание! Не проверяется: сколько ящиков в трюме, мешки ищутся в первом;
// пустые ли мешки в ящике.
// 1.03 - Мелкие правки, улучшаем вывод информации о результатах лова. При подсчете
// кол-ва итемов в трюме заодно читаем количество ранее выловленного.
// 1.04 - Вводим магические рыбы, плюс исправляем кол-во карт в мешках на 250 (тестов
// достаточно).
//
//
// Схема облова (Х - можно, 0 - нельзя, # - чар):
//
// \x -6-5-4-3-2-1 0 1 2 3 4 5 6
// y\
// -6 X X X X 0 0 0 0 0 X X X X
// -5 X X X X 0 0 0 0 0 X X X X
// -4 X X X X 0 0 0 0 0 X X X X
// -3 X X X X 0 0 0 0 0 X X X X
// -2 X X X X 0 0 0 0 0 X X X X
// -1 X X X X 0 0 0 0 0 X X X X
// 0 X X X X 0 0 # 0 0 X X X X
// 1 X X X X 0 0 0 0 0 X X X X
// 2 X X X X X X X X X X X X X
// 3 X X X X X X X X X X X X X
// 4 X X X X X X X X X X X X X
// 5 X X X X X X X X X X X X X
// 6 X X X X X X X X X X X X X
{$Include 'all.inc'}
const
HatchID = $40051BE0; // Сериал трюма
FPoleType = $0DBF; // Тип удочки
BoxOfBags = $0E7D; // тип ящика с мешками
EmptyBags = $0E76; // тип пустого мешка
{Сообщения}
Mes1 = 'You pull out';
Mes2 = 'You fish a while, but fail';
Mes3 = 'There are no fish here.';
Mes4 = 'That is too far away.';
Mes5 = 'Try fishing in water.';
Mes6 = 'Вы не смогли выловить';
{Команды кораблем}
Com1 = 'Raise Anchor';
Com2 = 'Drop Anchor';
Com3 = 'Forward';
Com4 = 'Back';
Com5 = 'Stop';
Answer1 = 'Aye';
{цвета магических рыб}
MagicF = $0489; // Magic Fish
GoldenF = $0630; // Golden Fish
SilverF = $0482; // Silver Fish
var
x, y, k, n, d, s, scard, snom, m1, m2, m3, m4, m5, m6 : integer;
ctime : TDateTime;
CurBagID : Cardinal;
CurBoxID : Cardinal;
temp1 : Cardinal;
FishResult : array[1..7] of Cardinal;
SumResult : array[1..10] of Integer;
FlagMagic : Integer;
function GetEmptyBag : Cardinal;
begin
Result := 0;
UseObject(HatchID);
wait(1000);
checksave;
CurBoxID := findtype(BoxOfBags, HatchID);
if CurBoxID = 0 then
begin
Addtosystemjournal( 'Не смог найти ящик с мешками');
exit;
end;
UseObject(CurBoxID);
wait(1000);
checksave;
temp1 := findtype(EmptyBags, CurBoxID);
if temp1 = 0 then
begin
Addtosystemjournal( 'Не смог найти мешок в ящике');
exit;
end;
MoveItem(finditem, 1, HatchID, 0, 0, 0);
wait(1000);
checksave;
Result := temp1;
end;
begin
for k := 1 to 10 do
SumResult[k] := 0;
FishResult[1] := $09CC; // рыба
FishResult[2] := $09CF; // рыба
FishResult[3] := $09CE; // рыба
FishResult[4] := $09CD; // рыба
FishResult[5] := $14EB; // карты
FishResult[6] := $14EC; // карты
FishResult[7] := $0F7A; // black perl
scard := 0;
CurBagID := GetEmptyBag;
if CurBagID = 0 then exit;
snom := 1;
UseObject(CurBagID);
wait(1000);
checksave;
s := 0;
repeat
// подсчет количества итемов в трюме
findtype($FFFF,HatchID);
if findcount > 0 then s := s + 1;
for k := 1 to 7 do
begin
if (GetType(finditem) = FishResult[1]) and (GetColor(finditem) = MagicF) then
begin
SumResult[8] := GetQuantity(finditem);
break;
end;
if (GetType(finditem) = FishResult[1]) and (GetColor(finditem) = GoldenF) then
begin
SumResult[9] := GetQuantity(finditem);
break;
end;
if (GetType(finditem) = FishResult[1]) and (GetColor(finditem) = SilverF) then
begin
SumResult[10] := GetQuantity(finditem);
break;
end;
if GetType(finditem) = FishResult[k] then SumResult[k] := GetQuantity(finditem);
end;
ignore(finditem);
wait(50);
until findcount = 0;
ignorereset;
repeat
UseObject(HatchID);
wait(1000);
checksave;
for x := -6 to 6 do
begin
for y := -6 to 6 do
begin
// Если схема облова другая - уберите следующую строку:
if (y < 2) AND (x > -3) AND (x < 3) then continue;
repeat
if scard >= 250 then
begin
// взять новый мешок
CurBagID := GetEmptyBag;
if CurBagID = 0 then exit;
UseObject(CurBagID);
wait(1000);
checksave;
scard := 0;
s := s + 1;
snom := snom + 1;
end;
if TargetPresent then CancelTarget;
waitconnection(3000);
ctime := Now;
UseObject(ObjAtLayerEx(LHandLayer,self));
WaitForTarget(5000);
If TargetPresent then TargetToTile(0, GetX(self)+x, GETY(self)+y, 251);
k := 0;
repeat
wait(100);
k := k + 1;
checksave;
m1 := InJournalBetweenTimes(Mes1, ctime, Now);
m2 := InJournalBetweenTimes(Mes2, ctime, Now);
m3 := InJournalBetweenTimes(Mes3, ctime, Now);
m4 := InJournalBetweenTimes(Mes4, ctime, Now);
m5 := InJournalBetweenTimes(Mes5, ctime, Now);
m6 := InJournalBetweenTimes(Mes6, ctime, Now);
until (m1<>-1) or (m2<>-1) or (m3<>-1) or (m4<>-1) or (m5<>-1) or (m6<>-1) or (k > 300);
if m1 <> -1 then
begin
k := 1;
for n := 1 to 7 do
begin
findtype(FishResult[n],ground);
if finditem = 0 then continue;
d := GetQuantity(finditem);
FlagMagic := 0;
if (n = 1) and (GetColor(finditem) = MagicF) then FlagMagic := 1;
if (n = 1) and (GetColor(finditem) = GoldenF) then FlagMagic := 2;
if (n = 1) and (GetColor(finditem) = SilverF) then FlagMagic := 3;
if (n = 5) OR (n = 6) then
MoveItem(finditem, d, CurBagID, 0, 0, 0)
else
MoveItem(finditem, d, HatchID, 0, 0, 0);
wait(1000);
checksave;
// Перепроверим, переместился ли объект
findtype(FishResult[n],ground);
if finditem > 0 then
begin
// Раз не переместился - значит был реконнект
UseObject(HatchID);
wait(1000);
checksave;
UseObject(CurBagID);
wait(1000);
checksave;
d := GetQuantity(finditem);
if (n = 5) OR (n = 6) then
MoveItem(finditem, d, CurBagID, 0, 0, 0)
else
MoveItem(finditem, d, HatchID, 0, 0, 0);
wait(1000);
checksave;
end;
if d = 0 then d := 1;
if FlagMagic = 1 then SumResult[8] := SumResult[8] + d;
if FlagMagic = 2 then SumResult[9] := SumResult[9] + d;
if FlagMagic = 3 then SumResult[10] := SumResult[10] + d;
if FlagMagic = 0 then SumResult[n] := SumResult[n] + d;
if (n = 5) OR (n = 6) then scard := scard + 1;
// Сообщения о результатах лова:
if (n = 1) and (FlagMagic = 1) then Addtosystemjournal( inttostr(x) + inttostr(y) + ': сбросил в трюм ' + inttostr(d) + ' magic fish из ' + inttostr(SumResult[8]) + '. В трюме ' + inttostr(s) + ' итемов');
if (n = 1) and (FlagMagic = 2) then Addtosystemjournal( inttostr(x) + inttostr(y) + ': сбросил в трюм ' + inttostr(d) + ' golden fish из ' + inttostr(SumResult[9]) + '. В трюме ' + inttostr(s) + ' итемов');
if (n = 1) and (FlagMagic = 3) then Addtosystemjournal( inttostr(x) + inttostr(y) + ': сбросил в трюм ' + inttostr(d) + ' silver fish из ' + inttostr(SumResult[10]) + '. В трюме ' + inttostr(s) + ' итемов');
if (n <= 4) and (FlagMagic = 0) then Addtosystemjournal( inttostr(x) + inttostr(y) + ': сбросил в трюм ' + inttostr(d) + ' рыбы типа ' + inttostr(n) + ' из ' + inttostr(SumResult[n]) + '. В трюме ' + inttostr(s) + ' итемов');
if (n = 5) OR (n = 6) then Addtosystemjournal( inttostr(x) + inttostr(y) + ': сбросил в мешок N' + inttostr(snom) + ' карту. Всего в мешке ' + inttostr(scard) + ' карт');
if (n = 7) then Addtosystemjournal( inttostr(x) + inttostr(y) + ': сбросил в трюм ' + inttostr(d) + ' black perls из ' + inttostr(SumResult[n]) + '. В трюме ' + inttostr(s) + ' итемов');
if s > 250 then exit;
end;
end;
until (m3<>-1) or (m4<>-1) or (m5<>-1);
end;
end;
until False;
End.
Code: Select all
####################################################################
; FishingAround. v.2.07b (c) Edred
;
; Рыбачим вокруг чара
;
sub FishingAround()
VAR Ms0 = "You can't see" ; не можем ловит здесь
VAR Ms1 = "You can't fish under the ship" ; не можем ловить здесь
VAR Ms2 = "That is too far away." ; далеко
VAR Ms3 = "There are no fish here" ; кончилось тут
VAR Ms4 = "You fish a while, but fail to catch anything" ; физл
VAR Ms5 = "You pull out" ; поймал что-то
VAR Ms6 = "Try fishing in water." ; не можем ловить здесь
VAR k, t, v, x, y, i
VAR MaxTime = 800
VAR YLines
UO.TextOpen()
UO.TextClear()
For y = -7 To 7
YLines = ''
For x = -7 To 7
If UO.Dead() Then
return
Endif
DeleteJournal(ms0)
DeleteJournal(ms1)
DeleteJournal(ms2)
DeleteJournal(ms3)
DeleteJournal(ms4)
DeleteJournal(ms5)
DeleteJournal(ms6)
t = UO.Timer()
If UO.Waiting() Then
UO.CancelTarget()
Endif
UO.WaitTargetTile( '0', STR( UO.GetX() + x ), STR( UO.GetY() + y ), '251')
UO.UseObject( UO.GetSerial( UO.ObjAtLayer( 'Lhand' ) ) )
repeat
wait(100)
until UO.InJournal(ms0) OR UO.InJournal(ms1) OR UO.InJournal(ms2) OR UO.InJournal(ms3) OR UO.InJournal(ms4) OR UO.InJournal(ms5) OR UO.InJournal(ms6) OR ((t + MaxTime) < UO.Timer())
If UO.InJournal(ms0) OR UO.InJournal(ms1) OR UO.InJournal(ms2) OR UO.InJournal(ms6) Then
if x == 0 AND y == 0 Then
YLines = YLines + '#'
else
YLines = YLines + '0'
endif
Else
if x == 0 AND y == 0 Then
YLines = YLines + '#'
else
YLines = YLines + 'X'
endif
Endif
If UO.Dead() Then
return
Endif
Next
UO.TextPrint( YLines )
Next
endsub
#####################################################################
Sub CheckLag()
DeleteJournal( 'backpack' )
UO.Click( 'backpack' )
repeat
wait(100)
until UO.InJournal( 'backpack' )
return
end sub
#####################################################################
Sub DeleteJournal( string1 )
VAR nom = UO.InJournal( string1 )
If nom > 0 Then
UO.SetJournalLine( Nom - 1, 'string replaced' )
DeleteJournal( string1 )
Endif
endsub