sub FishTile(t, x, y, z)
  var timer

  repeat
    uo.WaitTargetTile(Str(t), Str(x), Str(y), Str(z))
    uo.UseType(0x0DBF) #Удочка

    uo.DeleteJournal()
    timer = 0
    repeat
      wait(1000)
      timer = timer + 1
    until uo.InJournal("Points") or uo.InJournal("here") or uo.InJournal("line") or uo.InJournal("broken") or timer > 120
        

  until uo.InJournal("here") or uo.InJournal("line")
end sub

sub Fishing()
  var i, j, tile
  
  uo.Disarm()

  while not uo.dead()
    for i = -6 to 6
      for j = -6 to 6
        tile = 168
        while (not uo.PrivateGetTile(uo.GetX() + i, uo.GetY() + j, 251, tile, tile)) and (tile < 6045)
          if tile == 171 then
            tile = 310
          else
            if tile == 311 then
              tile = 6039
            else
              tile = tile + 1
            endif
          endif
        wend
      
        if tile < 6039 then
          tile = 0
        endif

        if tile < 6045 then
          uo.concolor(0x53)
          uo.Print("Fishing: " + Str((i + 6) * 13 + j + 7) + "/169...")
          uo.concolor(0)
          
          FishTile(tile, uo.GetX() + i, uo.GetY() + j, 251)
        endif
      next
    next
    
    uo.Print("Завершил круг. Продолжаю.")
  wend
end sub