Code: Select all
############################################
### Lumberjacking / Ðóáêà äåðåâüåâ ###
############################################
### Øàðä Dragon World / www.drw.ru ###
############################################
### Ðåàâòîð ýòîãî ñêðèïòà: BETEPAH ###
############################################
##################
### Ïåðåìåííûå ###
##################
###################################################################################################
var f=file("C:\trees3.dat") ## - Ïóòü ê ôàéëó â êîòîðîì áóäóò õðàíèòñÿ êîîðäèíàòû äåðåâüåâ.
###
var TryHiding=1 ## 1 - Ïåðåä òåì êàê ðóáèòü äåðåâî, áóäåò ïûòàòüñÿ óéòè â õàéä, 0 - íå áóäåò .
###
var LogsQty=400 ## - Êîëè÷åñòâî ëîãîâ, äîáûâ êîòîðîå íàäî ðåêîëèòüñÿ äîìîé.
###
var GetFromFile=1 ## 1 - Êîîðäèíàòû äåðåâüåâ áóäóò ñ÷èòûâàòñÿ èç ôàéëà, 0 - ñîáèðàòñÿ èç êëèåíòà
### (ñíà÷àëà ñîáåðèòå à ïîòîì ñ÷èòûâàéòå èç ôàéëà).
###
var EatingFood=0 ## 1 - Áóäåì åñòü, 0 - íåò.
###
var SSpeak=0 ## 1 - Áóäåì êà÷àòü è ñïèðèò ñïèê, 0 - íå áóäåì.
###
var TypeFood='0x097B' ## - Òèï åäû êîòîðóþ áóäåì êóøàòü.(ñåé÷àñ ôèøòåéêè)
###
var Chest='0x4104F8F7' ## - ID ñóíäóêà êóäà áóäóò âûãðóæàòüñÿ ëîãè.
###
var Trytodrop=1 ## Áóäåì ïûòàòñÿ ïîäõîäèòü ê ñóíäóêó èëè íåò.
###
var ContX= ##Êîîðäèíàòû X ó ñóíäóêà
###
var ContY=##Êîîðäèíàòû Y ó ñóíäóêà
###
var oldX,oldY,time ## - Äëÿ ðåêîëà.
###
###########
### Êîä ###
###########
sub Lumberjacking()
var i=0,j=0,k=0,r=0,q=0,ii,jj
var TopX=324,TopY=65
dim TreeX[5000], TreeY[5000],TreeT[5000]
dim TreeTile[29]
var flag=0,treeCount=0,clicks=0,flag2=0
uo.exec ("terminate Reconnector")
wait(1000)
uo.exec ("exec Reconnector")
wait(1000)
########################
### Ãðàôèêà äåðåâüåâ ###
########################
TreeTile[0]=3277
TreeTile[1]=3280
TreeTile[2]=3283
TreeTile[3]=3286
TreeTile[4]=3289
TreeTile[5]=3291
TreeTile[6]=3294
TreeTile[7]=3296
TreeTile[8]=3299
TreeTile[9]=3302
TreeTile[10]=3393
TreeTile[11]=3394
TreeTile[12]=3395
TreeTile[13]=3396
TreeTile[14]=3415
TreeTile[15]=3416
TreeTile[16]=3417
TreeTile[17]=3418
TreeTile[18]=3419
TreeTile[19]=3438
TreeTile[20]=3439
TreeTile[21]=3440
TreeTile[22]=3441
TreeTile[23]=3442
TreeTile[24]=3460
TreeTile[25]=3461
TreeTile[26]=3462
TreeTile[27]=3290
TreeTile[28]=3288
uo.Exec("filterspeech on")
uo.Exec("filterspeech add 'Where do you want to use the pickaxe?'")
#####################################
### Çàãðóæàåì êîîðäèíàòû èç ôàéëà ###
#####################################
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('Ñîáèðàåì êîîðäèíàòû äåðåâüåâ â îêðóãå...')
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))+' '+str(treeCount))
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==500)
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
end if
if uo.dead() then
gotoxy (722,1136,1)
checklag()
uo.useobject ('0x400097CF')
wait(1000)
endif
if Trytodrop==1 and uo.Count('ZLK')>=LogsQty then
GotoXY(ContX,ContY,1)
DropLogs()
end if
uo.Print('Èäåì ê äåðåâó '+str(i)+': x='+str(TreeX[i])+' y='+str(TreeY[i]))
InfoLogs()
flag=GotoXY(TreeX[i],TreeY[i],1)
if flag==1 then
checklag()
ToHide()
checklag()
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 30
if uo.Warmode()==1 then
return 0
end if
wait(200)
uo.DeleteJournal()
checklag()
uo.WaitTargetTile(Type,X,Y,Z)
uo.UseObject('Axe')
if WaitForChange()==1 then
return 1
end if
next
return 0
end sub
Sub ToHide()
while not uo.Hidden()
checklag()
uo.Print('Ïûòàåìñÿ óéòè â õàéä...')
uo.DeleteJournal()
uo.UseSkill('Hiding')
wait(3000)
wend
wait(100)
end sub
Sub WaitForChange()
var Text0='You put'
var Text1='You hack at the tree for a while, but fail to produce any useable wood.'
var Text2='There is nothing 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."
for var i=0 to 200
if uo.INJournal(Text2) or uo.INJournal(Text3) or uo.INJournal(Text4) then
return 1
end if
if uo.INJournal(Text1) then
return 0
end if
if uo.INJournal (Text0) 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
Подскажыте, куда в етом скрипте прикрутить функцию резуректа.
Скрипт рубит=>перса убивают=>бежыт резаца=>бежыт обратно рубить