if AddObject==1 then uo.FilterSpeech('on') uo.FilterSpeech('add', 'Where do you want to use the pickaxe?')
uo.Print('Выбери Топор: ') uo.Exec('addobject Axe') while uo.Targeting() wait(100) wend
if TryRecall==1 then uo.Print('Выбери PунБук: ') uo.Exec('addobject Runebook') while uo.Targeting() wait(100) wend end if
if ControlOfDanger==1 then uo.Print('Выбери Руну: ') uo.Exec('addobject Rune') while uo.Targeting() wait(100) wend end if end if
if ControlOfDanger==1 then uo.Exec('exec ControlOfDanger') end if
if Reconnect==1 then uo.Exec('exec Reconnect') end if
##################################### ### Загружаем координаты из файла ### ##################################### if GetFromFile==1 then uo.Print('Загружаем координаты из файла...') f=file(FileName) f.Open() TreeCount=safe call f.ReadNumber() for i=1 to TreeCount TreeT[i]=safe call f.ReadNumber() TreeX[i]=safe call f.ReadNumber() TreeY[i]=safe call f.ReadNumber() next f.Close() else ###################################### ### Собираем координаты из клиента ### ###################################### if AddObject==1 then uo.Print('Выбери Кирку: ') uo.Exec('addobject Pickaxe') while uo.Targeting() wait(100) wend end if uo.Print('Собираем координаты деревьев в округе...') repeat clicks=0 flag=0 uo.DeleteJournal() ####################### ### Кликаем на тайл ### ####################### uo.UseObject('Pickaxe') waitForTarget() uo.DeleteJournal() WaitForTryRock() ############################### ### Проверяем дерево ли это ### ############################### flag=0 for k=0 to 28 if uo.LastTile(0)==TreeTile[k]+1 then flag=2 end if next if flag==0 then for k=0 to 28 if uo.LastTile(0)==TreeTile[k] then flag=1 end if next end if if uo.Lasttile(1)==uo.GetX() and uo.Lasttile(2)==uo.GetY() then flag=3 end if ######################### ### Кликнули на ствол ### ######################### if flag==1 then flag2=0 if TreeCount>0 then for ii=1 to TreeCount if TreeX[ii]==uo.LastTile(1) and TreeY[ii]==uo.LastTile(2) then flag2=1 end if next end if if flag2==0 then TreeCount=TreeCount+1 TreeX[TreeCount]=uo.LastTile(1) TreeY[TreeCount]=uo.LastTile(2) TreeT[TreeCount]=uo.LastTile(0) uo.Print('Найдено дерево номер '+str(TreeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2))) end if end if ########################## ### Кликнули по листве ### ########################## if flag==2 then flag2=0 if TreeCount>0 then for ii=1 to TreeCount if TreeX[ii]==uo.LastTile(1) and TreeY[ii]==uo.LastTile(2) then flag2=1 end if next end if if flag2==0 then TreeCount=TreeCount+1 TreeX[TreeCount]=uo.LastTile(1) TreeY[TreeCount]=uo.LastTile(2) TreeT[TreeCount]=uo.LastTile(0)-1 uo.Print('Найдено дерево номер '+str(TreeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2))) end if end if until (flag==3) or (TreeCount==5000) uo.FilterSpeech('off') uo.Print('Анализ закончен, координаты деревьев записаны в файл ' + FileName) SaveToFile(TreeCount,TreeX,TreeY,TreeT) end if uo.Print('Деревьев найдено: '+str(TreeCount)) wait(2000) ###################################### ### Ходим по собранным координатам ### ###################################### while 1==1 if TreeCount>0 then for i=1 to TreeCount if TryRecall==1 and uo.Count('ZLK')>=LogsQty or uo.Weight>=uo.STR*4+20 then ToRecall() end if uo.Print('Идем к дереву номер '+str(i)+': x='+str(TreeX[i])+' y='+str(TreeY[i])) InfoLogs() flag=GotoXY(TreeX[i],TreeY[i]) if flag==1 then if TryHiding==1 then ToHide() end if GetTree(str(TreeT[i]),str(TreeX[i]),str(TreeY[i]),str(uo.GetZ())) end if next end if wend end sub
sub SaveToFile(TreeCount,TreeX,TreeY,TreeT) var s=0,i=0,f f=file(FileName) f.Open() f.Create() s=safe call f.Writeln(TreeCount) for i=1 to TreeCount s=safe call f.Writeln(str(TreeT[i])+' '+str(TreeX[i])+' '+str(TreeY[i])) next f.Close() end sub
sub GetTree(Type,X,Y,Z) var i uo.Print('Начинаем рубку дерева...') for i=0 to QuantityImpact if uo.Warmode()==1 then return 0 end if wait(200) uo.DeleteJournal() uo.WaitTargetTile(Type,X,Y,Z) uo.UseObject('Axe') if WaitForChange()==1 then return 1 end if next return 0 end sub
sub WaitForRecall() var Text1=uo.GetName()+': The spell fizzles.' var LastX=uo.GetX() var LastY=uo.GetY() var mess='' for var i=0 to 200 mess=uo.Journal(0) if uo.Journal(0)==Text1 then return 0 end if if uo.GetX()<>LastX or uo.GetY()<>LastY then return 1 end if wait(50) next return 0 end sub
sub WaitForHide() var Text1=uo.GetName()+': You have hidden yourself well' var Text2=uo.GetName()+": You can't seem to hide here." var mess for var i=0 to 200 mess=uo.Journal(0) if uo.Journal(0)==Text1 then return 1 end if if uo.Journal(0)==Text2 then return 0 end if wait(50) next return 0 end sub
sub WaitForChange() var Text1=uo.GetName()+': You hack at the tree for a while, but fail to produce any useable wood.' var Text2='There are no logs here to chop.' var Text3="You can't reach this." var Text4='That is too far away.' var Text5="You can't do much in your current state." var mess for var i=0 to 200 mess=uo.Journal(0) if uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 then return 1 end if if uo.Journal(0)==Text1 then return 0 end if if mess[0]=='Y' and mess[1]=='o' and mess[2]=='u' and mess[4]=='p' and mess[5]=='u' and mess[6]=='t' then return 0 end if wait(50) next return 0 end sub
sub WaitForTryRock() var Text1='That is too far away.' var Text2='Try mining in rock.' var Text3='There is no ore here to mine.' var Text4='You have no line of sight to that location' var Text5="You can't see the target" for var i=0 to 50 if uo.Journal(0)==Text1 or uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 or uo.Journal(0)==Text5 then return 1 end if wait(200) next return 0 end sub
sub WaitForTarget() for var i=0 to 50 if uo.Targeting()==1 then return 1 end if wait(200) next return 0 end sub
sub WaitForChangeXY(myX,myY,LastX,LastY) for var i=1 to 50 if LastX<>myX or LastY<>myY then return 1 end if wait(200) next return 0 end sub
sub MovingItems(tItem,cItem,qItem,FromBackPack) var idResivCont,idSendCont Open(Chest) uo.UseObject('backpack') if FromBackPack==1 then idResivCont=uo.GetSerial('backpack') idSendCont=Chest else idSendCont=uo.GetSerial('backpack') idResivCont=Chest end if CheckLag() uo.Findtype(tItem,cItem,idSendCont) while uo.GetQuantity('finditem')>0 uo.MoveItem('finditem',str(qItem),idResivCont) wait(1000) CheckLag() if qItem>0 then return end if uo.FindType(tItem,cItem,idSendCont) wend end sub
sub InfoTrees(sNum,fStr,lStr,Sort) var n=VAL(Right(sNum,1)) if n==0 then if Sort==0 then uo.Print(fStr+'а'+lStr) else uo.Print(fStr+lStr) end if return end if if n<5 then uo.Print(fStr+'а'+lStr) return end if if Sort==0 then uo.Print(fStr+'ев'+lStr) else uo.Print(fStr+'ов'+lStr) end if end sub
sub Open(Container) uo.DeleteJournal() uo.UseObject(Container) repeat wait(500) until uo.InJournal('Contains') end sub
sub GotoXY(x,y) var myX,myY,LastX=0,LastY=0,i,halt=0,z,r=0 for i=1 to 60 myX=uo.GetX() myY=uo.GetY() if LastX==myX and LastY==myY then halt=halt+1 else halt=0 end if if halt>=10 then if uo.GetDir()==1 then for z=0 to 8 uo.Press(40) next end if if uo.GetDir()==3 then for z=0 to 8 uo.Press(37) next end if if uo.GetDir()==5 then for z=0 to 8 uo.Press(38) next end if if uo.GetDir()==7 then for z=0 to 8 uo.Press(39) next end if halt=15 end if if Numb(x-myX)<=1 and Numb(y-myY)<=2 then return 1 end if if x<=myX then if y<=myY then for z=0 to 3 uo.Press(38) next else for z=0 to 3 uo.Press(37) next end if else if y<=myY then for z=0 to 3 uo.Press(39) next else for z=0 to 3 uo.Press(40) next end if end if LastX=myX LastY=myY wait(200) next return 0 end sub
sub Numb(num) if num>=0 then return num else return num*(-1) end if end sub
sub InfoLogs() uo.Print('У вас всего '+str(uo.Count('0x1BDD'))+' логов в сумке') uo.Print('Из них '+str(uo.Count('0x1BDD','0x0000'))+' простых и ' +str(uo.Count('0x1BDD')-uo.Count('0x1BDD','0x0000'))+' цветных') end sub
sub ToHide() while not uo.Hidden() uo.Print('Пытаемся уйти в хайд...') uo.DeleteJournal() uo.Exec('warmode 0') uo.UseSkill('Stealth') wait(4100) wend wait(100) end sub
sub ToRecall() uo.Exec('terminate ControlOfDanger') RecallToHome() DropLogs() InfoLogs() if RechargeBook==1 then RechargeBook() wait(4000) end if if EatingFood==1 then EatingFood() end if wait(3000) RecallToLumber() uo.Exec('exec ControlOfDanger') end sub
sub RecallToHome() uo.Print('Прыгаем Домой.') RuneBookRecall(RuneToHome) end sub
sub RecallToLumber() uo.Print('Прыгаем в Лес.') RuneBookRecall(RuneToForest) end sub
sub RuneBookRecall(n) var OldX=uo.GetX() var OldY=uo.GetY() var Time repeat uo.Exec('warmode 0') uo.UseObject('Runebook') CheckLag() uo.Lclick(135, n*15+55) CheckLag() Time=uo.Timer() repeat wait(500) until OldX<>uo.GetX() or OldY<>uo.GetY() or uo.Dead() or uo.InJournal('needs') or uo.InJournal('fizzles') or Time+200<uo.Timer() uo.DeleteJournal() until OldX<>uo.GetX() or OldY<>uo.GetY() or uo.Dead() or uo.InJournal('needs') end sub
sub DropLogs() var Time,Space Time=Time() Space=' ' uo.TextOpen() uo.TextPrint('Выкладываем логи - ' +Space +Time) ToHide() var a,Exit dim Logs[1] Logs[0]=0x1BDD uo.Print('Выкладываем Логи.') for a=0 to 0 MovingItems(Logs[a],'-1',-1,0) next uo.Print('Логи Выложены.') end sub
sub RechargeBook() var Time,Space Time=Time() Space=' ' uo.TextOpen() uo.TextPrint('Речарим рунбуку - ' +Space +Time) repeat MovingItems('0x1F4C','-1',50,1) uo.UseObject('Runebook') wait(1000) Checklag() uo.Lclick(296,91) wait(1000) until uo.InJournal('charges are 50') or uo.InJournal('fully') or uo.InJournal('You need a Recall Scroll') or uo.Dead() while uo.Count('0x1F4C')>0 MovingItems('0x1F4C','-1',-1,0) wend end sub
sub EatingFood() var Time,Space Time=Time() Space=' ' uo.TextOpen() uo.TextPrint('Кушаем - ' +Space +Time) MovingItems(TypeFood,'-1',20,1) repeat CheckLag() if uo.Count(TypeFood)<=0 then uo.Exec('terminate EatingFood') end if uo.UseType(TypeFood) while not uo.InJournal('full') and not uo.InJournal('stuffed') and not uo.InJournal('hungry') and not uo.InJournal('satiated') and not uo.Dead() wait(100) wend until uo.InJournal('too full') or uo.Dead() while uo.Count(TypeFood)>0 MovingItems(TypeFood,'-1',-1,0) wend end sub
sub ControlOfDanger() var Time,danger,Space Time=Time() Space=' ' while 1 uo.DeleteJournal() while not uo.InJournal(':') wait(100) wend danger=uo.GetNotoriety(uo.JournalSerial(0))
if PhysicalDanger==1 then if uo.InJournal('OOPS') then uo.TextOpen() uo.TextPrint('Был вырублен Ент ' +Space +Time) uo.Exec('exec RecallRune') end if if uo.InJournal('attacking you') then uo.GetStatus('uo.JournalSerial(0)') uo.SetGlobal('name',uo.GetName(uo.JournalSerial(0))) uo.TextOpen() uo.TextPrint('Вы были атакованы - '+uo.GetName(uo.JournalSerial(0)) +Space +Time) uo.Exec('exec RecallRune') end if end if
if SeenDanger==1 then if Danger==6 and UO.JournalSerial(0) <> UO.GetSerial() then uo.GetStatus('uo.JournalSerial(0)') uo.SetGlobal('name',uo.GetName(uo.JournalSerial(0))) uo.TextOpen() uo.TextPrint('Рядом оказался ПК - '+uo.GetName(uo.JournalSerial(0)) +Space +Time) uo.Exec('exec RecallRune') end if
if Danger==4 and UO.JournalSerial(0) <> UO.GetSerial() then uo.GetStatus('uo.JournalSerial(0)') uo.SetGlobal('name',uo.GetName(uo.JournalSerial(0))) uo.TextOpen() uo.TextPrint('Рядом оказался криминал - '+uo.GetName(uo.JournalSerial(0)) +Space +Time) uo.Exec('exec RecallRune') end if
if RecallFromAll==1 then if Danger==1 and UO.JournalSerial(0) <> UO.GetSerial() then uo.GetStatus('uo.JournalSerial(0)') uo.SetGlobal('name',uo.GetName(uo.JournalSerial(0))) uo.TextOpen() uo.TextPrint('Рядом оказался чар - '+uo.GetName(uo.JournalSerial(0)) +Space +Time) uo.Exec('exec RecallRune') end if end if end if wend end sub
sub RecallRune() Terminate() uo.PlayWav(DisturbingSound) uo.UseType('0x0F0E','0x0631') wait(100) repeat uo.WaitTargetObject('Rune') uo.Exec('warmode 0') uo.Cast('Recall') wait(3000) until not uo.InJournal('spell fizzles') repeat uo.DeleteJournal() uo.WaitTargetObject('Rune') wait(100) uo.Cast('Mark') if uo.InJournal('mana for this spell') then ManaUp('Bottle') wait(100) end if wait(3000) until not uo.InJournal('spell fizzles') if uo.Life<uo.STR then LifeUp('Bottle') wait(100) end if if CycleScript==1 then uo.Exec('exec DangerWait') end if if CycleScript==0 then uo.Exec('exec ExitUO') end if end sub
sub DisturbingSound(amount) var i for i=1 to amount uo.PlayWav(DisturbingSound) wait(1500) next end sub
sub DangerWait() wait(DangerousTime) ToRecall() uo.Exec('exec Lumberjacking') end sub
sub ExitUO() wait(3000) uo.CloseUO() end sub
sub LifeUp(Mode) if Mode=='Healing' then while uo.Life<uo.STR uo.Exec('bandageself') wait(4000) wend end if if Mode=='Bottle' then if uo.Life<uo.STR then uo.UseType('0x0F0E','0x09BB') wait(100) end if end if end sub
sub ManaUp(Mode) if Mode=='Meditation' then while uo.Mana<uo.INT uo.Exec('useskill Meditation') wait(4000) wend end if if Mode=='Bottle' then if uo.Mana<uo.INT then uo.UseType('0x0F0E','0x09DF') wait(100) end if end if end sub
sub Reconnect() var ReconnectTime,rflag ReconnectTime='0' rflag=1 repeat while (uo.ObjAtLayer('Bpack')=='') if rflag then ReconnectTime=Time() rflag=0 end if 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('Disconnected & Reconnected @ '+ReconnectTime) rflag=1 ReconnectTime='0' end if until false end sub
sub Time() var Date,nTime,uTime,i uTime=str(uo.Time()) nTime='' for i=0 to Len(uTime) nTime=uTime[Len(uTime)-i]+nTime if (i==2) or (i==4) then nTime=':'+nTime end if next uTime=str(uo.Date()) Date='' for i=0 to Len(uTime) Date=uTime[Len(uTime)-i]+Date if (i==2) or (i==4) then Date='.'+Date end if next uTime=nTime+' @ '+Date return uTime end sub
sub Terminate() uo.Exec('terminate Lumberjacking') uo.Exec('terminate ControlOfDanger') uo.Exec('terminate Reconnect') end sub
sub CheckLag() if uo.Waiting()>0 then uo.Exec('canceltarget') end if uo.DeleteJournal() uo.Click('backpack') repeat wait(50) until uo.InJournal('backpack') end sub