Категории каталога

Форма входа

Приветствую Вас Нуб!

Поиск

Друзья сайта

Мини-чат

200
Главная » Файлы » Для Ultima Online

Рыбалка с корабля
[ Скачать с сервера (4.9 Kb) ] 13.12.2008, 14:31

;                  чтобы не переустанавливать лишний раз глобалку
sub StartFishing()
         UO.SetGlobal( 'TimeProcess', str( UO.Timer() ) )
         UO.Exec( 'exec Fishing' )
    wait(100)
    uo.exec('terminate Reconnect; exec Reconnect')
    uo.useobject('backpack')
    wait(1000)
endsub

; ================================================================
; Fishing() - Основная процедура фишинга
;
Sub Fishing()
   UO.WarMode( 0 )
   wait(500)
   While TRUE
      FishForward()
      If UO.Dead() Then
         return
      Endif
   Wend
endsub

; ================================================================
; FishForward() - Процедура ловли вокруг лодки и сдвига корабля
;
Sub FishForward()
   VAR x, y
   repeat
      For y = -4 To 4
         For x = -4 To -1
            FishTile( x, y )
            If UO.Dead() Then
               return
            Endif
            Next
      Next
      UO.SayU( 'forward' )
      wait( 5000 )
      CheckLag()
      UO.SayU( 'stop' )
   until UO.Dead()
endsub

; ================================================================
; FishTile() - Процедура ловли в заданном тайле
;
Sub FishTile( x, y )
   VAR Ms0 = "You can't see"               ; не можем ловит здесь
   VAR Ms1 = "You can't fish under the ship"   ; не можем ловить здесь
   VAR Ms2 = "You are 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 k, t, v
   VAR MaxTime = 300
   k = 0
   repeat
      If UO.Dead() Then
         return
      Endif
      DeleteJournal(ms0)
      DeleteJournal(ms1)
      DeleteJournal(ms2)
      DeleteJournal(ms3)
      DeleteJournal(ms4)
      DeleteJournal(ms5)
      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(300)
      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 ((t + MaxTime) < UO.Timer())
      If UO.InJournal(ms0) OR UO.InJournal(ms1) OR UO.InJournal(ms2) Then
         wait(3000)
      Endif
      k = k + 1
      If UO.InJournal(ms5) Then
         k = 0
      Endif
      If UO.Dead() Then
         return
      Endif
      If UO.InJournal( ms5 ) Then
         GetResultFish()
      Endif
   until UO.InJournal(ms0) OR UO.InJournal(ms1) OR UO.InJournal(ms2) OR UO.InJournal(ms3) OR (k > 6)
endsub

; ================================================================
; GetResultFish() - Процедура подбора рузультатов лова
;
Sub GetResultFish()
   ; ------- улов -------
   DIM Fish[7]
   Fish[0] = '0x09CC'      #fish1
   Fish[1] = '0x09CD'      #fish2
   Fish[2] = '0x09CE'      #fish3
   Fish[3] = '0x09CF'      #fish4
   Fish[4] = '0x0DD6'      #Truly or Prize Rare Fish
   Fish[5] = '0x14EB'      #Tattered Treasure map
   Fish[6] = '0x0DCA'      #Fishing Net
   VAR Razmer = 6      ; размер массива - 1
   VAR i,RetValue = 0
   VAR Trum = '0x4000A1E1'    ; сундук для основного улова
   For i=0 To Razmer
      UO.FindType( Fish[i], '-1', 'ground' )
      If UO.FindCount() > 0 Then
            RetValue = 1
            UO.MoveItem( 'finditem', '0', Trum )
       wait( 2000 )
      Endif
   Next
   return RetValue
endsub




Sub DeleteJournal( string1 )
   VAR nom = UO.InJournal( string1 )
   If nom > 0 Then
      UO.SetJournalLine( Nom - 1, 'string replaced' )
      DeleteJournal( string1 )
   Endif
endsub




sub CheckLag()
uo.DeleteJournal()
uo.Click('backpack')
repeat
wait(50)
until uo.InJournal('backpack')
end sub

Sub Reconnect()

var ReconnectTime,rFlag

  ReconnectTime='0'
  rFlag=1
  repeat
    while (uo.ObjAtLayer('Bpack')=='')
      if rFlag then
        ReconnectTime=Time()
        rFlag=0
      endif
      wait(20000)
      uo.Say('')
      wait(3000)
      uo.Say('')
      wait(3000)
      uo.Say('')
      wait(3000)
      uo.LDblClick(357,164)
      uo.LClick(616,459)
      wait(3000)
    wend

    wait(3000)
    if (rFlag==0) and (ReconnectTime<>'0') then
      uo.TextOpen()
      uo.TextPrint(ReconnectTime+' | Потеря связи с сервером, повторное подсоединение')
uo.exec('terminate Fishing')
wait(1000)
uo.exec('exec StartFishing')
      rFlag=1
      ReconnectTime='0'
    endif
  until false

end sub

Sub Time()

var hh,mm,ss,hms,t=str(uo.Time())

  if len(t)<=2 then
    hh="0"
    mm="0"
    ss=t
  endif

  if len(t)==3 then
    hh="0"
    mm=left(t,len(t)-2)
    ss=right(t,len(t)-1)
  endif

  if len(t)==4 then
    hh="0"
    mm=left(t,len(t)-2)
    ss=right(t,len(t)-2)
  endif

  if len(t)==5 then
    hh=left(t,len(t)-4)
    hms=left(t,len(t)-2)
    mm=right(hms,len(hms)-1)
    ss=right(t,len(t)-3)
  endif

  if len(t)==6 then
    hh=left(t,len(t)-4)
    hms=left(t,len(t)-2)
    mm=right(hms,len(hms)-2)
    ss=right(t,len(t)-4)
  endif

  return hh+":"+mm+":"+ss

end sub
Категория: Для Ultima Online | Добавил: Anima
Просмотров: 1635 | Загрузок: 231 | Рейтинг: 0.0/0 |
Всего комментариев: 0
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]