sub Lumberjacking() var i=0,j=0,k=0,r=0,q=0,ii,jj var TopX=324,TopY=65 dim TreeX[500], TreeY[500],TreeT[500] dim TreeTile[10] var flag=0,treeCount=0,clicks=0,flag2=0 ###################### ### Меню / Options ### ###################### ############################################################################################ var f=file("C:\trees3.dat") ## - Путь к файлу в котором будут хранится координаты Деревьев. ### var Area=1 ## Размер обрабатываемой территории, можно менять от 1 до 4. ### var TryHiding=1 ## 1 - Перед тем как рубить дерево, будет пытаться уйти в хайд, 0 - не будет . ### var TryRecall=1 ## 1 - После того как соберет LogsQty логов, будет пытаться реколиться домой, # складывать логи в сундук и реколиться обратно (нужно указать Рунбук в которой,1 ая руна домой, а 9 ая в лес), 0 - не будет. ### var TryRecall2=1 ## 1 - После того как соберет LogsQty логов, будет пытаться реколиться домой, # складывать логи в сундук и реколиться обратно (нужно указать Рунбук в которой,1 ая руна домой, а 9 ая в лес), 0 - не будет. ### var LogsQty=700 ## Количество логов, добыв которое надо реколиться домой. ### var GetFromFile=0 ## 0 - Координаты деревьев будут считыватся из файла, 0 - собиратся из клиента #(сначала соберите а потом считывайте из файла). ### uo.exec("set norbcheck 1")# Для рекола. ### uo.exec("set norbcalc 1") # Для рекола . ### ############################################################################################ ######################## ### Графика деревьев ### ######################## TreeTile[0]=3283 TreeTile[1]=3277 TreeTile[2]=3293 TreeTile[3]=3296 TreeTile[4]=3302 TreeTile[5]=3299 TreeTile[6]=3290 TreeTile[7]=3288 TreeTile[8]=3286 TreeTile[9]=3280
uo.exec("filterspeech on") uo.exec("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('!!Выбери Руну ДОМОЙ !! ') uo.exec('addobject runeHome') while uo.targeting() wait(100) wend
if TryRecall2==1 then uo.print('!!Выбери Руну В ПЕЩЕРУ !! ') uo.exec('addobject runeCave') while uo.targeting() wait(100) wend end if ##################################### ### Загружаем координаты из файла ### ##################################### if GetFromFile==1 then uo.print('Загружаем координаты из файла...') 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 ###################################### ### Собираем координаты из клиента ### ###################################### uo.print('Выбери Кирку: ') uo.exec('addobject Pickaxe') while uo.targeting() wait(100) wend uo.print('Собираем координаты деревьев в округе...') for q=1 to Area if q==2 then gotoxy(uo.getx()+20,uo.gety()-10) end if if q==3 then gotoxy(uo.getx(),uo.gety()+20) end if if q==4 then gotoxy(uo.getx()-20,uo.gety()) end if for r=0 to 3 if r==1 then gotoxy(uo.getx()+10,uo.gety()) end if if r==2 then gotoxy(uo.getx(),uo.gety()+10) end if if r==3 then gotoxy(uo.getx()-10,uo.gety()) end if for j=0 to 8 for i=0 to 8 clicks=0 flag=0 uo.DeleteJournal() ####################### ### Кликаем на тайл ### ####################### uo.useobject('Pickaxe') waitForTarget() uo.DeleteJournal()
WaitForTryRock()
############################### ### Проверяем дерево ли это ### ############################### flag=0 for k=0 to 9 if uo.LastTile(0)==TreeTile[k]+1 then flag=2 end if next if flag==0 then for k=0 to 9 if uo.LastTile(0)==TreeTile[k] then flag=1 end if next 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('Найдено дерево: 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('Найдено дерево: x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2))) end if end if next next next next uo.exec("filterspeech off") uo.print('Анализ закончен, координаты деревьев записаны в файл C:\trees3.dat') 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 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 GetTree(type,x,y,z) var i uo.print('Начинаем рубку дерева...') for i=0 to 15 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 ToRecall() VAR Meshok='0x401C1142' ## - ID сундука в который чар должен складывать логи RecallToHome() wait(500) uo.press(36) wait(500) uo.press(36) wait(500) repeat wait(500) repeat wait(500) repeat wait(500) repeat wait(600) UO.SetReceivingContainer(Meshok) uo.findtype('ZLK') wait(500) UO.Grab('all','finditem') infologs() wait(500) until uo.GetQuantity('finditem')==0 UO.UnSetReceivingContainer() UO.SetReceivingContainer(Meshok) uo.findtype('ZLK') wait(500) UO.Grab('all','finditem') infologs() wait(500) until uo.GetQuantity('finditem')==0 UO.UnSetReceivingContainer() UO.SetReceivingContainer(Meshok) uo.findtype('ZLK') wait(500) UO.Grab('all','finditem') infologs() wait(500) until uo.GetQuantity('finditem')==0 UO.UnSetReceivingContainer() RecallToLumber() end sub
sub RecallToHome() UO.Print("!!Прыгаем ДоМОЙ!!") uo.exec("recall Runebook 21") wait(10000) end sub
sub RecallToLumber() UO.Print("!!Прыгаем в ЛЕС!!") uo.exec("recall Runebook 1025") wait(10000) end sub
sub ToHide() while not UO.Hidden() uo.print('Пытаемся уйти в хайд...') uo.deletejournal() UO.UseSkill("Stealth") wait(4100) wend wait(100) end sub
sub WaitForRecall() var Text1=uo.getname()+": The spell fizzles." var mess='',lastX=uo.getX(),lastY=uo.getY() 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 mess for var i=0 to 200 mess=uo.journal(0) if uo.Journal(0)==Text2 OR uo.Journal(0)==Text3 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 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 abs(x-myX)<=1 AND abs(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 abs(num) if num>=0 then return num else return num*(-1) end if end sub
sub SaveToFile(TreeCount,TreeX,TreeY,TreeT) var f=file("C:\trees3.dat") var s=0,i=0 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 infologs() UO.Print('У вас всего '+Str(UO.Count('0x1BDD'))+' логов в сумке') UO.Print('Из них '+Str(UO.Count('0x1BDD','0x0000'))+' простых и ' +str(uo.count('0x1BDD')-uo.count('0x1BDD','0x0000'))+' цветных') end sub
############################################################## ### ВНИМАНИЕ!!! В СКРИПТЕ РУНБУКИ НАСТРОЕНЫ ПОД DRW (шард) ### ##############################################################
|